Title: [97653] trunk
Revision
97653
Author
o...@chromium.org
Date
2011-10-17 14:46:50 -0700 (Mon, 17 Oct 2011)

Log Message

display:inline-block elements don't correctly handle orthogonal writing-modes
https://bugs.webkit.org/show_bug.cgi?id=69957

Reviewed by David Hyatt.

Source/WebCore:

Reading min/maxPreferredLogicalWidth from a child uses the child's writing-mode.
Instead, we need to grab the result based on the parent's writing-mode.
In the case of orthogonal writing-modes, we need the child's logical height.

Tests: fast/writing-mode/borders-expected.html
       fast/writing-mode/borders.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):

LayoutTests:

* fast/writing-mode/borders-expected.html: Added.
* fast/writing-mode/borders.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97652 => 97653)


--- trunk/LayoutTests/ChangeLog	2011-10-17 21:42:26 UTC (rev 97652)
+++ trunk/LayoutTests/ChangeLog	2011-10-17 21:46:50 UTC (rev 97653)
@@ -1,3 +1,13 @@
+2011-10-12  Ojan Vafai  <o...@chromium.org>
+
+        display:inline-block elements don't correctly handle orthogonal writing-modes
+        https://bugs.webkit.org/show_bug.cgi?id=69957
+
+        Reviewed by David Hyatt.
+
+        * fast/writing-mode/borders-expected.html: Added.
+        * fast/writing-mode/borders.html: Added.
+
 2011-10-17  Erik Arvidsson  <a...@chromium.org>
 
         REGRESSION(r97566) fast/js/stack-overflow-arrity-catch.html fails

Added: trunk/LayoutTests/fast/writing-mode/borders-expected.html (0 => 97653)


--- trunk/LayoutTests/fast/writing-mode/borders-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/borders-expected.html	2011-10-17 21:46:50 UTC (rev 97653)
@@ -0,0 +1,29 @@
+<style>
+.container {
+    border: 5px solid red;
+    display: inline-block;
+}
+.box {
+    border: 5px solid;
+    width: 100px;
+    height: 50px;
+}
+</style>
+
+<div>The four boxes below should look identical.</div>
+
+<div class="container">
+    <div class="box"></div>
+</div>
+
+<div class="container">
+    <div class="box"></div>
+</div>
+
+<div class="container">
+    <div class="box"></div>
+</div>
+
+<div class="container">
+    <div class="box"></div>
+</div>
Property changes on: trunk/LayoutTests/fast/writing-mode/borders-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/writing-mode/borders.html (0 => 97653)


--- trunk/LayoutTests/fast/writing-mode/borders.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/borders.html	2011-10-17 21:46:50 UTC (rev 97653)
@@ -0,0 +1,29 @@
+<style>
+.container {
+    border: 5px solid red;
+    display: inline-block;
+}
+.box {
+    border: 5px solid;
+    width: 100px;
+    height: 50px;
+}
+</style>
+
+<div>The four boxes below should look identical.</div>
+
+<div class="container">
+    <div class="box" style="-webkit-writing-mode: horizontal-tb;"></div>
+</div>
+
+<div class="container">
+    <div class="box" style="-webkit-writing-mode: horitzontal-bt;"></div>
+</div>
+
+<div class="container">
+    <div class="box" style="-webkit-writing-mode: vertical-lr;"></div>
+</div>
+
+<div class="container">
+    <div class="box" style="-webkit-writing-mode: vertical-rl;"></div>
+</div>
Property changes on: trunk/LayoutTests/fast/writing-mode/borders.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (97652 => 97653)


--- trunk/Source/WebCore/ChangeLog	2011-10-17 21:42:26 UTC (rev 97652)
+++ trunk/Source/WebCore/ChangeLog	2011-10-17 21:46:50 UTC (rev 97653)
@@ -1,3 +1,20 @@
+2011-10-12  Ojan Vafai  <o...@chromium.org>
+
+        display:inline-block elements don't correctly handle orthogonal writing-modes
+        https://bugs.webkit.org/show_bug.cgi?id=69957
+
+        Reviewed by David Hyatt.
+
+        Reading min/maxPreferredLogicalWidth from a child uses the child's writing-mode.
+        Instead, we need to grab the result based on the parent's writing-mode.
+        In the case of orthogonal writing-modes, we need the child's logical height.
+
+        Tests: fast/writing-mode/borders-expected.html
+               fast/writing-mode/borders.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
+
 2011-10-17  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r97643.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (97652 => 97653)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-17 21:42:26 UTC (rev 97652)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-17 21:46:50 UTC (rev 97653)
@@ -5252,14 +5252,27 @@
             marginEnd += endMarginLength.value();
         margin = marginStart + marginEnd;
 
-        LayoutUnit w = child->minPreferredLogicalWidth() + margin;
+        LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth;
+        if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWritingMode()) {
+            RenderBox* childBox = toRenderBox(child);
+            LayoutUnit oldHeight = childBox->logicalHeight();
+            setLogicalHeight(childBox->borderAndPaddingLogicalHeight());
+            childBox->computeLogicalHeight();
+            childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = childBox->logicalHeight();
+            childBox->setLogicalHeight(oldHeight);
+        } else {
+            childMinPreferredLogicalWidth = child->minPreferredLogicalWidth();
+            childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth();
+        }
+
+        LayoutUnit w = childMinPreferredLogicalWidth + margin;
         m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
         
         // IE ignores tables for calculation of nowrap. Makes some sense.
         if (nowrap && !child->isTable())
             m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
 
-        w = child->maxPreferredLogicalWidth() + margin;
+        w = childMaxPreferredLogicalWidth + margin;
 
         if (!child->isFloating()) {
             if (child->isBox() && toRenderBox(child)->avoidsFloats()) {
@@ -5271,7 +5284,7 @@
                 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart;
                 LayoutUnit maxLeft = marginLogicalLeft > 0 ? max(floatLeftWidth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft;
                 LayoutUnit maxRight = marginLogicalRight > 0 ? max(floatRightWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight;
-                w = child->maxPreferredLogicalWidth() + maxLeft + maxRight;
+                w = childMaxPreferredLogicalWidth + maxLeft + maxRight;
                 w = max(w, floatLeftWidth + floatRightWidth);
             }
             else
@@ -5300,6 +5313,7 @@
         // of 100px because of the table.
         // We can achieve this effect by making the maxwidth of blocks that contain tables
         // with percentage widths be infinite (as long as they are not inside a table cell).
+        // FIXME: There is probably a bug here with orthogonal writing modes since we check logicalWidth only using the child's writing mode.
         if (containingBlock && document()->inQuirksMode() && child->style()->logicalWidth().isPercent()
             && !isTableCell() && child->isTable() && m_maxPreferredLogicalWidth < BLOCK_MAX_WIDTH) {
             RenderBlock* cb = containingBlock;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to