Bug 1593708 - Part 2: Get inRDMPane value from BrowsingContext instead of Document. r=smaug

Depends on D52214

Differential Revision: https://phabricator.services.mozilla.com/D52216

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Micah Tigley 2019-11-14 20:32:02 +00:00
parent 00d97635a3
commit 72a0d2c330
5 changed files with 15 additions and 9 deletions

View File

@ -13615,6 +13615,12 @@ bool Document::SetOrientationPendingPromise(Promise* aPromise) {
return true;
}
void Document::SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
if (GetBrowsingContext()->InRDMPane()) {
SetCurrentOrientation(aType, aAngle);
}
}
static void DispatchPointerLockChange(Document* aTarget) {
if (!aTarget) {
return;
@ -15924,8 +15930,9 @@ void Document::RemoveToplevelLoadingDocument(Document* aDoc) {
// static
bool Document::UseOverlayScrollbars(const Document* aDocument) {
BrowsingContext* bc = aDocument ? aDocument->GetBrowsingContext() : nullptr;
return LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) ||
(aDocument && aDocument->InRDMPane());
(bc && bc->InRDMPane());
}
bool Document::HasRecentlyStartedForegroundLoads() {

View File

@ -2284,11 +2284,7 @@ class Document : public nsINode,
return mOrientationPendingPromise;
}
void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
if (mInRDMPane) {
SetCurrentOrientation(aType, aAngle);
}
}
void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle);
//----------------------------------------------------------------------

View File

@ -3622,7 +3622,8 @@ Maybe<CSSIntSize> nsGlobalWindowOuter::GetRDMDeviceSize(
// Bug 1576256: This does not work for cross-process subframes.
const Document* topInProcessContentDoc =
aDocument.GetTopLevelContentDocument();
if (topInProcessContentDoc && topInProcessContentDoc->InRDMPane()) {
BrowsingContext* bc = topInProcessContentDoc ? topInProcessContentDoc->GetBrowsingContext() : nullptr;
if (bc && bc->InRDMPane()) {
nsIDocShell* docShell = topInProcessContentDoc->GetDocShell();
if (docShell) {
nsPresContext* presContext = docShell->GetPresContext();

View File

@ -1269,7 +1269,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvUpdateDimensions(
// This is used by RDM to respond correctly to changes to full zoom,
// which also change the window size.
RefPtr<Document> doc = GetTopLevelDocument();
if (doc && doc->InRDMPane()) {
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (bc && bc->InRDMPane()) {
RefPtr<AsyncEventDispatcher> dispatcher = new AsyncEventDispatcher(
doc, NS_LITERAL_STRING("mozupdatedremoteframedimensions"),
CanBubble::eYes, ChromeOnlyDispatch::eYes);

View File

@ -699,8 +699,9 @@ bool nsLayoutUtils::AllowZoomingForDocument(
// True if we allow zooming for all documents on this platform, or if we are
// in RDM and handling meta viewports, which force zoom under some
// circumstances.
BrowsingContext* bc = aDocument ? aDocument->GetBrowsingContext() : nullptr;
return StaticPrefs::apz_allow_zooming() ||
(aDocument && aDocument->InRDMPane() &&
(bc && bc->InRDMPane() &&
nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
}