Title: [135741] trunk
Revision
135741
Author
jchaffr...@webkit.org
Date
2012-11-26 11:07:20 -0800 (Mon, 26 Nov 2012)

Log Message

RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent
https://bugs.webkit.org/show_bug.cgi?id=103075

Reviewed by Ojan Vafai.

Source/WebCore:

Using the containing block's content logical block was working for most renderers but 2 renderers
were special and were broken in orthogonal writing modes:
- captions as they override containingBlockLogicalWidthForContent to return the table's logical width.
- multi-column renderers as they override availableLogicalWidth to constrain the child to the column logical width.

By switching to containingBlockLogicalWidthForContent, we got those 2 cases covered.

Tests: fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html
       fast/table/caption-orthogonal-writing-mode-sizing.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
Updated the function to track which renderer's containing block we use and call
containingBlockLogicalWidthForContent on it.

LayoutTests:

* fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode-expected.txt: Added.
* fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html: Added.
* fast/table/caption-orthogonal-writing-mode-sizing-expected.txt: Added.
* fast/table/caption-orthogonal-writing-mode-sizing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135740 => 135741)


--- trunk/LayoutTests/ChangeLog	2012-11-26 18:58:27 UTC (rev 135740)
+++ trunk/LayoutTests/ChangeLog	2012-11-26 19:07:20 UTC (rev 135741)
@@ -1,3 +1,15 @@
+2012-11-26  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent
+        https://bugs.webkit.org/show_bug.cgi?id=103075
+
+        Reviewed by Ojan Vafai.
+
+        * fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode-expected.txt: Added.
+        * fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html: Added.
+        * fast/table/caption-orthogonal-writing-mode-sizing-expected.txt: Added.
+        * fast/table/caption-orthogonal-writing-mode-sizing.html: Added.
+
 2012-11-26  Abhishek Arya  <infe...@chromium.org>
 
         Crash in Frame::dispatchVisibilityStateChangeEvent.

Added: trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode-expected.txt (0 => 135741)


--- trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode-expected.txt	2012-11-26 19:07:20 UTC (rev 135741)
@@ -0,0 +1,5 @@
+Bug 103075: RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent
+
+This test checks that a percent logical height child in an orthogonal writing mode uses the multi-column's containing block column-width when resolving the logical height.
+
+PASS

Added: trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html (0 => 135741)


--- trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html	2012-11-26 19:07:20 UTC (rev 135741)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+    height: 100px;
+    width: 400px;
+    -webkit-column-width: 100px;
+    -webkit-column-gap: 0px;
+}
+
+.percentLogicalHeight {
+    -webkit-writing-mode: vertical-lr;
+    height: 100%;
+    width: 100%;
+    background-color: navy;
+}
+</style>
+</head>
+<script src=""
+<body _onload_="checkLayout('.percentLogicalHeight')">
+<p><a href="" 103075</a>: RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent</p>
+<p>This test checks that a percent logical height child in an orthogonal writing mode uses the multi-column's containing block column-width when resolving the logical height.</p>
+<div class="container">
+    <div class="percentLogicalHeight" data-expected-width="100" data-expected-height="100"></div>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing-expected.txt (0 => 135741)


--- trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing-expected.txt	2012-11-26 19:07:20 UTC (rev 135741)
@@ -0,0 +1,5 @@
+Bug 103075: RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent
+
+This test checks that a table caption with an orthogonal writing mode properly uses the table's logical width (including padding and borders).
+
+PASS

Added: trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing.html (0 => 135741)


--- trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/caption-orthogonal-writing-mode-sizing.html	2012-11-26 19:07:20 UTC (rev 135741)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.table {
+    display: table;
+    height: 100px;
+    width: 100px;
+    border: 10px green solid;
+    padding: 40px;
+}
+
+.caption {
+    display: table-caption;
+    -webkit-writing-mode: vertical-lr;
+    height: 100%;
+    width: 100%;
+    background-color: navy;
+}
+</style>
+</head>
+<script src=""
+<body _onload_="checkLayout('.caption')">
+<p><a href="" 103075</a>: RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent</p>
+<p>This test checks that a table caption with an orthogonal writing mode properly uses the table's logical width (including padding and borders).</p>
+<div class="table">
+    <div class="caption" data-expected-width="200" data-expected-height="100"></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (135740 => 135741)


--- trunk/Source/WebCore/ChangeLog	2012-11-26 18:58:27 UTC (rev 135740)
+++ trunk/Source/WebCore/ChangeLog	2012-11-26 19:07:20 UTC (rev 135741)
@@ -1,3 +1,25 @@
+2012-11-26  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        RenderBox::computePercentageLogicalHeight should use containingBlockLogicalWidthForContent
+        https://bugs.webkit.org/show_bug.cgi?id=103075
+
+        Reviewed by Ojan Vafai.
+
+        Using the containing block's content logical block was working for most renderers but 2 renderers
+        were special and were broken in orthogonal writing modes:
+        - captions as they override containingBlockLogicalWidthForContent to return the table's logical width.
+        - multi-column renderers as they override availableLogicalWidth to constrain the child to the column logical width.
+
+        By switching to containingBlockLogicalWidthForContent, we got those 2 cases covered.
+
+        Tests: fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode.html
+               fast/table/caption-orthogonal-writing-mode-sizing.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        Updated the function to track which renderer's containing block we use and call
+        containingBlockLogicalWidthForContent on it.
+
 2012-11-26  Abhishek Arya  <infe...@chromium.org>
 
         Crash in Frame::dispatchVisibilityStateChangeEvent.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (135740 => 135741)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-26 18:58:27 UTC (rev 135740)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-26 19:07:20 UTC (rev 135741)
@@ -2194,11 +2194,13 @@
     
     bool skippedAutoHeightContainingBlock = false;
     RenderBlock* cb = containingBlock();
+    const RenderBox* containingBlockChild = this;
     LayoutUnit rootMarginBorderPaddingHeight = 0;
     while (!cb->isRenderView() && skipContainingBlockForPercentHeightCalculation(cb)) {
         if (cb->isBody() || cb->isRoot())
             rootMarginBorderPaddingHeight += cb->marginBefore() + cb->marginAfter() + cb->borderAndPaddingLogicalHeight();
         skippedAutoHeightContainingBlock = true;
+        containingBlockChild = cb;
         cb = cb->containingBlock();
         cb->addPercentHeightDescendant(const_cast<RenderBox*>(this));
     }
@@ -2214,7 +2216,7 @@
     bool includeBorderPadding = isTable();
 
     if (isHorizontalWritingMode() != cb->isHorizontalWritingMode())
-        availableHeight = cb->contentLogicalWidth();
+        availableHeight = containingBlockChild->containingBlockLogicalWidthForContent();
     else if (cb->isTableCell()) {
         if (!skippedAutoHeightContainingBlock) {
             // Table cells violate what the CSS spec says to do with heights. Basically we
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to