Title: [123973] trunk
Revision
123973
Author
m...@apple.com
Date
2012-07-28 14:40:48 -0700 (Sat, 28 Jul 2012)

Log Message

In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
https://bugs.webkit.org/show_bug.cgi?id=92566

Reviewed by Simon Fraser.

Source/WebCore: 

Enhanced the fix for <http://webkit.org/b/92524> to work with flipped lines.

Extended fast/multicol/hit-test-end-of-column-with-line-height.html.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPointWithInlineChildren): For flipped lines, check if the
hit line is the last one before a page break, and in that case, check if the hit point was
after the break.

LayoutTests: 

* fast/multicol/hit-test-end-of-column-with-line-height-expected.txt: Updated.
* fast/multicol/hit-test-end-of-column-with-line-height.html: Extended with tests for
horizontal-bt.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123972 => 123973)


--- trunk/LayoutTests/ChangeLog	2012-07-28 21:32:02 UTC (rev 123972)
+++ trunk/LayoutTests/ChangeLog	2012-07-28 21:40:48 UTC (rev 123973)
@@ -1,3 +1,14 @@
+2012-07-28  Dan Bernstein  <m...@apple.com>
+
+        In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
+        https://bugs.webkit.org/show_bug.cgi?id=92566
+
+        Reviewed by Simon Fraser.
+
+        * fast/multicol/hit-test-end-of-column-with-line-height-expected.txt: Updated.
+        * fast/multicol/hit-test-end-of-column-with-line-height.html: Extended with tests for
+        horizontal-bt.
+
 2012-07-28  Simon Fraser  <simon.fra...@apple.com>
 
         Size changes on a layer with negative z-index children don't repaint correctly

Modified: trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height-expected.txt (123972 => 123973)


--- trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height-expected.txt	2012-07-28 21:32:02 UTC (rev 123972)
+++ trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height-expected.txt	2012-07-28 21:40:48 UTC (rev 123973)
@@ -1,4 +1,6 @@
 Lorem ipsum dolor sit amet
 PASS
 PASS
+PASS
+PASS
 

Modified: trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height.html (123972 => 123973)


--- trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height.html	2012-07-28 21:32:02 UTC (rev 123972)
+++ trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height.html	2012-07-28 21:40:48 UTC (rev 123973)
@@ -27,4 +27,16 @@
     // Clicking above the first line in the second column should not snap to the beginning of the line.
     hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 2).startOffset;
     log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+
+    // Now test with a flipped lines writing mode.
+    target.style.webkitWritingMode = "horizontal-bt";
+
+    // Clicking above the last line in the first column should not select anything from the first
+    // line on the second column.
+    hitOffset = document.caretRangeFromPoint(target.offsetLeft + 190, target.offsetTop + 3).startOffset;
+    log(hitOffset === 11 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+
+    // Clicking below the first line in the second column should not snap to the beginning of the line.
+    hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 78).startOffset;
+    log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
 </script>

Modified: trunk/Source/WebCore/ChangeLog (123972 => 123973)


--- trunk/Source/WebCore/ChangeLog	2012-07-28 21:32:02 UTC (rev 123972)
+++ trunk/Source/WebCore/ChangeLog	2012-07-28 21:40:48 UTC (rev 123973)
@@ -1,3 +1,19 @@
+2012-07-28  Dan Bernstein  <m...@apple.com>
+
+        In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
+        https://bugs.webkit.org/show_bug.cgi?id=92566
+
+        Reviewed by Simon Fraser.
+
+        Enhanced the fix for <http://webkit.org/b/92524> to work with flipped lines.
+
+        Extended fast/multicol/hit-test-end-of-column-with-line-height.html.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::positionForPointWithInlineChildren): For flipped lines, check if the
+        hit line is the last one before a page break, and in that case, check if the hit point was
+        after the break.
+
 2012-07-28  Simon Fraser  <simon.fra...@apple.com>
 
         Size changes on a layer with negative z-index children don't repaint correctly

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (123972 => 123973)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-28 21:32:02 UTC (rev 123972)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-28 21:40:48 UTC (rev 123973)
@@ -4916,6 +4916,8 @@
     if (!firstRootBox())
         return createVisiblePosition(0, DOWNSTREAM);
 
+    bool linesAreFlipped = style()->isFlippedLinesWritingMode();
+
     // look for the closest line box in the root box which is at the passed-in y coordinate
     InlineBox* closestBox = 0;
     RootInlineBox* firstRootBoxWithChildren = 0;
@@ -4926,13 +4928,21 @@
         if (!firstRootBoxWithChildren)
             firstRootBoxWithChildren = root;
 
-        if (root->isFirstAfterPageBreak() && pointInLogicalContents.y() < root->lineTopWithLeading())
+        if (!linesAreFlipped && root->isFirstAfterPageBreak() && pointInLogicalContents.y() < root->lineTopWithLeading())
             break;
 
         lastRootBoxWithChildren = root;
 
         // check if this root line box is located at this y coordinate
         if (pointInLogicalContents.y() < root->selectionBottom()) {
+            if (linesAreFlipped) {
+                RootInlineBox* nextRootBoxWithChildren = root->nextRootBox();
+                while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafChild())
+                    nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox();
+
+                if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && pointInLogicalContents.y() >= nextRootBoxWithChildren->lineTopWithLeading())
+                    continue;
+            }
             closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x());
             if (closestBox)
                 break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to