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

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

Issue 2845773002: Make TextDecoration an enum class. (Closed)
Patch Set: Rebase 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/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index fe7f6757639aeefc7286610dcb53bde9e30cd9e2..3b84549b16e6138e603dbd8da12af9b0d20df391 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1736,18 +1736,18 @@ FontStretch ComputedStyle::GetFontStretch() const {
TextDecoration ComputedStyle::TextDecorationsInEffect() const {
if (HasSimpleUnderlineInternal())
- return kTextDecorationUnderline;
+ return TextDecoration::kUnderline;
if (!rare_inherited_data_->applied_text_decorations_)
- return kTextDecorationNone;
+ return TextDecoration::kNone;
- int decorations = 0;
+ TextDecoration decorations = TextDecoration::kNone;
const Vector<AppliedTextDecoration>& applied = AppliedTextDecorations();
for (size_t i = 0; i < applied.size(); ++i)
decorations |= applied[i].Lines();
- return static_cast<TextDecoration>(decorations);
+ return decorations;
}
const Vector<AppliedTextDecoration>& ComputedStyle::AppliedTextDecorations()
@@ -1756,7 +1756,7 @@ const Vector<AppliedTextDecoration>& ComputedStyle::AppliedTextDecorations()
DEFINE_STATIC_LOCAL(
Vector<AppliedTextDecoration>, underline,
(1, AppliedTextDecoration(
- kTextDecorationUnderline, kTextDecorationStyleSolid,
+ TextDecoration::kUnderline, kTextDecorationStyleSolid,
VisitedDependentColor(CSSPropertyTextDecorationColor))));
// Since we only have one of these in memory, just update the color before
// returning.
@@ -2039,7 +2039,7 @@ void ComputedStyle::OverrideTextDecorationColors(Color override_color) {
void ComputedStyle::ApplyTextDecorations(
const Color& parent_text_decoration_color,
bool override_existing_colors) {
- if (GetTextDecoration() == kTextDecorationNone &&
+ if (GetTextDecoration() == TextDecoration::kNone &&
!HasSimpleUnderlineInternal() &&
!rare_inherited_data_->applied_text_decorations_)
return;
@@ -2049,24 +2049,24 @@ void ComputedStyle::ApplyTextDecorations(
Color current_text_decoration_color =
VisitedDependentColor(CSSPropertyTextDecorationColor);
if (HasSimpleUnderlineInternal() &&
- (GetTextDecoration() != kTextDecorationNone ||
+ (GetTextDecoration() != TextDecoration::kNone ||
current_text_decoration_color != parent_text_decoration_color)) {
SetHasSimpleUnderlineInternal(false);
AddAppliedTextDecoration(AppliedTextDecoration(
- kTextDecorationUnderline, kTextDecorationStyleSolid,
+ TextDecoration::kUnderline, kTextDecorationStyleSolid,
parent_text_decoration_color));
}
if (override_existing_colors &&
rare_inherited_data_->applied_text_decorations_)
OverrideTextDecorationColors(current_text_decoration_color);
- if (GetTextDecoration() == kTextDecorationNone)
+ if (GetTextDecoration() == TextDecoration::kNone)
return;
DCHECK(!HasSimpleUnderlineInternal());
// To save memory, we don't use AppliedTextDecoration objects in the common
// case of a single simple underline of currentColor.
TextDecoration decoration_lines = GetTextDecoration();
TextDecorationStyle decoration_style = GetTextDecorationStyle();
- bool is_simple_underline = decoration_lines == kTextDecorationUnderline &&
+ bool is_simple_underline = decoration_lines == TextDecoration::kUnderline &&
decoration_style == kTextDecorationStyleSolid &&
TextDecorationColor().IsCurrentColor();
if (is_simple_underline && !rare_inherited_data_->applied_text_decorations_) {
« 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