From aea5e146fe8c6c948264bf381ef53a8ee5f2ed11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 2 Jun 2018 12:34:10 +0200 Subject: [PATCH] dom: Remove CSSStyleDeclaration.setPropertyValue/setPropertyPriority. --- components/script/dom/cssstyledeclaration.rs | 41 +++---------------- .../dom/webidls/CSSStyleDeclaration.webidl | 6 --- .../metadata/css/cssom/historical.html.ini | 7 ---- tests/wpt/mozilla/meta/MANIFEST.json | 25 ----------- .../tests/css/setpropertypriority.html | 20 --------- .../tests/css/setpropertypriority_ref.html | 4 -- 6 files changed, 6 insertions(+), 97 deletions(-) delete mode 100644 tests/wpt/metadata/css/cssom/historical.html.ini delete mode 100644 tests/wpt/mozilla/tests/css/setpropertypriority.html delete mode 100644 tests/wpt/mozilla/tests/css/setpropertypriority_ref.html diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index e63d5833909..43eac985c5e 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -350,39 +350,6 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { self.set_property(id, value, priority) } - // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertypriority - fn SetPropertyPriority(&self, property: DOMString, priority: DOMString) -> ErrorResult { - // Step 1 - if self.readonly { - return Err(Error::NoModificationAllowed); - } - - // Step 2 & 3 - let id = match PropertyId::parse_enabled_for_all_content(&property) { - Ok(id) => id, - Err(..) => return Ok(()), // Unkwown property - }; - - // Step 4 - let importance = match &*priority { - "" => Importance::Normal, - p if p.eq_ignore_ascii_case("important") => Importance::Important, - _ => return Ok(()), - }; - - self.owner.mutate_associated_block(|pdb, changed| { - // Step 5 & 6 - *changed = pdb.set_importance(&id, importance); - }); - - Ok(()) - } - - // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue - fn SetPropertyValue(&self, property: DOMString, value: DOMString) -> ErrorResult { - self.SetProperty(property, value, DOMString::new()) - } - // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty fn RemoveProperty(&self, property: DOMString) -> Fallible { // Step 1 @@ -407,12 +374,16 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat fn CssFloat(&self) -> DOMString { - self.GetPropertyValue(DOMString::from("float")) + self.get_property_value(PropertyId::Longhand(LonghandId::Float)) } // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat fn SetCssFloat(&self, value: DOMString) -> ErrorResult { - self.SetPropertyValue(DOMString::from("float"), value) + self.set_property( + PropertyId::Longhand(LonghandId::Float), + value, + DOMString::new(), + ) } // https://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl index 760f3461f0a..49377cd1044 100644 --- a/components/script/dom/webidls/CSSStyleDeclaration.webidl +++ b/components/script/dom/webidls/CSSStyleDeclaration.webidl @@ -19,12 +19,6 @@ interface CSSStyleDeclaration { [CEReactions, Throws] void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = ""); - [CEReactions, Throws] - void setPropertyValue(DOMString property, [TreatNullAs=EmptyString] DOMString value); - - [CEReactions, Throws] - void setPropertyPriority(DOMString property, [TreatNullAs=EmptyString] DOMString priority); - [CEReactions, Throws] DOMString removeProperty(DOMString property); // readonly attribute CSSRule? parentRule; diff --git a/tests/wpt/metadata/css/cssom/historical.html.ini b/tests/wpt/metadata/css/cssom/historical.html.ini deleted file mode 100644 index af096027a4d..00000000000 --- a/tests/wpt/metadata/css/cssom/historical.html.ini +++ /dev/null @@ -1,7 +0,0 @@ -[historical.html] - [Historical CSSStyleDeclaration member: setPropertyValue] - expected: FAIL - - [Historical CSSStyleDeclaration member: setPropertyPriority] - expected: FAIL - diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 69d53b994b0..10895d4aa5f 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5501,18 +5501,6 @@ {} ] ], - "css/setpropertypriority.html": [ - [ - "/_mozilla/css/setpropertypriority.html", - [ - [ - "/_mozilla/css/setpropertypriority_ref.html", - "==" - ] - ], - {} - ] - ], "css/simple_inline_absolute_containing_block_a.html": [ [ "/_mozilla/css/simple_inline_absolute_containing_block_a.html", @@ -9651,11 +9639,6 @@ {} ] ], - "css/setpropertypriority_ref.html": [ - [ - {} - ] - ], "css/simple_inline_absolute_containing_block_ref.html": [ [ {} @@ -63756,14 +63739,6 @@ "3de96c5c95089cb3c931f0158613ed585438f9ec", "support" ], - "css/setpropertypriority.html": [ - "67d08c6e155403d6452a48ea57680fc242264d15", - "reftest" - ], - "css/setpropertypriority_ref.html": [ - "c869671f731182ae1e07b9e6e6fc9b76c20a6d31", - "support" - ], "css/simple_inline_absolute_containing_block_a.html": [ "b4343b0b1b4c78ff951156bcc67645cc253bf48c", "reftest" diff --git a/tests/wpt/mozilla/tests/css/setpropertypriority.html b/tests/wpt/mozilla/tests/css/setpropertypriority.html deleted file mode 100644 index 50fe54005bd..00000000000 --- a/tests/wpt/mozilla/tests/css/setpropertypriority.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -

This text should be green.

-

This text should be green.

- -

This text should be green.

-

This text should be green.

- - - diff --git a/tests/wpt/mozilla/tests/css/setpropertypriority_ref.html b/tests/wpt/mozilla/tests/css/setpropertypriority_ref.html deleted file mode 100644 index c526c2f371b..00000000000 --- a/tests/wpt/mozilla/tests/css/setpropertypriority_ref.html +++ /dev/null @@ -1,4 +0,0 @@ -

This text should be green. -

This text should be green. -

This text should be green. -

This text should be green.