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

Unified Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc

Issue 2892293002: Add a basic support of text-align:right property to NGInlineLayoutAlgorithm. (Closed)
Patch Set: fix comments Created 3 years, 7 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: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
index 57d3ecf4d43df9f8e7f86ab546204b6491a410fe..9b24b14cc9cc1b0bcc07d3994ba979c94ceb410c 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -315,6 +315,13 @@ bool NGInlineLayoutAlgorithm::PlaceItems(
DCHECK_EQ(line_left_position, LogicalLeftOffset());
LayoutUnit inline_size = position - line_left_position;
line_box.SetInlineSize(inline_size);
+
+ // Account for text align property.
+ if (Node()->Style().GetTextAlign() == ETextAlign::kRight) {
+ line_box.MoveChildrenInInlineDirection(
+ current_opportunity_.size.inline_size - inline_size);
+ }
+
container_builder_.AddChild(
line_box.ToLineBoxFragment(),
{LayoutUnit(), baseline - box_states_.LineBoxState().metrics.ascent});

Powered by Google App Engine
This is Rietveld 408576698