Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 3ba774d860a97579b0c4f27979ea420e8c300d6b..eac2e0e8707a4514118db4a775676656e3258828 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -3450,8 +3450,21 @@ static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const |
if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingMode() && containerBlock->style()->isFlippedBlocksWritingMode()) { |
logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeftPos; |
logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderRight() : containerBlock->borderBottom()); |
- } else |
- logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop()); |
+ } else if (child->isHorizontalWritingMode()) { |
+ RenderStyle* blockStyle = containerBlock->style(); |
+ bool containerBlockIsLTR = isLeftToRightDirection(blockStyle->direction()); |
+ ETextAlign textAlignForContainerBlock = containerBlock->simplifiedTextAlign(blockStyle->textAlign()); |
+ if (containerBlockIsLTR && textAlignForContainerBlock == RIGHT) { |
+ logicalLeftPos = containerLogicalWidth - (logicalWidthValue + child->borderLogicalWidth() + child->style()->logicalRight().value()); |
+ logicalLeftPos += containerBlock->borderLogicalRight(); |
+ } else if (!containerBlockIsLTR && textAlignForContainerBlock == LEFT) { |
+ logicalLeftPos += containerBlock->borderAndPaddingLogicalLeft() + logicalWidthValue; |
+ } else { |
+ logicalLeftPos += containerBlock->borderLeft(); |
+ } |
+ } else { |
+ logicalLeftPos += containerBlock->borderTop(); |
+ } |
} |
void RenderBox::shrinkToFitWidth(const LayoutUnit availableSpace, const LayoutUnit logicalLeftValue, const LayoutUnit bordersPlusPadding, LogicalExtentComputedValues& computedValues) const |