Add -internal-visited-text-decoration-color.
Bug: 972388
Change-Id: I916bdd5d7aaccb192c68951f097f92a70479bc3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1653020
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668546}
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn
index e1c5720..7236476 100644
--- a/third_party/blink/renderer/core/BUILD.gn
+++ b/third_party/blink/renderer/core/BUILD.gn
@@ -714,6 +714,8 @@
"$blink_core_output_dir/css/properties/longhands/internal_visited_border_top_color.h",
"$blink_core_output_dir/css/properties/longhands/internal_visited_color.cc",
"$blink_core_output_dir/css/properties/longhands/internal_visited_color.h",
+ "$blink_core_output_dir/css/properties/longhands/internal_visited_text_decoration_color.cc",
+ "$blink_core_output_dir/css/properties/longhands/internal_visited_text_decoration_color.h",
"$blink_core_output_dir/css/properties/longhands/internal_visited_text_emphasis_color.cc",
"$blink_core_output_dir/css/properties/longhands/internal_visited_text_emphasis_color.h",
"$blink_core_output_dir/css/properties/longhands/internal_visited_text_fill_color.cc",
diff --git a/third_party/blink/renderer/core/animation/color_property_functions.cc b/third_party/blink/renderer/core/animation/color_property_functions.cc
index 8d9cb2cf4..8c1a172b 100644
--- a/third_party/blink/renderer/core/animation/color_property_functions.cc
+++ b/third_party/blink/renderer/core/animation/color_property_functions.cc
@@ -100,7 +100,7 @@
case CSSPropertyID::kWebkitTapHighlightColor:
return style.TapHighlightColor();
case CSSPropertyID::kTextDecorationColor:
- return style.VisitedLinkTextDecorationColor();
+ return style.InternalVisitedTextDecorationColor();
default:
NOTREACHED();
return nullptr;
@@ -195,7 +195,7 @@
style.SetStopColor(color);
return;
case CSSPropertyID::kTextDecorationColor:
- style.SetVisitedLinkTextDecorationColor(color);
+ style.SetInternalVisitedTextDecorationColor(color);
return;
case CSSPropertyID::kColumnRuleColor:
style.SetVisitedLinkColumnRuleColor(color);
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5
index d153e8d..68cb7777 100644
--- a/third_party/blink/renderer/core/css/css_properties.json5
+++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -3162,7 +3162,7 @@
keywords: ["currentcolor"],
typedom_types: ["Keyword"],
converter: "ConvertStyleColor",
- style_builder_template: "color",
+ style_builder_template: "color_only",
valid_for_visited_link: true,
},
{
@@ -5262,6 +5262,19 @@
},
},
{
+ name: "-internal-visited-text-decoration-color",
+ visited_property_for: "text-decoration-color",
+ property_methods: ["ColorIncludingFallback"],
+ field_group: "*",
+ field_template: "external",
+ include_paths: ["third_party/blink/renderer/core/css/style_color.h"],
+ default_value: "StyleColor::CurrentColor()",
+ type_name: "StyleColor",
+ computed_style_custom_functions: ["getter", "setter"],
+ converter: "ConvertStyleColor",
+ style_builder_template: "visited_color",
+ },
+ {
name: "-internal-visited-text-emphasis-color",
visited_property_for: "-webkit-text-emphasis-color",
property_methods: ["ColorIncludingFallback"],
diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc
index 145e2fae..3efea4e 100644
--- a/third_party/blink/renderer/core/css/css_property_equality.cc
+++ b/third_party/blink/renderer/core/css/css_property_equality.cc
@@ -266,8 +266,8 @@
return a.StrokeWidth() == b.StrokeWidth();
case CSSPropertyID::kTextDecorationColor:
return a.TextDecorationColor() == b.TextDecorationColor() &&
- a.VisitedLinkTextDecorationColor() ==
- b.VisitedLinkTextDecorationColor();
+ a.InternalVisitedTextDecorationColor() ==
+ b.InternalVisitedTextDecorationColor();
case CSSPropertyID::kTextDecorationSkipInk:
return a.TextDecorationSkipInk() == b.TextDecorationSkipInk();
case CSSPropertyID::kTextIndent:
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
index bea66c6..9cb559c 100644
--- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
+++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -179,6 +179,7 @@
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_border_right_color.h"
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_border_top_color.h"
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_color.h"
+#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_text_decoration_color.h"
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_text_emphasis_color.h"
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_text_fill_color.h"
#include "third_party/blink/renderer/core/css/properties/longhands/internal_visited_text_stroke_color.h"
@@ -3744,6 +3745,14 @@
style.InternalVisitedColor());
}
+const blink::Color InternalVisitedTextDecorationColor::ColorIncludingFallback(
+ bool visited_link,
+ const ComputedStyle& style) const {
+ DCHECK(visited_link);
+ return style.DecorationColorIncludingFallback(visited_link)
+ .Resolve(style.InternalVisitedColor());
+}
+
const blink::Color InternalVisitedTextEmphasisColor::ColorIncludingFallback(
bool visited_link,
const ComputedStyle& style) const {
@@ -6235,10 +6244,9 @@
const blink::Color TextDecorationColor::ColorIncludingFallback(
bool visited_link,
const ComputedStyle& style) const {
- StyleColor result = style.DecorationColorIncludingFallback(visited_link);
- if (!result.IsCurrentColor())
- return result.GetColor();
- return visited_link ? style.InternalVisitedColor() : style.GetColor();
+ DCHECK(!visited_link);
+ return style.DecorationColorIncludingFallback(visited_link)
+ .Resolve(style.GetColor());
}
const CSSValue* TextDecorationColor::CSSValueFromComputedStyleInternal(
diff --git a/third_party/blink/renderer/core/frame/use_counter_helper.cc b/third_party/blink/renderer/core/frame/use_counter_helper.cc
index 1d09515d..0ff48ba 100644
--- a/third_party/blink/renderer/core/frame/use_counter_helper.cc
+++ b/third_party/blink/renderer/core/frame/use_counter_helper.cc
@@ -1260,6 +1260,7 @@
case CSSPropertyID::kInternalVisitedBorderRightColor:
case CSSPropertyID::kInternalVisitedBorderTopColor:
case CSSPropertyID::kInternalVisitedColor:
+ case CSSPropertyID::kInternalVisitedTextDecorationColor:
case CSSPropertyID::kInternalVisitedTextEmphasisColor:
case CSSPropertyID::kInternalVisitedTextFillColor:
case CSSPropertyID::kInternalVisitedTextStrokeColor:
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc
index 5e5a911..4f6003f 100644
--- a/third_party/blink/renderer/core/style/computed_style.cc
+++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -2028,8 +2028,8 @@
StyleColor ComputedStyle::DecorationColorIncludingFallback(
bool visited_link) const {
- StyleColor style_color =
- visited_link ? VisitedLinkTextDecorationColor() : TextDecorationColor();
+ StyleColor style_color = visited_link ? InternalVisitedTextDecorationColor()
+ : TextDecorationColor();
if (!style_color.IsCurrentColor())
return style_color;
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h
index 3fa571ad..a227a31 100644
--- a/third_party/blink/renderer/core/style/computed_style.h
+++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -107,6 +107,7 @@
class InternalVisitedBorderRightColor;
class InternalVisitedBorderTopColor;
class InternalVisitedColor;
+class InternalVisitedTextDecorationColor;
class InternalVisitedTextEmphasisColor;
class InternalVisitedTextFillColor;
class InternalVisitedTextStrokeColor;
@@ -204,6 +205,7 @@
friend class css_longhand::InternalVisitedBorderRightColor;
friend class css_longhand::InternalVisitedBorderTopColor;
friend class css_longhand::InternalVisitedColor;
+ friend class css_longhand::InternalVisitedTextDecorationColor;
friend class css_longhand::InternalVisitedTextEmphasisColor;
friend class css_longhand::InternalVisitedTextFillColor;
friend class css_longhand::InternalVisitedTextStrokeColor;
@@ -2384,8 +2386,8 @@
void SetVisitedLinkColumnRuleColor(const StyleColor& v) {
SetVisitedLinkColumnRuleColorInternal(v);
}
- void SetVisitedLinkTextDecorationColor(const StyleColor& v) {
- SetVisitedLinkTextDecorationColorInternal(v);
+ void SetInternalVisitedTextDecorationColor(const StyleColor& v) {
+ SetInternalVisitedTextDecorationColorInternal(v);
}
void SetInternalVisitedTextEmphasisColor(const StyleColor& color) {
SetInternalVisitedTextEmphasisColorInternal(color.Resolve(Color()));
@@ -2566,8 +2568,8 @@
StyleColor VisitedLinkColumnRuleColor() const {
return VisitedLinkColumnRuleColorInternal();
}
- StyleColor VisitedLinkTextDecorationColor() const {
- return VisitedLinkTextDecorationColorInternal();
+ StyleColor InternalVisitedTextDecorationColor() const {
+ return InternalVisitedTextDecorationColorInternal();
}
StyleColor InternalVisitedTextEmphasisColor() const {
return InternalVisitedTextEmphasisColorIsCurrentColorInternal()
diff --git a/third_party/blink/renderer/core/style/computed_style_diff_functions.json5 b/third_party/blink/renderer/core/style/computed_style_diff_functions.json5
index fd6ab8c..1b06181 100644
--- a/third_party/blink/renderer/core/style/computed_style_diff_functions.json5
+++ b/third_party/blink/renderer/core/style/computed_style_diff_functions.json5
@@ -414,7 +414,7 @@
name: "UpdatePropertySpecificDifferencesTextDecorationOrColor",
fields_to_diff: ["color", "-internal-visited-color", "text-decoration-line",
"text-decoration-style", "text-decoration-color",
- "VisitedLinkTextDecorationColor", "TextEmphasisFill",
+ "-internal-visited-text-decoration-color", "TextEmphasisFill",
"text-underline-position", "text-decoration-skip-ink", "AppliedTextDecorations"],
methods_to_diff: [
{
diff --git a/third_party/blink/renderer/core/style/computed_style_extra_fields.json5 b/third_party/blink/renderer/core/style/computed_style_extra_fields.json5
index 33dfb38..44d5945 100644
--- a/third_party/blink/renderer/core/style/computed_style_extra_fields.json5
+++ b/third_party/blink/renderer/core/style/computed_style_extra_fields.json5
@@ -620,14 +620,6 @@
field_group: "*",
},
{
- name: "VisitedLinkTextDecorationColor",
- field_template: "external",
- type_name: "StyleColor",
- field_group: "*",
- default_value: "StyleColor::CurrentColor()",
- computed_style_custom_functions: ["getter", "setter"],
- },
- {
name: "VisitedLinkOutlineColor",
field_template: "external",
type_name: "StyleColor",