Title: [148643] trunk
Revision
148643
Author
[email protected]
Date
2013-04-17 16:23:20 -0700 (Wed, 17 Apr 2013)

Log Message

Content inside frames and scrollbars in overflow areas hit-tests incorrectly when 
the WKView has a header
https://bugs.webkit.org/show_bug.cgi?id=114769

Reviewed by Simon Fraser.

Source/WebCore: 

convertToRenderer() and convertFromRenderer() need to factor in the headerHeight, 
much like all of the conversion functions on ScrollView. 
* page/FrameView.cpp:
(WebCore::FrameView::convertFromRenderer):
(WebCore::FrameView::convertToRenderer):

The scrollPosition equivalent of the existing scrollOffsetRelativeToDocument() 
function. 
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollPositionRelativeToDocument):
* platform/ScrollView.h:
(ScrollView):

LayoutTests: 

* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame.html: Added.
* platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148642 => 148643)


--- trunk/LayoutTests/ChangeLog	2013-04-17 23:01:40 UTC (rev 148642)
+++ trunk/LayoutTests/ChangeLog	2013-04-17 23:23:20 UTC (rev 148643)
@@ -1,3 +1,15 @@
+2013-04-17  Beth Dakin  <[email protected]>
+
+        Content inside frames and scrollbars in overflow areas hit-tests incorrectly when 
+        the WKView has a header
+        https://bugs.webkit.org/show_bug.cgi?id=114769
+
+        Reviewed by Simon Fraser.
+
+        * platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame.html: Added.
+        * platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html: Added.
+
 2013-04-17  Jessie Berlin  <[email protected]>
 
         Unskip some tests for wk2 where the underlying cause of them being skipped has since been

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame-expected.txt (0 => 148643)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame-expected.txt	2013-04-17 23:23:20 UTC (rev 148643)
@@ -0,0 +1,2 @@
+
+Pass!

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame.html (0 => 148643)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/header-and-footer-hit-testing-in-frame.html	2013-04-17 23:23:20 UTC (rev 148643)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script>
+    function runTest() {
+        if (!window.eventSender)
+            return;
+        if (window.internals)
+            window.internals.setHeaderHeight(document, 100);
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        eventSender.mouseMoveTo(20, 120);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
+</script>
+</head>
+<body _onload_="runTest()">
+    <iframe src="" scrolling="no" frameborder="no" height="300" width="600"></iframe>
+    <div id="result">This test needs to be run through WebKitTestRunner.</div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html (0 => 148643)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/iframe-to-hit-test.html	2013-04-17 23:23:20 UTC (rev 148643)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style>
+    #target {
+        background-color:purple;
+        width:25px;
+        height:25px;
+    }
+</style>
+<script>
+    function clicked() {
+        var result = parent.document.getElementById("result");
+        result.innerHTML = "Pass!";
+    }
+</script>
+</head>
+<body>
+    <div id="target" _onclick_="clicked()"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148642 => 148643)


--- trunk/Source/WebCore/ChangeLog	2013-04-17 23:01:40 UTC (rev 148642)
+++ trunk/Source/WebCore/ChangeLog	2013-04-17 23:23:20 UTC (rev 148643)
@@ -1,3 +1,24 @@
+2013-04-17  Beth Dakin  <[email protected]>
+
+        Content inside frames and scrollbars in overflow areas hit-tests incorrectly when 
+        the WKView has a header
+        https://bugs.webkit.org/show_bug.cgi?id=114769
+
+        Reviewed by Simon Fraser.
+
+        convertToRenderer() and convertFromRenderer() need to factor in the headerHeight, 
+        much like all of the conversion functions on ScrollView. 
+        * page/FrameView.cpp:
+        (WebCore::FrameView::convertFromRenderer):
+        (WebCore::FrameView::convertToRenderer):
+
+        The scrollPosition equivalent of the existing scrollOffsetRelativeToDocument() 
+        function. 
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::scrollPositionRelativeToDocument):
+        * platform/ScrollView.h:
+        (ScrollView):
+
 2013-04-17  Andreas Kling  <[email protected]>
 
         Remove FragmentScriptingPermission.h include from Element.h.

Modified: trunk/Source/WebCore/page/FrameView.cpp (148642 => 148643)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-04-17 23:01:40 UTC (rev 148642)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-04-17 23:23:20 UTC (rev 148643)
@@ -3803,7 +3803,7 @@
 
     // Convert from page ("absolute") to FrameView coordinates.
     if (!delegatesScrolling())
-        rect.moveBy(-scrollPosition());
+        rect.moveBy(-scrollPosition() + IntPoint(0, headerHeight()));
 
     return rect;
 }
@@ -3814,7 +3814,7 @@
     
     // Convert from FrameView coords into page ("absolute") coordinates.
     if (!delegatesScrolling())
-        rect.moveBy(scrollPosition());
+        rect.moveBy(scrollPositionRelativeToDocument());
 
     // FIXME: we don't have a way to map an absolute rect down to a local quad, so just
     // move the rect for now.
@@ -3828,7 +3828,7 @@
 
     // Convert from page ("absolute") to FrameView coordinates.
     if (!delegatesScrolling())
-        point.moveBy(-scrollPosition());
+        point.moveBy(-scrollPosition() + IntPoint(0, headerHeight()));
     return point;
 }
 
@@ -3838,7 +3838,7 @@
 
     // Convert from FrameView coords into page ("absolute") coordinates.
     if (!delegatesScrolling())
-        point += IntSize(scrollX(), scrollY());
+        point = point + scrollPositionRelativeToDocument();
 
     return roundedIntPoint(renderer->absoluteToLocal(point, UseTransforms));
 }

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (148642 => 148643)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2013-04-17 23:01:40 UTC (rev 148642)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2013-04-17 23:23:20 UTC (rev 148643)
@@ -341,6 +341,12 @@
     return IntSize(scrollOffset.width(), scrollOffset.height() - headerHeight());
 }
 
+IntPoint ScrollView::scrollPositionRelativeToDocument() const
+{
+    IntPoint scrollPosition = this->scrollPosition();
+    return IntPoint(scrollPosition.x(), scrollPosition.y() - headerHeight());
+}
+
 int ScrollView::scrollSize(ScrollbarOrientation orientation) const
 {
     // If no scrollbars are present, it does not indicate content is not be scrollable.

Modified: trunk/Source/WebCore/platform/ScrollView.h (148642 => 148643)


--- trunk/Source/WebCore/platform/ScrollView.h	2013-04-17 23:01:40 UTC (rev 148642)
+++ trunk/Source/WebCore/platform/ScrollView.h	2013-04-17 23:23:20 UTC (rev 148643)
@@ -190,6 +190,7 @@
     // anchors (0,0) at the top of the Document, which will be beneath any headers, so it is relative
     // to contentsSize().
     IntSize scrollOffsetRelativeToDocument() const;
+    IntPoint scrollPositionRelativeToDocument() const;
 
     virtual IntSize overhangAmount() const OVERRIDE;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to