Title: [123977] trunk
Revision
123977
Author
m...@apple.com
Date
2012-07-28 21:59:30 -0700 (Sat, 28 Jul 2012)

Log Message

Source/WebCore: RenderBlock::offsetForContents() is wrong in flipped blocks writing modes
https://bugs.webkit.org/show_bug.cgi?id=92588

Reviewed by Sam Weinig.

Tests: fast/multicol/hit-test-block-axis-flipped.html
       fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::offsetForContents): Flip the point, which puts it back in unflipped
coordinates, before adding the scroll offset and adjusting for columns, then flip it back.
(WebCore::RenderBlock::adjustPointToColumnContents): Changed the inline-axis cases to
work with an unflipped point.

LayoutTests: Hit test results are wrong in flipped blocks writing modes with block column axis
https://bugs.webkit.org/show_bug.cgi?id=92588

Reviewed by Sam Weinig.

* fast/multicol/hit-test-block-axis-flipped-expected.txt: Added.
* fast/multicol/hit-test-block-axis-flipped.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123976 => 123977)


--- trunk/LayoutTests/ChangeLog	2012-07-29 03:38:11 UTC (rev 123976)
+++ trunk/LayoutTests/ChangeLog	2012-07-29 04:59:30 UTC (rev 123977)
@@ -1,3 +1,13 @@
+2012-07-28  Dan Bernstein  <m...@apple.com>
+
+        Hit test results are wrong in flipped blocks writing modes with block column axis
+        https://bugs.webkit.org/show_bug.cgi?id=92588
+
+        Reviewed by Sam Weinig.
+
+        * fast/multicol/hit-test-block-axis-flipped-expected.txt: Added.
+        * fast/multicol/hit-test-block-axis-flipped.html: Added.
+
 2012-07-28  Peter Kasting  <pkast...@google.com>
 
         [Chromium] New baselines and test expectations update.

Added: trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped-expected.txt (0 => 123977)


--- trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped-expected.txt	2012-07-29 04:59:30 UTC (rev 123977)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped.html (0 => 123977)


--- trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-block-axis-flipped.html	2012-07-29 04:59:30 UTC (rev 123977)
@@ -0,0 +1,24 @@
+<div style="-webkit-writing-mode: horizontal-bt;">
+    <div style="
+        margin-top: 300px;
+        outline: dashed lightblue;
+        height: 100px;
+        width: 100px;
+        border-bottom: 25px solid;
+        -webkit-column-axis: vertical;
+        -webkit-column-gap: 50px;
+    ">
+        <div style="height: 100px; background-color: silver;"></div>
+        <div id="target" style="height: 100px; background-color: silver;"></div>
+        <div style="height: 100px; background-color: silver;"></div>
+    </div>
+</div>
+<p id="result">FAIL: Test did not run.</p>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var hitContainer = document.caretRangeFromPoint(208, 208).startContainer;
+    var target = document.getElementById("target");
+    document.getElementById("result").innerText = hitContainer === target ? "PASS" : "FAIL";
+</script>

Added: trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll-expected.txt (0 => 123977)


--- trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll-expected.txt	2012-07-29 04:59:30 UTC (rev 123977)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html (0 => 123977)


--- trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html	2012-07-29 04:59:30 UTC (rev 123977)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<div style="-webkit-writing-mode: horizontal-bt;">
+    <div id="scrollable" style="height: 100px; overflow: hidden;">
+        <div style="height: 100px; width: 100px; background-color: silver;"></div>
+        <div id="target" style="height: 100px; width: 100px; background-color: blue;"></div>
+    </div>
+</div>
+<p id="result">
+    FAIL: Test did not run.
+</p>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var scrollable = document.getElementById("scrollable");
+    scrollable.scrollTop = 40;
+    var target = document.getElementById("target");
+    var hitContainer = document.caretRangeFromPoint(208, 58).startContainer;
+    document.getElementById("result").innerText = hitContainer === target ? "PASS" : "FAIL";
+</script>

Modified: trunk/Source/WebCore/ChangeLog (123976 => 123977)


--- trunk/Source/WebCore/ChangeLog	2012-07-29 03:38:11 UTC (rev 123976)
+++ trunk/Source/WebCore/ChangeLog	2012-07-29 04:59:30 UTC (rev 123977)
@@ -1,5 +1,21 @@
 2012-07-28  Dan Bernstein  <m...@apple.com>
 
+        RenderBlock::offsetForContents() is wrong in flipped blocks writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=92588
+
+        Reviewed by Sam Weinig.
+
+        Tests: fast/multicol/hit-test-block-axis-flipped.html
+               fast/writing-mode/flipped-blocks-hit-test-overflow-scroll.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::offsetForContents): Flip the point, which puts it back in unflipped
+        coordinates, before adding the scroll offset and adjusting for columns, then flip it back.
+        (WebCore::RenderBlock::adjustPointToColumnContents): Changed the inline-axis cases to
+        work with an unflipped point.
+
+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
 

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (123976 => 123977)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-29 03:38:11 UTC (rev 123976)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-07-29 04:59:30 UTC (rev 123977)
@@ -5042,11 +5042,15 @@
 
 void RenderBlock::offsetForContents(LayoutPoint& offset) const
 {
+    offset = flipForWritingMode(offset);
+
     if (hasOverflowClip())
         offset += scrolledContentOffset();
 
     if (hasColumns())
         adjustPointToColumnContents(offset);
+
+    offset = flipForWritingMode(offset);
 }
 
 LayoutUnit RenderBlock::availableLogicalWidth() const
@@ -5282,12 +5286,12 @@
 
                 // We're inside the column.  Translate the x and y into our column coordinate space.
                 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis)
-                    point.move(columnPoint.x() - colRect.x(), logicalOffset);
+                    point.move(columnPoint.x() - colRect.x(), (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset));
                 else
                     point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.x() + borderLeft() + paddingLeft(), 0);
                 return;
             }
-            
+
             // Move to the next position.
             logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.height() : colRect.width();
         } else {
@@ -5314,12 +5318,12 @@
 
                 // We're inside the column.  Translate the x and y into our column coordinate space.
                 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis)
-                    point.move(logicalOffset, columnPoint.y() - colRect.y());
+                    point.move((!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset), columnPoint.y() - colRect.y());
                 else
                     point.move(0, (!style()->isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.y() + borderTop() + paddingTop());
                 return;
             }
-            
+
             // Move to the next position.
             logicalOffset += colInfo->progressionAxis() == ColumnInfo::InlineAxis ? colRect.width() : colRect.height();
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to