Commit 88ae629e authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[css-properties-values-api] CSS.supports should ignore syntax after all.

According to a recent spec change, the syntax of a registered custom
property must be ignored until computed-value time. This means that
CSS.supports must treat all custom properties as unregistered.

This effectively reverts 9646ae2d (except
the test).

Bug: 641877
Change-Id: I6d24fc23534636b88167121b73b28455f563d501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713508Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679986}
parent 5e0b332d
......@@ -33,7 +33,6 @@
#include "third_party/blink/renderer/core/css/css_property_value_set.h"
#include "third_party/blink/renderer/core/css/parser/css_parser.h"
#include "third_party/blink/renderer/core/css/properties/css_property.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
......@@ -51,10 +50,8 @@ bool DOMWindowCSS::supports(const ExecutionContext* execution_context,
auto* dummy_style =
MakeGarbageCollected<MutableCSSPropertyValueSet>(kHTMLStandardMode);
bool is_animation_tainted = false;
const Document& document = To<Document>(*execution_context);
const PropertyRegistry* registry = document.GetPropertyRegistry();
return CSSParser::ParseValueForCustomProperty(
dummy_style, AtomicString(property), registry, value, false,
dummy_style, "--valid", nullptr, value, false,
execution_context->GetSecureContextMode(), nullptr,
is_animation_tainted)
.did_parse;
......
<!DOCTYPE html>
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1/#conditional-rules" />
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1/#conditional-rules">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
......@@ -35,8 +35,9 @@ test(function() {
}, 'CSS.supports(conditionText) should ignore registered syntax');
test(function() {
assert_false(CSS.supports('--length', 'red'));
assert_true(CSS.supports('--length', 'red'));
assert_true(CSS.supports('--length', '10px'));
}, 'CSS.supports(property, value) should parse against registered syntax');
assert_true(CSS.supports('--length', ' anything, really'));
}, 'CSS.supports(property, value) should ignore registered syntax');
</script>
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