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

Unified Diff: third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp

Issue 2537373005: [css-ui] Make caret-color animatable (Closed)
Patch Set: Come back to previous version but keep DCHECK in toStyleColor() Created 4 years 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/animation/ColorPropertyFunctions.cpp
diff --git a/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp b/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp
index 5755a3c6a58da258978f7c5655cbc315613193a5..16930e3c38dfc5514f57ec5dc93ef8585986b9d6 100644
--- a/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp
+++ b/third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp
@@ -8,8 +8,12 @@
namespace blink {
-StyleColor ColorPropertyFunctions::getInitialColor(CSSPropertyID property) {
- return getUnvisitedColor(property, ComputedStyle::initialStyle());
+bool ColorPropertyFunctions::getInitialColor(CSSPropertyID property,
+ StyleColor& initialColor) {
+ if (property == CSSPropertyCaretColor)
+ return false;
alancutter (OOO until 2018) 2016/12/21 23:24:03 Please add a TODO to make getUnvisitedColor() retu
Manuel Rego 2016/12/22 09:03:01 Done.
+ initialColor = getUnvisitedColor(property, ComputedStyle::initialStyle());
+ return true;
}
StyleColor ColorPropertyFunctions::getUnvisitedColor(
@@ -26,6 +30,12 @@ StyleColor ColorPropertyFunctions::getUnvisitedColor(
return style.borderTopColor();
case CSSPropertyBorderBottomColor:
return style.borderBottomColor();
+ case CSSPropertyCaretColor:
+ // TODO(rego): "auto" value for caret-color should not interpolate
+ // (http://crbug.com/676295).
+ if (style.caretColor().isAutoColor())
+ return StyleColor::currentColor();
+ return style.caretColor().toStyleColor();
case CSSPropertyColor:
return style.color();
case CSSPropertyOutlineColor:
@@ -67,6 +77,12 @@ StyleColor ColorPropertyFunctions::getVisitedColor(CSSPropertyID property,
return style.visitedLinkBorderTopColor();
case CSSPropertyBorderBottomColor:
return style.visitedLinkBorderBottomColor();
+ case CSSPropertyCaretColor:
+ // TODO(rego): "auto" value for caret-color should not interpolate
+ // (http://crbug.com/676295).
+ if (style.visitedLinkCaretColor().isAutoColor())
+ return StyleColor::currentColor();
+ return style.visitedLinkCaretColor().toStyleColor();
case CSSPropertyColor:
return style.visitedLinkColor();
case CSSPropertyOutlineColor:
@@ -114,6 +130,8 @@ void ColorPropertyFunctions::setUnvisitedColor(CSSPropertyID property,
case CSSPropertyBorderTopColor:
style.setBorderTopColor(color);
return;
+ case CSSPropertyCaretColor:
+ return style.setCaretColor(color);
case CSSPropertyColor:
style.setColor(color);
return;
@@ -163,6 +181,8 @@ void ColorPropertyFunctions::setVisitedColor(CSSPropertyID property,
case CSSPropertyBorderTopColor:
style.setVisitedLinkBorderTopColor(color);
return;
+ case CSSPropertyCaretColor:
+ return style.setVisitedLinkCaretColor(color);
case CSSPropertyColor:
style.setVisitedLinkColor(color);
return;

Powered by Google App Engine
This is Rietveld 408576698