Title: [128375] trunk
Revision
128375
Author
o...@chromium.org
Date
2012-09-12 15:54:56 -0700 (Wed, 12 Sep 2012)

Log Message

percentage widths rendered wrong in vertical writing mode with orthogonal parent
https://bugs.webkit.org/show_bug.cgi?id=96308

Reviewed by Tony Chang.

Source/WebCore:

When the containingBlock is in a perpendicular writing-mode, we need to use
it's logicalWidth as the availableHeight for computing percentage values.

Tests: fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html
       fast/writing-mode/percentage-height-orthogonal-writing-modes.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::availableLogicalHeightUsing):
Added some FIXMEs for perpendicular writing mode cases.

LayoutTests:

* fast/writing-mode/percentage-height-orthogonal-writing-modes-expected.txt: Added.
* fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks-expected.txt: Added.
* fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html: Added.
* fast/writing-mode/percentage-height-orthogonal-writing-modes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128374 => 128375)


--- trunk/LayoutTests/ChangeLog	2012-09-12 22:43:54 UTC (rev 128374)
+++ trunk/LayoutTests/ChangeLog	2012-09-12 22:54:56 UTC (rev 128375)
@@ -1,3 +1,15 @@
+2012-09-12  Ojan Vafai  <o...@chromium.org>
+
+        percentage widths rendered wrong in vertical writing mode with orthogonal parent
+        https://bugs.webkit.org/show_bug.cgi?id=96308
+
+        Reviewed by Tony Chang.
+
+        * fast/writing-mode/percentage-height-orthogonal-writing-modes-expected.txt: Added.
+        * fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks-expected.txt: Added.
+        * fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html: Added.
+        * fast/writing-mode/percentage-height-orthogonal-writing-modes.html: Added.
+
 2012-09-12  Adam Barth  <aba...@webkit.org>
 
         [v8] document.getCSSCanvasContext doesn't need to be custom

Added: trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-expected.txt (0 => 128375)


--- trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-expected.txt	2012-09-12 22:54:56 UTC (rev 128375)
@@ -0,0 +1,20 @@
+PASS
+PASS
+PASS
+PASS
+PASS
+FAIL:
+Expected 100 for height, but got 600. 
+
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height="100" data-expected-width="200">
+        <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height="100" data-expected-width="200"></div>
+    </div>
+</div>
+PASS
+FAIL:
+Expected 584 for height, but got 600. 
+
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height="584" data-expected-width="0"></div>
+</div>

Added: trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks-expected.txt (0 => 128375)


--- trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks-expected.txt	2012-09-12 22:54:56 UTC (rev 128375)
@@ -0,0 +1,39 @@
+compatMode: BackCompat
+PASS
+PASS
+PASS
+PASS
+PASS
+FAIL:
+Expected 100 for height, but got 600. 
+
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height="100" data-expected-width="200">
+        <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height="100" data-expected-width="200"></div>
+    </div>
+</div>
+PASS
+FAIL:
+Expected 100 for height, but got 600. 
+Expected 100 for height, but got 600. 
+Expected 100 for height, but got 600. 
+
+<div class="container">
+    <div style="width: 150px;" data-expected-height="100" data-expected-width="150">
+        <div data-expected-height="100" data-expected-width="150">
+            <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height="100" data-expected-width="150"></div>
+        </div>
+    </div>
+</div>
+FAIL:
+Expected 584 for height, but got 1447. 
+
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item" style="width: 100%; height: 100%;" data-expected-height="584" data-expected-width="0"></div>
+</div>
+FAIL:
+Expected 584 for height, but got 600. 
+
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height="584" data-expected-width="0"></div>
+</div>

Added: trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html (0 => 128375)


--- trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html	2012-09-12 22:54:56 UTC (rev 128375)
@@ -0,0 +1,84 @@
+<script src=""
+
+<style>
+html {
+    height: 600px;
+}
+.container {
+    width: 200px;
+    height: 100px;
+    outline: 10px solid salmon;
+}
+.item {
+    background-color: orange;
+}
+.vertical-rl {
+    -webkit-writing-mode: vertical-rl;
+}
+</style>
+
+<body _onload_="checkLayout('.container')">
+
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+document.write("<div>compatMode: " + document.compatMode + "</div>");
+</script>
+
+<div class="container">
+    <div class="item" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+</div>
+
+<div class="container">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+</div>
+
+<div class="container" style="border-style: dashed; border-width: 1px 2px; padding: 3px 4px;">
+    <div class="item" style="width: 100%; height: 100%; border-style: solid; border-width: 1px 2px; padding: 3px 4px;" data-expected-height=108 data-expected-width=212></div>
+</div>
+
+<div class="container" style="border-style: dashed; border-width: 1px 2px; padding: 3px 4px;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%; border-style: solid; border-width: 1px 2px; padding: 3px 4px;" data-expected-height=108 data-expected-width=212></div>
+</div>
+
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200>
+        <div class="item" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+    </div>
+</div>
+
+<!-- FIXME: We get the height wrong on the innermost element. https://bugs.webkit.org/show_bug.cgi?id=93655 --> 
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200>
+        <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+    </div>
+</div>
+
+<div class="container">
+    <div style="width: 150px;" data-expected-height=100 data-expected-width=150>
+        <div data-expected-height=100 data-expected-width=150>
+            <div class="item" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=150></div>
+        </div>
+    </div>
+</div>
+
+<!-- FIXME: We get the height wrong on the innermost element. https://bugs.webkit.org/show_bug.cgi?id=93655 --> 
+<div class="container">
+    <div style="width: 150px;" data-expected-height=100 data-expected-width=150>
+        <div data-expected-height=100 data-expected-width=150>
+            <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=150></div>
+        </div>
+    </div>
+</div>
+
+<!-- FIXME: We incorrectly use the size of the body element for calculating the percentage height. https://bugs.webkit.org/show_bug.cgi?id=96426 --> 
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item" style="width: 100%; height: 100%;" data-expected-height=584 data-expected-width=0></div>
+</div>
+
+<!-- FIXME: We get the height wrong on the innermost element. https://bugs.webkit.org/show_bug.cgi?id=93655 --> 
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=584 data-expected-width=0></div>
+</div>
+
+</body>

Added: trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes.html (0 => 128375)


--- trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/percentage-height-orthogonal-writing-modes.html	2012-09-12 22:54:56 UTC (rev 128375)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+
+<style>
+html {
+    height: 600px;
+}
+.container {
+    width: 200px;
+    height: 100px;
+    outline: 10px solid salmon;
+}
+.item {
+    background-color: orange;
+}
+.vertical-rl {
+    -webkit-writing-mode: vertical-rl;
+}
+</style>
+
+<body _onload_="checkLayout('.container')">
+
+<div class="container">
+    <div class="item" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+</div>
+
+<div class="container">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+</div>
+
+<div class="container" style="border-style: dashed; border-width: 1px 2px; padding: 3px 4px;">
+    <div class="item" style="width: 100%; height: 100%; border-style: solid; border-width: 1px 2px; padding: 3px 4px;" data-expected-height=108 data-expected-width=212></div>
+</div>
+
+<div class="container" style="border-style: dashed; border-width: 1px 2px; padding: 3px 4px;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%; border-style: solid; border-width: 1px 2px; padding: 3px 4px;" data-expected-height=108 data-expected-width=212></div>
+</div>
+
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200>
+        <div class="item" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+    </div>
+</div>
+
+<!-- FIXME: We get the height wrong on the innermost element. https://bugs.webkit.org/show_bug.cgi?id=93655 --> 
+<div class="container">
+    <div style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200>
+        <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=100 data-expected-width=200></div>
+    </div>
+</div>
+
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item" style="width: 100%; height: 100%;" data-expected-height=0 data-expected-width=0></div>
+</div>
+
+<!-- FIXME: We get the height wrong on the innermost element. https://bugs.webkit.org/show_bug.cgi?id=93655 --> 
+<div class="container" style="width: auto; height: auto; float: left;">
+    <div class="item vertical-rl" style="width: 100%; height: 100%;" data-expected-height=584 data-expected-width=0></div>
+</div>
+
+</body>

Modified: trunk/LayoutTests/platform/chromium-linux/fast/table/height-percent-test-vertical-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt (128374 => 128375)


--- trunk/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt	2012-09-12 22:43:54 UTC (rev 128374)
+++ trunk/LayoutTests/platform/mac/fast/table/height-percent-test-vertical-expected.txt	2012-09-12 22:54:56 UTC (rev 128375)
@@ -1,9 +1,9 @@
-layer at (0,0) size 1282x585
+layer at (0,0) size 1712x585
   RenderView at (0,0) size 800x585
 layer at (0,0) size 800x585
   RenderBlock {HTML} at (0,0) size 800x585
     RenderBody {BODY} at (8,8) size 784x569
