mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #11086 - heycam:radius, r=bholley
Support border/outline-radius properties in geckolib. <s>Because of the way Gecko stores outline-width in nsStyleOutline::mOutlineWidth (i.e., as its specified value for keywords) we need separate property implementations for servo/gecko products.</s> The -moz-outline-radius parsing is a bit of a hack; I was just avoiding the effort of factoring out the parsing into a separate method. Let me know if I should do that. <s>Gecko-side changes are https://bugzilla.mozilla.org/show_bug.cgi?id=1271168.</s> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11086) <!-- Reviewable:end -->
This commit is contained in:
commit
a834bc1ec7
5 changed files with 93 additions and 9 deletions
|
@ -145,7 +145,11 @@ class PropertiesData(object):
|
|||
|
||||
return longand
|
||||
|
||||
def declare_shorthand(self, name, sub_properties, *args, **kwargs):
|
||||
def declare_shorthand(self, name, sub_properties, products="gecko servo", *args, **kwargs):
|
||||
products = products.split()
|
||||
if self.product not in products:
|
||||
return
|
||||
|
||||
sub_properties = [self.longhands_by_name[s] for s in sub_properties]
|
||||
shorthand = Shorthand(name, sub_properties, *args, **kwargs)
|
||||
self.shorthands.append(shorthand)
|
||||
|
|
|
@ -191,10 +191,12 @@
|
|||
</%call>
|
||||
</%def>
|
||||
|
||||
<%def name="shorthand(name, sub_properties, experimental=False)">
|
||||
<%def name="shorthand(name, sub_properties, experimental=False, **kwargs)">
|
||||
<%
|
||||
shorthand = data.declare_shorthand(name, sub_properties.split(), experimental=experimental)
|
||||
shorthand = data.declare_shorthand(name, sub_properties.split(), experimental=experimental,
|
||||
**kwargs)
|
||||
%>
|
||||
% if shorthand:
|
||||
pub mod ${shorthand.ident} {
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
|
@ -252,6 +254,7 @@
|
|||
${caller.body()}
|
||||
}
|
||||
}
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function)">
|
||||
|
|
|
@ -58,4 +58,11 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// The -moz-outline-radius-* properties are non-standard and not on a standards track.
|
||||
% for corner in ["topleft", "topright", "bottomright", "bottomleft"]:
|
||||
${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderRadiusSize",
|
||||
"computed::BorderRadiusSize::zero()",
|
||||
"parse", products="gecko")}
|
||||
% endfor
|
||||
|
||||
${helpers.predefined_type("outline-offset", "Length", "Au(0)")}
|
||||
|
|
|
@ -47,3 +47,20 @@
|
|||
Err(())
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
// The -moz-outline-radius shorthand is non-standard and not on a standards track.
|
||||
<%helpers:shorthand name="-moz-outline-radius" sub_properties="${' '.join(
|
||||
'-moz-outline-radius-%s' % corner
|
||||
for corner in ['topleft', 'topright', 'bottomright', 'bottomleft']
|
||||
)}" products="gecko">
|
||||
use properties::shorthands;
|
||||
|
||||
// Re-use border-radius parsing.
|
||||
shorthands::border_radius::parse_value(context, input).map(|longhands| {
|
||||
Longhands {
|
||||
% for corner in ["top_left", "top_right", "bottom_right", "bottom_left"]:
|
||||
_moz_outline_radius_${corner.replace("_", "")}: longhands.border_${corner}_radius,
|
||||
% endfor
|
||||
}
|
||||
})
|
||||
</%helpers:shorthand>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue