Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 7c0317be2904508c2c8bb47f8f9942dddf60f2b2..6f6266bfd33367ee13b25bcf49b23b4ee8769f61 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -2144,26 +2144,22 @@ void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const |
} |
// CSS 2.1: "If there is exactly one value specified as 'auto', its used value follows from the equality." |
- if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { |
- marginStart = marginStartWidth; |
- marginEnd = availableWidth - childWidth - marginStart; |
- return; |
- } |
- |
- bool adjustFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT) |
- || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); |
- bool hasInvertedDirection = containingBlockStyle->isLeftToRightDirection() != style()->isLeftToRightDirection(); |
- |
- if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || (adjustFromTextAlign && !hasInvertedDirection)) { |
- marginEnd = marginEndWidth; |
- marginStart = availableWidth - childWidth - marginEnd; |
- return; |
- } |
+ if (marginBoxWidth < availableWidth) { |
mstensho (USE GERRIT)
2014/12/10 10:45:05
Should move this check to include center alignment
Kyungtae Kim
2014/12/10 11:50:38
Done.
|
+ bool adjustFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT) |
+ || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT)); |
+ bool hasInvertedDirection = containingBlockStyle->isLeftToRightDirection() != style()->isLeftToRightDirection(); |
+ |
+ if (marginEndLength.isAuto() || (adjustFromTextAlign && hasInvertedDirection && !marginStartLength.isAuto())) { |
mstensho (USE GERRIT)
2014/12/10 10:45:05
Now is a good time to get rid of adjustFromTextAli
Kyungtae Kim
2014/12/10 11:50:38
I think it could be confusing.
Because auto margin
mstensho (USE GERRIT)
2014/12/10 23:27:00
The code for WEBKIT_CENTER needs to remain special
|
+ marginStart = marginStartWidth; |
+ marginEnd = availableWidth - childWidth - marginStart; |
+ return; |
+ } |
- if (adjustFromTextAlign && hasInvertedDirection) { |
- marginStart = marginStartWidth; |
- marginEnd = availableWidth - childWidth - marginStart; |
- return; |
+ if (marginStartLength.isAuto() || adjustFromTextAlign) { |
+ marginEnd = marginEndWidth; |
+ marginStart = availableWidth - childWidth - marginEnd; |
+ return; |
+ } |
} |
// Either no auto margins, or our margin box width is >= the container width, auto margins will just turn into 0. |