dom: Remove CSSStyleDeclaration.setPropertyValue/setPropertyPriority.

This commit is contained in:
Emilio Cobos Álvarez 2018-06-02 12:34:10 +02:00
parent 2434c2bef1
commit aea5e146fe
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 6 additions and 97 deletions

View file

@ -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<DOMString> {
// 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

View file

@ -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;

View file

@ -1,7 +0,0 @@
[historical.html]
[Historical CSSStyleDeclaration member: setPropertyValue]
expected: FAIL
[Historical CSSStyleDeclaration member: setPropertyPriority]
expected: FAIL

View file

@ -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"

View file

@ -1,20 +0,0 @@
<link rel=match href=setpropertypriority_ref.html>
<body>
<p id="control_1" style="color: red">This text should be green.</p>
<p id="test_1" style="color: green">This text should be green.</p>
<p id="control_2" style="color: green !important">This text should be green.</p>
<p id="test_2" style="color: red !important">This text should be green.</p>
<style>
#control_1 { color: green !important }
#test_1 { color: red !important }
#control_2 { color: red !important }
#test_2 { color: green !important }
</style>
<script>
document.getElementById("test_1").style.setPropertyPriority("color", "important");
document.getElementById("test_2").style.setPropertyPriority("color", "");
</script>

View file

@ -1,4 +0,0 @@
<p style="color: green">This text should be green.
<p style="color: green">This text should be green.
<p style="color: green">This text should be green.
<p style="color: green">This text should be green.