- Revision
- 227974
- Author
- [email protected]
- Date
- 2018-02-01 10:59:38 -0800 (Thu, 01 Feb 2018)
Log Message
REGRESSION (r219342): Scaled HTML widget is not responding to a clicks outside the body
https://bugs.webkit.org/show_bug.cgi?id=182394
<rdar://problem/34840816>
Reviewed by Simon Fraser.
Source/WebCore:
If a scale < 1 is applied to the page, then the visual viewport will be bigger
than the layout viewport. Our hit testing code would then ignore any hits
that were outside the layout viewport.
The fix is to only apply a hit testing clip if the page is scaling up, not down.
Update the existing fast/dom/elementFromPoint-scaled-scrolled.html test.
* page/FrameView.cpp:
(WebCore::FrameView::layoutViewportToAbsoluteRect const): Deleted. This helper is
no longer used, and it would have probably been more confusing to have it accept
a flag to ignore the scale if it is less than 1.
* page/FrameView.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest): No need to take the layout rect, remove the origin,
and pass it to a helper that added the origin back. The only thing the helper was
doing for us was applying a scale factor, which we only want to do if it was
scaling up.
LayoutTests:
Add a test for a scaled down page.
* fast/dom/elementFromPoint-scaled-scrolled-expected.txt:
* fast/dom/elementFromPoint-scaled-scrolled.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (227973 => 227974)
--- trunk/LayoutTests/ChangeLog 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/LayoutTests/ChangeLog 2018-02-01 18:59:38 UTC (rev 227974)
@@ -1,3 +1,16 @@
+2018-02-01 Dean Jackson <[email protected]>
+
+ REGRESSION (r219342): Scaled HTML widget is not responding to a clicks outside the body
+ https://bugs.webkit.org/show_bug.cgi?id=182394
+ <rdar://problem/34840816>
+
+ Reviewed by Simon Fraser.
+
+ Add a test for a scaled down page.
+
+ * fast/dom/elementFromPoint-scaled-scrolled-expected.txt:
+ * fast/dom/elementFromPoint-scaled-scrolled.html:
+
2018-02-01 Commit Queue <[email protected]>
Unreviewed, rolling out r227958 and r227972.
Modified: trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled-expected.txt (227973 => 227974)
--- trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled-expected.txt 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled-expected.txt 2018-02-01 18:59:38 UTC (rev 227974)
@@ -14,6 +14,7 @@
PASS document.elementFromPoint(415, 315) is b2
PASS document.elementFromPoint(-85, 15) is null
PASS document.elementFromPoint(215, 315) is b2
+PASS document.elementFromPoint(525, 425) is b2
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled.html (227973 => 227974)
--- trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled.html 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/LayoutTests/fast/dom/elementFromPoint-scaled-scrolled.html 2018-02-01 18:59:38 UTC (rev 227974)
@@ -52,6 +52,14 @@
shouldBeNull("document.elementFromPoint(-85, 15)");
shouldBe("document.elementFromPoint(215, 315)", "b2");
+ window.scrollTo(0, 0);
+ if (window.internals)
+ window.internals.setPageScaleFactor(0.5, 0, 0);
+ // b2 is now technically outside the 800x600 scaled viewport rect,
+ // but should still be found.
+
+ shouldBe("document.elementFromPoint(525, 425)", "b2");
+
finishJSTest();
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (227973 => 227974)
--- trunk/Source/WebCore/ChangeLog 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/Source/WebCore/ChangeLog 2018-02-01 18:59:38 UTC (rev 227974)
@@ -1,3 +1,30 @@
+2018-02-01 Dean Jackson <[email protected]>
+
+ REGRESSION (r219342): Scaled HTML widget is not responding to a clicks outside the body
+ https://bugs.webkit.org/show_bug.cgi?id=182394
+ <rdar://problem/34840816>
+
+ Reviewed by Simon Fraser.
+
+ If a scale < 1 is applied to the page, then the visual viewport will be bigger
+ than the layout viewport. Our hit testing code would then ignore any hits
+ that were outside the layout viewport.
+
+ The fix is to only apply a hit testing clip if the page is scaling up, not down.
+
+ Update the existing fast/dom/elementFromPoint-scaled-scrolled.html test.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layoutViewportToAbsoluteRect const): Deleted. This helper is
+ no longer used, and it would have probably been more confusing to have it accept
+ a flag to ignore the scale if it is less than 1.
+ * page/FrameView.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::hitTest): No need to take the layout rect, remove the origin,
+ and pass it to a helper that added the origin back. The only thing the helper was
+ doing for us was applying a scale factor, which we only want to do if it was
+ scaling up.
+
2018-02-01 Yusuke Suzuki <[email protected]>
Structured cloning a Symbol should throw
Modified: trunk/Source/WebCore/page/FrameView.cpp (227973 => 227974)
--- trunk/Source/WebCore/page/FrameView.cpp 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/Source/WebCore/page/FrameView.cpp 2018-02-01 18:59:38 UTC (rev 227974)
@@ -4608,14 +4608,6 @@
return point;
}
-FloatRect FrameView::layoutViewportToAbsoluteRect(FloatRect rect) const
-{
- ASSERT(frame().settings().visualViewportEnabled());
- rect.moveBy(layoutViewportRect().location());
- rect.scale(frame().frameScaleFactor());
- return rect;
-}
-
FloatPoint FrameView::layoutViewportToAbsolutePoint(FloatPoint p) const
{
ASSERT(frame().settings().visualViewportEnabled());
Modified: trunk/Source/WebCore/page/FrameView.h (227973 => 227974)
--- trunk/Source/WebCore/page/FrameView.h 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/Source/WebCore/page/FrameView.h 2018-02-01 18:59:38 UTC (rev 227974)
@@ -475,7 +475,6 @@
WEBCORE_EXPORT FloatRect clientToDocumentRect(FloatRect) const;
WEBCORE_EXPORT FloatPoint clientToDocumentPoint(FloatPoint) const;
- FloatRect layoutViewportToAbsoluteRect(FloatRect) const;
FloatPoint layoutViewportToAbsolutePoint(FloatPoint) const;
// Unlike client coordinates, layout viewport coordinates are affected by page zoom.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (227973 => 227974)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-02-01 18:31:06 UTC (rev 227973)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2018-02-01 18:59:38 UTC (rev 227974)
@@ -4933,8 +4933,10 @@
if (!request.ignoreClipping()) {
if (renderer().settings().visualViewportEnabled()) {
auto& frameView = renderer().view().frameView();
- LayoutRect layoutViewportBounds({ }, frameView.layoutViewportRect().size());
- LayoutRect absoluteLayoutViewportRect = LayoutRect(frameView.layoutViewportToAbsoluteRect(layoutViewportBounds));
+ LayoutRect absoluteLayoutViewportRect = frameView.layoutViewportRect();
+ auto scaleFactor = frameView.frame().frameScaleFactor();
+ if (scaleFactor > 1)
+ absoluteLayoutViewportRect.scale(scaleFactor);
hitTestArea.intersect(absoluteLayoutViewportRect);
} else
hitTestArea.intersect(renderer().view().frameView().visibleContentRect(LegacyIOSDocumentVisibleRect));