diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-11-21 13:33:35 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-11-21 14:26:16 +0100 |
commit | 8de554f33456d3bf06fdec812d024ed35a7d28bd (patch) | |
tree | 883c1383d01367fb52e3a9476dde614745298718 /components/layout/query.rs | |
parent | 5905f8d3eab42ce759c9802699ee5bd50498dd59 (diff) | |
download | servo-8de554f33456d3bf06fdec812d024ed35a7d28bd.tar.gz servo-8de554f33456d3bf06fdec812d024ed35a7d28bd.zip |
style: Move property allowance tests to PropertyId::parse_into.
It's not only more consistent (since we have a proper ParserContext there), but
also fixes a bunch of bugs where Gecko accidentally exposes and allows setting
internal state because of conversions from nsCSSPropertyID to PropertyId.
This adds the extra complexity of caring about aliases for longer, but that's
probably not a big deal in practice, since we also have PropertyDeclarationId.
MozReview-Commit-ID: C2Js8PfloxQ
Diffstat (limited to 'components/layout/query.rs')
-rw-r--r-- | components/layout/query.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs index 7fac8d3b5b1..13ecfd7a8c6 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -689,9 +689,11 @@ pub fn process_resolved_style_request<'a, N>(context: &LayoutContext, let styles = resolve_style(&mut context, element, RuleInclusion::All, false, pseudo.as_ref()); let style = styles.primary(); let longhand_id = match *property { + PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id, // Firefox returns blank strings for the computed value of shorthands, // so this should be web-compatible. + PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(), PropertyId::Custom(ref name) => { return style.computed_value_to_string(PropertyDeclarationId::Custom(name)) @@ -737,12 +739,12 @@ where let style = &*layout_el.resolved_style(); let longhand_id = match *property { + PropertyId::LonghandAlias(id, _) | PropertyId::Longhand(id) => id, - // Firefox returns blank strings for the computed value of shorthands, // so this should be web-compatible. + PropertyId::ShorthandAlias(..) | PropertyId::Shorthand(_) => return String::new(), - PropertyId::Custom(ref name) => { return style.computed_value_to_string(PropertyDeclarationId::Custom(name)) } |