diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index ad7977000fe..a42355167e9 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -276,8 +276,21 @@ impl StylesheetOwner for HTMLStyleElement { } impl HTMLStyleElementMethods for HTMLStyleElement { - // https://drafts.csswg.org/cssom/#dom-linkstyle-sheet + /// fn GetSheet(&self) -> Option> { self.get_cssom_stylesheet().map(DomRoot::upcast) } + + /// + fn Disabled(&self) -> bool { + self.get_cssom_stylesheet() + .map_or(false, |sheet| sheet.disabled()) + } + + /// + fn SetDisabled(&self, value: bool) { + if let Some(sheet) = self.get_cssom_stylesheet() { + sheet.set_disabled(value); + } + } } diff --git a/components/script/dom/webidls/HTMLStyleElement.webidl b/components/script/dom/webidls/HTMLStyleElement.webidl index dd68cb6270a..0bcb86af24b 100644 --- a/components/script/dom/webidls/HTMLStyleElement.webidl +++ b/components/script/dom/webidls/HTMLStyleElement.webidl @@ -7,6 +7,7 @@ interface HTMLStyleElement : HTMLElement { [HTMLConstructor] constructor(); + attribute boolean disabled; // [CEReactions] // attribute DOMString media; // [CEReactions] diff --git a/tests/wpt/meta-legacy-layout/css/cssom/style-sheet-interfaces-001.html.ini b/tests/wpt/meta-legacy-layout/css/cssom/style-sheet-interfaces-001.html.ini index 20bea8c9342..256fdbd5da1 100644 --- a/tests/wpt/meta-legacy-layout/css/cssom/style-sheet-interfaces-001.html.ini +++ b/tests/wpt/meta-legacy-layout/css/cssom/style-sheet-interfaces-001.html.ini @@ -11,6 +11,3 @@ [StyleSheet_property_values] expected: FAIL - - [disabled attribute getter/setter] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/html/dom/idlharness.https.html.ini b/tests/wpt/meta-legacy-layout/html/dom/idlharness.https.html.ini index 759156c30fe..a26ec9c194c 100644 --- a/tests/wpt/meta-legacy-layout/html/dom/idlharness.https.html.ini +++ b/tests/wpt/meta-legacy-layout/html/dom/idlharness.https.html.ini @@ -4863,15 +4863,9 @@ [HTMLLinkElement interface: document.createElement("link") must inherit property "blocking" with the proper type] expected: FAIL - [HTMLStyleElement interface: attribute disabled] - expected: FAIL - [HTMLStyleElement interface: attribute blocking] expected: FAIL - [HTMLStyleElement interface: document.createElement("style") must inherit property "disabled" with the proper type] - expected: FAIL - [HTMLStyleElement interface: document.createElement("style") must inherit property "blocking" with the proper type] expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/html/semantics/document-metadata/the-style-element/style_disabled.html.ini b/tests/wpt/meta-legacy-layout/html/semantics/document-metadata/the-style-element/style_disabled.html.ini deleted file mode 100644 index 1275792fe5f..00000000000 --- a/tests/wpt/meta-legacy-layout/html/semantics/document-metadata/the-style-element/style_disabled.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[style_disabled.html] - type: testharness - [The style is not applied when it is disabled] - expected: FAIL - diff --git a/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-015.xht.ini b/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-015.xht.ini deleted file mode 100644 index 65758d60ef4..00000000000 --- a/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-015.xht.ini +++ /dev/null @@ -1,2 +0,0 @@ -[table-anonymous-objects-015.xht] - expected: FAIL diff --git a/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-016.xht.ini b/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-016.xht.ini deleted file mode 100644 index d4477181430..00000000000 --- a/tests/wpt/meta/css/CSS2/tables/table-anonymous-objects-016.xht.ini +++ /dev/null @@ -1,2 +0,0 @@ -[table-anonymous-objects-016.xht] - expected: FAIL diff --git a/tests/wpt/meta/css/cssom/style-sheet-interfaces-001.html.ini b/tests/wpt/meta/css/cssom/style-sheet-interfaces-001.html.ini index 72057d982ea..9bc43c2c946 100644 --- a/tests/wpt/meta/css/cssom/style-sheet-interfaces-001.html.ini +++ b/tests/wpt/meta/css/cssom/style-sheet-interfaces-001.html.ini @@ -10,6 +10,3 @@ [StyleSheet_property_values] expected: FAIL - - [disabled attribute getter/setter] - expected: FAIL diff --git a/tests/wpt/meta/html/dom/idlharness.https.html.ini b/tests/wpt/meta/html/dom/idlharness.https.html.ini index dbbf5f8355d..91e2de01021 100644 --- a/tests/wpt/meta/html/dom/idlharness.https.html.ini +++ b/tests/wpt/meta/html/dom/idlharness.https.html.ini @@ -4581,15 +4581,9 @@ [HTMLLinkElement interface: document.createElement("link") must inherit property "blocking" with the proper type] expected: FAIL - [HTMLStyleElement interface: attribute disabled] - expected: FAIL - [HTMLStyleElement interface: attribute blocking] expected: FAIL - [HTMLStyleElement interface: document.createElement("style") must inherit property "disabled" with the proper type] - expected: FAIL - [HTMLStyleElement interface: document.createElement("style") must inherit property "blocking" with the proper type] expected: FAIL diff --git a/tests/wpt/meta/html/semantics/document-metadata/the-style-element/style_disabled.html.ini b/tests/wpt/meta/html/semantics/document-metadata/the-style-element/style_disabled.html.ini deleted file mode 100644 index b890dfaffcd..00000000000 --- a/tests/wpt/meta/html/semantics/document-metadata/the-style-element/style_disabled.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[style_disabled.html] - [The style is not applied when it is disabled] - expected: FAIL