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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2900633003: Make TextEmphasisMark an enum class. (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
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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1)); 1528 DEFINE_STATIC_LOCAL(AtomicString, hyphen_string, (&kHyphenCharacter, 1));
1529 const SimpleFontData* primary_font = GetFont().PrimaryFont(); 1529 const SimpleFontData* primary_font = GetFont().PrimaryFont();
1530 DCHECK(primary_font); 1530 DCHECK(primary_font);
1531 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter) 1531 return primary_font && primary_font->GlyphForCharacter(kHyphenCharacter)
1532 ? hyphen_string 1532 ? hyphen_string
1533 : hyphen_minus_string; 1533 : hyphen_minus_string;
1534 } 1534 }
1535 1535
1536 const AtomicString& ComputedStyle::TextEmphasisMarkString() const { 1536 const AtomicString& ComputedStyle::TextEmphasisMarkString() const {
1537 switch (GetTextEmphasisMark()) { 1537 switch (GetTextEmphasisMark()) {
1538 case kTextEmphasisMarkNone: 1538 case TextEmphasisMark::kNone:
1539 return g_null_atom; 1539 return g_null_atom;
1540 case kTextEmphasisMarkCustom: 1540 case TextEmphasisMark::kCustom:
1541 return TextEmphasisCustomMark(); 1541 return TextEmphasisCustomMark();
1542 case kTextEmphasisMarkDot: { 1542 case TextEmphasisMark::kDot: {
1543 DEFINE_STATIC_LOCAL(AtomicString, filled_dot_string, 1543 DEFINE_STATIC_LOCAL(AtomicString, filled_dot_string,
1544 (&kBulletCharacter, 1)); 1544 (&kBulletCharacter, 1));
1545 DEFINE_STATIC_LOCAL(AtomicString, open_dot_string, 1545 DEFINE_STATIC_LOCAL(AtomicString, open_dot_string,
1546 (&kWhiteBulletCharacter, 1)); 1546 (&kWhiteBulletCharacter, 1));
1547 return GetTextEmphasisFill() == TextEmphasisFill::kFilled 1547 return GetTextEmphasisFill() == TextEmphasisFill::kFilled
1548 ? filled_dot_string 1548 ? filled_dot_string
1549 : open_dot_string; 1549 : open_dot_string;
1550 } 1550 }
1551 case kTextEmphasisMarkCircle: { 1551 case TextEmphasisMark::kCircle: {
1552 DEFINE_STATIC_LOCAL(AtomicString, filled_circle_string, 1552 DEFINE_STATIC_LOCAL(AtomicString, filled_circle_string,
1553 (&kBlackCircleCharacter, 1)); 1553 (&kBlackCircleCharacter, 1));
1554 DEFINE_STATIC_LOCAL(AtomicString, open_circle_string, 1554 DEFINE_STATIC_LOCAL(AtomicString, open_circle_string,
1555 (&kWhiteCircleCharacter, 1)); 1555 (&kWhiteCircleCharacter, 1));
1556 return GetTextEmphasisFill() == TextEmphasisFill::kFilled 1556 return GetTextEmphasisFill() == TextEmphasisFill::kFilled
1557 ? filled_circle_string 1557 ? filled_circle_string
1558 : open_circle_string; 1558 : open_circle_string;
1559 } 1559 }
1560 case kTextEmphasisMarkDoubleCircle: { 1560 case TextEmphasisMark::kDoubleCircle: {
1561 DEFINE_STATIC_LOCAL(AtomicString, filled_double_circle_string, 1561 DEFINE_STATIC_LOCAL(AtomicString, filled_double_circle_string,
1562 (&kFisheyeCharacter, 1)); 1562 (&kFisheyeCharacter, 1));
1563 DEFINE_STATIC_LOCAL(AtomicString, open_double_circle_string, 1563 DEFINE_STATIC_LOCAL(AtomicString, open_double_circle_string,
1564 (&kBullseyeCharacter, 1)); 1564 (&kBullseyeCharacter, 1));
1565 return GetTextEmphasisFill() == TextEmphasisFill::kFilled 1565 return GetTextEmphasisFill() == TextEmphasisFill::kFilled
1566 ? filled_double_circle_string 1566 ? filled_double_circle_string
1567 : open_double_circle_string; 1567 : open_double_circle_string;
1568 } 1568 }
1569 case kTextEmphasisMarkTriangle: { 1569 case TextEmphasisMark::kTriangle: {
1570 DEFINE_STATIC_LOCAL(AtomicString, filled_triangle_string, 1570 DEFINE_STATIC_LOCAL(AtomicString, filled_triangle_string,
1571 (&kBlackUpPointingTriangleCharacter, 1)); 1571 (&kBlackUpPointingTriangleCharacter, 1));
1572 DEFINE_STATIC_LOCAL(AtomicString, open_triangle_string, 1572 DEFINE_STATIC_LOCAL(AtomicString, open_triangle_string,
1573 (&kWhiteUpPointingTriangleCharacter, 1)); 1573 (&kWhiteUpPointingTriangleCharacter, 1));
1574 return GetTextEmphasisFill() == TextEmphasisFill::kFilled 1574 return GetTextEmphasisFill() == TextEmphasisFill::kFilled
1575 ? filled_triangle_string 1575 ? filled_triangle_string
1576 : open_triangle_string; 1576 : open_triangle_string;
1577 } 1577 }
1578 case kTextEmphasisMarkSesame: { 1578 case TextEmphasisMark::kSesame: {
1579 DEFINE_STATIC_LOCAL(AtomicString, filled_sesame_string, 1579 DEFINE_STATIC_LOCAL(AtomicString, filled_sesame_string,
1580 (&kSesameDotCharacter, 1)); 1580 (&kSesameDotCharacter, 1));
1581 DEFINE_STATIC_LOCAL(AtomicString, open_sesame_string, 1581 DEFINE_STATIC_LOCAL(AtomicString, open_sesame_string,
1582 (&kWhiteSesameDotCharacter, 1)); 1582 (&kWhiteSesameDotCharacter, 1));
1583 return GetTextEmphasisFill() == TextEmphasisFill::kFilled 1583 return GetTextEmphasisFill() == TextEmphasisFill::kFilled
1584 ? filled_sesame_string 1584 ? filled_sesame_string
1585 : open_sesame_string; 1585 : open_sesame_string;
1586 } 1586 }
1587 case kTextEmphasisMarkAuto: 1587 case TextEmphasisMark::kAuto:
1588 NOTREACHED(); 1588 NOTREACHED();
1589 return g_null_atom; 1589 return g_null_atom;
1590 } 1590 }
1591 1591
1592 NOTREACHED(); 1592 NOTREACHED();
1593 return g_null_atom; 1593 return g_null_atom;
1594 } 1594 }
1595 1595
1596 CSSAnimationData& ComputedStyle::AccessAnimations() { 1596 CSSAnimationData& ComputedStyle::AccessAnimations() {
1597 if (!rare_non_inherited_data_.Access()->animations_) 1597 if (!rare_non_inherited_data_.Access()->animations_)
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 const ComputedStyle* other_style) const { 2274 const ComputedStyle* other_style) const {
2275 return ColumnRuleStyle() == other_style->ColumnRuleStyle() && 2275 return ColumnRuleStyle() == other_style->ColumnRuleStyle() &&
2276 ColumnRuleWidth() == other_style->ColumnRuleWidth() && 2276 ColumnRuleWidth() == other_style->ColumnRuleWidth() &&
2277 VisitedDependentColor(CSSPropertyColumnRuleColor) == 2277 VisitedDependentColor(CSSPropertyColumnRuleColor) ==
2278 other_style->VisitedDependentColor(CSSPropertyColumnRuleColor); 2278 other_style->VisitedDependentColor(CSSPropertyColumnRuleColor);
2279 } 2279 }
2280 2280
2281 TextEmphasisMark ComputedStyle::GetTextEmphasisMark() const { 2281 TextEmphasisMark ComputedStyle::GetTextEmphasisMark() const {
2282 TextEmphasisMark mark = 2282 TextEmphasisMark mark =
2283 static_cast<TextEmphasisMark>(rare_inherited_data_->text_emphasis_mark_); 2283 static_cast<TextEmphasisMark>(rare_inherited_data_->text_emphasis_mark_);
2284 if (mark != kTextEmphasisMarkAuto) 2284 if (mark != TextEmphasisMark::kAuto)
2285 return mark; 2285 return mark;
2286 2286
2287 if (IsHorizontalWritingMode()) 2287 if (IsHorizontalWritingMode())
2288 return kTextEmphasisMarkDot; 2288 return TextEmphasisMark::kDot;
2289 2289
2290 return kTextEmphasisMarkSesame; 2290 return TextEmphasisMark::kSesame;
2291 } 2291 }
2292 2292
2293 Color ComputedStyle::InitialTapHighlightColor() { 2293 Color ComputedStyle::InitialTapHighlightColor() {
2294 return LayoutTheme::TapHighlightColor(); 2294 return LayoutTheme::TapHighlightColor();
2295 } 2295 }
2296 2296
2297 const FilterOperations& ComputedStyle::InitialFilter() { 2297 const FilterOperations& ComputedStyle::InitialFilter() {
2298 DEFINE_STATIC_LOCAL(FilterOperationsWrapper, ops, 2298 DEFINE_STATIC_LOCAL(FilterOperationsWrapper, ops,
2299 (FilterOperationsWrapper::Create())); 2299 (FilterOperationsWrapper::Create()));
2300 return ops.Operations(); 2300 return ops.Operations();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 if (value < 0) 2430 if (value < 0)
2431 fvalue -= 0.5f; 2431 fvalue -= 0.5f;
2432 else 2432 else
2433 fvalue += 0.5f; 2433 fvalue += 0.5f;
2434 } 2434 }
2435 2435
2436 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2436 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2437 } 2437 }
2438 2438
2439 } // namespace blink 2439 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698