Title: [167706] trunk
Revision
167706
Author
commit-qu...@webkit.org
Date
2014-04-23 06:32:56 -0700 (Wed, 23 Apr 2014)

Log Message

Overflow propagation broken in BTT and RTL writing-modes
https://bugs.webkit.org/show_bug.cgi?id=113781

Patch by Morten Stenshorne <msten...@opera.com> on 2014-04-23
Reviewed by David Hyatt.

Source/WebCore:
Overflow rectangles are not quite physical, not quite logical. This
means that we cannot use clientBoxRect() directly to represent a
rectangle that expresses exactly no overflow. This rectangle is the
padding box (relative to the border box) in vertical-lr and
horizontal-tb, but the block-direction borders need to be flipped in
vertical-rl and horizontal-bt.

Tests: fast/css/overflow-btt-border-after.html
       fast/css/overflow-rtl-border-after.html

* WebCore.exp.in:
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeOverflow):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::addVisualOverflow):
(WebCore::RenderBox::layoutOverflowRectForPropagation):
* rendering/RenderBox.h:
(WebCore::RenderBox::layoutOverflowRect):

LayoutTests:
* fast/css/overflow-btt-border-after-expected.txt: Added.
* fast/css/overflow-btt-border-after.html: Added.
* fast/css/overflow-rtl-border-after-expected.txt: Added.
* fast/css/overflow-rtl-border-after.html: Added.
* fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
* platform/gtk/fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
* platform/mac/fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
Removed incorrect screenshots that now differ from the actual (correct) rendering.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167705 => 167706)


--- trunk/LayoutTests/ChangeLog	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/LayoutTests/ChangeLog	2014-04-23 13:32:56 UTC (rev 167706)
@@ -1,3 +1,19 @@
+2014-04-23  Morten Stenshorne  <msten...@opera.com>
+
+        Overflow propagation broken in BTT and RTL writing-modes
+        https://bugs.webkit.org/show_bug.cgi?id=113781
+
+        Reviewed by David Hyatt.
+
+        * fast/css/overflow-btt-border-after-expected.txt: Added.
+        * fast/css/overflow-btt-border-after.html: Added.
+        * fast/css/overflow-rtl-border-after-expected.txt: Added.
+        * fast/css/overflow-rtl-border-after.html: Added.
+        * fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
+        * platform/gtk/fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
+        * platform/mac/fast/multicol/vertical-rl/rules-with-border-before-expected.png: Removed.
+        Removed incorrect screenshots that now differ from the actual (correct) rendering.
+
 2014-04-23  Ryuan Choi  <ryuan.c...@samsung.com>
 
         Unreviewed EFL gardening.

Added: trunk/LayoutTests/fast/css/overflow-btt-border-after-expected.txt (0 => 167706)


--- trunk/LayoutTests/fast/css/overflow-btt-border-after-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/overflow-btt-border-after-expected.txt	2014-04-23 13:32:56 UTC (rev 167706)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/css/overflow-btt-border-after.html (0 => 167706)


--- trunk/LayoutTests/fast/css/overflow-btt-border-after.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/overflow-btt-border-after.html	2014-04-23 13:32:56 UTC (rev 167706)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Border-after in horizontal-bt mode, non-visible overflow</title>
+    <style>
+      body { color:black; background:white; }
+      #container {
+        -webkit-writing-mode: horizontal-bt;
+        overflow:hidden;
+        -webkit-logical-height:100px;
+        -webkit-border-after:150px solid white;
+        background:red;
+      }
+      #inner { -webkit-logical-height:200px; background:white; }
+    </style>
+    <script>
+      if (window.testRunner)
+        testRunner.dumpAsText();
+    </script>
+  </head>
+  <body>
+    <p>The word 'HEST' should be seen below, and there should be no red.</p>
+    <div id="container">
+      <div id="inner">HEST</div>
+    </div>
+    <script>
+      if (window.testRunner) {
+        var height = container.scrollHeight;
+        document.body.innerHTML = height == 200 ? "PASS" : "FAIL - height was " + height;
+      }
+    </script>
+  </body>
+</html>

Added: trunk/LayoutTests/fast/css/overflow-rtl-border-after-expected.txt (0 => 167706)


--- trunk/LayoutTests/fast/css/overflow-rtl-border-after-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/overflow-rtl-border-after-expected.txt	2014-04-23 13:32:56 UTC (rev 167706)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/css/overflow-rtl-border-after.html (0 => 167706)


--- trunk/LayoutTests/fast/css/overflow-rtl-border-after.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/overflow-rtl-border-after.html	2014-04-23 13:32:56 UTC (rev 167706)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Border-after in vertical-rl mode, non-visible overflow</title>
+    <style>
+      body { color:black; background:white; }
+      #container {
+        -webkit-writing-mode: vertical-rl;
+        overflow:hidden;
+        -webkit-logical-height:100px;
+        -webkit-border-after:150px solid white;
+        background:red;
+      }
+      #inner { -webkit-logical-height:200px; background:white; }
+    </style>
+    <script>
+      if (window.testRunner)
+        testRunner.dumpAsText();
+    </script>
+  </head>
+  <body>
+    <p>The word 'HEST' should be seen below, and there should be no red.</p>
+    <div id="container">
+      <div id="inner">HEST</div>
+    </div>
+    <script>
+      if (window.testRunner) {
+        var logicalHeight = container.scrollWidth;
+        document.body.innerHTML = logicalHeight == 200 ? "PASS" : "FAIL - logicalHeight was " + logicalHeight;
+      }
+    </script>
+  </body>
+</html>

Deleted: trunk/LayoutTests/fast/multicol/vertical-rl/rules-with-border-before-expected.png


(Binary files differ)

