From e2617c5fcf4f95e3f446fbf3c9185d1470a07bec Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 11 Jan 2021 23:52:09 +0000 Subject: [PATCH] Bug 1682200 - Apply the top level resolution for iframes in the same process of the top level document. r=botond Differential Revision: https://phabricator.services.mozilla.com/D100280 --- .../mochitest/browser_test_group_fission.js | 13 ++- ...ission_tap_in_nested_iframe_on_zoomed.html | 106 ++++++++++++++++++ layout/generic/nsSubDocumentFrame.cpp | 17 ++- 3 files changed, 129 insertions(+), 7 deletions(-) create mode 100644 gfx/layers/apz/test/mochitest/helper_fission_tap_in_nested_iframe_on_zoomed.html diff --git a/gfx/layers/apz/test/mochitest/browser_test_group_fission.js b/gfx/layers/apz/test/mochitest/browser_test_group_fission.js index bf4440719d0f..909420332c8e 100644 --- a/gfx/layers/apz/test/mochitest/browser_test_group_fission.js +++ b/gfx/layers/apz/test/mochitest/browser_test_group_fission.js @@ -51,6 +51,14 @@ add_task(async function test_main() { prefs: [["apz.max_tap_time", 10000]], }, { file: "helper_fission_inactivescroller_under_oopif.html" }, + { + file: "helper_fission_tap_on_zoomed.html", + prefs: [["apz.max_tap_time", 10000]], + }, + { + file: "helper_fission_tap_in_nested_iframe_on_zoomed.html", + prefs: [["apz.max_tap_time", 10000]], + }, // add additional tests here ]; if (isWebRender) { @@ -63,11 +71,6 @@ add_task(async function test_main() { { file: "helper_fission_animation_styling_in_transformed_oopif.html", }, - // Bug 1682200: This test fails on WebRender. - { - file: "helper_fission_tap_on_zoomed.html", - prefs: [["apz.max_tap_time", 10000]], - }, ]); } diff --git a/gfx/layers/apz/test/mochitest/helper_fission_tap_in_nested_iframe_on_zoomed.html b/gfx/layers/apz/test/mochitest/helper_fission_tap_in_nested_iframe_on_zoomed.html new file mode 100644 index 000000000000..4d0663788b49 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_fission_tap_in_nested_iframe_on_zoomed.html @@ -0,0 +1,106 @@ + + + + + Test to ensure events get delivered properly for a nested OOP iframe + + + + + + + + + +
+ + diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 6f811dd7ade2..2f7adccbd7c2 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -1427,8 +1427,21 @@ bool nsDisplayRemote::UpdateScrollData( if (aLayerData) { aLayerData->SetReferentId(mLayersId); - aLayerData->SetTransform( - mozilla::gfx::Matrix4x4::Translation(mOffset.x, mOffset.y, 0.0)); + Matrix4x4 m = Matrix4x4::Translation(mOffset.x, mOffset.y, 0.0); + + // Apply the top level resolution if we are in the same process of the top + // level document. We don't need to apply it in cases where we are in OOP + // iframes since it will be applied later in + // HitTestingTreeNode::GetTransformToGecko by walking up the tree node. + nsPresContext* inProcessRootContext = + mFrame->PresContext()->GetInProcessRootContentDocumentPresContext(); + if (inProcessRootContext && + inProcessRootContext->IsRootContentDocumentCrossProcess()) { + float resolution = inProcessRootContext->PresShell()->GetResolution(); + m.PostScale(resolution, resolution, 1.0); + } + + aLayerData->SetTransform(m); aLayerData->SetEventRegionsOverride(mEventRegionsOverride); aLayerData->SetRemoteDocumentSize(GetFrameSize(mFrame)); }