-      RenderBlock {DIV} at (0,0) size 1274x134
+      RenderBlock {DIV} at (0,0) size 1704x134
         RenderBlock {DIV} at (16,16) size 26x102 [border: (1px solid #000000)]
           RenderBlock (floating) {DIV} at (1,1) size 24x100
             RenderBlock {DIV} at (0,0) size 24x100 [bgcolor=#008000]
@@ -14,13 +14,13 @@
                 RenderTableRow {TR} at (0,0) size 24x96
                   RenderTableCell {TD} at (0,1) size 24x94 [r=0 c=0 rs=1 cs=1]
                     RenderImage {IMG} at (1,-1) size 22x96 [bgcolor=#008000]
-        RenderBlock {DIV} at (100,16) size 571x102 [border: (1px solid #000000)]
-          RenderBlock {DIV} at (1,1) size 569x100
-            RenderBlock {DIV} at (0,0) size 569x100 [bgcolor=#008000]
-        RenderBlock {DIV} at (687,16) size 571x102 [border: (1px solid #000000)]
-          RenderBlock {DIV} at (1,1) size 569x100
-            RenderTable {TABLE} at (0,0) size 569x96 [bgcolor=#FF0000]
-              RenderTableSection {TBODY} at (0,0) size 569x96
-                RenderTableRow {TR} at (0,0) size 569x96
-                  RenderTableCell {TD} at (0,273) size 569x-451 [r=0 c=0 rs=1 cs=1]
-                    RenderImage {IMG} at (273,-273) size 22x96 [bgcolor=#008000]
+        RenderBlock {DIV} at (100,16) size 786x102 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 784x100
+            RenderBlock {DIV} at (0,0) size 784x100 [bgcolor=#008000]
+        RenderBlock {DIV} at (902,16) size 786x102 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 784x100
+            RenderTable {TABLE} at (0,0) size 784x96 [bgcolor=#FF0000]
+              RenderTableSection {TBODY} at (0,0) size 784x96
+                RenderTableRow {TR} at (0,0) size 784x96
+                  RenderTableCell {TD} at (0,381) size 784x-666 [r=0 c=0 rs=1 cs=1]
+                    RenderImage {IMG} at (381,-381) size 22x96 [bgcolor=#008000]

Modified: trunk/Source/WebCore/ChangeLog (128374 => 128375)


--- trunk/Source/WebCore/ChangeLog	2012-09-12 22:43:54 UTC (rev 128374)
+++ trunk/Source/WebCore/ChangeLog	2012-09-12 22:54:56 UTC (rev 128375)
@@ -1,3 +1,21 @@
+2012-09-12  Ojan Vafai  <o...@chromium.org>
+
+        percentage widths rendered wrong in vertical writing mode with orthogonal parent
+        https://bugs.webkit.org/show_bug.cgi?id=96308
+
+        Reviewed by Tony Chang.
+
+        When the containingBlock is in a perpendicular writing-mode, we need to use
+        it's logicalWidth as the availableHeight for computing percentage values.
+
+        Tests: fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html
+               fast/writing-mode/percentage-height-orthogonal-writing-modes.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        (WebCore::RenderBox::availableLogicalHeightUsing):
+        Added some FIXMEs for perpendicular writing mode cases.
+
 2012-09-12  Adam Barth  <aba...@webkit.org>
 
         [v8] document.getCSSCanvasContext doesn't need to be custom

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (128374 => 128375)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-09-12 22:43:54 UTC (rev 128374)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-09-12 22:54:56 UTC (rev 128375)
@@ -2127,7 +2127,7 @@
     // only at explicit containers.
     bool skippedAutoHeightContainingBlock = false;
     RenderBlock* cb = containingBlock();
-    while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto()) {
+    while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode()) {
         if (!document()->inQuirksMode() && !cb->isAnonymousBlock())
             break;
         skippedAutoHeightContainingBlock = true;
@@ -2145,10 +2145,12 @@
 
     bool includeBorderPadding = isTable();
 
-    // Table cells violate what the CSS spec says to do with heights.  Basically we
-    // don't care if the cell specified a height or not.  We just always make ourselves
-    // be a percentage of the cell's current content height.
-    if (cb->isTableCell()) {
+    if (isHorizontalWritingMode() != cb->isHorizontalWritingMode())
+        availableHeight = cb->contentLogicalWidth();
+    else if (cb->isTableCell()) {
+        // Table cells violate what the CSS spec says to do with heights. Basically we
+        // don't care if the cell specified a height or not. We just always make ourselves
+        // be a percentage of the cell's current content height.
         if (!skippedAutoHeightContainingBlock) {
             if (!cb->hasOverrideHeight()) {
                 // Normally we would let the cell size intrinsically, but scrolling overflow has to be
@@ -2336,6 +2338,7 @@
         return overrideLogicalContentHeight();
 
     if (h.isPercent() && isOutOfFlowPositioned()) {
+        // FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
         LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
         return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
     }
@@ -2355,6 +2358,7 @@
         return adjustContentBoxLogicalHeightForBoxSizing(newHeight);
     }
 
+    // FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
     return containingBlock()->availableLogicalHeight();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to