From 18c5efd3671199f81e009aa19335bf8b974b651f Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Mon, 22 May 2023 19:11:30 +0000 Subject: [PATCH] Bug 1833540 - [css-properties-values-api] Implement parsing and serialization for @property at-rule r=emilio Implemented behind the new properties-and-values pref. Support for the CSSPropertyRule WebIDL interface is also added in this patch, because until it's added, any attempt to access the rule using the CSSOM would crash the browser. Depends on D178268 Differential Revision: https://phabricator.services.mozilla.com/D178270 --- .../en-US/chrome/layout/css.properties | 7 + dom/webidl/CSSPropertyRule.webidl | 17 ++ dom/webidl/moz.build | 1 + layout/inspector/ServoStyleRuleMap.cpp | 2 + layout/style/CSSPropertyRule.cpp | 72 +++++ layout/style/CSSPropertyRule.h | 61 +++++ layout/style/ServoBindings.h | 1 + layout/style/ServoCSSRuleList.cpp | 3 + layout/style/ServoLockedArcTypeList.h | 1 + layout/style/ServoStyleConstsInlines.h | 1 + layout/style/ServoStyleSet.cpp | 2 + layout/style/moz.build | 2 + modules/libpref/init/StaticPrefList.yaml | 7 + servo/components/style/error_reporting.rs | 10 + servo/components/style/gecko/arc_types.rs | 8 +- .../style/invalidation/stylesheets.rs | 7 +- .../style/properties_and_values/mod.rs | 1 + .../style/properties_and_values/rule.rs | 245 ++++++++++++++++++ servo/components/style/stylesheets/mod.rs | 15 ++ .../style/stylesheets/property_rule.rs | 5 + .../style/stylesheets/rule_parser.rs | 18 +- .../style/stylesheets/rules_iterator.rs | 1 + .../style/stylesheets/stylesheet.rs | 1 + servo/components/style/stylist.rs | 2 + servo/components/style_traits/lib.rs | 2 + servo/ports/geckolib/error_reporter.rs | 30 ++- servo/ports/geckolib/glue.rs | 50 +++- .../css/css-properties-values-api/__dir__.ini | 1 + .../at-property-cssom.html.ini | 183 ------------- .../at-property.html.ini | 72 ----- .../idlharness.html.ini | 30 --- .../at-property.html | 16 +- 32 files changed, 581 insertions(+), 293 deletions(-) create mode 100644 dom/webidl/CSSPropertyRule.webidl create mode 100644 layout/style/CSSPropertyRule.cpp create mode 100644 layout/style/CSSPropertyRule.h create mode 100644 servo/components/style/properties_and_values/rule.rs create mode 100644 servo/components/style/stylesheets/property_rule.rs diff --git a/dom/locales/en-US/chrome/layout/css.properties b/dom/locales/en-US/chrome/layout/css.properties index 1d84889a513f..e9ec13286821 100644 --- a/dom/locales/en-US/chrome/layout/css.properties +++ b/dom/locales/en-US/chrome/layout/css.properties @@ -8,6 +8,13 @@ MimeNotCssWarn=The stylesheet %1$S was loaded as CSS even though its MIME type, PEDeclDropped=Declaration dropped. PEDeclSkipped=Skipped to next declaration. PEUnknownProperty=Unknown property ‘%1$S’. +PEPRSyntaxFieldEmptyInput=@property syntax descriptor is empty. +PEPRSyntaxFieldExpectedPipe=@property syntax descriptor ‘%S’ contains components without a pipe between them. +PEPRSyntaxFieldInvalidNameStart=@property syntax descriptor ‘%S’ contains a component name that starts with an invalid character. +PEPRSyntaxFieldInvalidName=@property syntax descriptor ‘%S’ contains a component name with an invalid character. +PEPRSyntaxFieldUnclosedDataTypeName=@property syntax descriptor ‘%S’ contains an unclosed data type name. +PEPRSyntaxFieldUnexpectedEOF=@property syntax descriptor ‘%S’ is incomplete. +PEPRSyntaxFieldUnknownDataTypeName=@property syntax descriptor ‘%S’ contains an unknown data type name. PEValueParsingError=Error in parsing value for ‘%1$S’. PEUnknownAtRule=Unrecognized at-rule or error parsing at-rule ‘%1$S’. PEMQUnexpectedOperator=Unexpected operator in media list. diff --git a/dom/webidl/CSSPropertyRule.webidl b/dom/webidl/CSSPropertyRule.webidl new file mode 100644 index 000000000000..20b03a738b22 --- /dev/null +++ b/dom/webidl/CSSPropertyRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.css-houdini.org/css-properties-values-api-1/#the-css-property-rule-interface + */ + +// https://drafts.css-houdini.org/css-properties-values-api-1/#the-css-property-rule-interface +[Exposed=Window, Pref="layout.css.properties-and-values.enabled"] +interface CSSPropertyRule : CSSRule { + readonly attribute UTF8String name; + readonly attribute UTF8String syntax; + readonly attribute boolean inherits; + readonly attribute UTF8String? initialValue; +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 52b0e0892420..f30cadabbbb9 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -492,6 +492,7 @@ WEBIDL_FILES = [ "CSSMozDocumentRule.webidl", "CSSNamespaceRule.webidl", "CSSPageRule.webidl", + "CSSPropertyRule.webidl", "CSSPseudoElement.webidl", "CSSRule.webidl", "CSSRuleList.webidl", diff --git a/layout/inspector/ServoStyleRuleMap.cpp b/layout/inspector/ServoStyleRuleMap.cpp index 178bfd1ef7aa..81463432a792 100644 --- a/layout/inspector/ServoStyleRuleMap.cpp +++ b/layout/inspector/ServoStyleRuleMap.cpp @@ -98,6 +98,7 @@ void ServoStyleRuleMap::RuleRemoved(StyleSheet& aStyleSheet, case StyleCssRuleType::LayerStatement: case StyleCssRuleType::FontFace: case StyleCssRuleType::Page: + case StyleCssRuleType::Property: case StyleCssRuleType::Keyframes: case StyleCssRuleType::Keyframe: case StyleCssRuleType::Namespace: @@ -144,6 +145,7 @@ void ServoStyleRuleMap::FillTableFromRule(css::Rule& aRule) { case StyleCssRuleType::LayerStatement: case StyleCssRuleType::FontFace: case StyleCssRuleType::Page: + case StyleCssRuleType::Property: case StyleCssRuleType::Keyframes: case StyleCssRuleType::Keyframe: case StyleCssRuleType::Namespace: diff --git a/layout/style/CSSPropertyRule.cpp b/layout/style/CSSPropertyRule.cpp new file mode 100644 index 000000000000..9538b59b1321 --- /dev/null +++ b/layout/style/CSSPropertyRule.cpp @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/dom/CSSPropertyRule.h" +#include "mozilla/dom/CSSPropertyRuleBinding.h" +#include "mozilla/ServoBindings.h" + +namespace mozilla::dom { + +bool CSSPropertyRule::IsCCLeaf() const { return Rule::IsCCLeaf(); } + +void CSSPropertyRule::SetRawAfterClone(RefPtr aRaw) { + mRawRule = std::move(aRaw); +} + +/* virtual */ +JSObject* CSSPropertyRule::WrapObject(JSContext* aCx, + JS::Handle aGivenProto) { + return CSSPropertyRule_Binding::Wrap(aCx, this, aGivenProto); +} + +#ifdef DEBUG +void CSSPropertyRule::List(FILE* out, int32_t aIndent) const { + nsAutoCString str; + for (int32_t i = 0; i < aIndent; i++) { + str.AppendLiteral(" "); + } + Servo_PropertyRule_Debug(mRawRule, &str); + fprintf_stderr(out, "%s\n", str.get()); +} +#endif + +size_t CSSPropertyRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { + // TODO Implement this! + return aMallocSizeOf(this); +} + +StyleCssRuleType CSSPropertyRule::Type() const { + return StyleCssRuleType::Property; +} + +/* CSSRule implementation */ + +void CSSPropertyRule::GetCssText(nsACString& aCssText) const { + Servo_PropertyRule_GetCssText(mRawRule, &aCssText); +} + +/* CSSPropertyRule implementation */ + +void CSSPropertyRule::GetName(nsACString& aNameStr) const { + Servo_PropertyRule_GetName(mRawRule, &aNameStr); +} + +void CSSPropertyRule::GetSyntax(nsACString& aSyntaxStr) const { + Servo_PropertyRule_GetSyntax(mRawRule, &aSyntaxStr); +} + +bool CSSPropertyRule::Inherits() const { + return Servo_PropertyRule_GetInherits(mRawRule); +} + +void CSSPropertyRule::GetInitialValue(nsACString& aInitialValueStr) const { + bool found = Servo_PropertyRule_GetInitialValue(mRawRule, &aInitialValueStr); + if (!found) { + aInitialValueStr.SetIsVoid(true); + } +} + +} // namespace mozilla::dom diff --git a/layout/style/CSSPropertyRule.h b/layout/style/CSSPropertyRule.h new file mode 100644 index 000000000000..03d8bec1da78 --- /dev/null +++ b/layout/style/CSSPropertyRule.h @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_CSSPropertyRule_h +#define mozilla_dom_CSSPropertyRule_h + +#include "mozilla/css/Rule.h" +#include "mozilla/ServoBindingTypes.h" + +#include "nsICSSDeclaration.h" + +struct StyleLockedPropertyRule; + +namespace mozilla::dom { + +class CSSPropertyRule final : public css::Rule { + public: + CSSPropertyRule(already_AddRefed aRawRule, + StyleSheet* aSheet, css::Rule* aParentRule, uint32_t aLine, + uint32_t aColumn) + : css::Rule(aSheet, aParentRule, aLine, aColumn), + mRawRule(std::move(aRawRule)) {} + + bool IsCCLeaf() const final; + + StyleLockedPropertyRule* Raw() const { return mRawRule; } + void SetRawAfterClone(RefPtr aRaw); + + JSObject* WrapObject(JSContext* aCx, JS::Handle aGivenProto) final; + +#ifdef DEBUG + void List(FILE* out = stdout, int32_t aIndent = 0) const final; +#endif + + size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final; + + // WebIDL interfaces + StyleCssRuleType Type() const final; + + void GetName(nsACString& aName) const; + + void GetSyntax(nsACString& aSyntax) const; + + bool Inherits() const; + + void GetInitialValue(nsACString& aInitialValueStr) const; + + void GetCssText(nsACString& aCssText) const final; + + private: + ~CSSPropertyRule() = default; + + RefPtr mRawRule; +}; + +} // namespace mozilla::dom + +#endif // mozilla_dom_CSSPropertyRule_h diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 0cecb69d4499..88b1f50d6461 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -63,6 +63,7 @@ GROUP_RULE_FUNCS(Media) GROUP_RULE_FUNCS(Document) BASIC_RULE_FUNCS(Namespace) BASIC_RULE_FUNCS(Page) +BASIC_RULE_FUNCS(Property) GROUP_RULE_FUNCS(Supports) GROUP_RULE_FUNCS(LayerBlock) BASIC_RULE_FUNCS(LayerStatement) diff --git a/layout/style/ServoCSSRuleList.cpp b/layout/style/ServoCSSRuleList.cpp index f40b9bccca75..9e458c60362b 100644 --- a/layout/style/ServoCSSRuleList.cpp +++ b/layout/style/ServoCSSRuleList.cpp @@ -21,6 +21,7 @@ #include "mozilla/dom/CSSMozDocumentRule.h" #include "mozilla/dom/CSSNamespaceRule.h" #include "mozilla/dom/CSSPageRule.h" +#include "mozilla/dom/CSSPropertyRule.h" #include "mozilla/dom/CSSStyleRule.h" #include "mozilla/dom/CSSSupportsRule.h" #include "mozilla/IntegerRange.h" @@ -83,6 +84,7 @@ css::Rule* ServoCSSRuleList::GetRule(uint32_t aIndex) { CASE_RULE(Media, Media) CASE_RULE(Namespace, Namespace) CASE_RULE(Page, Page) + CASE_RULE(Property, Property) CASE_RULE(Supports, Supports) CASE_RULE(Document, MozDocument) CASE_RULE(Import, Import) @@ -253,6 +255,7 @@ void ServoCSSRuleList::SetRawContents(RefPtr aNewRules, CASE_FOR(Media, Media) CASE_FOR(Namespace, Namespace) CASE_FOR(Page, Page) + CASE_FOR(Property, Property) CASE_FOR(Supports, Supports) CASE_FOR(Document, MozDocument) CASE_FOR(Import, Import) diff --git a/layout/style/ServoLockedArcTypeList.h b/layout/style/ServoLockedArcTypeList.h index 57c55c0a2f7b..d6f829b28497 100644 --- a/layout/style/ServoLockedArcTypeList.h +++ b/layout/style/ServoLockedArcTypeList.h @@ -27,6 +27,7 @@ SERVO_LOCKED_ARC_TYPE(NamespaceRule) SERVO_LOCKED_ARC_TYPE(SupportsRule) SERVO_LOCKED_ARC_TYPE(DocumentRule) SERVO_LOCKED_ARC_TYPE(PageRule) +SERVO_LOCKED_ARC_TYPE(PropertyRule) SERVO_LOCKED_ARC_TYPE(ContainerRule) SERVO_LOCKED_ARC_TYPE(FontFeatureValuesRule) SERVO_LOCKED_ARC_TYPE(FontPaletteValuesRule) diff --git a/layout/style/ServoStyleConstsInlines.h b/layout/style/ServoStyleConstsInlines.h index cc91476bb3ca..31ce73aedcd0 100644 --- a/layout/style/ServoStyleConstsInlines.h +++ b/layout/style/ServoStyleConstsInlines.h @@ -46,6 +46,7 @@ template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; +template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; template struct StyleStrong; diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index c8c4abf43c08..88d67f8049a6 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -39,6 +39,7 @@ #include "mozilla/dom/CSSKeyframeRule.h" #include "mozilla/dom/CSSNamespaceRule.h" #include "mozilla/dom/CSSPageRule.h" +#include "mozilla/dom/CSSPropertyRule.h" #include "mozilla/dom/CSSSupportsRule.h" #include "mozilla/dom/FontFaceSet.h" #include "mozilla/dom/Element.h" @@ -1014,6 +1015,7 @@ void ServoStyleSet::RuleChangedInternal(StyleSheet& aSheet, css::Rule& aRule, CASE_FOR(FontPaletteValues, FontPaletteValues) CASE_FOR(FontFace, FontFace) CASE_FOR(Page, Page) + CASE_FOR(Property, Property) CASE_FOR(Document, MozDocument) CASE_FOR(Supports, Supports) CASE_FOR(LayerBlock, LayerBlock) diff --git a/layout/style/moz.build b/layout/style/moz.build index f7b7909f402f..0afe3f5d0c49 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -135,6 +135,7 @@ EXPORTS.mozilla.dom += [ "CSSMozDocumentRule.h", "CSSNamespaceRule.h", "CSSPageRule.h", + "CSSPropertyRule.h", "CSSRuleList.h", "CSSStyleRule.h", "CSSSupportsRule.h", @@ -185,6 +186,7 @@ UNIFIED_SOURCES += [ "CSSMozDocumentRule.cpp", "CSSNamespaceRule.cpp", "CSSPageRule.cpp", + "CSSPropertyRule.cpp", "CSSRuleList.cpp", "CSSStyleRule.cpp", "CSSSupportsRule.cpp", diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 621aebb67ec5..4f6f04399052 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -8791,6 +8791,13 @@ value: @IS_EARLY_BETA_OR_EARLIER@ mirror: always +# Whether Properties and Values is enabled +- name: layout.css.properties-and-values.enabled + type: RelaxedAtomicBool + value: false + mirror: always + rust: true + # Dictates whether or not the prefers contrast media query will be # usable. # true: prefers-contrast will toggle based on OS and browser settings. diff --git a/servo/components/style/error_reporting.rs b/servo/components/style/error_reporting.rs index 042838f33946..258c7c44ef44 100644 --- a/servo/components/style/error_reporting.rs +++ b/servo/components/style/error_reporting.rs @@ -22,6 +22,8 @@ pub enum ContextualParseError<'a> { ParseError<'a>, Option<&'a SelectorList>, ), + /// A property descriptor was not recognized. + UnsupportedPropertyDescriptor(&'a str, ParseError<'a>), /// A font face descriptor was not recognized. UnsupportedFontFaceDescriptor(&'a str, ParseError<'a>), /// A font feature values descriptor was not recognized. @@ -135,6 +137,14 @@ impl<'a> fmt::Display for ContextualParseError<'a> { write!(f, "Unsupported property declaration: '{}', ", decl)?; parse_error_to_str(err, f) }, + ContextualParseError::UnsupportedPropertyDescriptor(decl, ref err) => { + write!( + f, + "Unsupported @property descriptor declaration: '{}', ", + decl + )?; + parse_error_to_str(err, f) + }, ContextualParseError::UnsupportedFontFaceDescriptor(decl, ref err) => { write!( f, diff --git a/servo/components/style/gecko/arc_types.rs b/servo/components/style/gecko/arc_types.rs index b2835abdfd05..707266d2bec1 100644 --- a/servo/components/style/gecko/arc_types.rs +++ b/servo/components/style/gecko/arc_types.rs @@ -16,7 +16,7 @@ use crate::stylesheets::keyframes_rule::Keyframe; use crate::stylesheets::{ ContainerRule, CounterStyleRule, CssRules, DocumentRule, FontFaceRule, FontFeatureValuesRule, FontPaletteValuesRule, ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule, - MediaRule, NamespaceRule, PageRule, StyleRule, StylesheetContents, SupportsRule, + MediaRule, NamespaceRule, PageRule, PropertyRule, StyleRule, StylesheetContents, SupportsRule, }; use servo_arc::Arc; @@ -114,6 +114,12 @@ impl_locked_arc_ffi!( Servo_PageRule_AddRef, Servo_PageRule_Release ); +impl_locked_arc_ffi!( + PropertyRule, + LockedPropertyRule, + Servo_PropertyRule_AddRef, + Servo_PropertyRule_Release +); impl_locked_arc_ffi!( SupportsRule, LockedSupportsRule, diff --git a/servo/components/style/invalidation/stylesheets.rs b/servo/components/style/invalidation/stylesheets.rs index f18fe7942c5e..5fc8ec4b7640 100644 --- a/servo/components/style/invalidation/stylesheets.rs +++ b/servo/components/style/invalidation/stylesheets.rs @@ -550,6 +550,7 @@ impl StylesheetInvalidationSet { }, CounterStyle(..) | Page(..) | + Property(..) | Viewport(..) | FontFeatureValues(..) | FontPaletteValues(..) | @@ -633,7 +634,11 @@ impl StylesheetInvalidationSet { // existing elements. } }, - CounterStyle(..) | Page(..) | Viewport(..) | FontFeatureValues(..) | + CounterStyle(..) | + Page(..) | + Property(..) | + Viewport(..) | + FontFeatureValues(..) | FontPaletteValues(..) => { debug!( " > Found unsupported rule, marking the whole subtree \ diff --git a/servo/components/style/properties_and_values/mod.rs b/servo/components/style/properties_and_values/mod.rs index 3590d1279cc3..00f7ac98f75b 100644 --- a/servo/components/style/properties_and_values/mod.rs +++ b/servo/components/style/properties_and_values/mod.rs @@ -6,4 +6,5 @@ //! //! https://drafts.css-houdini.org/css-properties-values-api-1/ +pub mod rule; pub mod syntax; diff --git a/servo/components/style/properties_and_values/rule.rs b/servo/components/style/properties_and_values/rule.rs new file mode 100644 index 000000000000..3392e68124b0 --- /dev/null +++ b/servo/components/style/properties_and_values/rule.rs @@ -0,0 +1,245 @@ +/* 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/. */ + +//! The [`@property`] at-rule. +//! +//! https://drafts.css-houdini.org/css-properties-values-api-1/#at-property-rule + +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::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard}; +use crate::str::CssStringWriter; +use crate::values::serialize_atom_name; +use cssparser::{ + AtRuleParser, CowRcStr, DeclarationParser, ParseErrorKind, Parser, QualifiedRuleParser, + RuleBodyItemParser, RuleBodyParser, SourceLocation, +}; +use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; +use selectors::parser::SelectorParseErrorKind; +use servo_arc::Arc; +use std::fmt::{self, Write}; +use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; +use to_shmem::{SharedMemoryBuilder, ToShmem}; + +/// Parse the block inside a `@property` rule. +/// +/// Valid `@property` rules result in a registered custom property, as if `registerProperty()` had +/// been called with equivalent parameters. +pub fn parse_property_block( + context: &ParserContext, + input: &mut Parser, + name: PropertyRuleName, + location: SourceLocation, +) -> PropertyRuleData { + let mut rule = PropertyRuleData::empty(name, location); + let mut parser = PropertyRuleParser { + context, + rule: &mut rule, + }; + let mut iter = RuleBodyParser::new(input, &mut parser); + while let Some(declaration) = iter.next() { + if !context.error_reporting_enabled() { + continue; + } + if let Err((error, slice)) = declaration { + let location = error.location; + let error = if matches!( + error.kind, + ParseErrorKind::Custom(StyleParseErrorKind::PropertySyntaxField(_)) + ) { + ContextualParseError::UnsupportedValue(slice, error) + } else { + ContextualParseError::UnsupportedPropertyDescriptor(slice, error) + }; + context.log_css_error(location, error); + } + } + rule +} + +struct PropertyRuleParser<'a, 'b: 'a> { + context: &'a ParserContext<'b>, + rule: &'a mut PropertyRuleData, +} + +/// Default methods reject all at rules. +impl<'a, 'b, 'i> AtRuleParser<'i> for PropertyRuleParser<'a, 'b> { + type Prelude = (); + type AtRule = (); + type Error = StyleParseErrorKind<'i>; +} + +impl<'a, 'b, 'i> QualifiedRuleParser<'i> for PropertyRuleParser<'a, 'b> { + type Prelude = (); + type QualifiedRule = (); + type Error = StyleParseErrorKind<'i>; +} + +impl<'a, 'b, 'i> RuleBodyItemParser<'i, (), StyleParseErrorKind<'i>> + for PropertyRuleParser<'a, 'b> +{ + fn parse_qualified(&self) -> bool { + false + } + fn parse_declarations(&self) -> bool { + true + } +} + +macro_rules! property_descriptors { + ( + $( #[$doc: meta] $name: tt $ident: ident: $ty: ty, )* + ) => { + /// Data inside a `@property` rule. + /// + /// + #[derive(Clone, Debug, PartialEq)] + pub struct PropertyRuleData { + /// The custom property name. + pub name: PropertyRuleName, + + $( + #[$doc] + pub $ident: Option<$ty>, + )* + + /// Line and column of the @property rule source code. + pub source_location: SourceLocation, + } + + impl PropertyRuleData { + /// Create an empty property rule + pub fn empty(name: PropertyRuleName, source_location: SourceLocation) -> Self { + PropertyRuleData { + name, + $( + $ident: None, + )* + source_location, + } + } + + /// Serialization of declarations in PropertyRuleData + pub fn decl_to_css(&self, dest: &mut CssStringWriter) -> fmt::Result { + $( + if let Some(ref value) = self.$ident { + dest.write_str(concat!($name, ": "))?; + value.to_css(&mut CssWriter::new(dest))?; + dest.write_str("; ")?; + } + )* + Ok(()) + } + } + + impl<'a, 'b, 'i> DeclarationParser<'i> for PropertyRuleParser<'a, 'b> { + type Declaration = (); + type Error = StyleParseErrorKind<'i>; + + fn parse_value<'t>( + &mut self, + name: CowRcStr<'i>, + input: &mut Parser<'i, 't>, + ) -> Result<(), ParseError<'i>> { + match_ignore_ascii_case! { &*name, + $( + $name => { + // DeclarationParser also calls parse_entirely so we’d normally not need + // to, but in this case we do because we set the value as a side effect + // rather than returning it. + let value = input.parse_entirely(|i| Parse::parse(self.context, i))?; + self.rule.$ident = Some(value) + }, + )* + _ => return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone()))), + } + Ok(()) + } + } + } +} + +#[cfg(feature = "gecko")] +property_descriptors! { + /// + "syntax" syntax: SyntaxDescriptor, + + /// + "inherits" inherits: Inherits, + + /// + "initial-value" initial_value: InitialValue, +} + +impl PropertyRuleData { + /// Measure heap usage. + #[cfg(feature = "gecko")] + pub fn size_of(&self, _guard: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize { + self.name.0.size_of(ops) + + self.syntax.size_of(ops) + + self.inherits.size_of(ops) + + if let Some(ref initial_value) = self.initial_value { + initial_value.size_of(ops) + } else { + 0 + } + } +} + +impl ToCssWithGuard for PropertyRuleData { + /// + fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result { + dest.write_str("@property ")?; + self.name.to_css(&mut CssWriter::new(dest))?; + dest.write_str(" { ")?; + self.decl_to_css(dest)?; + dest.write_char('}') + } +} + +impl ToShmem for PropertyRuleData { + fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> to_shmem::Result { + Err(String::from( + "ToShmem failed for PropertyRule: cannot handle @property rules", + )) + } +} + +/// A custom property name wrapper that includes the `--` prefix in its serialization +#[derive(Clone, Debug, PartialEq)] +pub struct PropertyRuleName(pub Arc); + +impl ToCss for PropertyRuleName { + fn to_css(&self, dest: &mut CssWriter) -> fmt::Result { + dest.write_str("--")?; + serialize_atom_name(&self.0, dest) + } +} + +/// +#[derive(Clone, Debug, MallocSizeOf, Parse, PartialEq, ToCss)] +pub enum Inherits { + /// `true` value for the `inherits` descriptor + True, + /// `false` value for the `inherits` descriptor + False, +} + +/// Specifies the initial value of the custom property registration represented by the @property +/// rule, controlling the property’s initial value. +/// +/// The SpecifiedValue is wrapped in an Arc to avoid copying when using it. +pub type InitialValue = Arc; + +impl Parse for InitialValue { + fn parse<'i, 't>( + _context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { + input.skip_whitespace(); + SpecifiedValue::parse(input) + } +} diff --git a/servo/components/style/stylesheets/mod.rs b/servo/components/style/stylesheets/mod.rs index 4c6027219baf..c5d2ec8b8e87 100644 --- a/servo/components/style/stylesheets/mod.rs +++ b/servo/components/style/stylesheets/mod.rs @@ -19,6 +19,7 @@ mod media_rule; mod namespace_rule; pub mod origin; mod page_rule; +mod property_rule; mod rule_list; mod rule_parser; mod rules_iterator; @@ -61,6 +62,7 @@ pub use self::media_rule::MediaRule; pub use self::namespace_rule::NamespaceRule; pub use self::origin::{Origin, OriginSet, OriginSetIterator, PerOrigin, PerOriginIter}; pub use self::page_rule::{PageRule, PageSelector, PageSelectors}; +pub use self::property_rule::PropertyRule; pub use self::rule_list::{CssRules, CssRulesHelpers}; pub use self::rule_parser::{InsertRuleContext, State, TopLevelRuleParser}; pub use self::rules_iterator::{AllRules, EffectiveRules}; @@ -261,6 +263,7 @@ pub enum CssRule { Keyframes(Arc>), Supports(Arc>), Page(Arc>), + Property(Arc>), Document(Arc>), LayerBlock(Arc>), LayerStatement(Arc>), @@ -306,6 +309,10 @@ impl CssRule { lock.unconditional_shallow_size_of(ops) + lock.read_with(guard).size_of(guard, ops) }, + CssRule::Property(ref lock) => { + lock.unconditional_shallow_size_of(ops) + lock.read_with(guard).size_of(guard, ops) + }, + CssRule::Document(ref lock) => { lock.unconditional_shallow_size_of(ops) + lock.read_with(guard).size_of(guard, ops) }, @@ -350,6 +357,8 @@ pub enum CssRuleType { LayerStatement = 17, Container = 18, FontPaletteValues = 19, + // 20 is an arbitrary number to use for Property. + Property = 20, } impl CssRuleType { @@ -413,6 +422,7 @@ impl CssRule { CssRule::Viewport(_) => CssRuleType::Viewport, CssRule::Supports(_) => CssRuleType::Supports, CssRule::Page(_) => CssRuleType::Page, + CssRule::Property(_) => CssRuleType::Property, CssRule::Document(_) => CssRuleType::Document, CssRule::LayerBlock(_) => CssRuleType::LayerBlock, CssRule::LayerStatement(_) => CssRuleType::LayerStatement, @@ -545,6 +555,10 @@ impl DeepCloneWithLock for CssRule { lock.wrap(rule.deep_clone_with_lock(lock, guard, params)), )) }, + CssRule::Property(ref arc) => { + let rule = arc.read_with(guard); + CssRule::Property(Arc::new(lock.wrap(rule.clone()))) + }, CssRule::Document(ref arc) => { let rule = arc.read_with(guard); CssRule::Document(Arc::new( @@ -583,6 +597,7 @@ impl ToCssWithGuard for CssRule { CssRule::Media(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Supports(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Page(ref lock) => lock.read_with(guard).to_css(guard, dest), + CssRule::Property(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::Document(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::LayerBlock(ref lock) => lock.read_with(guard).to_css(guard, dest), CssRule::LayerStatement(ref lock) => lock.read_with(guard).to_css(guard, dest), diff --git a/servo/components/style/stylesheets/property_rule.rs b/servo/components/style/stylesheets/property_rule.rs new file mode 100644 index 000000000000..1d1c1c982e9f --- /dev/null +++ b/servo/components/style/stylesheets/property_rule.rs @@ -0,0 +1,5 @@ +/* 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/. */ + +pub use crate::properties_and_values::rule::PropertyRuleData as PropertyRule; diff --git a/servo/components/style/stylesheets/rule_parser.rs b/servo/components/style/stylesheets/rule_parser.rs index 8bc98b66ba0b..ee3ae61d830b 100644 --- a/servo/components/style/stylesheets/rule_parser.rs +++ b/servo/components/style/stylesheets/rule_parser.rs @@ -5,6 +5,7 @@ //! Parsing of the stylesheet contents. use crate::counter_style::{parse_counter_style_body, parse_counter_style_name_definition}; +use crate::custom_properties::parse_name as parse_custom_property_name; use crate::error_reporting::ContextualParseError; use crate::font_face::parse_font_face_block; use crate::media_queries::MediaList; @@ -12,6 +13,7 @@ use crate::parser::{Parse, ParserContext}; use crate::properties::declaration_block::{ parse_property_declaration_list, DeclarationParserState, PropertyDeclarationBlock, }; +use crate::properties_and_values::rule::{parse_property_block, PropertyRuleName}; use crate::selector_parser::{SelectorImpl, SelectorParser}; use crate::shared_lock::{Locked, SharedRwLock}; use crate::str::starts_with_ignore_ascii_case; @@ -30,7 +32,7 @@ use crate::stylesheets::{ }; use crate::values::computed::font::FamilyName; use crate::values::{CssUrl, CustomIdent, DashedIdent, KeyframesName}; -use crate::{Namespace, Prefix}; +use crate::{Atom, Namespace, Prefix}; use cssparser::{ AtRuleParser, BasicParseError, BasicParseErrorKind, CowRcStr, DeclarationParser, Parser, ParserState, QualifiedRuleParser, RuleBodyItemParser, RuleBodyParser, SourceLocation, @@ -201,6 +203,8 @@ pub enum AtRulePrelude { Keyframes(KeyframesName, Option), /// A @page rule prelude, with its page name if it exists. Page(PageSelectors), + /// A @property rule prelude. + Property(PropertyRuleName), /// A @document rule, with its conditional. Document(DocumentCondition), /// A @import rule prelude. @@ -586,6 +590,13 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b, 'i> { input.try_parse(|i| PageSelectors::parse(self.context, i)).unwrap_or_default() ) }, + "property" if static_prefs::pref!("layout.css.properties-and-values.enabled") => { + let name = input.expect_ident_cloned()?; + 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)))) + }, "-moz-document" if cfg!(feature = "gecko") => { let cond = DocumentCondition::parse(self.context, input)?; AtRulePrelude::Document(cond) @@ -690,6 +701,11 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for NestedRuleParser<'a, 'b, 'i> { source_location: start.source_location(), }))) }, + AtRulePrelude::Property(name) => self.nest_for_rule(CssRuleType::Property, |p| { + CssRule::Property(Arc::new(p.shared_lock.wrap( + parse_property_block(&p.context, input, name, start.source_location()), + ))) + }), AtRulePrelude::Document(condition) => { if !cfg!(feature = "gecko") { unreachable!() diff --git a/servo/components/style/stylesheets/rules_iterator.rs b/servo/components/style/stylesheets/rules_iterator.rs index 59736ab09e0b..ec0ceb7398ef 100644 --- a/servo/components/style/stylesheets/rules_iterator.rs +++ b/servo/components/style/stylesheets/rules_iterator.rs @@ -68,6 +68,7 @@ where CssRule::Viewport(_) | CssRule::Keyframes(_) | CssRule::Page(_) | + CssRule::Property(_) | CssRule::LayerStatement(_) | CssRule::FontFeatureValues(_) | CssRule::FontPaletteValues(_) => None, diff --git a/servo/components/style/stylesheets/stylesheet.rs b/servo/components/style/stylesheets/stylesheet.rs index 3f1a2bc58267..ecb095933625 100644 --- a/servo/components/style/stylesheets/stylesheet.rs +++ b/servo/components/style/stylesheets/stylesheet.rs @@ -366,6 +366,7 @@ impl SanitizationKind { CssRule::Keyframes(..) | CssRule::Page(..) | + CssRule::Property(..) | CssRule::FontFeatureValues(..) | CssRule::FontPaletteValues(..) | CssRule::Viewport(..) | diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs index 11b461d85968..8f03d49b4bd1 100644 --- a/servo/components/style/stylist.rs +++ b/servo/components/style/stylist.rs @@ -2841,6 +2841,7 @@ impl CascadeData { self.extra_data .add_page(guard, rule, containing_rule_state.layer_id)?; }, + // TODO: Handle CssRule::Property CssRule::Viewport(..) => {}, _ => { handled = false; @@ -3082,6 +3083,7 @@ impl CascadeData { CssRule::Supports(..) | CssRule::Keyframes(..) | CssRule::Page(..) | + CssRule::Property(..) | CssRule::Viewport(..) | CssRule::Document(..) | CssRule::LayerBlock(..) | diff --git a/servo/components/style_traits/lib.rs b/servo/components/style_traits/lib.rs index d56113a045ea..2f69f46873c6 100644 --- a/servo/components/style_traits/lib.rs +++ b/servo/components/style_traits/lib.rs @@ -143,6 +143,8 @@ pub enum StyleParseErrorKind<'i> { DisallowedImportRule, /// Unexpected @charset rule encountered. UnexpectedCharsetRule, + /// The @property `` must start with `--` + UnexpectedIdent(CowRcStr<'i>), /// A placeholder for many sources of errors that require more specific variants. UnspecifiedError, /// An unexpected token was found within a namespace rule. diff --git a/servo/ports/geckolib/error_reporter.rs b/servo/ports/geckolib/error_reporter.rs index 01db8aec8277..b9439730933a 100644 --- a/servo/ports/geckolib/error_reporter.rs +++ b/servo/ports/geckolib/error_reporter.rs @@ -18,7 +18,7 @@ use style::gecko_bindings::structs::URLExtraData as RawUrlExtraData; use style::gecko_bindings::structs::{nsIURI, Loader, StyleSheet as DomStyleSheet}; use style::selector_parser::SelectorImpl; use style::stylesheets::UrlExtraData; -use style_traits::{StyleParseErrorKind, ValueParseErrorKind}; +use style_traits::{PropertySyntaxParseError, StyleParseErrorKind, ValueParseErrorKind}; pub type ErrorKind<'i> = ParseErrorKind<'i, StyleParseErrorKind<'i>>; @@ -190,6 +190,7 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { fn error_data(self) -> (CowRcStr<'a>, ErrorKind<'a>) { match self { ContextualParseError::UnsupportedPropertyDeclaration(s, err, _) | + ContextualParseError::UnsupportedPropertyDescriptor(s, err) | ContextualParseError::UnsupportedFontFaceDescriptor(s, err) | ContextualParseError::UnsupportedFontFeatureValuesDescriptor(s, err) | ContextualParseError::UnsupportedFontPaletteValuesDescriptor(s, err) | @@ -393,6 +394,7 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols | ContextualParseError::InvalidCounterStyleExtendsWithSymbols | ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols | + ContextualParseError::UnsupportedPropertyDescriptor(..) | ContextualParseError::UnsupportedFontFeatureValuesDescriptor(..) | ContextualParseError::UnsupportedFontPaletteValuesDescriptor(..) | ContextualParseError::InvalidFontFeatureValuesRule(..) => { @@ -403,6 +405,32 @@ impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> { ParseErrorKind::Custom(StyleParseErrorKind::ValueError( ValueParseErrorKind::InvalidColor(..), )) => (cstr!("PEColorNotColor"), Action::Nothing), + ParseErrorKind::Custom(StyleParseErrorKind::PropertySyntaxField(ref kind)) => { + let name = match kind { + PropertySyntaxParseError::EmptyInput => { + cstr!("PEPRSyntaxFieldEmptyInput") + }, + PropertySyntaxParseError::ExpectedPipeBetweenComponents => { + cstr!("PEPRSyntaxFieldExpectedPipe") + }, + PropertySyntaxParseError::InvalidNameStart => { + cstr!("PEPRSyntaxFieldInvalidNameStart") + }, + PropertySyntaxParseError::InvalidName => { + cstr!("PEPRSyntaxFieldInvalidName") + }, + PropertySyntaxParseError::UnclosedDataTypeName => { + cstr!("PEPRSyntaxFieldUnclosedDataTypeName") + }, + PropertySyntaxParseError::UnexpectedEOF => { + cstr!("PEPRSyntaxFieldUnexpectedEOF") + }, + PropertySyntaxParseError::UnknownDataTypeName => { + cstr!("PEPRSyntaxFieldUnknownDataTypeName") + }, + }; + (name, Action::Nothing) + }, _ => { // Not the best error message, since we weren't parsing // a declaration, just a value. But we don't produce diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 2084c4cb4ef1..e0caf53f337f 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -34,7 +34,7 @@ use style::gecko::arc_types::{ LockedDocumentRule, LockedFontFaceRule, LockedFontFeatureValuesRule, LockedFontPaletteValuesRule, LockedImportRule, LockedKeyframe, LockedKeyframesRule, LockedLayerBlockRule, LockedLayerStatementRule, LockedMediaList, LockedMediaRule, - LockedNamespaceRule, LockedPageRule, LockedStyleRule, LockedSupportsRule, + LockedNamespaceRule, LockedPageRule, LockedPropertyRule, LockedStyleRule, LockedSupportsRule, }; use style::gecko::data::{ AuthorStyles, GeckoStyleSheet, PerDocumentStyleData, PerDocumentStyleDataImpl, @@ -105,6 +105,7 @@ use style::properties::{ComputedValues, CountedUnknownProperty, Importance, NonC use style::properties::{LonghandId, LonghandIdSet, PropertyDeclarationBlock, PropertyId}; use style::properties::{PropertyDeclarationId, ShorthandId}; use style::properties::{SourcePropertyDeclaration, StyleBuilder}; +use style::properties_and_values::rule::Inherits as PropertyInherits; use style::rule_cache::RuleCacheConditions; use style::rule_tree::{CascadeLevel, StrongRuleNode}; use style::selector_parser::PseudoElementCascadeType; @@ -122,8 +123,8 @@ use style::stylesheets::{ AllowImportRules, ContainerRule, CounterStyleRule, CssRule, CssRuleType, CssRules, CssRulesHelpers, DocumentRule, FontFaceRule, FontFeatureValuesRule, FontPaletteValuesRule, ImportRule, KeyframesRule, LayerBlockRule, LayerStatementRule, MediaRule, NamespaceRule, - Origin, OriginSet, PageRule, SanitizationData, SanitizationKind, StyleRule, StylesheetContents, - StylesheetLoader as StyleStylesheetLoader, SupportsRule, UrlExtraData, + Origin, OriginSet, PageRule, PropertyRule, SanitizationData, SanitizationKind, StyleRule, + StylesheetContents, StylesheetLoader as StyleStylesheetLoader, SupportsRule, UrlExtraData, }; use style::stylist::{add_size_of_ua_cache, AuthorStylesEnabled, RuleInclusion, Stylist}; use style::thread_state; @@ -2266,6 +2267,13 @@ impl_basic_rule_funcs! { (Page, PageRule), changed: Servo_StyleSet_PageRuleChanged, } +impl_basic_rule_funcs! { (Property, PropertyRule), + getter: Servo_CssRules_GetPropertyRuleAt, + debug: Servo_PropertyRule_Debug, + to_css: Servo_PropertyRule_GetCssText, + changed: Servo_StyleSet_PropertyRuleChanged, +} + impl_group_rule_funcs! { (Supports, SupportsRule), get_rules: Servo_SupportsRule_GetRules, getter: Servo_CssRules_GetSupportsRuleAt, @@ -2829,6 +2837,42 @@ pub extern "C" fn Servo_PageRule_SetSelectorText( }) } +#[no_mangle] +pub extern "C" fn Servo_PropertyRule_GetName(rule: &LockedPropertyRule, result: &mut nsACString) { + read_locked_arc(rule, |rule: &PropertyRule| { + rule.name.to_css(&mut CssWriter::new(result)).unwrap() + }) +} + +#[no_mangle] +pub extern "C" fn Servo_PropertyRule_GetSyntax(rule: &LockedPropertyRule, result: &mut nsACString) { + read_locked_arc(rule, |rule: &PropertyRule| { + if let Some(ref syntax) = rule.syntax { + CssWriter::new(result).write_str(syntax.as_str()).unwrap() + } + }) +} + +#[no_mangle] +pub extern "C" fn Servo_PropertyRule_GetInherits(rule: &LockedPropertyRule) -> bool { + read_locked_arc(rule, |rule: &PropertyRule| { + matches!(rule.inherits, Some(PropertyInherits::True)) + }) +} + +#[no_mangle] +pub extern "C" fn Servo_PropertyRule_GetInitialValue( + rule: &LockedPropertyRule, + result: &mut nsACString, +) -> bool { + read_locked_arc(rule, |rule: &PropertyRule| { + rule.initial_value + .to_css(&mut CssWriter::new(result)) + .unwrap(); + rule.initial_value.is_some() + }) +} + #[no_mangle] pub extern "C" fn Servo_SupportsRule_GetConditionText( rule: &LockedSupportsRule, diff --git a/testing/web-platform/meta/css/css-properties-values-api/__dir__.ini b/testing/web-platform/meta/css/css-properties-values-api/__dir__.ini index 2ef043b92840..49bdd147616d 100644 --- a/testing/web-platform/meta/css/css-properties-values-api/__dir__.ini +++ b/testing/web-platform/meta/css/css-properties-values-api/__dir__.ini @@ -1 +1,2 @@ implementation-status: backlog +prefs: [layout.css.properties-and-values.enabled:true] diff --git a/testing/web-platform/meta/css/css-properties-values-api/at-property-cssom.html.ini b/testing/web-platform/meta/css/css-properties-values-api/at-property-cssom.html.ini index e41bf0a9d7a4..092b4411f75a 100644 --- a/testing/web-platform/meta/css/css-properties-values-api/at-property-cssom.html.ini +++ b/testing/web-platform/meta/css/css-properties-values-api/at-property-cssom.html.ini @@ -1,187 +1,4 @@ [at-property-cssom.html] - [Rule for --no-descriptors returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --valid returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --initial-value-only returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --no-syntax returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --valid returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --initial-value-only returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --valid-whitespace returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --valid-universal returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --valid-universal returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --valid-universal returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --valid-whitespace returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --no-syntax has expected cssText] - expected: FAIL - - [Rule for --syntax-only returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --no-syntax returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --initial-value-only returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --no-initial-value has expected cssText] - expected: FAIL - - [Rule for --no-syntax returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --no-initial-value returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --valid-whitespace has expected cssText] - expected: FAIL - - [Rule for --syntax-only returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --no-descriptors returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --syntax-only returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --no-inherits returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --valid-whitespace returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --valid-reverse has expected cssText] - expected: FAIL - - [Rule for --valid-reverse returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --no-inherits returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --vALId returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --no-inherits has expected cssText] - expected: FAIL - - [Rule for --valid-reverse returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --vALId has expected cssText] - expected: FAIL - - [Rule for --no-descriptors has expected cssText] - expected: FAIL - - [Rule for --syntax-only has expected cssText] - expected: FAIL - - [Rule for --valid-universal returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --initial-value-only has expected cssText] - expected: FAIL - - [Rule for --syntax-only returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --no-syntax returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --inherits-only returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --no-initial-value returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --initial-value-only returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --inherits-only has expected cssText] - expected: FAIL - - [Rule for --vALId returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --valid returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --no-initial-value returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --valid returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --valid-universal has expected cssText] - expected: FAIL - - [Rule for --valid has expected cssText] - expected: FAIL - - [Rule for --inherits-only returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --valid-reverse returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --no-descriptors returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --no-inherits returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --inherits-only returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --inherits-only returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --valid-whitespace returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --vALId returns expected value for CSSPropertyRule.name] - expected: FAIL - - [Rule for --no-descriptors returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --valid-reverse returns expected value for CSSPropertyRule.initialValue] - expected: FAIL - - [Rule for --vALId returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [Rule for --no-inherits returns expected value for CSSPropertyRule.syntax] - expected: FAIL - - [Rule for --no-initial-value returns expected value for CSSPropertyRule.inherits] - expected: FAIL - - [CSSRule.type returns 0] - expected: FAIL - [Rule for --tab\ttab has expected cssText] expected: FAIL diff --git a/testing/web-platform/meta/css/css-properties-values-api/at-property.html.ini b/testing/web-platform/meta/css/css-properties-values-api/at-property.html.ini index aefd97a3d86a..07e9bc191473 100644 --- a/testing/web-platform/meta/css/css-properties-values-api/at-property.html.ini +++ b/testing/web-platform/meta/css/css-properties-values-api/at-property.html.ini @@ -5,18 +5,12 @@ [Rule applied [, rgb(1, 2, 3), false\]] expected: FAIL - [Attribute 'inherits' returns expected value for ["false"\]] - expected: FAIL - [Rule applied [, 2.5, false\]] expected: FAIL [Rule applied [, 42deg, false\]] expected: FAIL - [Attribute 'inherits' returns expected value for [0\]] - expected: FAIL - [Rule applied [, 1turn, false\]] expected: FAIL @@ -26,39 +20,21 @@ [Rule applied [, 10%, false\]] expected: FAIL - [Attribute 'syntax' returns expected value for [rgb(255, 0, 0)\]] - expected: FAIL - [Rule applied [, 5, false\]] expected: FAIL - [Attribute 'initial-value' returns expected value for [red\]] - expected: FAIL - - [Attribute 'syntax' returns expected value for ["# | | none"\]] - expected: FAIL - [Rule applied [*, if(){}, false\]] expected: FAIL [Rule applied [, green, false\]] expected: FAIL - [Attribute 'initial-value' returns expected value for [rgb(1, 2, 3)\]] - expected: FAIL - [Rule applied [, 96dpi, false\]] expected: FAIL - [Attribute 'inherits' returns expected value for [none\]] - expected: FAIL - [Non-inherited properties do not inherit] expected: FAIL - [Attribute 'inherits' returns expected value for ["true"\]] - expected: FAIL - [Rule applied [, tomato, false\]] expected: FAIL @@ -68,57 +44,18 @@ [Rule applied [, 10px, false\]] expected: FAIL - [Attribute 'initial-value' returns expected value for [var(--x)\]] - expected: FAIL - [Rule applied [, rotateX(0deg) translateX(10px), false\]] expected: FAIL [Rule applied [, calc(10% + 10px), false\]] expected: FAIL - [Attribute 'syntax' returns expected value for ["notasyntax"\]] - expected: FAIL - [Rule applied [