diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif-2.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif-2.html index 74707b0d8a98..b737cdf21176 100644 --- a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif-2.html +++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif-2.html @@ -79,6 +79,7 @@ async function test(aTestFile) { let resolution = await getResolution(); ok(resolution > 0, "The initial_resolution is " + resolution + ", which is some sane value"); + let initial_resolution = resolution; let pos = await targetElementPosition(); const iframe = document.querySelector("iframe"); @@ -97,11 +98,18 @@ async function test(aTestFile) { let zoomedOutState = cloneVisualViewport(); + // Reset the scale to the initial one since in the `visible: overflow` case + // the second double-tap doesn't restore to the initial scale. + SpecialPowers.DOMWindowUtils.setResolutionAndScaleTo(initial_resolution); + await promiseApzFlushedRepaints(); + // Now load the document in an OOP iframe. iframeURL = iframeURL.replace(window.location.origin, "https://example.com"); await setupIframe(iframeURL); + pos = await targetElementPosition(); await doubleTapOn(iframe, pos.x + 10, pos.y + 10, useTouchpad); + prev_resolution = resolution; resolution = await getResolution(); ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); @@ -132,6 +140,10 @@ waitUntilApzStable() .then(async () => test("helper_doubletap_zoom_oopif_subframe-1.html")) // A test case where the layout scroll offset in the iframe isn't zero. .then(async () => test("helper_doubletap_zoom_oopif_subframe-2.html#target")) +// A test case where the double-tap-to-zoom target element is `overflow: visible`. +.then(async () => test("helper_doubletap_zoom_oopif_subframe-3.html#target")) +// Similar to above but the target element has positive `margin-top`. +.then(async () => test("helper_doubletap_zoom_oopif_subframe-4.html#target")) .then(subtestDone, subtestFailed); diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-3.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-3.html new file mode 100644 index 000000000000..30b3ca930cb8 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-3.html @@ -0,0 +1,31 @@ + + + + + + + +
+ + diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-4.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-4.html new file mode 100644 index 000000000000..b98f48450e03 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_oopif_subframe-4.html @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/gfx/layers/apz/util/DoubleTapToZoom.cpp b/gfx/layers/apz/util/DoubleTapToZoom.cpp index 23206bfd9c7e..cf64a310b763 100644 --- a/gfx/layers/apz/util/DoubleTapToZoom.cpp +++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp @@ -11,6 +11,8 @@ #include "mozilla/PresShell.h" #include "mozilla/AlreadyAddRefed.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/EffectsInfo.h" +#include "mozilla/dom/BrowserChild.h" #include "nsCOMPtr.h" #include "nsIContent.h" #include "mozilla/dom/Document.h" @@ -104,9 +106,10 @@ static CSSRect GetBoundingContentRect( const nsIScrollableFrame* aRootScrollFrame, const DoubleTapToZoomMetrics& aMetrics, mozilla::Maybe