Title: [96159] trunk
Revision
96159
Author
[email protected]
Date
2011-09-27 14:45:54 -0700 (Tue, 27 Sep 2011)

Log Message

take padding/border on flexbox into account with direction:rtl
https://bugs.webkit.org/show_bug.cgi?id=68846

Reviewed by David Hyatt.

Source/WebCore:

Use the logicalWidth of the flexbox instead of it's availableLogicalWidth
so that we include the flexbox's border and padding.

Also, change all uses of availableLogicalWidth to contentLogicalWidth.
The former takes multi-column into account. Multi-column flexboxes don't
make any sense, so there's no point in calling availableLogicalWidth.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::flowAwareLogicalWidth):
(WebCore::RenderFlexibleBox::flowAwareContentLogicalWidth):
(WebCore::RenderFlexibleBox::computePreferredLogicalWidth):
(WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection):
* rendering/RenderFlexibleBox.h:

LayoutTests:

* css3/flexbox/writing-modes-expected.txt:
* css3/flexbox/writing-modes.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96158 => 96159)


--- trunk/LayoutTests/ChangeLog	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 21:45:54 UTC (rev 96159)
@@ -1,3 +1,13 @@
+2011-09-27  Ojan Vafai  <[email protected]>
+
+        take padding/border on flexbox into account with direction:rtl
+        https://bugs.webkit.org/show_bug.cgi?id=68846
+
+        Reviewed by David Hyatt.
+
+        * css3/flexbox/writing-modes-expected.txt:
+        * css3/flexbox/writing-modes.html:
+
 2011-09-27  Mihai Parparita  <[email protected]>
 
         Chromium test expectations update.

Modified: trunk/LayoutTests/css3/flexbox/writing-modes-expected.txt (96158 => 96159)


--- trunk/LayoutTests/css3/flexbox/writing-modes-expected.txt	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/LayoutTests/css3/flexbox/writing-modes-expected.txt	2011-09-27 21:45:54 UTC (rev 96159)
@@ -14,4 +14,6 @@
 PASS
 PASS
 PASS
+PASS
+PASS
 

Modified: trunk/LayoutTests/css3/flexbox/writing-modes.html (96158 => 96159)


--- trunk/LayoutTests/css3/flexbox/writing-modes.html	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/LayoutTests/css3/flexbox/writing-modes.html	2011-09-27 21:45:54 UTC (rev 96159)
@@ -7,6 +7,7 @@
 .flexbox {
     width: 600px;
     display: -webkit-flexbox;
+    background-color: grey;
 }
 .flexbox div {
     height: 20px;
@@ -174,5 +175,21 @@
 </div>
 </div>
 
+<div style="position: relative;">
+    <div data-expected-width="600" style="direction: rtl; display: -webkit-flexbox; margin-left: 10px; margin-right:20px;" class="flexbox">
+      <div data-expected-width="50" data-offset-x="510" style="width: -webkit-flex(1 0 0); margin: 0 auto;"></div>
+      <div data-expected-width="300" data-offset-x="160" style="width: -webkit-flex(2 0 0); padding: 0 100px;"></div>
+      <div data-expected-width="50" data-offset-x="10" style="width: -webkit-flex(1 0 0);margin-right: 100px;"></div>
+    </div>
+</div>
+
+<div style="position: relative;">
+    <div data-expected-width="700" style="direction: rtl; display: -webkit-flexbox; padding-left: 10px; padding-right: 20px; border-style: solid; border-left: 30px solid; border-right: 40px solid;" class="flexbox ">
+      <div data-expected-width="50" data-offset-x="540" style="width: -webkit-flex(1 0 0); margin: 0 auto;"></div>
+      <div data-expected-width="300" data-offset-x="190" style="width: -webkit-flex(2 0 0); padding: 0 100px;"></div>
+      <div data-expected-width="50" data-offset-x="40" style="width: -webkit-flex(1 0 0);margin-right: 100px;"></div>
+    </div>
+</div>
+
 </body>
 </html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (96158 => 96159)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 21:45:54 UTC (rev 96159)
@@ -1,3 +1,25 @@
+2011-09-27  Ojan Vafai  <[email protected]>
+
+        take padding/border on flexbox into account with direction:rtl
+        https://bugs.webkit.org/show_bug.cgi?id=68846
+
+        Reviewed by David Hyatt.
+
+        Use the logicalWidth of the flexbox instead of it's availableLogicalWidth
+        so that we include the flexbox's border and padding.
+        
+        Also, change all uses of availableLogicalWidth to contentLogicalWidth.
+        The former takes multi-column into account. Multi-column flexboxes don't
+        make any sense, so there's no point in calling availableLogicalWidth.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::flowAwareLogicalWidth):
+        (WebCore::RenderFlexibleBox::flowAwareContentLogicalWidth):
+        (WebCore::RenderFlexibleBox::computePreferredLogicalWidth):
+        (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection):
+        (WebCore::RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection):
+        * rendering/RenderFlexibleBox.h:
+
 2011-09-27  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r96139.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (96158 => 96159)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2011-09-27 21:45:54 UTC (rev 96159)
@@ -229,14 +229,14 @@
     return logicalHeight();
 }
 
-LayoutUnit RenderFlexibleBox::flowAwareContentLogicalWidth() const
+LayoutUnit RenderFlexibleBox::flowAwareLogicalWidth() const
 {
-    return contentLogicalWidth();
+    return logicalWidth();
 }
 
-LayoutUnit RenderFlexibleBox::flowAwareAvailableLogicalWidth() const
+LayoutUnit RenderFlexibleBox::flowAwareContentLogicalWidth() const
 {
-    return availableLogicalWidth();
+    return contentLogicalWidth();
 }
 
 LayoutUnit RenderFlexibleBox::flowAwareBorderStart() const
@@ -374,7 +374,7 @@
     preferredLogicalWidth = 0;
     totalPositiveFlexibility = totalNegativeFlexibility = 0;
 
-    LayoutUnit flexboxAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
+    LayoutUnit flexboxAvailableLogicalWidth = flowAwareContentLogicalWidth();
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
         // We always have to lay out flexible objects again, since the flex distribution
         // may have changed, and we need to reallocate space.
@@ -410,7 +410,7 @@
 {
     childSizes.clear();
 
-    LayoutUnit flexboxAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
+    LayoutUnit flexboxAvailableLogicalWidth = flowAwareContentLogicalWidth();
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
         LayoutUnit childPreferredSize;
         if (inflexibleItems.contains(child))
@@ -474,7 +474,7 @@
     }
 
     LayoutUnit logicalTop = flowAwareBorderBefore() + flowAwarePaddingBefore();
-    LayoutUnit totalAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
+    LayoutUnit totalLogicalWidth = flowAwareLogicalWidth();
     setFlowAwareLogicalHeight(0);
     size_t i = 0;
     for (RenderBox* child = iterator.first(); child; child = iterator.next(), ++i) {
@@ -494,7 +494,7 @@
         startEdge += flowAwareMarginStartForChild(child);
 
         LayoutUnit childLogicalWidth = flowAwareLogicalWidthForChild(child);
-        LayoutUnit logicalLeft = isLeftToRightFlow() ? startEdge : totalAvailableLogicalWidth - startEdge - childLogicalWidth;
+        LayoutUnit logicalLeft = isLeftToRightFlow() ? startEdge : totalLogicalWidth - startEdge - childLogicalWidth;
         // FIXME: Do repaintDuringLayoutIfMoved.
         // FIXME: Supporting layout deltas.
         setFlowAwareLogicalLocationForChild(child, IntPoint(logicalLeft, logicalTop));

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (96158 => 96159)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2011-09-27 21:25:17 UTC (rev 96158)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2011-09-27 21:45:54 UTC (rev 96159)
@@ -60,8 +60,8 @@
     LayoutUnit flowAwareLogicalHeightForChild(RenderBox* child);
     LayoutUnit flowAwareLogicalWidthForChild(RenderBox* child);
     LayoutUnit flowAwareLogicalHeight() const;
+    LayoutUnit flowAwareLogicalWidth() const;
     LayoutUnit flowAwareContentLogicalWidth() const;
-    LayoutUnit flowAwareAvailableLogicalWidth() const;
     LayoutUnit flowAwareBorderStart() const;
     LayoutUnit flowAwareBorderBefore() const;
     LayoutUnit flowAwareBorderAfter() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to