Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1690)

Unified Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 176763011: Revert "Consider text alignment and direction when computing the left offset for horizontal writing… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
}

Powered by Google App Engine
This is Rietveld 408576698