Issue #2714 - Implement the Visual Viewport API

This DOM/Web API is entirely irrelevant for desktop use.
We give back the width/height of the root scrollframe of content and
for scale we pass forward our dpp resolution (usually 1.0).
Since we have no "no touch" zones in our content on desktop,. the rest
(origin and offset) is hard-coded to (0,0).
This commit is contained in:
Moonchild 2025-07-21 11:08:16 +02:00 committed by roytam1
commit a036cfeb69
11 changed files with 246 additions and 0 deletions

View file

@ -23,6 +23,7 @@
#include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/dom/Timeout.h"
#include "mozilla/dom/TimeoutHandler.h"
#include "mozilla/dom/VisualViewport.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "nsDOMOfflineResourceList.h"
#include "nsError.h"
@ -4156,6 +4157,16 @@ nsGlobalWindow::GetNavigator()
return navigator;
}
VisualViewport*
nsGlobalWindow::VisualViewport()
{
if (!mVisualViewport) {
mVisualViewport = new mozilla::dom::VisualViewport(this);
}
return mVisualViewport;
}
nsScreen*
nsGlobalWindow::GetScreen(ErrorResult& aError)
{