mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add spec links for margin properties, support spec links on four_sides_shorthand
This commit is contained in:
parent
6138b6aa75
commit
3128694bff
3 changed files with 12 additions and 7 deletions
|
@ -551,10 +551,9 @@
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True)">
|
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True, **kwargs)">
|
||||||
<%self:shorthand name="${name}" sub_properties="${
|
<% sub_properties=' '.join(sub_property_pattern % side for side in ['top', 'right', 'bottom', 'left']) %>
|
||||||
' '.join(sub_property_pattern % side
|
<%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)">
|
||||||
for side in ['top', 'right', 'bottom', 'left'])}">
|
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use parser::Parse;
|
use parser::Parse;
|
||||||
use super::parse_four_sides;
|
use super::parse_four_sides;
|
||||||
|
@ -586,7 +585,7 @@
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</%self:shorthand>
|
</%call>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="logical_setter_helper(name)">
|
<%def name="logical_setter_helper(name)">
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
<% data.new_style_struct("Margin", inherited=False) %>
|
<% data.new_style_struct("Margin", inherited=False) %>
|
||||||
|
|
||||||
% for side in ALL_SIDES:
|
% for side in ALL_SIDES:
|
||||||
|
<%
|
||||||
|
spec = "https://drafts.csswg.org/css-box/#propdef-margin-%s" % side[0]
|
||||||
|
if side[1]:
|
||||||
|
spec = "https://drafts.csswg.org/css-logical-props/#propdef-margin-%s" % side[1]
|
||||||
|
%>
|
||||||
${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto",
|
${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto",
|
||||||
"computed::LengthOrPercentageOrAuto::Length(Au(0))",
|
"computed::LengthOrPercentageOrAuto::Length(Au(0))",
|
||||||
animatable=True, logical = side[1])}
|
animatable=True, logical = side[1], spec = spec)}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
|
|
||||||
<%namespace name="helpers" file="/helpers.mako.rs" />
|
<%namespace name="helpers" file="/helpers.mako.rs" />
|
||||||
|
|
||||||
${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthOrPercentageOrAuto::parse")}
|
${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthOrPercentageOrAuto::parse",
|
||||||
|
spec="https://drafts.csswg.org/css-box/#propdef-margin")}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue