| Index: Source/core/rendering/RenderBox.cpp
|
| diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
|
| index d08b3e586e7a1029c8b6f54e29794111935075af..5cc2f0f8d93141e1654c227eb53538e58786c97b 100644
|
| --- a/Source/core/rendering/RenderBox.cpp
|
| +++ b/Source/core/rendering/RenderBox.cpp
|
| @@ -2107,14 +2107,22 @@ void RenderBox::computeMarginsForDirection(MarginDirection flowDirection, const
|
| return;
|
| }
|
|
|
| - bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
|
| + bool adjustFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
|
| || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
|
| - if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushToEndFromTextAlign) {
|
| + bool hasInvertedDirection = containingBlockStyle->isLeftToRightDirection() != style()->isLeftToRightDirection();
|
| +
|
| + if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || (adjustFromTextAlign && !hasInvertedDirection)) {
|
| marginEnd = marginEndWidth;
|
| marginStart = availableWidth - childWidth - marginEnd;
|
| return;
|
| }
|
|
|
| + if (adjustFromTextAlign && hasInvertedDirection) {
|
| + marginStart = marginStartWidth;
|
| + marginEnd = availableWidth - childWidth - marginStart;
|
| + return;
|
| + }
|
| +
|
| // Either no auto margins, or our margin box width is >= the container width, auto margins will just turn into 0.
|
| marginStart = marginStartWidth;
|
| marginEnd = marginEndWidth;
|
|
|