Deleted: trunk/LayoutTests/platform/gtk/fast/multicol/vertical-rl/rules-with-border-before-expected.png


(Binary files differ)

Deleted: trunk/LayoutTests/platform/mac/fast/multicol/vertical-rl/rules-with-border-before-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (167705 => 167706)


--- trunk/Source/WebCore/ChangeLog	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/Source/WebCore/ChangeLog	2014-04-23 13:32:56 UTC (rev 167706)
@@ -1,3 +1,30 @@
+2014-04-23  Morten Stenshorne  <msten...@opera.com>
+
+        Overflow propagation broken in BTT and RTL writing-modes
+        https://bugs.webkit.org/show_bug.cgi?id=113781
+
+        Reviewed by David Hyatt.
+
+        Overflow rectangles are not quite physical, not quite logical. This
+        means that we cannot use clientBoxRect() directly to represent a
+        rectangle that expresses exactly no overflow. This rectangle is the
+        padding box (relative to the border box) in vertical-lr and
+        horizontal-tb, but the block-direction borders need to be flipped in
+        vertical-rl and horizontal-bt.
+
+        Tests: fast/css/overflow-btt-border-after.html
+               fast/css/overflow-rtl-border-after.html
+
+        * WebCore.exp.in:
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeOverflow):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::addLayoutOverflow):
+        (WebCore::RenderBox::addVisualOverflow):
+        (WebCore::RenderBox::layoutOverflowRectForPropagation):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::layoutOverflowRect):
+
 2014-04-23  Andrei Bucur  <abu...@adobe.com>
 
         [CSS Regions] Improve the debugging infrastructure

Modified: trunk/Source/WebCore/WebCore.exp.in (167705 => 167706)


--- trunk/Source/WebCore/WebCore.exp.in	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-04-23 13:32:56 UTC (rev 167706)
@@ -1961,6 +1961,7 @@
 __ZNK7WebCore9PageCache10frameCountEv
 __ZNK7WebCore9RenderBox11clientWidthEv
 __ZNK7WebCore9RenderBox12clientHeightEv
+__ZNK7WebCore9RenderBox20flippedClientBoxRectEv
 __ZNK7WebCore9TreeScope14getElementByIdERKN3WTF6StringE
 __ZTVN7WebCore11PageConsoleE
 __ZTVN7WebCore12ChromeClientE

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (167705 => 167706)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-04-23 13:32:56 UTC (rev 167706)
@@ -1373,7 +1373,7 @@
         // When we have overflow clip, propagate the original spillout since it will include collapsed bottom margins
         // and bottom padding.  Set the axis we don't care about to be 1, since we want this overflow to always
         // be considered reachable.
-        LayoutRect clientRect(clientBoxRect());
+        LayoutRect clientRect(flippedClientBoxRect());
         LayoutRect rectToApply;
         if (isHorizontalWritingMode())
             rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, std::max<LayoutUnit>(0, oldClientAfterEdge - clientRect.y()));

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (167705 => 167706)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2014-04-23 13:32:56 UTC (rev 167706)
@@ -4311,7 +4311,7 @@
 
 void RenderBox::addLayoutOverflow(const LayoutRect& rect)
 {
-    LayoutRect clientBox = clientBoxRect();
+    LayoutRect clientBox = flippedClientBoxRect();
     if (clientBox.contains(rect) || rect.isEmpty())
         return;
     
@@ -4352,7 +4352,7 @@
         return;
         
     if (!m_overflow)
-        m_overflow = adoptRef(new RenderOverflow(clientBoxRect(), borderBox));
+        m_overflow = adoptRef(new RenderOverflow(flippedClientBoxRect(), borderBox));
     
     m_overflow->addVisualOverflow(rect);
 }
@@ -4545,6 +4545,26 @@
     return rect;
 }
 
+LayoutRect RenderBox::flippedClientBoxRect() const
+{
+    // Because of the special coodinate system used for overflow rectangles (not quite logical, not
+    // quite physical), we need to flip the block progression coordinate in vertical-rl and
+    // horizontal-bt writing modes. Apart from that, this method does the same as clientBoxRect().
+
+    LayoutUnit left = borderLeft();
+    LayoutUnit top = borderTop();
+    LayoutUnit right = borderRight();
+    LayoutUnit bottom = borderBottom();
+    // Calculate physical padding box.
+    LayoutRect rect(left, top, width() - left - right, height() - top - bottom);
+    // Flip block progression axis if writing mode is vertical-rl or horizontal-bt.
+    flipForWritingMode(rect);
+    // Subtract space occupied by scrollbars. They are at their physical edge in this coordinate
+    // system, so order is important here: first flip, then subtract scrollbars.
+    rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight());
+    return rect;
+}
+
 LayoutRect RenderBox::overflowRectForPaintRejection(RenderNamedFlowFragment* namedFlowFragment) const
 {
     LayoutRect overflowRect = visualOverflowRect();

Modified: trunk/Source/WebCore/rendering/RenderBox.h (167705 => 167706)


--- trunk/Source/WebCore/rendering/RenderBox.h	2014-04-23 12:30:22 UTC (rev 167705)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2014-04-23 13:32:56 UTC (rev 167706)
@@ -189,7 +189,8 @@
     // For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right
     // respectively are flipped when compared to their physical counterparts.  For example minX is on the left in vertical-lr,
     // but it is on the right in vertical-rl.
-    LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
+    LayoutRect flippedClientBoxRect() const;
+    LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : flippedClientBoxRect(); }
     LayoutUnit logicalLeftLayoutOverflow() const { return style().isHorizontalWritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); }
     LayoutUnit logicalRightLayoutOverflow() const { return style().isHorizontalWritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to