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

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

Issue 2358203003: CSS Properties and Values API: Use initial value where appropriate for var() (Closed)
Patch Set: bla Created 4 years, 3 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 5587576f4c60b33f2e38d938fe2afbda9e0c9f6e..f74d0d30f6d243e342a05a00e9ef1bfe08184aa2 100644
--- a/third_party/WebKit/Source/core/css/PropertyRegistration.cpp
+++ b/third_party/WebKit/Source/core/css/PropertyRegistration.cpp
@@ -9,6 +9,7 @@
#include "core/css/CSSVariableReferenceValue.h"
#include "core/css/PropertyDescriptor.h"
#include "core/css/PropertyRegistry.h"
+#include "core/css/parser/CSSTokenizer.h"
#include "core/css/parser/CSSVariableParser.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
@@ -79,7 +80,8 @@ void PropertyRegistration::registerProperty(ExecutionContext* executionContext,
}
if (descriptor.hasInitialValue()) {
- const CSSValue* initial = syntaxDescriptor.parse(descriptor.initialValue());
+ CSSTokenizer::Scope scope(descriptor.initialValue());
+ const CSSValue* initial = syntaxDescriptor.parse(scope.tokenRange());
if (!initial) {
exceptionState.throwDOMException(SyntaxError, "The initial value provided does not parse for the given syntax.");
return;
@@ -88,13 +90,14 @@ void PropertyRegistration::registerProperty(ExecutionContext* executionContext,
exceptionState.throwDOMException(SyntaxError, "The initial value provided is not computationally independent.");
return;
}
- registry.registerProperty(atomicName, syntaxDescriptor, descriptor.inherits(), initial);
+ RefPtr<CSSVariableData> initialVariableData = CSSVariableData::create(scope.tokenRange(), false);
+ registry.registerProperty(atomicName, syntaxDescriptor, descriptor.inherits(), initial, initialVariableData.release());
} else {
if (!syntaxDescriptor.isTokenStream()) {
exceptionState.throwDOMException(SyntaxError, "An initial value must be provided if the syntax is not '*'");
return;
}
- registry.registerProperty(atomicName, syntaxDescriptor, descriptor.inherits(), nullptr);
+ registry.registerProperty(atomicName, syntaxDescriptor, descriptor.inherits(), nullptr, nullptr);
}
// TODO(timloh): Invalidate only elements with this custom property set

Powered by Google App Engine
This is Rietveld 408576698