Bug 1840476 - [css-properties-values-api] Custom property registration plumbing. r=zrhoffman,firefox-style-system-reviewers,webidl,saschanaz

This implements script registration and some basic validity checks so
that we start keeping track of custom properties in the CascadeData and
in script.

Differential Revision: https://phabricator.services.mozilla.com/D182110
This commit is contained in:
Emilio Cobos Álvarez 2023-06-27 09:48:51 +00:00
Родитель b2af7cafb3
Коммит 3d3511bf24
58 изменённых файлов: 928 добавлений и 698 удалений

Просмотреть файл

@ -28,3 +28,16 @@ partial namespace CSS {
[Pref="dom.customHighlightAPI.enabled", GetterThrows]
readonly attribute HighlightRegistry highlights;
};
// https://drafts.css-houdini.org/css-properties-values-api-1/#registering-custom-properties
// See https://github.com/w3c/css-houdini-drafts/pull/1100 for DOMString vs. UTF8String
dictionary PropertyDefinition {
required UTF8String name;
UTF8String syntax = "*";
required boolean inherits;
UTF8String initialValue;
};
partial namespace CSS {
[Pref="layout.css.properties-and-values.enabled", Throws]
undefined registerProperty(PropertyDefinition definition);
};

Просмотреть файл

@ -16,8 +16,7 @@
#include "nsStyleUtil.h"
#include "xpcpublic.h"
namespace mozilla {
namespace dom {
namespace mozilla::dom {
/* static */
bool CSS::Supports(const GlobalObject&, const nsACString& aProperty,
@ -37,27 +36,37 @@ void CSS::Escape(const GlobalObject&, const nsAString& aIdent,
nsStyleUtil::AppendEscapedCSSIdent(aIdent, aReturn);
}
static Document* GetDocument(const GlobalObject& aGlobal) {
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(aGlobal.GetAsSupports());
MOZ_DIAGNOSTIC_ASSERT(window, "CSS is only exposed to window globals");
if (!window) {
return nullptr;
}
return window->GetExtantDoc();
}
/* static */
HighlightRegistry* CSS::GetHighlights(const GlobalObject& aGlobal,
ErrorResult& aRv) {
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.ThrowUnknownError(
"There is no window associated to "
"this highlight registry object!");
return nullptr;
}
Document* doc = window->GetExtantDoc();
Document* doc = GetDocument(aGlobal);
if (!doc) {
aRv.ThrowUnknownError(
"There is no document associated to "
"this highlight registry object!");
aRv.ThrowUnknownError("No document associated to this global?");
return nullptr;
}
return &doc->HighlightRegistry();
}
} // namespace dom
} // namespace mozilla
/* static */
void CSS::RegisterProperty(const GlobalObject& aGlobal,
const PropertyDefinition& aDefinition,
ErrorResult& aRv) {
Document* doc = GetDocument(aGlobal);
if (!doc) {
return aRv.ThrowUnknownError("No document associated to this global?");
}
doc->StyleSetForPresShellOrMediaQueryEvaluation()->RegisterProperty(
aDefinition, aRv);
}
} // namespace mozilla::dom

Просмотреть файл

