From dc783b1546318ba476d8ab5abb172a950f1ee70b Mon Sep 17 00:00:00 2001 From: "ojan@chromium.org" Date: Tue, 27 Sep 2011 21:45:54 +0000 Subject: [PATCH] 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: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96159 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 10 ++++++++++ .../css3/flexbox/writing-modes-expected.txt | 2 ++ LayoutTests/css3/flexbox/writing-modes.html | 17 +++++++++++++++++ Source/WebCore/ChangeLog | 22 ++++++++++++++++++++++ Source/WebCore/rendering/RenderFlexibleBox.cpp | 16 ++++++++-------- Source/WebCore/rendering/RenderFlexibleBox.h | 2 +- 6 files changed, 60 insertions(+), 9 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 99735de..8e11791 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2011-09-27 Ojan Vafai + + 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 Chromium test expectations update. diff --git a/LayoutTests/css3/flexbox/writing-modes-expected.txt b/LayoutTests/css3/flexbox/writing-modes-expected.txt index 7941f7d..d895ae8 100644 --- a/LayoutTests/css3/flexbox/writing-modes-expected.txt +++ b/LayoutTests/css3/flexbox/writing-modes-expected.txt @@ -14,4 +14,6 @@ PASS PASS PASS PASS +PASS +PASS diff --git a/LayoutTests/css3/flexbox/writing-modes.html b/LayoutTests/css3/flexbox/writing-modes.html index 7e96821..7beca72 100644 --- a/LayoutTests/css3/flexbox/writing-modes.html +++ b/LayoutTests/css3/flexbox/writing-modes.html @@ -7,6 +7,7 @@ body { .flexbox { width: 600px; display: -webkit-flexbox; + background-color: grey; } .flexbox div { height: 20px; @@ -174,5 +175,21 @@ if (window.layoutTestController) +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 39b5db1..151f6fa 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,25 @@ +2011-09-27 Ojan Vafai + + 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 Unreviewed, rolling out r96139. diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index f0d74ce..1d1d0fb 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -229,14 +229,14 @@ LayoutUnit RenderFlexibleBox::flowAwareLogicalHeight() const 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 @@ void RenderFlexibleBox::computePreferredLogicalWidth(bool relayoutChildren, Tree 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 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection(FlexOrder { 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 @@ void RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection(FlexOrderIterator& } 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 @@ void RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection(FlexOrderIterator& 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)); diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 96ff3a9..b935761 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -60,8 +60,8 @@ private: 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; -- 2.7.4