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

Side by Side Diff: third_party/WebKit/Source/core/animation/ColorPropertyFunctions.cpp

Issue 2694383002: Don't animate caret-color: auto (Closed)
Patch Set: Fix composition test Created 3 years, 10 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/animation/ColorPropertyFunctions.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/ColorPropertyFunctions.h" 5 #include "core/animation/ColorPropertyFunctions.h"
6 6
7 #include "core/style/ComputedStyle.h" 7 #include "core/style/ComputedStyle.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 bool ColorPropertyFunctions::getInitialColor(CSSPropertyID property, 11 OptionalStyleColor ColorPropertyFunctions::getInitialColor(
12 StyleColor& initialColor) { 12 CSSPropertyID property) {
13 if (property == CSSPropertyCaretColor) 13 return getUnvisitedColor(property, ComputedStyle::initialStyle());
14 return false;
15 // TODO(rego): Make getUnvisitedColor() return a bool, so we don't need a
16 // special case for caret-color here (http://crbug.com/676295).
17 initialColor = getUnvisitedColor(property, ComputedStyle::initialStyle());
18 return true;
19 } 14 }
20 15
21 StyleColor ColorPropertyFunctions::getUnvisitedColor( 16 OptionalStyleColor ColorPropertyFunctions::getUnvisitedColor(
22 CSSPropertyID property, 17 CSSPropertyID property,
23 const ComputedStyle& style) { 18 const ComputedStyle& style) {
24 switch (property) { 19 switch (property) {
25 case CSSPropertyBackgroundColor: 20 case CSSPropertyBackgroundColor:
26 return style.backgroundColor(); 21 return style.backgroundColor();
27 case CSSPropertyBorderLeftColor: 22 case CSSPropertyBorderLeftColor:
28 return style.borderLeftColor(); 23 return style.borderLeftColor();
29 case CSSPropertyBorderRightColor: 24 case CSSPropertyBorderRightColor:
30 return style.borderRightColor(); 25 return style.borderRightColor();
31 case CSSPropertyBorderTopColor: 26 case CSSPropertyBorderTopColor:
32 return style.borderTopColor(); 27 return style.borderTopColor();
33 case CSSPropertyBorderBottomColor: 28 case CSSPropertyBorderBottomColor:
34 return style.borderBottomColor(); 29 return style.borderBottomColor();
35 case CSSPropertyCaretColor: 30 case CSSPropertyCaretColor:
36 // TODO(rego): "auto" value for caret-color should not interpolate
37 // (http://crbug.com/676295).
38 if (style.caretColor().isAutoColor()) 31 if (style.caretColor().isAutoColor())
39 return StyleColor::currentColor(); 32 return nullptr;
40 return style.caretColor().toStyleColor(); 33 return style.caretColor().toStyleColor();
41 case CSSPropertyColor: 34 case CSSPropertyColor:
42 return style.color(); 35 return style.color();
43 case CSSPropertyOutlineColor: 36 case CSSPropertyOutlineColor:
44 return style.outlineColor(); 37 return style.outlineColor();
45 case CSSPropertyColumnRuleColor: 38 case CSSPropertyColumnRuleColor:
46 return style.columnRuleColor(); 39 return style.columnRuleColor();
47 case CSSPropertyWebkitTextEmphasisColor: 40 case CSSPropertyWebkitTextEmphasisColor:
48 return style.textEmphasisColor(); 41 return style.textEmphasisColor();
49 case CSSPropertyWebkitTextFillColor: 42 case CSSPropertyWebkitTextFillColor:
50 return style.textFillColor(); 43 return style.textFillColor();
51 case CSSPropertyWebkitTextStrokeColor: 44 case CSSPropertyWebkitTextStrokeColor:
52 return style.textStrokeColor(); 45 return style.textStrokeColor();
53 case CSSPropertyFloodColor: 46 case CSSPropertyFloodColor:
54 return style.floodColor(); 47 return style.floodColor();
55 case CSSPropertyLightingColor: 48 case CSSPropertyLightingColor:
56 return style.lightingColor(); 49 return style.lightingColor();
57 case CSSPropertyStopColor: 50 case CSSPropertyStopColor:
58 return style.stopColor(); 51 return style.stopColor();
59 case CSSPropertyWebkitTapHighlightColor: 52 case CSSPropertyWebkitTapHighlightColor:
60 return style.tapHighlightColor(); 53 return style.tapHighlightColor();
61 case CSSPropertyTextDecorationColor: 54 case CSSPropertyTextDecorationColor:
62 return style.textDecorationColor(); 55 return style.textDecorationColor();
63 default: 56 default:
64 NOTREACHED(); 57 NOTREACHED();
65 return StyleColor::currentColor(); 58 return nullptr;
66 } 59 }
67 } 60 }
68 61
69 StyleColor ColorPropertyFunctions::getVisitedColor(CSSPropertyID property, 62 OptionalStyleColor ColorPropertyFunctions::getVisitedColor(
70 const ComputedStyle& style) { 63 CSSPropertyID property,
64 const ComputedStyle& style) {
71 switch (property) { 65 switch (property) {
72 case CSSPropertyBackgroundColor: 66 case CSSPropertyBackgroundColor:
73 return style.visitedLinkBackgroundColor(); 67 return style.visitedLinkBackgroundColor();
74 case CSSPropertyBorderLeftColor: 68 case CSSPropertyBorderLeftColor:
75 return style.visitedLinkBorderLeftColor(); 69 return style.visitedLinkBorderLeftColor();
76 case CSSPropertyBorderRightColor: 70 case CSSPropertyBorderRightColor:
77 return style.visitedLinkBorderRightColor(); 71 return style.visitedLinkBorderRightColor();
78 case CSSPropertyBorderTopColor: 72 case CSSPropertyBorderTopColor:
79 return style.visitedLinkBorderTopColor(); 73 return style.visitedLinkBorderTopColor();
80 case CSSPropertyBorderBottomColor: 74 case CSSPropertyBorderBottomColor:
(...skipping 21 matching lines...) Expand all
102 case CSSPropertyLightingColor: 96 case CSSPropertyLightingColor:
103 return style.lightingColor(); 97 return style.lightingColor();
104 case CSSPropertyStopColor: 98 case CSSPropertyStopColor:
105 return style.stopColor(); 99 return style.stopColor();
106 case CSSPropertyWebkitTapHighlightColor: 100 case CSSPropertyWebkitTapHighlightColor:
107 return style.tapHighlightColor(); 101 return style.tapHighlightColor();
108 case CSSPropertyTextDecorationColor: 102 case CSSPropertyTextDecorationColor:
109 return style.visitedLinkTextDecorationColor(); 103 return style.visitedLinkTextDecorationColor();
110 default: 104 default:
111 NOTREACHED(); 105 NOTREACHED();
112 return StyleColor::currentColor(); 106 return nullptr;
113 } 107 }
114 } 108 }
115 109
116 void ColorPropertyFunctions::setUnvisitedColor(CSSPropertyID property, 110 void ColorPropertyFunctions::setUnvisitedColor(CSSPropertyID property,
117 ComputedStyle& style, 111 ComputedStyle& style,
118 const Color& color) { 112 const Color& color) {
119 switch (property) { 113 switch (property) {
120 case CSSPropertyBackgroundColor: 114 case CSSPropertyBackgroundColor:
121 style.setBackgroundColor(color); 115 style.setBackgroundColor(color);
122 return; 116 return;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 case CSSPropertyWebkitTextStrokeColor: 203 case CSSPropertyWebkitTextStrokeColor:
210 style.setVisitedLinkTextStrokeColor(color); 204 style.setVisitedLinkTextStrokeColor(color);
211 return; 205 return;
212 default: 206 default:
213 NOTREACHED(); 207 NOTREACHED();
214 return; 208 return;
215 } 209 }
216 } 210 }
217 211
218 } // namespace blink 212 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/ColorPropertyFunctions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698