diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-06-02 12:24:44 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-06-02 12:24:44 +0200 |
commit | 274bc4df3e78eb7adb02be439c2720d383211b79 (patch) | |
tree | 2c19eab7883c73fb0efe9d5ea02a75d04a954930 /components/script/dom/cssstyledeclaration.rs | |
parent | 9bb72139e40571126f9b2872c77a4f38bb0b568b (diff) | |
download | servo-274bc4df3e78eb7adb02be439c2720d383211b79.tar.gz servo-274bc4df3e78eb7adb02be439c2720d383211b79.zip |
dom: don't parse internal properties in CSSStyleDeclaration.
Diffstat (limited to 'components/script/dom/cssstyledeclaration.rs')
-rw-r--r-- | components/script/dom/cssstyledeclaration.rs | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 1e95cd9d27d..e63d5833909 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -312,22 +312,18 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue fn GetPropertyValue(&self, property: DOMString) -> DOMString { - let id = if let Ok(id) = PropertyId::parse(&property) { - id - } else { - // Unkwown property - return DOMString::new() + let id = match PropertyId::parse_enabled_for_all_content(&property) { + Ok(id) => id, + Err(..) => return DOMString::new(), }; self.get_property_value(id) } // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority fn GetPropertyPriority(&self, property: DOMString) -> DOMString { - let id = if let Ok(id) = PropertyId::parse(&property) { - id - } else { - // Unkwown property - return DOMString::new() + let id = match PropertyId::parse_enabled_for_all_content(&property) { + Ok(id) => id, + Err(..) => return DOMString::new(), }; self.owner.with_block(|pdb| { @@ -347,11 +343,9 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { priority: DOMString) -> ErrorResult { // Step 3 - let id = if let Ok(id) = PropertyId::parse(&property) { - id - } else { - // Unknown property - return Ok(()) + let id = match PropertyId::parse_enabled_for_all_content(&property) { + Ok(id) => id, + Err(..) => return Ok(()), }; self.set_property(id, value, priority) } @@ -364,7 +358,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { } // Step 2 & 3 - let id = match PropertyId::parse(&property) { + let id = match PropertyId::parse_enabled_for_all_content(&property) { Ok(id) => id, Err(..) => return Ok(()), // Unkwown property }; @@ -396,11 +390,9 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration { return Err(Error::NoModificationAllowed); } - let id = if let Ok(id) = PropertyId::parse(&property) { - id - } else { - // Unkwown property, cannot be there to remove. - return Ok(DOMString::new()) + let id = match PropertyId::parse_enabled_for_all_content(&property) { + Ok(id) => id, + Err(..) => return Ok(DOMString::new()), }; let mut string = String::new(); |