@ -10,7 +10,7 @@
#define mozilla_dom_CSS_h_
#include "mozilla/Attributes.h"
#include "mozilla/Preferences.h"
#include "nsStringFwd.h"
namespace mozilla {
@ -20,12 +20,12 @@ namespace dom {
class GlobalObject;
class HighlightRegistry;
struct PropertyDefinition;
class CSS {
private:
public:
CSS() = delete;
public:
static bool Supports(const GlobalObject&, const nsACString& aProperty,
const nsACString& aValue);
@ -36,6 +36,9 @@ class CSS {
static HighlightRegistry* GetHighlights(const GlobalObject& aGlobal,
ErrorResult& aRv);
static void RegisterProperty(const GlobalObject&, const PropertyDefinition&,
ErrorResult&);
};
} // namespace dom

Просмотреть файл

@ -26,6 +26,7 @@
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/AnonymousContent.h"
#include "mozilla/dom/CSSBinding.h"
#include "mozilla/dom/CSSCounterStyleRule.h"
#include "mozilla/dom/CSSFontFaceRule.h"
#include "mozilla/dom/CSSFontFeatureValuesRule.h"
@ -1445,6 +1446,34 @@ void ServoStyleSet::InvalidateForViewportUnits(OnlyDynamic aOnlyDynamic) {
aOnlyDynamic == OnlyDynamic::Yes);
}
void ServoStyleSet::RegisterProperty(const PropertyDefinition& aDefinition,
ErrorResult& aRv) {
using Result = StyleRegisterCustomPropertyResult;
auto result = Servo_RegisterCustomProperty(
RawData(), &aDefinition.mName, &aDefinition.mSyntax,
aDefinition.mInherits,
aDefinition.mInitialValue.WasPassed() ? &aDefinition.mInitialValue.Value()
: nullptr);
switch (result) {
case Result::SuccessfullyRegistered:
break;
case Result::InvalidName:
return aRv.ThrowSyntaxError("Invalid name");
case Result::InvalidSyntax:
return aRv.ThrowSyntaxError("Invalid syntax descriptor");
case Result::InvalidInitialValue:
return aRv.ThrowSyntaxError("Invalid initial value syntax");
case Result::NoInitialValue:
return aRv.ThrowSyntaxError(
"Initial value is required when syntax is not universal");
case Result::InitialValueNotComputationallyIndependent:
return aRv.ThrowSyntaxError(
"Initial value is required when syntax is not universal");
case Result::AlreadyRegistered:
return aRv.ThrowInvalidModificationError("Property already registered");
}
}
NS_IMPL_ISUPPORTS(UACacheReporter, nsIMemoryReporter)
MOZ_DEFINE_MALLOC_SIZE_OF(ServoUACacheMallocSizeOf)

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsAtom.h"
#include "nsIMemoryReporter.h"
#include "nsTArray.h"
#include "nsIMemoryReporter.h"
#include "nsSize.h"
namespace mozilla {
@ -33,6 +32,8 @@ enum class MediaFeatureChangeReason : uint8_t;
enum class StylePageSizeOrientation : uint8_t;
enum class StyleRuleChangeKind : uint32_t;
class ErrorResult;
template <typename Integer, typename Number, typename LinearStops>
struct StyleTimingFunction;
struct StylePagePseudoClassFlags;
@ -47,6 +48,7 @@ namespace dom {
class CSSImportRule;
class Element;
class ShadowRoot;
struct PropertyDefinition;
} // namespace dom
namespace gfx {
class FontPaletteValueSet;
@ -660,6 +662,8 @@ class ServoStyleSet {
loc.second);
}
void RegisterProperty(const dom::PropertyDefinition&, ErrorResult&);
private:
// Map of AnonymousContentKey values to an (index, length) pair pointing into
// mCachedAnonymousContentStyles.

Просмотреть файл

@ -7,4 +7,5 @@
//! https://drafts.css-houdini.org/css-properties-values-api-1/
pub mod rule;
pub mod registry;
pub mod syntax;

Просмотреть файл

@ -0,0 +1,47 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Registered custom properties.
use crate::Atom;
use crate::selector_map::PrecomputedHashMap;
use super::syntax::Descriptor;
use super::rule::InitialValue;
/// A computed, already-validated property registration.
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#custom-property-registration>
#[derive(Debug, Clone, MallocSizeOf)]
pub struct PropertyRegistration {
/// The syntax of the property.
pub syntax: Descriptor,
/// Whether the property inherits.
pub inherits: bool,
/// The initial value. Only missing for universal syntax.
#[ignore_malloc_size_of = "Arc"]
pub initial_value: Option<InitialValue>,
}
/// The script registry of custom properties.
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-window-registeredpropertyset-slot>
#[derive(Default)]
pub struct ScriptRegistry {
properties: PrecomputedHashMap<Atom, PropertyRegistration>,
}
impl ScriptRegistry {
/// Gets an already-registered custom property via script.
#[inline]
pub fn get(&self, name: &Atom) -> Option<&PropertyRegistration> {
self.properties.get(name)
}
/// Register a given property. As per
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#the-registerproperty-function>
/// we don't allow overriding the registration.
#[inline]
pub fn register(&mut self, name: Atom, registration: PropertyRegistration) {
let old = self.properties.insert(name, registration);
debug_assert!(old.is_none(), "Already registered? Should be an error");
}
}

Просмотреть файл

@ -9,10 +9,11 @@
use crate::custom_properties::{Name as CustomPropertyName, SpecifiedValue};
use crate::error_reporting::ContextualParseError;
use crate::parser::{Parse, ParserContext};
use crate::properties_and_values::syntax::Descriptor as SyntaxDescriptor;
use crate::properties_and_values::syntax::{Descriptor, ParsedDescriptor};
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::values::serialize_atom_name;
use super::registry::PropertyRegistration;
use cssparser::{
AtRuleParser, CowRcStr, DeclarationParser, ParseErrorKind, Parser, QualifiedRuleParser,
RuleBodyItemParser, RuleBodyParser, SourceLocation,
@ -165,7 +166,7 @@ macro_rules! property_descriptors {
#[cfg(feature = "gecko")]
property_descriptors! {
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#the-syntax-descriptor>
"syntax" syntax: SyntaxDescriptor,
"syntax" syntax: ParsedDescriptor,
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#inherits-descriptor>
"inherits" inherits: Inherits,
@ -174,6 +175,16 @@ property_descriptors! {
"initial-value" initial_value: InitialValue,
}
/// Errors that can happen when turning a property rule into a PropertyRegistration.
#[allow(missing_docs)]
pub enum ToRegistrationError {
MissingSyntax,
MissingInherits,
NoInitialValue,
InvalidInitialValue,
InitialValueNotComputationallyIndependent,
}
impl PropertyRuleData {
/// Measure heap usage.
#[cfg(feature = "gecko")]
@ -187,6 +198,65 @@ impl PropertyRuleData {
0
}
}
/// Performs syntax validation as per the initial value descriptor.
pub fn validate_syntax(syntax: &Descriptor, initial_value: Option<&InitialValue>) -> Result<(), ToRegistrationError> {
// https://drafts.css-houdini.org/css-properties-values-api-1/#initial-value-descriptor:
//
// If the value of the syntax descriptor is the universal syntax definition, then
// the initial-value descriptor is optional. If omitted, the initial value of the
// property is the guaranteed-invalid value.
//
// Otherwise, if the value of the syntax descriptor is not the universal syntax
// definition, the following conditions must be met for the @property rule to be
// valid:
//
// * The initial-value descriptor must be present.
// * The initial-value descriptors value must parse successfully according to the
// grammar specified by the syntax definition.
// * The initial-value must be computationally independent.
//
// If the above conditions are not met, the @property rule is invalid.
if !syntax.is_universal() {
if initial_value.is_none() {
return Err(ToRegistrationError::NoInitialValue);
}
// TODO(bug 1840477): Parse according to syntax (InvalidInitialValue), and ensure
// initial value is computationally independent
// (InitialValueNotComputationallyIndependent).
}
Ok(())
}
/// Performs relevant rule validity checks.
///
/// If these don't pass, we shouldn't end up with a property registration.
///
/// NOTE(emilio): Currently per spec these should happen at parse-time, but I think that's just
/// a spec bug, see https://github.com/w3c/css-houdini-drafts/issues/1098
pub fn to_valid_registration(&self) -> Result<PropertyRegistration, ToRegistrationError> {
use self::ToRegistrationError::*;
// https://drafts.css-houdini.org/css-properties-values-api-1/#the-syntax-descriptor:
//
// The syntax descriptor is required for the @property rule to be valid; if its
// missing, the @property rule is invalid.
let Some(ref syntax) = self.syntax else { return Err(MissingSyntax) };
// https://drafts.css-houdini.org/css-properties-values-api-1/#inherits-descriptor:
//
// The inherits descriptor is required for the @property rule to be valid; if its
// missing, the @property rule is invalid.
let Some(ref inherits) = self.inherits else { return Err(MissingInherits) };
Self::validate_syntax(syntax.descriptor(), self.initial_value.as_ref())?;
Ok(PropertyRegistration {
syntax: syntax.descriptor().clone(),
inherits: *inherits == Inherits::True,
initial_value: self.initial_value.clone(),
})
}
}
impl ToCssWithGuard for PropertyRuleData {
@ -210,7 +280,7 @@ impl ToShmem for PropertyRuleData {
/// A custom property name wrapper that includes the `--` prefix in its serialization
#[derive(Clone, Debug, PartialEq)]
pub struct PropertyRuleName(pub Arc<CustomPropertyName>);
pub struct PropertyRuleName(pub CustomPropertyName);
impl ToCss for PropertyRuleName {
fn to_css<W: Write>(&self, dest: &mut CssWriter<W>) -> fmt::Result {

Просмотреть файл

@ -23,19 +23,59 @@ mod ascii;
mod data_type;
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#parsing-syntax>
#[derive(Debug, Clone, MallocSizeOf)]
pub struct Descriptor {
components: Box<[Component]>,
css: String,
}
#[derive(Debug, Clone, Default, MallocSizeOf, PartialEq)]
pub struct Descriptor(#[ignore_malloc_size_of = "arc"] crate::ArcSlice<Component>);
impl Descriptor {
/// Returns the universal syntax definition with the given CSS representation.
fn universal(css: &str) -> Self {
Self {
components: Default::default(),
css: String::from(css),
/// Returns whether this is the universal syntax descriptor.
pub fn is_universal(&self) -> bool {
self.0.is_empty()
}
/// Parse a syntax descriptor.
/// https://drafts.css-houdini.org/css-properties-values-api-1/#consume-a-syntax-definition
pub fn from_str(css: &str) -> Result<Self, ParseError> {
// 1. Strip leading and trailing ASCII whitespace from string.
let input = ascii::trim_ascii_whitespace(css);
// 2. If string's length is 0, return failure.
if input.is_empty() {
return Err(ParseError::EmptyInput);
}
// 3. If string's length is 1, and the only code point in string is U+002A
// ASTERISK (*), return the universal syntax descriptor.
if input.len() == 1 && input.as_bytes()[0] == b'*' {
return Ok(Self::default());
}
// 4. Let stream be an input stream created from the code points of string,
// preprocessed as specified in [css-syntax-3]. Let descriptor be an
// initially empty list of syntax components.
//
// NOTE(emilio): Instead of preprocessing we cheat and treat new-lines and
// nulls in the parser specially.
let mut components = vec![];
{
let mut parser = Parser::new(input, &mut components);
// 5. Repeatedly consume the next input code point from stream.
parser.parse()?;
}
Ok(Self(crate::ArcSlice::from_iter(components.into_iter())))
}
}
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#parsing-syntax>
#[derive(Debug, Clone, Default, MallocSizeOf, PartialEq)]
pub struct ParsedDescriptor {
descriptor: Descriptor,
css: String
}
impl ParsedDescriptor {
/// Returns the specified syntax string.
pub fn descriptor(&self) -> &Descriptor {
&self.descriptor
}
/// Returns the specified syntax string.
@ -44,13 +84,7 @@ impl Descriptor {
}
}
impl PartialEq for Descriptor {
fn eq(&self, other: &Self) -> bool {
self.components == other.components
}
}
impl Parse for Descriptor {
impl Parse for ParsedDescriptor {
/// Parse a syntax descriptor.
fn parse<'i, 't>(
_context: &ParserContext,
@ -58,14 +92,17 @@ impl Parse for Descriptor {
) -> Result<Self, StyleParseError<'i>> {
// 1. Strip leading and trailing ASCII whitespace from string.
let input = parser.expect_string()?;
match parse_descriptor(input) {
Ok(syntax) => Ok(syntax),
match Descriptor::from_str(input.as_ref()) {
Ok(descriptor) => Ok(Self {
descriptor,
css: input.as_ref().to_owned(),
}),
Err(err) => Err(parser.new_custom_error(StyleParseErrorKind::PropertySyntaxField(err))),
}
}
}
impl ToCss for Descriptor {
impl ToCss for ParsedDescriptor {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
@ -142,41 +179,6 @@ impl ComponentName {
}
}
/// Parse a syntax descriptor.
#[inline]
fn parse_descriptor(css: &str) -> Result<Descriptor, ParseError> {
// 1. Strip leading and trailing ASCII whitespace from string.
let input = ascii::trim_ascii_whitespace(css);
// 2. If string's length is 0, return failure.
if input.is_empty() {
return Err(ParseError::EmptyInput);
}
// 3. If string's length is 1, and the only code point in string is U+002A
// ASTERISK (*), return the universal syntax descriptor.
if input.len() == 1 && input.as_bytes()[0] == b'*' {
return Ok(Descriptor::universal(css));
}
// 4. Let stream be an input stream created from the code points of string,
// preprocessed as specified in [css-syntax-3]. Let descriptor be an
// initially empty list of syntax components.
//
// NOTE(emilio): Instead of preprocessing we cheat and treat new-lines and
// nulls in the parser specially.
let mut components = vec![];
{
let mut parser = Parser::new(input, &mut components);
// 5. Repeatedly consume the next input code point from stream.
parser.parse()?;
}
Ok(Descriptor {
components: components.into_boxed_slice(),
css: String::from(css),
})
}
struct Parser<'a> {
input: &'a str,
position: usize,

Просмотреть файл

@ -688,7 +688,7 @@ impl<'a, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'i> {
let name = parse_custom_property_name(&name).map_err(|_| {
input.new_custom_error(StyleParseErrorKind::UnexpectedIdent(name.clone()))
})?;
AtRulePrelude::Property(PropertyRuleName(Arc::new(Atom::from(name))))
AtRulePrelude::Property(PropertyRuleName(Atom::from(name)))
},
"-moz-document" if cfg!(feature = "gecko") => {
let cond = DocumentCondition::parse(&self.context, input)?;

Просмотреть файл

@ -19,6 +19,7 @@ use crate::invalidation::stylesheets::RuleChangeKind;
use crate::media_queries::Device;
use crate::properties::{self, CascadeMode, ComputedValues};
use crate::properties::{AnimationDeclarations, PropertyDeclarationBlock};
use crate::properties_and_values::registry::{ScriptRegistry as CustomPropertyScriptRegistry, PropertyRegistration};
use crate::rule_cache::{RuleCache, RuleCacheConditions};
use crate::rule_collector::{containing_shadow_ignoring_svg_use, RuleCollector};
use crate::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
@ -523,6 +524,10 @@ pub struct Stylist {
/// The rule tree, that stores the results of selector matching.
rule_tree: RuleTree,
/// The set of registered custom properties from script.
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-window-registeredpropertyset-slot>
script_custom_properties: CustomPropertyScriptRegistry,
/// The total number of times the stylist has been rebuilt.
num_rebuilds: usize,
}
@ -612,6 +617,7 @@ impl Stylist {
cascade_data: Default::default(),
author_styles_enabled: AuthorStylesEnabled::Yes,
rule_tree: RuleTree::new(),
script_custom_properties: Default::default(),
num_rebuilds: 0,
}
}
@ -1496,6 +1502,18 @@ impl Stylist {
&self.rule_tree
}
/// Returns the script-registered custom property registry.
#[inline]
pub fn custom_property_script_registry(&self) -> &CustomPropertyScriptRegistry {
&self.script_custom_properties
}
/// Returns the script-registered custom property registry, as a mutable ref.
#[inline]
pub fn custom_property_script_registry_mut(&mut self) -> &mut CustomPropertyScriptRegistry {
&mut self.script_custom_properties
}
/// Measures heap usage.
#[cfg(feature = "gecko")]
pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
@ -1544,6 +1562,9 @@ impl<T: 'static> LayerOrderedVec<T> {
}
impl<T: 'static> LayerOrderedMap<T> {
fn shrink_if_needed(&mut self) {
self.0.shrink_if_needed();
}
fn clear(&mut self) {
self.0.clear();
}
@ -2266,6 +2287,10 @@ pub struct CascadeData {
/// by name.
animations: LayerOrderedMap<KeyframesAnimation>,
/// A map with all the layer-ordered registrations from style at this `CascadeData`'s origin,
/// indexed by name.
custom_property_registrations: LayerOrderedMap<PropertyRegistration>,
/// A map from cascade layer name to layer order.
layer_id: FxHashMap<LayerName, LayerId>,
@ -2319,6 +2344,7 @@ impl CascadeData {
// somewhat gnarly.
selectors_for_cache_revalidation: SelectorMap::new_without_attribute_bucketing(),
animations: Default::default(),
custom_property_registrations: Default::default(),
layer_id: Default::default(),
layers: smallvec::smallvec![CascadeLayer::root()],
container_conditions: smallvec::smallvec![ContainerConditionReference::none()],
@ -2508,6 +2534,8 @@ impl CascadeData {
if let Some(ref mut slotted_rules) = self.slotted_rules {
slotted_rules.shrink_if_needed();
}
self.animations.shrink_if_needed();
self.custom_property_registrations.shrink_if_needed();
self.invalidation_map.shrink_if_needed();
self.attribute_dependencies.shrink_if_needed();
self.nth_of_attribute_dependencies.shrink_if_needed();
@ -2558,6 +2586,7 @@ impl CascadeData {
self.extra_data.sort_by_layer(&self.layers);
self.animations
.sort_with(&self.layers, compare_keyframes_in_same_layer);
self.custom_property_registrations.sort(&self.layers)
}
/// Collects all the applicable media query results into `results`.
@ -2780,6 +2809,15 @@ impl CascadeData {
compare_keyframes_in_same_layer,
)?;
},
CssRule::Property(ref rule) => {
if let Ok(registration) = rule.to_valid_registration() {
self.custom_property_registrations.try_insert(
rule.name.0.clone(),
registration,
containing_rule_state.layer_id,
)?;
}
},
#[cfg(feature = "gecko")]
CssRule::FontFace(ref rule) => {
// NOTE(emilio): We don't care about container_condition_id
@ -3129,6 +3167,7 @@ impl CascadeData {
host_rules.clear();
}
self.animations.clear();
self.custom_property_registrations.clear();
self.layer_id.clear();
self.layers.clear();
self.layers.push(CascadeLayer::root());

Просмотреть файл

@ -7817,3 +7817,83 @@ pub extern "C" fn Servo_ParseAbsoluteLength(len: &nsACString, out: &mut f32) ->
Err(..) => false,
}
}
#[repr(u8)]
pub enum RegisterCustomPropertyResult {
SuccessfullyRegistered,
InvalidName,
AlreadyRegistered,
InvalidSyntax,
NoInitialValue,
InvalidInitialValue,
InitialValueNotComputationallyIndependent,
}
/// https://drafts.css-houdini.org/css-properties-values-api-1/#the-registerproperty-function
#[no_mangle]
pub extern "C" fn Servo_RegisterCustomProperty(
per_doc_data: &PerDocumentStyleData,
name: &nsACString,
syntax: &nsACString,
inherits: bool,
initial_value: Option<&nsACString>,
) -> RegisterCustomPropertyResult {
use self::RegisterCustomPropertyResult::*;
use style::custom_properties::SpecifiedValue;
use style::properties_and_values::registry::PropertyRegistration;
use style::properties_and_values::rule::{PropertyRuleData, ToRegistrationError};
use style::properties_and_values::syntax::Descriptor;
let mut per_doc_data = per_doc_data.borrow_mut();
let name = unsafe { name.as_str_unchecked() };
let syntax = unsafe { syntax.as_str_unchecked() };
let initial_value = initial_value.map(|v| unsafe { v.as_str_unchecked() });
// If name is not a custom property name string, throw a SyntaxError and exit this algorithm.
let name = match style::custom_properties::parse_name(name) {
Ok(n) => Atom::from(n),
Err(()) => return InvalidName,
};
// If property set already contains an entry with name as its property name (compared
// codepoint-wise), throw an InvalidModificationError and exit this algorithm.
if per_doc_data.stylist.custom_property_script_registry().get(&name).is_some() {
return AlreadyRegistered
}
// Attempt to consume a syntax definition from syntax. If it returns failure, throw a
// SyntaxError. Otherwise, let syntax definition be the returned syntax definition.
let Ok(syntax) = Descriptor::from_str(syntax) else { return InvalidSyntax };
let initial_value = match initial_value {
Some(v) => {
let mut input = ParserInput::new(v);
let parsed = Parser::new(&mut input).parse_entirely(|input| {
input.skip_whitespace();
SpecifiedValue::parse(input)
}).ok();
if parsed.is_none() {
return InvalidInitialValue
}
parsed
}
None => None,
};
if let Err(error) = PropertyRuleData::validate_syntax(&syntax, initial_value.as_ref()) {
return match error {
ToRegistrationError::MissingInherits |
ToRegistrationError::MissingSyntax => unreachable!(),
ToRegistrationError::InitialValueNotComputationallyIndependent => InitialValueNotComputationallyIndependent,
ToRegistrationError::InvalidInitialValue => InvalidInitialValue,
ToRegistrationError::NoInitialValue=> NoInitialValue,
}
}
per_doc_data.stylist.custom_property_script_registry_mut().register(name, PropertyRegistration {
syntax,
inherits,
initial_value,
});
SuccessfullyRegistered
}

Просмотреть файл

@ -1,4 +1,14 @@
[anchor-query-custom-property-registration.html]
expected:
if (os == "android") and fission: [ERROR, TIMEOUT]
ERROR
[anchor() cannot be used as <length> initial value]
expected: FAIL
[anchor-size() cannot be used as <length> initial value]
expected: FAIL
[anchor() cannot be used as <length-percentage> initial value]
expected: FAIL
[anchor-size() cannot be used as <length-percentage> initial value]
expected: FAIL

Просмотреть файл

@ -1,4 +1,5 @@
[animation-important-001.html]
expected:
if (os == "android") and fission: [ERROR, TIMEOUT]
ERROR
[Custom property animations appearing via setKeyframes do not override important declarations]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-angle-comma-list.html]
expected: ERROR
[Animating a custom property of type <angle>#]
expected: FAIL
[Animating a custom property of type <angle># with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle># with additivity]
expected: FAIL
[Animating a custom property of type <angle># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <angle># with iterationComposite]
expected: FAIL
[Animating a custom property of type <angle># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-angle-space-list.html]
expected: ERROR
[Animating a custom property of type <angle>+]
expected: FAIL
[Animating a custom property of type <angle>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle>+ with additivity]
expected: FAIL
[Animating a custom property of type <angle>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <angle>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <angle>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-angle.html]
expected: ERROR
[Animating a custom property of type <angle>]
expected: FAIL
[Animating a custom property of type <angle> with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle> with additivity]
expected: FAIL
[Animating a custom property of type <angle> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <angle> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-color-comma-list.html]
expected: ERROR
[Animating a custom property of type <color>#]
expected: FAIL
[Animating a custom property of type <color># with a single keyframe]
expected: FAIL
[Animating a custom property of type <color># with additivity]
expected: FAIL
[Animating a custom property of type <color># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <color># with iterationComposite]
expected: FAIL
[Animating a custom property of type <color># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-color-space-list.html]
expected: ERROR
[Animating a custom property of type <color>+]
expected: FAIL
[Animating a custom property of type <color>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <color>+ with additivity]
expected: FAIL
[Animating a custom property of type <color>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <color>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <color>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-color.html]
expected: ERROR
[Animating a custom property of type <color>]
expected: FAIL
[Animating a custom property of type <color> with a single keyframe]
expected: FAIL
[Animating a custom property of type <color> with additivity]
expected: FAIL
[Animating a custom property of type <color> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <color> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-integer-comma-list.html]
expected: ERROR
[Animating a custom property of type <integer>#]
expected: FAIL
[Animating a custom property of type <integer># with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer># with additivity]
expected: FAIL
[Animating a custom property of type <integer># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <integer># with iterationComposite]
expected: FAIL
[Animating a custom property of type <integer># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-integer-space-list.html]
expected: ERROR
[Animating a custom property of type <integer>+]
expected: FAIL
[Animating a custom property of type <integer>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer>+ with additivity]
expected: FAIL
[Animating a custom property of type <integer>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <integer>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <integer>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-integer.html]
expected: ERROR
[Animating a custom property of type <integer>]
expected: FAIL
[Animating a custom property of type <integer> with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer> with additivity]
expected: FAIL
[Animating a custom property of type <integer> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <integer> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-length-comma-list.html]
expected: ERROR
[Animating a custom property of type <length>#]
expected: FAIL
[Animating a custom property of type <length># with a single keyframe]
expected: FAIL
[Animating a custom property of type <length># with additivity]
expected: FAIL
[Animating a custom property of type <length># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length># with iterationComposite]
expected: FAIL
[Animating a custom property of type <length># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-length-percentage-comma-list.html]
expected: ERROR
[Animating a custom property of type <length-percentage>#]
expected: FAIL
[Animating a custom property of type <length-percentage># with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage># with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length-percentage># with iterationComposite]
expected: FAIL
[Animating a custom property of type <length-percentage># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-length-percentage-space-list.html]
expected: ERROR
[Animating a custom property of type <length-percentage>+]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-length-percentage.html]
expected: ERROR
[Animating a custom property of type <length-percentage>]
expected: FAIL
[Animating a custom property of type <length-percentage> with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage> with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length-percentage> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-length-space-list.html]
expected: ERROR
[Animating a custom property of type <length>+]
expected: FAIL
[Animating a custom property of type <length>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <length>+ with additivity]
expected: FAIL
[Animating a custom property of type <length>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <length>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-length.html]
expected: ERROR
[Animating a custom property of type <length>]
expected: FAIL
[Animating a custom property of type <length> with a single keyframe]
expected: FAIL
[Animating a custom property of type <length> with additivity]
expected: FAIL
[Animating a custom property of type <length> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,3 @@
[custom-property-animation-list-type-mismatch.html]
expected: ERROR
[Animating a custom property allowing multiple list types with two mismatching types]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-number-comma-list.html]
expected: ERROR
[Animating a custom property of type <number>#]
expected: FAIL
[Animating a custom property of type <number># with a single keyframe]
expected: FAIL
[Animating a custom property of type <number># with additivity]
expected: FAIL
[Animating a custom property of type <number># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <number># with iterationComposite]
expected: FAIL
[Animating a custom property of type <number># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-number-space-list.html]
expected: ERROR
[Animating a custom property of type <number>+]
expected: FAIL
[Animating a custom property of type <number>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <number>+ with additivity]
expected: FAIL
[Animating a custom property of type <number>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <number>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <number>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-number.html]
expected: ERROR
[Animating a custom property of type <number>]
expected: FAIL
[Animating a custom property of type <number> with a single keyframe]
expected: FAIL
[Animating a custom property of type <number> with additivity]
expected: FAIL
[Animating a custom property of type <number> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <number> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-percentage-comma-list.html]
expected: ERROR
[Animating a custom property of type <percentage>#]
expected: FAIL
[Animating a custom property of type <percentage># with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage># with additivity]
expected: FAIL
[Animating a custom property of type <percentage># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <percentage># with iterationComposite]
expected: FAIL
[Animating a custom property of type <percentage># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-percentage-space-list.html]
expected: ERROR
[Animating a custom property of type <percentage>+]
expected: FAIL
[Animating a custom property of type <percentage>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage>+ with additivity]
expected: FAIL
[Animating a custom property of type <percentage>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <percentage>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <percentage>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-percentage.html]
expected: ERROR
[Animating a custom property of type <percentage>]
expected: FAIL
[Animating a custom property of type <percentage> with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage> with additivity]
expected: FAIL
[Animating a custom property of type <percentage> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <percentage> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-resolution-comma-list.html]
expected: ERROR
[Animating a custom property of type <resolution>#]
expected: FAIL
[Animating a custom property of type <resolution># with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution># with additivity]
expected: FAIL
[Animating a custom property of type <resolution># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <resolution># with iterationComposite]
expected: FAIL
[Animating a custom property of type <resolution># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-resolution-space-list.html]
expected: ERROR
[Animating a custom property of type <resolution>+]
expected: FAIL
[Animating a custom property of type <resolution>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution>+ with additivity]
expected: FAIL
[Animating a custom property of type <resolution>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <resolution>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <resolution>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-resolution.html]
expected: ERROR
[Animating a custom property of type <resolution>]
expected: FAIL
[Animating a custom property of type <resolution> with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution> with additivity]
expected: FAIL
[Animating a custom property of type <resolution> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <resolution> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-time-comma-list.html]
expected: ERROR
[Animating a custom property of type <time>#]
expected: FAIL
[Animating a custom property of type <time># with a single keyframe]
expected: FAIL
[Animating a custom property of type <time># with additivity]
expected: FAIL
[Animating a custom property of type <time># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <time># with iterationComposite]
expected: FAIL
[Animating a custom property of type <time># with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-time-space-list.html]
expected: ERROR
[Animating a custom property of type <time>+]
expected: FAIL
[Animating a custom property of type <time>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <time>+ with additivity]
expected: FAIL
[Animating a custom property of type <time>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <time>+ with iterationComposite]
expected: FAIL
[Animating a custom property of type <time>+ with different lengths is discrete]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-time.html]
expected: ERROR
[Animating a custom property of type <time>]
expected: FAIL
[Animating a custom property of type <time> with a single keyframe]
expected: FAIL
[Animating a custom property of type <time> with additivity]
expected: FAIL
[Animating a custom property of type <time> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <time> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-transform-function.html]
expected: ERROR
[Animating a custom property of type <transform-function>]
expected: FAIL
[Animating a custom property of type <transform-function> with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-function> with additivity]
expected: FAIL
[Animating a custom property of type <transform-function> with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <transform-function> with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +1,18 @@
[custom-property-animation-transform-list-multiple-values.html]
expected: ERROR
[Animating a custom property of type <transform-list> containing multiple values]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with iterationComposite]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values and with mismatching list lengths]
expected: FAIL

Просмотреть файл

@ -1,2 +1,15 @@
[custom-property-animation-transform-list-single-values.html]
expected: ERROR
[Animating a custom property of type <transform-list> containing a single value]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with iterationComposite]
expected: FAIL

Просмотреть файл

@ -1,2 +0,0 @@
[conditional-rules.html]
expected: ERROR

Просмотреть файл

@ -1,2 +1,3 @@
[font-size-animation.html]
expected: ERROR
[Animating font-size handled identically for standard and custom properties]
expected: FAIL

Просмотреть файл

@ -1,10 +1,6 @@
[idlharness.html]
expected:
if debug and (os == "linux"): ["OK", "TIMEOUT"]
[CSS namespace: operation registerProperty(PropertyDefinition)]
expected: FAIL
if debug and (os == "linux"): [OK, TIMEOUT]
[idl_test setup]
expected:
if debug and (os == "linux"): ["PASS", "TIMEOUT"]
if debug and (os == "linux"): [PASS, TIMEOUT]

Просмотреть файл

@ -1,235 +1,7 @@
[register-property-syntax-parsing.html]
[syntax:'*', initialValue:'a' is valid]
expected: FAIL
[syntax:' * ', initialValue:'b' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'2px' is valid]
expected: FAIL
[syntax:' <number>', initialValue:'5' is valid]
expected: FAIL
[syntax:'<percentage> ', initialValue:'10%' is valid]
expected: FAIL
[syntax:'<color>+', initialValue:'red' is valid]
expected: FAIL
[syntax:' <length>+ | <percentage>', initialValue:'2px 8px' is valid]
expected: FAIL
[syntax:'<length>|<percentage>|<length-percentage>', initialValue:'2px' is valid]
expected: FAIL
[syntax:'<color> | <image> | <url> | <integer> | <angle>', initialValue:'red' is valid]
expected: FAIL
[syntax:'<time> | <resolution> | <transform-list> | <custom-ident>', initialValue:'red' is valid]
expected: FAIL
[syntax:'*', initialValue:':> hello' is valid]
expected: FAIL
[syntax:'*', initialValue:'([ brackets \]) { yay (??)}' is valid]
expected: FAIL
[syntax:'*', initialValue:'yep 'this is valid too'' is valid]
expected: FAIL
[syntax:'*', initialValue:'unmatched opening bracket is valid :(' is valid]
expected: FAIL
[syntax:'*', initialValue:'"' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'0' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'10px /*:)*/' is valid]
expected: FAIL
[syntax:'<length>', initialValue:' calc(-2px)' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'calc(2px*4 + 10px)' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'7.1e-4cm' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'calc(7in - 12px)' is valid]
expected: FAIL
[syntax:'<length>+', initialValue:'2px 7px calc(8px)' is valid]
expected: FAIL
[syntax:'<percentage>', initialValue:'-9.3e3%' is valid]
expected: FAIL
[syntax:'<length-percentage>', initialValue:'-54%' is valid]
expected: FAIL
[syntax:'<length-percentage>', initialValue:'0' is valid]
expected: FAIL
[syntax:'<length-percentage>', initialValue:'calc(-11px + 10.4%)' is valid]
expected: FAIL
[syntax:'<number>', initialValue:'-109' is valid]
expected: FAIL
[syntax:'<number>', initialValue:'2.3e4' is valid]
expected: FAIL
[syntax:'<integer>', initialValue:'-109' is valid]
expected: FAIL
[syntax:'<integer>', initialValue:'19' is valid]
expected: FAIL
[syntax:'<angle>', initialValue:'10deg' is valid]
expected: FAIL
[syntax:'<angle>', initialValue:'20.5rad' is valid]
expected: FAIL
[syntax:'<angle>', initialValue:'calc(50grad + 3.14159rad)' is valid]
expected: FAIL
[syntax:'<time>', initialValue:'2s' is valid]
expected: FAIL
[syntax:'<time>', initialValue:'calc(2s - 9ms)' is valid]
expected: FAIL
[syntax:'<resolution>', initialValue:'10dpi' is valid]
expected: FAIL
[syntax:'<resolution>', initialValue:'3dPpX' is valid]
expected: FAIL
[syntax:'<resolution>', initialValue:'-5.3dpcm' is valid]
expected: FAIL
[syntax:'<transform-list>', initialValue:'scale(2)' is valid]
expected: FAIL
[syntax:'<transform-list>', initialValue:'translateX(2px) rotate(20deg)' is valid]
expected: FAIL
[syntax:'<color>', initialValue:'rgb(12, 34, 56)' is valid]
expected: FAIL
[syntax:'<color>', initialValue:'lightgoldenrodyellow' is valid]
expected: FAIL
[syntax:'<image>', initialValue:'url(a)' is valid]
expected: FAIL
[syntax:'<image>', initialValue:'linear-gradient(yellow, blue)' is valid]
expected: FAIL
[syntax:'<url>', initialValue:'url(a)' is valid]
expected: FAIL
[syntax:'banana', initialValue:'banana' is valid]
expected: FAIL
[syntax:'bAnAnA', initialValue:'bAnAnA' is valid]
expected: FAIL
[syntax:'ba-na-nya', initialValue:'ba-na-nya' is valid]
expected: FAIL
[syntax:'banana', initialValue:'banan\\61' is valid]
expected: FAIL
[syntax:'<custom-ident>', initialValue:'banan\\61' is valid]
expected: FAIL
[syntax:'big | bigger | BIGGER', initialValue:'bigger' is valid]
expected: FAIL
[syntax:'foo+|bar', initialValue:'foo foo foo' is valid]
expected: FAIL
[syntax:'banana\t', initialValue:'banana' is valid]
expected: FAIL
[syntax:'\nbanana\r\n', initialValue:'banana' is valid]
expected: FAIL
[syntax:'ba\x0c\n|\tna\r|nya', initialValue:'nya' is valid]
expected: FAIL
[syntax:'null', initialValue:'null' is valid]
expected: FAIL
[syntax:'undefined', initialValue:'undefined' is valid]
expected: FAIL
[syntax:'array', initialValue:'array' is valid]
expected: FAIL
[syntax:'banana,nya', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'<\\6c ength>', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<banana>', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'<Number>', initialValue:'10' is invalid]
expected: FAIL
[syntax:'<length', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<LENGTH>', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'< length>', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<length >', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<length> +', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<length>++', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<length> | *', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'*|banana', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'*+', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'initial', initialValue:'initial' is invalid]
expected: FAIL
[syntax:'inherit', initialValue:'inherit' is invalid]
expected: FAIL
[syntax:'unset', initialValue:'unset' is invalid]
expected: FAIL
[syntax:'<length>|initial', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<length>|INHERIT', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'<percentage>|unsEt', initialValue:'2%' is invalid]
expected: FAIL
[syntax:'*', initialValue:'initial' is invalid]
expected: FAIL
@ -248,27 +20,6 @@
[syntax:'<custom-ident>+', initialValue:'foo inherit bar' is invalid]
expected: FAIL
[syntax:'*', initialValue:')' is invalid]
expected: FAIL
[syntax:'*', initialValue:'([)\]' is invalid]
expected: FAIL
[syntax:'*', initialValue:'whee!' is invalid]
expected: FAIL
[syntax:'*', initialValue:'"\n' is invalid]
expected: FAIL
[syntax:'*', initialValue:'url(moo '')' is invalid]
expected: FAIL
[syntax:'*', initialValue:'semi;colon' is invalid]
expected: FAIL
[syntax:'*', initialValue:'var(invalid var ref)' is invalid]
expected: FAIL
[syntax:'*', initialValue:'var(--foo)' is invalid]
expected: FAIL
@ -305,9 +56,6 @@
[syntax:'<length>+', initialValue:'10px calc(20px + 4rem)' is invalid]
expected: FAIL
[syntax:'<length>', initialValue:'10px;' is invalid]
expected: FAIL
[syntax:'<length-percentage>', initialValue:'calc(2px + 10% + 7ex)' is invalid]
expected: FAIL
@ -338,9 +86,6 @@
[syntax:'<transform-list>', initialValue:'scale()' is invalid]
expected: FAIL
[syntax:'<transform-list>+', initialValue:'translateX(2px) rotate(20deg)' is invalid]
expected: FAIL
[syntax:'<color>', initialValue:'fancy-looking' is invalid]
expected: FAIL
@ -350,120 +95,18 @@
[syntax:'<url>', initialValue:'banana.png' is invalid]
expected: FAIL
[syntax:'<transform-function>', initialValue:'translateX(2px)' is valid]
expected: FAIL
[syntax:'<transform-function>|<integer>', initialValue:'5' is valid]
expected: FAIL
[syntax:'<transform-function>|<integer>', initialValue:'scale(2)' is valid]
expected: FAIL
[syntax:'<transform-function>+', initialValue:'translateX(2px) rotate(42deg)' is valid]
expected: FAIL
[syntax:'<transform-function>', initialValue:'scale()' is invalid]
expected: FAIL
[syntax:'<integer>', initialValue:'calc(1 + 2)' is valid]
expected: FAIL
[syntax:'<integer>', initialValue:'calc(3.1415)' is valid]
expected: FAIL
[syntax:'<integer>', initialValue:'calc(1)' is valid]
expected: FAIL
[syntax:'<integer>', initialValue:'calc(3.1415 + 3.1415)' is valid]
expected: FAIL
[syntax:'<length>#', initialValue:'2px, 7px, calc(8px)' is valid]
expected: FAIL
[syntax:'<length>#', initialValue:'' is invalid]
expected: FAIL
[syntax:'<length>+', initialValue:'' is invalid]
expected: FAIL
[syntax:'<transform-list>+', initialValue:'scale(2)' is invalid]
expected: FAIL
[syntax:'\\1F914 hmm', initialValue:'🤔hmm' is valid]
expected: FAIL
[syntax:'<length>#+', initialValue:'10px' is invalid]
expected: FAIL
[syntax:' <length>+ | <color>#', initialValue:'red, blue' is valid]
expected: FAIL
[syntax:'|banana', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'hmm\\1F914', initialValue:'hmm🤔' is valid]
expected: FAIL
[syntax:'\\1F914\\1F914', initialValue:'🤔🤔' is valid]
expected: FAIL
[syntax:'||', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'\t<color>\n| foo', initialValue:'foo' is valid]
expected: FAIL
[syntax:'\\1F914', initialValue:'🤔' is valid]
expected: FAIL
[syntax:'<length>+#', initialValue:'10px' is invalid]
expected: FAIL
[syntax:'\\1F914hmm', initialValue:'🤔hmm' is valid]
expected: FAIL
[syntax:'<transform-list>#', initialValue:'scale(2)' is invalid]
expected: FAIL
[syntax:'banan\\61', initialValue:'banana' is valid]
expected: FAIL
[syntax:'|', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'<length>##', initialValue:'10px' is invalid]
expected: FAIL
[syntax:' |', initialValue:'banana' is invalid]
expected: FAIL
[syntax:'\\1F914 hmm', initialValue:'🤔hmm' is valid]
expected: FAIL
[syntax:'default', initialValue:'default' is invalid]
expected: FAIL
[syntax:'hmm\\1F914', initialValue:'hmm🤔' is valid]
expected: FAIL
[syntax:'\\1F914\\1F914', initialValue:'🤔🤔' is valid]
expected: FAIL
[syntax:'<color>|REVert', initialValue:'red' is invalid]
expected: FAIL
[syntax:'\\1F914', initialValue:'🤔' is valid]
expected: FAIL
[syntax:'<custom-ident>', initialValue:'default' is invalid]
expected: FAIL
[syntax:'\\1F914hmm', initialValue:'🤔hmm' is valid]
expected: FAIL
[syntax:'<integer>|deFAUlt', initialValue:'1' is invalid]
expected: FAIL
[syntax:'<custom-ident>+', initialValue:'foo revert bar' is invalid]
expected: FAIL
@ -473,9 +116,6 @@
[syntax:'<custom-ident>+', initialValue:'foo default bar' is invalid]
expected: FAIL
[syntax:'revert', initialValue:'revert' is invalid]
expected: FAIL
[syntax:'<custom-ident>+', initialValue:'foo unset bar' is invalid]
expected: FAIL
@ -488,36 +128,12 @@
[syntax:'<custom-ident>', initialValue:'unset' is invalid]
expected: FAIL
[syntax:'foo § bar', initialValue:'foo § bar' is invalid]
expected: FAIL
[syntax:'Foo | bar', initialValue:'Bar' is invalid]
expected: FAIL
[syntax:'<length> <number>', initialValue:'0px 0' is invalid]
expected: FAIL
[syntax:'Foo | bar', initialValue:'foo' is invalid]
expected: FAIL
[syntax:'<length> <length> <length>', initialValue:'0px 0px 0px' is invalid]
expected: FAIL
[syntax:'foo bar', initialValue:'foo bar' is invalid]
expected: FAIL
[syntax:'foo foo foo', initialValue:'foo foo foo' is invalid]
expected: FAIL
[syntax:'foo \\1F914 bar', initialValue:'foo \\1F914 bar' is invalid]
expected: FAIL
[syntax:'<percentage> | <length>+', initialValue:'calc(100vh - 10px) 30px' is valid]
expected: FAIL
[syntax:'<length>', initialValue:'10vmin' is valid]
expected: FAIL
[syntax:'<custom-ident>+', initialValue:'foo revert-layer bar' is invalid]
expected: FAIL
@ -527,107 +143,20 @@
[syntax:'<custom-ident>', initialValue:'revert-layer' is invalid]
expected: FAIL
[syntax:'revert-layer', initialValue:'revert-layer' is invalid]
expected: FAIL
[syntax:'*', initialValue:'default' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1% 1%' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1px 1%' is invalid]
expected: FAIL
[syntax:'<transform-list> | <transform-function># ', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<color># | yellow', initialValue:'yellow, blue' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1 1%' is invalid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1% 1' is invalid]
expected: FAIL
[syntax:'<transform-list> | <transform-function># ', initialValue:'scale(2), rotate(90deg)' is valid]
expected: FAIL
[syntax:'<color># | <color>+', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1 1' is valid]
expected: FAIL
[syntax:'<transform-function> | <transform-list>', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<color>+ | yellow', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1% 1px' is invalid]
expected: FAIL
[syntax:'<color>+ | <color>', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'yellow', initialValue:'yellow' is valid]
expected: FAIL
[syntax:'<transform-list> | <transform-function>+ ', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<transform-function>+ | <transform-list>', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1%' is valid]
expected: FAIL
[syntax:'<color> | <color>#', initialValue:'yellow, blue' is valid]
expected: FAIL
[syntax:'yellow | <color>+', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1 1px' is invalid]
expected: FAIL
[syntax:'<color>+', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'<transform-function># | <transform-list>', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1px' is valid]
expected: FAIL
[syntax:'<color>+ | <color>#', initialValue:'yellow, blue' is valid]
expected: FAIL
[syntax:'yellow | <color>#', initialValue:'yellow, blue' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1px 1px' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1' is valid]
expected: FAIL
[syntax:'<transform-list> | <transform-function> ', initialValue:'scale(2) rotate(90deg)' is valid]
expected: FAIL
[syntax:'<color># | <color>', initialValue:'yellow, blue' is valid]
expected: FAIL
[syntax:'<transform-function># | <transform-list>', initialValue:'scale(2), rotate(90deg)' is valid]
expected: FAIL
[syntax:'<integer>+ | <percentage>+ | <length>+ ', initialValue:'1px 1' is invalid]
expected: FAIL
[syntax:'<color> | <color>+', initialValue:'yellow blue' is valid]
expected: FAIL
[syntax:'<number>', initialValue:'calc(1 / 2)' is valid]
expected: FAIL

Просмотреть файл

@ -1,16 +1,3 @@
[register-property.html]
[registerProperty requires a name matching <custom-property-name>]
expected: FAIL
[registerProperty fails for an already registered property]
expected: FAIL
[registerProperty only allows omitting initialValue if syntax is '*']
expected: FAIL
[registerProperty requires inherits]
expected: FAIL
[Registering a property should not cause a transition]
expected: FAIL

Просмотреть файл

@ -19,6 +19,3 @@
[Calc expressions are resolved before inheritance]
expected: FAIL
[Explicitly inheriting from a parent with a value results in that value.]
expected: FAIL

Просмотреть файл

@ -20,39 +20,21 @@
[<integer>+ values are computed correctly [15 calc(2.4) calc(2.6)\]]
expected: FAIL
[<integer> values are computed correctly [15\]]
expected: FAIL
[* values are computed correctly [50dpi\]]
expected: FAIL
[<color> values are computed correctly [#badbee33\]]
expected: FAIL
[<time> values are computed correctly [calc(1000ms + 1s)\]]
expected: FAIL
[<transform-function>+ values are computed correctly [translateX(10%) scale(2)\]]
expected: FAIL
[<length-percentage># values are computed correctly [3% , 10vmax , 22px\]]
expected: FAIL
[tomato | plum values are computed correctly [plum\]]
expected: FAIL
[<color> values are computed correctly [currentcolor\]]
expected: FAIL
[<resolution> values are computed correctly [96dpi\]]
expected: FAIL
[<length> values computed are correctly via var()-reference when font-size is inherited]
expected: FAIL
[* values are computed correctly [-50grad\]]
expected: FAIL
[<length># values are computed correctly [8em\]]
expected: FAIL
@ -62,9 +44,6 @@
[<time> values are computed correctly [1000ms\]]
expected: FAIL
[<transform-function> values are computed correctly [translateX(2px)\]]
expected: FAIL
[<length>+ values are computed correctly [4em 9px\]]
expected: FAIL
@ -92,9 +71,6 @@
[<length> values are computed correctly [15vmin\]]
expected: FAIL
[tomato | plum | <color> values are computed correctly [plum\]]
expected: FAIL
[<length-percentage> values are computed correctly [calc(19em - 2%)\]]
expected: FAIL
@ -104,18 +80,12 @@
[<integer> values are computed correctly [calc(2.6)\]]
expected: FAIL
[<length-percentage> values are computed correctly [18%\]]
expected: FAIL
[<transform-function> values are computed correctly [translateX(calc(11em + 10%))\]]
expected: FAIL
[<length> values computed are correctly via var()-reference]
expected: FAIL
[* values are computed correctly [50s\]]
expected: FAIL
[<length> values are computed correctly when font-size is inherited [14em\]]
expected: FAIL
@ -125,15 +95,6 @@
[<color> values are computed correctly [#00000a\]]
expected: FAIL
[<angle> values are computed correctly [180deg\]]
expected: FAIL
[<resolution> values are computed correctly [1dppx\]]
expected: FAIL
[<time> values are computed correctly [1s\]]
expected: FAIL
[<length> values are computed correctly [calc(16px - 7em + 10vh)\]]
expected: FAIL
@ -143,21 +104,12 @@
[<length># values are computed correctly [4em ,9px\]]
expected: FAIL
[<length-percentage># values are computed correctly [calc(13% + 37px)\]]
expected: FAIL
[<length> values are computed correctly [12px\]]
expected: FAIL
[<length-percentage> values are computed correctly [17em\]]
expected: FAIL
[<transform-function> values are computed correctly [translateX(10em)\]]
expected: FAIL
[* values are computed correctly [tomato\]]
expected: FAIL
[<integer> values are computed correctly [calc(2.6 + 3.1)\]]
expected: FAIL
@ -182,15 +134,9 @@
[<length> values are computed correctly [10lh\]]
expected: FAIL
[* values are computed correctly [url(why)\]]
expected: FAIL
[<number> values are computed correctly [calc(24 / 10)\]]
expected: FAIL
[<number> values are computed correctly [15\]]
expected: FAIL
[<number>+ values are computed correctly [15 calc(15 + 15) calc(24 / 10)\]]
expected: FAIL

Просмотреть файл

@ -1,7 +1,4 @@
[registered-property-cssom.html]
[CSS.registerProperty]
expected: FAIL
[Formerly valid values are still readable from inline styles but are computed as the unset value]
expected: FAIL

Просмотреть файл

@ -1,2 +1,9 @@
[registered-property-revert.html]
expected: ERROR
[Non-inherited registered custom property can be reverted]
expected: FAIL
[Non-inherited registered custom property can be reverted in animation]
expected: FAIL
[Inherited registered custom property can be reverted in animation]
expected: FAIL

Просмотреть файл

@ -1,7 +1,3 @@
[self-utils.html]
[Default initial values of generated properties are valid (self-test).]
expected: FAIL
[Generated properties respect inherits flag]
expected: FAIL

Просмотреть файл

@ -1,2 +1,48 @@
[url-resolution.html]
expected: ERROR
[Registered non-inherited <url> resolves against sheet (URL token)]
expected: FAIL
[Registered non-inherited <url> resolves against sheet (URL function)]
expected: FAIL
[Registered inherited <url> resolves against sheet (URL token)]
expected: FAIL
[Registered inherited <url> resolves against sheet (URL function)]
expected: FAIL
[Registered inherited <url> resolves against sheet (Child node, URL token)]
expected: FAIL
[Registered inherited <url> resolves against sheet (Child node, URL function)]
expected: FAIL
[Registered property with unregistered var reference resolves against sheet (URL token)]
expected: FAIL
[Registered property with unregistered var reference resolves against sheet. (URL function)]
expected: FAIL
[Registered property with registered var reference resolves against sheet of referenced property (URL token)]
expected: FAIL
[Registered property with registered var reference resolves against sheet of referenced property (URL function)]
expected: FAIL
[Unregistered property with registered var reference resolves against sheet of referenced property (URL token)]
expected: FAIL
[Unregistered property with registered var reference resolves against sheet of referenced property (URL function)]
expected: FAIL
[Multiple (registered) var reference resolve against respective sheets (URL token)]
expected: FAIL
[Multiple (registered) var reference resolve against respective sheets (URL function)]
expected: FAIL
[Registered UTF16BE-encoded var reference resolve against sheet (URL token)]
expected: FAIL
[Registered UTF16BE-encoded var reference resolve against sheet (URL function)]
expected: FAIL

Просмотреть файл

@ -7,10 +7,3 @@
[A var() cycle between a two unregistered properties is handled correctly.]
expected: FAIL
[A var() cycle between a syntax:'*' property and an unregistered property is handled correctly.]
expected: FAIL
[Custom properties with universal syntax become guaranteed-invalid when invalid at computed-value time]
expected: FAIL

Просмотреть файл

@ -2,15 +2,6 @@
[var() references work with registered properties]
expected: FAIL
[Registered lists may be concatenated]
expected: FAIL
[References to mixed registered and unregistered var()-properties work in registered lists]
expected: FAIL
[References to registered var()-properties work in registered lists]
expected: FAIL
[Calc expressions are resolved when substituting]
expected: FAIL
@ -20,18 +11,9 @@
[Lists with relative units are absolutized when substituting]
expected: FAIL
[Valid fallback does not invalidate var()-reference [<length> | <color>, red\]]
expected: FAIL
[Valid fallback does not invalidate var()-reference [<length>, 10px\]]
expected: FAIL
[Invalid fallback invalidates var()-reference [<length>, red\]]
expected: FAIL
[Valid fallback does not invalidate var()-reference [<length> | none, none\]]
expected: FAIL
[Invalid fallback invalidates var()-reference [<length>, var(--novar)\]]
expected: FAIL
@ -40,4 +22,3 @@
[Values are absolutized when substituting into properties with universal syntax]
expected: FAIL