Commit 9b7705c2 authored by timloh's avatar timloh Committed by Commit bot

Fix setting css-wide keywords on registered custom properties

This patch fixes setting of css-wide keywords on registered custom
properties, which was broken by crrev.com/2607403002.

BUG=679627

Review-Url: https://codereview.chromium.org/2624213004
Cr-Commit-Position: refs/heads/master@{#443204}
parent 83993358
......@@ -67,6 +67,8 @@ test(function() {
assert_equals(computedStyle.getPropertyValue('--length'), '10px');
sheetStyle.setProperty('--length', '20px');
assert_equals(computedStyle.getPropertyValue('--length'), '20px');
sheetStyle.setProperty('--length', 'initial');
assert_equals(computedStyle.getPropertyValue('--length'), '0px');
}, "Stylesheets can be modified by CSSOM");
test(function() {
......@@ -76,5 +78,8 @@ test(function() {
assert_equals(inlineStyle.getPropertyValue('--color'), 'pink');
assert_equals(computedStyle.getPropertyValue('--length'), '30px');
assert_equals(computedStyle.getPropertyValue('--color'), 'pink');
inlineStyle.setProperty('--color', 'inherit');
assert_equals(inlineStyle.getPropertyValue('--color'), 'inherit');
assert_equals(computedStyle.getPropertyValue('--color'), 'blue');
}, "Valid values can be set on inline styles");
</script>
......@@ -81,7 +81,9 @@ MutableStylePropertySet::SetResult CSSParserImpl::parseVariableValue(
bool didParse = false;
bool didChange = false;
if (!parser.m_parsedProperties.isEmpty()) {
if (registry) {
const CSSCustomPropertyDeclaration* parsedDeclaration =
toCSSCustomPropertyDeclaration(parser.m_parsedProperties[0].value());
if (parsedDeclaration->value() && registry) {
const PropertyRegistry::Registration* registration =
registry->registration(propertyName);
// TODO(timloh): This is a bit wasteful, we parse the registered property
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment