diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index 221966890c55..c63167b6ce80 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -3684,6 +3684,45 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "border-block": { + "isInherited": false, + "subproperties": [ + "border-block-start-width", + "border-block-end-width", + "border-block-start-style", + "border-block-end-style", + "border-block-start-color", + "border-block-end-color" + ], + "supports": [ + 2 + ], + "values": [ + "COLOR", + "currentColor", + "dashed", + "dotted", + "double", + "groove", + "hidden", + "hsl", + "hsla", + "inherit", + "initial", + "inset", + "medium", + "none", + "outset", + "rgb", + "rgba", + "ridge", + "solid", + "thick", + "thin", + "transparent", + "unset" + ] + }, "border-block-color": { "isInherited": false, "subproperties": [ @@ -4215,6 +4254,45 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "border-inline": { + "isInherited": false, + "subproperties": [ + "border-inline-start-width", + "border-inline-end-width", + "border-inline-start-style", + "border-inline-end-style", + "border-inline-start-color", + "border-inline-end-color" + ], + "supports": [ + 2 + ], + "values": [ + "COLOR", + "currentColor", + "dashed", + "dotted", + "double", + "groove", + "hidden", + "hsl", + "hsla", + "inherit", + "initial", + "inset", + "medium", + "none", + "outset", + "rgb", + "rgba", + "ridge", + "solid", + "thick", + "thin", + "transparent", + "unset" + ] + }, "border-inline-color": { "isInherited": false, "subproperties": [ diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index c5048b94358b..8a9dc66c9454 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1299,6 +1299,16 @@ var gCSSProperties = { other_values: [ "url(foo.xml)" ], invalid_values: [] }, + "border-inline": { + domProp: "borderInline", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", + "border-inline-end-color", "border-inline-end-style", "border-inline-end-width" ], + initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor" ], + other_values: [ "solid", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ], + invalid_values: [ "5%", "5", "5 solid green" ] + }, "border-inline-end": { domProp: "borderInlineEnd", inherited: false, @@ -6070,6 +6080,16 @@ var gCSSProperties = { ], invalid_values: [ "none" ], }, + "border-block": { + domProp: "borderBlock", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "border-block-start-color", "border-block-start-style", "border-block-start-width", + "border-block-end-color", "border-block-end-style", "border-block-end-width" ], + initial_values: [ "none", "medium", "currentColor", "thin", "none medium currentcolor" ], + other_values: [ "solid", "green", "medium solid", "green solid", "10px solid", "thick solid", "5px green none" ], + invalid_values: [ "5%", "5", "5 solid green" ] + }, "border-block-end": { domProp: "borderBlockEnd", inherited: false, diff --git a/servo/components/style/properties/shorthands/border.mako.rs b/servo/components/style/properties/shorthands/border.mako.rs index 314d58248802..255464892a4f 100644 --- a/servo/components/style/properties/shorthands/border.mako.rs +++ b/servo/components/style/properties/shorthands/border.mako.rs @@ -399,3 +399,50 @@ pub fn parse_border<'i, 't>( % 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> { + 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(&self, dest: &mut CssWriter) -> 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 + ) + } + } + +% endfor