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

Side by Side Diff: third_party/WebKit/Source/core/css/PropertyRegistration.cpp

Issue 2649103008: Revert of Add smooth interpolation support for <color> custom properties (Closed)
Patch Set: 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/css/CSSSyntaxDescriptor.cpp ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/css/PropertyRegistration.h" 5 #include "core/css/PropertyRegistration.h"
6 6
7 #include "core/animation/CSSValueInterpolationType.h"
7 #include "core/css/CSSStyleSheet.h" 8 #include "core/css/CSSStyleSheet.h"
8 #include "core/css/CSSSyntaxDescriptor.h" 9 #include "core/css/CSSSyntaxDescriptor.h"
9 #include "core/css/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
10 #include "core/css/CSSVariableReferenceValue.h" 11 #include "core/css/CSSVariableReferenceValue.h"
11 #include "core/css/PropertyDescriptor.h" 12 #include "core/css/PropertyDescriptor.h"
12 #include "core/css/PropertyRegistry.h" 13 #include "core/css/PropertyRegistry.h"
13 #include "core/css/StyleSheetContents.h" 14 #include "core/css/StyleSheetContents.h"
14 #include "core/css/parser/CSSParserContext.h" 15 #include "core/css/parser/CSSParserContext.h"
15 #include "core/css/parser/CSSTokenizer.h" 16 #include "core/css/parser/CSSTokenizer.h"
16 #include "core/css/parser/CSSVariableParser.h" 17 #include "core/css/parser/CSSVariableParser.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 54 }
54 return true; 55 return true;
55 } 56 }
56 57
57 // TODO(timloh): Images and transform-function values can also contain 58 // TODO(timloh): Images and transform-function values can also contain
58 // lengths. 59 // lengths.
59 60
60 return true; 61 return true;
61 } 62 }
62 63
64 InterpolationTypes interpolationTypesForSyntax(const AtomicString& propertyName,
65 const CSSSyntaxDescriptor&) {
66 PropertyHandle property(propertyName);
67 InterpolationTypes interpolationTypes;
68 // TODO(alancutter): Read the syntax descriptor and add the appropriate
69 // CSSInterpolationType subclasses.
70 interpolationTypes.push_back(
71 WTF::makeUnique<CSSValueInterpolationType>(property));
72 return interpolationTypes;
73 }
74
63 void PropertyRegistration::registerProperty( 75 void PropertyRegistration::registerProperty(
64 ExecutionContext* executionContext, 76 ExecutionContext* executionContext,
65 const PropertyDescriptor& descriptor, 77 const PropertyDescriptor& descriptor,
66 ExceptionState& exceptionState) { 78 ExceptionState& exceptionState) {
67 // Bindings code ensures these are set. 79 // Bindings code ensures these are set.
68 DCHECK(descriptor.hasName()); 80 DCHECK(descriptor.hasName());
69 DCHECK(descriptor.hasInherits()); 81 DCHECK(descriptor.hasInherits());
70 DCHECK(descriptor.hasSyntax()); 82 DCHECK(descriptor.hasSyntax());
71 83
72 String name = descriptor.name(); 84 String name = descriptor.name();
(...skipping 14 matching lines...) Expand all
87 99
88 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax()); 100 CSSSyntaxDescriptor syntaxDescriptor(descriptor.syntax());
89 if (!syntaxDescriptor.isValid()) { 101 if (!syntaxDescriptor.isValid()) {
90 exceptionState.throwDOMException( 102 exceptionState.throwDOMException(
91 SyntaxError, 103 SyntaxError,
92 "The syntax provided is not a valid custom property syntax."); 104 "The syntax provided is not a valid custom property syntax.");
93 return; 105 return;
94 } 106 }
95 107
96 InterpolationTypes interpolationTypes = 108 InterpolationTypes interpolationTypes =
97 syntaxDescriptor.createInterpolationTypes(atomicName); 109 interpolationTypesForSyntax(atomicName, syntaxDescriptor);
98 110
99 if (descriptor.hasInitialValue()) { 111 if (descriptor.hasInitialValue()) {
100 CSSTokenizer tokenizer(descriptor.initialValue()); 112 CSSTokenizer tokenizer(descriptor.initialValue());
101 bool isAnimationTainted = false; 113 bool isAnimationTainted = false;
102 const CSSValue* initial = syntaxDescriptor.parse( 114 const CSSValue* initial = syntaxDescriptor.parse(
103 tokenizer.tokenRange(), 115 tokenizer.tokenRange(),
104 document->elementSheet().contents()->parserContext(), 116 document->elementSheet().contents()->parserContext(),
105 isAnimationTainted); 117 isAnimationTainted);
106 if (!initial) { 118 if (!initial) {
107 exceptionState.throwDOMException( 119 exceptionState.throwDOMException(
(...skipping 26 matching lines...) Expand all
134 std::move(interpolationTypes)); 146 std::move(interpolationTypes));
135 } 147 }
136 148
137 // TODO(timloh): Invalidate only elements with this custom property set 149 // TODO(timloh): Invalidate only elements with this custom property set
138 document->setNeedsStyleRecalc(SubtreeStyleChange, 150 document->setNeedsStyleRecalc(SubtreeStyleChange,
139 StyleChangeReasonForTracing::create( 151 StyleChangeReasonForTracing::create(
140 StyleChangeReason::PropertyRegistration)); 152 StyleChangeReason::PropertyRegistration));
141 } 153 }
142 154
143 } // namespace blink 155 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698