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

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

Issue 150403003: Consider text alignment and direction when computing the left offset for horizontal writing modes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@issue313593
Patch Set: Rebased patch against master 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
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698