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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2931563002: [LayoutNG] Implement 'text-align-last' (Closed)
Patch Set: Rebase Created 3 years, 6 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 | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 39005f6f113dcdafee63cb29eda6253930d8d8bb..385e5a17c44e3e21c96abf4502766d5fcc6ffd90 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1423,6 +1423,36 @@ const AtomicString& ComputedStyle::HyphenString() const {
: hyphen_minus_string;
}
+ETextAlign ComputedStyle::GetTextAlign(bool is_last_line) const {
+ if (!is_last_line)
+ return GetTextAlign();
+
+ // When this is the last line of a block, or the line ends with a forced line
+ // break.
+ // https://drafts.csswg.org/css-text-3/#propdef-text-align-last
+ switch (TextAlignLast()) {
+ case ETextAlignLast::kStart:
+ return ETextAlign::kStart;
+ case ETextAlignLast::kEnd:
+ return ETextAlign::kEnd;
+ case ETextAlignLast::kLeft:
+ return ETextAlign::kLeft;
+ case ETextAlignLast::kRight:
+ return ETextAlign::kRight;
+ case ETextAlignLast::kCenter:
+ return ETextAlign::kCenter;
+ case ETextAlignLast::kJustify:
+ return ETextAlign::kJustify;
+ case ETextAlignLast::kAuto:
+ ETextAlign text_align = GetTextAlign();
+ if (text_align == ETextAlign::kJustify)
+ return ETextAlign::kStart;
+ return text_align;
+ }
+ NOTREACHED();
+ return GetTextAlign();
+}
+
const AtomicString& ComputedStyle::TextEmphasisMarkString() const {
switch (GetTextEmphasisMark()) {
case TextEmphasisMark::kNone:
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698