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

Unified Diff: third_party/WebKit/Source/core/css/PropertyRegistration.cpp

Issue 2654783004: Store PropertyRegistry::Registrations on CSSInterpolationTypes for registered custom properties (Closed)
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/PropertyRegistration.cpp
diff --git a/third_party/WebKit/Source/core/css/PropertyRegistration.cpp b/third_party/WebKit/Source/core/css/PropertyRegistration.cpp
index 2d049f680983e2e42cec3f87ec2429f0b430ff12..ff078f38b22f82736960149a56fb66931d765986 100644
--- a/third_party/WebKit/Source/core/css/PropertyRegistration.cpp
+++ b/third_party/WebKit/Source/core/css/PropertyRegistration.cpp
@@ -4,6 +4,7 @@
#include "core/css/PropertyRegistration.h"
+#include "core/animation/CSSInterpolationTypesMap.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/CSSSyntaxDescriptor.h"
#include "core/css/CSSValueList.h"
@@ -21,6 +22,31 @@
namespace blink {
+static InterpolationTypes setRegistrationOnCSSInterpolationTypes(
+ CSSInterpolationTypes cssInterpolationTypes,
+ const PropertyRegistration& registration) {
+ InterpolationTypes result;
+ for (auto& cssInterpolationType : cssInterpolationTypes) {
+ cssInterpolationType->setCustomPropertyRegistration(registration);
+ result.push_back(std::move(cssInterpolationType));
+ }
+ return result;
+}
+
+PropertyRegistration::PropertyRegistration(
+ const CSSSyntaxDescriptor& syntax,
+ bool inherits,
+ const CSSValue* initial,
+ PassRefPtr<CSSVariableData> initialVariableData,
+ CSSInterpolationTypes cssInterpolationTypes)
+ : m_syntax(syntax),
+ m_inherits(inherits),
+ m_initial(initial),
+ m_initialVariableData(initialVariableData),
+ m_interpolationTypes(setRegistrationOnCSSInterpolationTypes(
+ std::move(cssInterpolationTypes),
+ *this)) {}
+
static bool computationallyIndependent(const CSSValue& value) {
DCHECK(!value.isCSSWideKeyword());
@@ -93,8 +119,9 @@ void PropertyRegistration::registerProperty(
return;
}
- InterpolationTypes interpolationTypes =
- syntaxDescriptor.createInterpolationTypes(atomicName);
+ CSSInterpolationTypes cssInterpolationTypes =
+ CSSInterpolationTypesMap::createCSSInterpolationTypesForSyntax(
+ atomicName, syntaxDescriptor);
if (descriptor.hasInitialValue()) {
CSSTokenizer tokenizer(descriptor.initialValue());
@@ -121,7 +148,7 @@ void PropertyRegistration::registerProperty(
tokenizer.tokenRange(), isAnimationTainted, false);
registry.registerProperty(
atomicName, syntaxDescriptor, descriptor.inherits(), initial,
- std::move(initialVariableData), std::move(interpolationTypes));
+ std::move(initialVariableData), std::move(cssInterpolationTypes));
} else {
if (!syntaxDescriptor.isTokenStream()) {
exceptionState.throwDOMException(
@@ -131,7 +158,7 @@ void PropertyRegistration::registerProperty(
}
registry.registerProperty(atomicName, syntaxDescriptor,
descriptor.inherits(), nullptr, nullptr,
- std::move(interpolationTypes));
+ std::move(cssInterpolationTypes));
}
// TODO(timloh): Invalidate only elements with this custom property set
« no previous file with comments | « third_party/WebKit/Source/core/css/PropertyRegistration.h ('k') | third_party/WebKit/Source/core/css/PropertyRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698