From a60b53eded39d8e74c0f5da30d9fa3aa4417b9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Sun, 10 Aug 2025 05:35:25 +0200 Subject: [PATCH] script: Convert `CSS` from a IDL interface with static methods to a namespace (#38579) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change updates our implementation to match the spec. Per https://drafts.csswg.org/cssom/#issue-24739c22 this is observable. Testing: Covered by existing web platform tests. --------- Signed-off-by: Simon Wülker --- components/script_bindings/webidls/CSS.webidl | 36 ++++++++++++------- tests/wpt/meta/css/cssom/idlharness.html.ini | 9 ----- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/components/script_bindings/webidls/CSS.webidl b/components/script_bindings/webidls/CSS.webidl index 2a199569cd8..a797b926e60 100644 --- a/components/script_bindings/webidls/CSS.webidl +++ b/components/script_bindings/webidls/CSS.webidl @@ -3,22 +3,34 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ /* * The origin of this IDL file is - * http://dev.w3.org/csswg/cssom/#the-css-interface + * https://drafts.csswg.org/cssom/#namespacedef-css */ -[Abstract, Exposed=Window] -interface CSS { - [Throws] - static DOMString escape(DOMString ident); +// https://drafts.csswg.org/cssom/#the-css.escape()-method +[Exposed=Window] +namespace CSS { + [Throws] CSSOMString escape(CSSOMString ident); }; -// https://drafts.csswg.org/css-conditional-3/#the-css-interface -partial interface CSS { - static boolean supports(DOMString property, DOMString value); - static boolean supports(DOMString conditionText); +// https://drafts.csswg.org/css-conditional-3/#dom-css-supports +partial namespace CSS { + boolean supports(CSSOMString property, CSSOMString value); + boolean supports(CSSOMString conditionText); }; -// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet -partial interface CSS { - [SameObject, Pref="dom_worklet_enabled"] static readonly attribute Worklet paintWorklet; +// https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet +partial namespace CSS { + [SameObject, Pref="dom_worklet_enabled"] readonly attribute Worklet paintWorklet; }; + +// https://drafts.css-houdini.org/css-properties-values-api/#the-registerproperty-function +// dictionary PropertyDefinition { +// required DOMString name; +// DOMString syntax = "*"; +// required boolean inherits; +// DOMString initialValue; +// }; + +// partial namespace CSS { +// undefined registerProperty(PropertyDefinition definition); +// }; diff --git a/tests/wpt/meta/css/cssom/idlharness.html.ini b/tests/wpt/meta/css/cssom/idlharness.html.ini index 744f5ec50bb..4356e3d4f7c 100644 --- a/tests/wpt/meta/css/cssom/idlharness.html.ini +++ b/tests/wpt/meta/css/cssom/idlharness.html.ini @@ -374,15 +374,6 @@ [CSS namespace: [[Prototype\]\] is Object.prototype] expected: FAIL - [CSS namespace: typeof is "object"] - expected: FAIL - - [CSS namespace: has no name property] - expected: FAIL - - [CSS namespace: has no length property] - expected: FAIL - [MathMLElement interface: attribute style] expected: FAIL