Hit testing in the gap between pages returns incorrect results in flipped blocks...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2012 00:44:08 +0000 (00:44 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2012 00:44:08 +0000 (00:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=92600

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/multicol/hit-test-gap-between-pages-flipped.html

* rendering/RenderBlock.h:
(WebCore::RenderBlock): Promoted offsetForContents() from private to protected, and demoted
adjustPointToColumnContents() back to private.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTest): Changed to flip the point passed to updateHitTestResults().
* rendering/RenderView.cpp:
(WebCore::RenderView::updateHitTestResult): Changed to call offsetForContents(), which, as
of r123977, correctly accounts for flippedness.

LayoutTests:

* fast/multicol/hit-test-gap-between-pages-flipped-expected.txt: Added.
* fast/multicol/hit-test-gap-between-pages-flipped.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped-expected.txt [new file with mode: 0644]
LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderView.cpp

index 09ed8b1..3d340f3 100644 (file)
@@ -1,5 +1,15 @@
 2012-07-29  Dan Bernstein  <mitz@apple.com>
 
+        Hit testing in the gap between pages returns incorrect results in flipped blocks writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=92600
+
+        Reviewed by Simon Fraser.
+
+        * fast/multicol/hit-test-gap-between-pages-flipped-expected.txt: Added.
+        * fast/multicol/hit-test-gap-between-pages-flipped.html: Added.
+
+2012-07-29  Dan Bernstein  <mitz@apple.com>
+
         In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa)
         https://bugs.webkit.org/show_bug.cgi?id=92597
 
diff --git a/LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped-expected.txt b/LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped.html b/LayoutTests/fast/multicol/hit-test-gap-between-pages-flipped.html
new file mode 100644 (file)
index 0000000..3a29718
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+    <body style="margin: 0; -webkit-writing-mode: horizontal-bt;">
+        <div style="height: 50%;"></div>
+        <div style="height: 50%;"></div>
+        <div id="target" style="height: 50%;"></div>
+        <div style="height: 50%;"></div>
+        <div id="result">FAIL: Test did not run (DumpRenderTree or WebKitTestRunner needed)</div>
+        <script>
+            if (window.layoutTestController) {
+                layoutTestController.dumpAsText();
+                internals.setPagination(document, "LeftToRightPaginated", 20, 100);
+                document.getElementById("result").innerText = document.caretRangeFromPoint(115, 550).startContainer === document.getElementById("target")
+                    ? "PASS" : "FAIL";
+            }
+        </script>
+    </body>
+</html>
index 3e7c591..de04a5b 100644 (file)
@@ -1,5 +1,23 @@
 2012-07-29  Dan Bernstein  <mitz@apple.com>
 
+        Hit testing in the gap between pages returns incorrect results in flipped blocks writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=92600
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/multicol/hit-test-gap-between-pages-flipped.html
+
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock): Promoted offsetForContents() from private to protected, and demoted
+        adjustPointToColumnContents() back to private.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTest): Changed to flip the point passed to updateHitTestResults().
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::updateHitTestResult): Changed to call offsetForContents(), which, as
+        of r123977, correctly accounts for flippedness.
+
+2012-07-29  Dan Bernstein  <mitz@apple.com>
+
         In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa)
         https://bugs.webkit.org/show_bug.cgi?id=92597
 
index 07c8db7..53a1f20 100644 (file)
@@ -473,9 +473,9 @@ protected:
 
     void computeInitialRegionRangeForBlock();
     void computeRegionRangeForBlock();
-    
+
     virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight);
-    
+
 private:
     virtual RenderObjectChildList* virtualChildren() { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
@@ -807,6 +807,7 @@ private:
 
     virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
 
+    void adjustPointToColumnContents(LayoutPoint&) const;
     void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const; // Helper function for borderFitAdjust
 
     void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0);
@@ -816,9 +817,6 @@ private:
     Position positionForBox(InlineBox*, bool start = true) const;
     VisiblePosition positionForPointWithInlineChildren(const LayoutPoint&);
 
-    // Adjust from painting offsets to the local coords of this renderer
-    void offsetForContents(LayoutPoint&) const;
-
     virtual void calcColumnWidth();
     void makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild);
 
@@ -964,7 +962,8 @@ protected:
     void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset); // Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page.
     LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock);
 
-    void adjustPointToColumnContents(LayoutPoint&) const;
+    // Adjust from painting offsets to the local coords of this renderer
+    void offsetForContents(LayoutPoint&) const;
 
     // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new
     // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a
index f28d457..74b0f5a 100644 (file)
@@ -3406,7 +3406,7 @@ bool RenderLayer::hitTest(const HitTestRequest& request, const HitTestPoint& hit
         // return ourselves. We do this so mouse events continue getting delivered after a drag has 
         // exited the WebView, and so hit testing over a scrollbar hits the content document.
         if ((request.active() || request.release()) && isRootLayer()) {
-            renderer()->updateHitTestResult(result, result.point());
+            renderer()->updateHitTestResult(result, toRenderView(renderer())->flipForWritingMode(result.point()));
             insideLayer = this;
         }
     }
index ebae66e..8bd49cc 100644 (file)
@@ -854,7 +854,7 @@ void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p
             result.setInnerNonSharedNode(node);
 
         LayoutPoint adjustedPoint = point;
-        adjustPointToColumnContents(adjustedPoint);
+        offsetForContents(adjustedPoint);
 
         result.setLocalPoint(adjustedPoint);
     }