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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 DEFINE_STATIC_LOCAL(AtomicString, hyphen_minus_string, 1416 DEFINE_STATIC_LOCAL(AtomicString, hyphen_minus_string,
1417 (&kHyphenMinusCharacter, 1)); 1417 (&kHyphenMinusCharacter, 1));
1418 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1)); 1418 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1));
1419 const SimpleFontData* primary_font = GetFont().PrimaryFont(); 1419 const SimpleFontData* primary_font = GetFont().PrimaryFont();
1420 DCHECK(primary_font); 1420 DCHECK(primary_font);
1421 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter) 1421 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter)
1422 ? hyphen_string 1422 ? hyphen_string
1423 : hyphen_minus_string; 1423 : hyphen_minus_string;
1424 } 1424 }
1425 1425
1426 ETextAlign ComputedStyle::GetTextAlign(bool is_last_line) const {
1427 if (!is_last_line)
1428 return GetTextAlign();
1429
1430 // When this is the last line of a block, or the line ends with a forced line
1431 // break.
1432 // https://drafts.csswg.org/css-text-3/#propdef-text-align-last
1433 switch (TextAlignLast()) {
1434 case ETextAlignLast::kStart:
1435 return ETextAlign::kStart;
1436 case ETextAlignLast::kEnd:
1437 return ETextAlign::kEnd;
1438 case ETextAlignLast::kLeft:
1439 return ETextAlign::kLeft;
1440 case ETextAlignLast::kRight:
1441 return ETextAlign::kRight;
1442 case ETextAlignLast::kCenter:
1443 return ETextAlign::kCenter;
1444 case ETextAlignLast::kJustify:
1445 return ETextAlign::kJustify;
1446 case ETextAlignLast::kAuto:
1447 ETextAlign text_align = GetTextAlign();
1448 if (text_align == ETextAlign::kJustify)
1449 return ETextAlign::kStart;
1450 return text_align;
1451 }
1452 NOTREACHED();
1453 return GetTextAlign();
1454 }
1455
1426 const AtomicString& ComputedStyle::TextEmphasisMarkString() const { 1456 const AtomicString& ComputedStyle::TextEmphasisMarkString() const {
1427 switch (GetTextEmphasisMark()) { 1457 switch (GetTextEmphasisMark()) {
1428 case TextEmphasisMark::kNone: 1458 case TextEmphasisMark::kNone:
1429 return g_null_atom; 1459 return g_null_atom;
1430 case TextEmphasisMark::kCustom: 1460 case TextEmphasisMark::kCustom:
1431 return TextEmphasisCustomMark(); 1461 return TextEmphasisCustomMark();
1432 case TextEmphasisMark::kDot: { 1462 case TextEmphasisMark::kDot: {
1433 DEFINE_STATIC_LOCAL(AtomicString, filled_dot_string, 1463 DEFINE_STATIC_LOCAL(AtomicString, filled_dot_string,
1434 (&kBulletCharacter, 1)); 1464 (&kBulletCharacter, 1));
1435 DEFINE_STATIC_LOCAL(AtomicString, open_dot_string, 1465 DEFINE_STATIC_LOCAL(AtomicString, open_dot_string,
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 if (value < 0) 2381 if (value < 0)
2352 fvalue -= 0.5f; 2382 fvalue -= 0.5f;
2353 else 2383 else
2354 fvalue += 0.5f; 2384 fvalue += 0.5f;
2355 } 2385 }
2356 2386
2357 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2387 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2358 } 2388 }
2359 2389
2360 } // namespace blink 2390 } // namespace blink
OLDNEW
« 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