Skip to content

Commit

Permalink
style: Support the all shorthand.
Browse files Browse the repository at this point in the history
Fixes #15055.
  • Loading branch information
heycam committed Apr 13, 2017
1 parent 09460f9 commit 56ab106
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/script/dom/webidls/CSSStyleDeclaration.webidl
Expand Up @@ -33,6 +33,8 @@ interface CSSStyleDeclaration {
};

partial interface CSSStyleDeclaration {
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString all;

[SetterThrows, TreatNullAs=EmptyString] attribute DOMString background;
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString backgroundColor;
[SetterThrows, TreatNullAs=EmptyString] attribute DOMString background-color;
Expand Down
23 changes: 23 additions & 0 deletions components/style/properties/properties.mako.rs
Expand Up @@ -165,6 +165,29 @@ pub mod shorthands {
<%include file="/shorthand/position.mako.rs" />
<%include file="/shorthand/inherited_svg.mako.rs" />
<%include file="/shorthand/text.mako.rs" />

// FIXME(heycam): It might be worth trying to handle this more efficiently
// as part of the cascade function, rather than expanding this all
// shorthand out to hundreds of specified values.
<% components_of_all_shorthand = [p.name for p in data.longhands if p.name not in ['direction', 'unicode-bidi']] %>
<%helpers:shorthand name="all"
sub_properties="${' '.join(components_of_all_shorthand)}"
spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand">

pub fn parse_value(_context: &ParserContext, _input: &mut Parser) -> Result<Longhands, ()> {
// cascade_property handles parsing the CSS-wide keywords, so we
// don't need to handle any other values here.
Err(())
}

impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, _dest: &mut W) -> fmt::Result where W: fmt::Write {
// get_shorthand_appendable_value handles this for us.
debug_assert!(false, "we shouldn't need to be called");
Ok(())
}
}
</%helpers:shorthand>
}

/// A module with all the code related to animated properties.
Expand Down

0 comments on commit 56ab106

Please sign in to comment.