mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
style: Implement the border-block/border-inline shorthands.
Bug: 1520396 Reviewed-by: emilio
This commit is contained in:
parent
604ec247f7
commit
89e12780b9
1 changed files with 47 additions and 0 deletions
|
@ -399,3 +399,50 @@ pub fn parse_border<'i, 't>(
|
|||
</%helpers:shorthand>
|
||||
% endfor
|
||||
% endfor
|
||||
|
||||
% for axis in ["block", "inline"]:
|
||||
<%
|
||||
spec = "https://drafts.csswg.org/css-logical/#propdef-border-%s" % (axis)
|
||||
%>
|
||||
<%helpers:shorthand
|
||||
name="border-${axis}"
|
||||
sub_properties="${' '.join(
|
||||
'border-%s-%s-width' % (axis, side)
|
||||
for side in ['start', 'end']
|
||||
)} ${' '.join(
|
||||
'border-%s-%s-style' % (axis, side)
|
||||
for side in ['start', 'end']
|
||||
)} ${' '.join(
|
||||
'border-%s-%s-color' % (axis, side)
|
||||
for side in ['start', 'end']
|
||||
)}"
|
||||
spec="${spec}">
|
||||
|
||||
use crate::properties::shorthands::border_${axis}_start;
|
||||
pub fn parse_value<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Longhands, ParseError<'i>> {
|
||||
let start_value = border_${axis}_start::parse_value(context, input)?;
|
||||
Ok(expanded! {
|
||||
border_${axis}_start_width: start_value.border_${axis}_start_width.clone(),
|
||||
border_${axis}_end_width: start_value.border_${axis}_start_width,
|
||||
border_${axis}_start_style: start_value.border_${axis}_start_style.clone(),
|
||||
border_${axis}_end_style: start_value.border_${axis}_start_style,
|
||||
border_${axis}_start_color: start_value.border_${axis}_start_color.clone(),
|
||||
border_${axis}_end_color: start_value.border_${axis}_start_color,
|
||||
})
|
||||
}
|
||||
|
||||
impl<'a> ToCss for LonghandsToSerialize<'a> {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
|
||||
super::serialize_directional_border(
|
||||
dest,
|
||||
self.border_${axis}_start_width,
|
||||
self.border_${axis}_start_style,
|
||||
self.border_${axis}_start_color
|
||||
)
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
% endfor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue