Index: Source/core/rendering/RenderBlockLineLayout.cpp |
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
index 29e5c72ff90b5af376b593eff875fa6cbc568ad4..dcb13740d9145a53f32d1c91a87c9e968b3fc775 100644 |
--- a/Source/core/rendering/RenderBlockLineLayout.cpp |
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
@@ -535,18 +535,27 @@ static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* |
void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount) |
{ |
+ TextDirection direction; |
+ if (rootInlineBox && rootInlineBox->renderer().style()->unicodeBidi() == Plaintext) |
+ direction = rootInlineBox->direction(); |
+ else |
+ direction = style()->direction(); |
+ |
// Armed with the total width of the line (without justification), |
// we now examine our text-align property in order to determine where to position the |
// objects horizontally. The total width of the line can be increased if we end up |
// justifying text. |
- switch (simplifiedTextAlign(textAlign, rootInlineBox)) { |
+ switch (textAlign) { |
case LEFT: |
+ case WEBKIT_LEFT: |
updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
break; |
case RIGHT: |
+ case WEBKIT_RIGHT: |
updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
break; |
case CENTER: |
+ case WEBKIT_CENTER: |
updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
break; |
case JUSTIFY: |
@@ -556,13 +565,20 @@ void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign |
totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); |
trailingSpaceRun->m_box->setLogicalWidth(0); |
} |
- } else { |
- ETextAlign adjustedTextAlign = style()->isLeftToRightDirection() ? LEFT : RIGHT; |
- updateLogicalWidthForAlignment(adjustedTextAlign, rootInlineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount); |
+ break; |
} |
+ // Fall through |
+ case TASTART: |
+ if (direction == LTR) |
+ updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
+ else |
+ updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
break; |
- default: |
- ASSERT_NOT_REACHED(); |
+ case TAEND: |
+ if (direction == LTR) |
+ updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
+ else |
+ updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); |
break; |
} |
} |