зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1520396 - [css-logical] Implement the border-block/border-inline shorthands. r=emilio
This commit is contained in:
Родитель
1db6a31ac4
Коммит
790c50dcf0
|
@ -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": [
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче