mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add spec links for border properties
This commit is contained in:
parent
cd2f9734e9
commit
a9c0162000
2 changed files with 35 additions and 18 deletions
|
@ -8,10 +8,17 @@
|
|||
<% data.new_style_struct("Border", inherited=False,
|
||||
additional_methods=[Method("border_" + side + "_has_nonzero_width",
|
||||
"bool") for side in ["top", "right", "bottom", "left"]]) %>
|
||||
|
||||
<%
|
||||
def maybe_logical_spec(side, kind):
|
||||
if side[1]: # if it is logical
|
||||
return "https://drafts.csswg.org/css-logical-props/#propdef-border-%s-%s" % (side[0], kind)
|
||||
else:
|
||||
return "https://drafts.csswg.org/css-backgrounds/#border-%s-%s" % (side[0], kind)
|
||||
%>
|
||||
% for side in ALL_SIDES:
|
||||
${helpers.predefined_type("border-%s-color" % side[0], "CSSColor",
|
||||
"::cssparser::Color::CurrentColor",
|
||||
spec=maybe_logical_spec(side, "color"),
|
||||
animatable=True, logical = side[1])}
|
||||
% endfor
|
||||
|
||||
|
@ -19,11 +26,13 @@
|
|||
${helpers.predefined_type("border-%s-style" % side[0], "BorderStyle",
|
||||
"specified::BorderStyle::none",
|
||||
needs_context=False, need_clone=True,
|
||||
spec=maybe_logical_spec(side, "style"),
|
||||
animatable=False, logical = side[1])}
|
||||
% endfor
|
||||
|
||||
% for side in ALL_SIDES:
|
||||
<%helpers:longhand name="border-${side[0]}-width" animatable="True" logical="${side[1]}">
|
||||
<%helpers:longhand name="border-${side[0]}-width" animatable="True" logical="${side[1]}"
|
||||
spec="${maybe_logical_spec(side, 'width')}">
|
||||
use app_units::Au;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -53,12 +62,14 @@
|
|||
${helpers.predefined_type("border-" + corner + "-radius", "BorderRadiusSize",
|
||||
"computed::BorderRadiusSize::zero()",
|
||||
"parse",
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner,
|
||||
animatable=True)}
|
||||
% endfor
|
||||
|
||||
${helpers.single_keyword("box-decoration-break", "slice clone",
|
||||
gecko_enum_prefix="StyleBoxDecorationBreak",
|
||||
gecko_inexhaustive=True,
|
||||
spec="https://drafts.csswg.org/css-break/#propdef-box-decoration-break",
|
||||
products="gecko", animatable=False)}
|
||||
|
||||
${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
||||
|
@ -66,10 +77,11 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
gecko_enum_prefix="StyleFloatEdge",
|
||||
gecko_inexhaustive=True,
|
||||
products="gecko",
|
||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-float-edge)",
|
||||
animatable=False)}
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-source
|
||||
<%helpers:longhand name="border-image-source" products="gecko" animatable="False">
|
||||
<%helpers:longhand name="border-image-source" products="gecko" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-source">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
@ -144,8 +156,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-outset
|
||||
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False">
|
||||
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
@ -260,8 +272,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-repeat
|
||||
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False">
|
||||
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
@ -338,8 +350,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-width
|
||||
<%helpers:longhand name="border-image-width" products="gecko" animatable="False">
|
||||
<%helpers:longhand name="border-image-width" products="gecko" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::HasViewportPercentage;
|
||||
|
@ -538,8 +550,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image-slice
|
||||
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False">
|
||||
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
|
|
@ -87,11 +87,16 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
if any { Ok((color, style, width)) } else { Err(()) }
|
||||
}
|
||||
|
||||
% for side in map(lambda x: x[0], ALL_SIDES):
|
||||
% for side, logical in ALL_SIDES:
|
||||
<%
|
||||
spec = "https://drafts.csswg.org/css-backgrounds/#border-%s" % side
|
||||
if logical:
|
||||
spec = "https://drafts.csswg.org/css-logical-props/#propdef-border-%s" % side
|
||||
%>
|
||||
<%helpers:shorthand name="border-${side}" sub_properties="${' '.join(
|
||||
'border-%s-%s' % (side, prop)
|
||||
for prop in ['color', 'style', 'width']
|
||||
)}">
|
||||
)}" spec="${spec}">
|
||||
|
||||
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||
let (color, style, width) = try!(super::parse_border(context, input));
|
||||
|
@ -120,7 +125,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
'border-%s-%s' % (side, prop)
|
||||
for side in ['top', 'right', 'bottom', 'left']
|
||||
for prop in ['color', 'style', 'width']
|
||||
)}">
|
||||
)}" spec="https://drafts.csswg.org/css-backgrounds/#border">
|
||||
|
||||
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
|
||||
let (color, style, width) = try!(super::parse_border(context, input));
|
||||
|
@ -151,7 +156,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
<%helpers:shorthand name="border-radius" sub_properties="${' '.join(
|
||||
'border-%s-radius' % (corner)
|
||||
for corner in ['top-left', 'top-right', 'bottom-right', 'bottom-left']
|
||||
)}">
|
||||
)}" spec="https://drafts.csswg.org/css-backgrounds/#border-radius">
|
||||
use values::specified::basic_shape::BorderRadius;
|
||||
use parser::Parse;
|
||||
|
||||
|
@ -184,9 +189,9 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
|
|||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
// https://drafts.csswg.org/css-backgrounds-3/#border-image
|
||||
<%helpers:shorthand name="border-image" products="gecko" sub_properties="border-image-outset
|
||||
border-image-repeat border-image-slice border-image-source border-image-width">
|
||||
border-image-repeat border-image-slice border-image-source border-image-width"
|
||||
spec="https://drafts.csswg.org/css-backgrounds-3/#border-image">
|
||||
use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
|
||||
use properties::longhands::{border_image_source, border_image_width};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue