mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
style: Allow shorthands to specify their own impl of SpecifiedValueInfo and manual impl it for font and border.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 3B9OfkWU0Eq
This commit is contained in:
parent
e50847666c
commit
185e4ce61d
3 changed files with 46 additions and 22 deletions
|
@ -140,6 +140,7 @@ pub fn parse_border<'i, 't>(
|
|||
for prop in ['color', 'style', 'width'])}
|
||||
${' '.join('border-image-%s' % name
|
||||
for name in ['outset', 'repeat', 'slice', 'source', 'width'])}"
|
||||
derive_value_info="False"
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#border">
|
||||
|
||||
pub fn parse_value<'i, 't>(
|
||||
|
@ -202,6 +203,17 @@ pub fn parse_border<'i, 't>(
|
|||
}
|
||||
}
|
||||
|
||||
// Just use the same as border-left. The border shorthand can't accept
|
||||
// any value that the sub-shorthand couldn't.
|
||||
<%
|
||||
border_left = "<::properties::shorthands::border_left::Longhands as SpecifiedValueInfo>"
|
||||
%>
|
||||
impl SpecifiedValueInfo for Longhands {
|
||||
const SUPPORTED_TYPES: u8 = ${border_left}::SUPPORTED_TYPES;
|
||||
fn collect_completion_keywords(f: KeywordsCollectFn) {
|
||||
${border_left}::collect_completion_keywords(f);
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
<%helpers:shorthand name="border-radius" sub_properties="${' '.join(
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
${'font-language-override' if product == 'gecko' else ''}
|
||||
${'font-feature-settings' if product == 'gecko' else ''}
|
||||
${'font-variation-settings' if product == 'gecko' else ''}"
|
||||
derive_value_info="False"
|
||||
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font">
|
||||
use parser::Parse;
|
||||
use properties::longhands::{font_family, font_style, font_weight, font_stretch};
|
||||
|
@ -258,6 +259,29 @@
|
|||
}
|
||||
% endif
|
||||
}
|
||||
|
||||
<%
|
||||
subprops_for_value_info = ["font_style", "font_weight", "font_stretch",
|
||||
"font_variant_caps", "font_size", "font_family"]
|
||||
subprops_for_value_info = [
|
||||
"<longhands::{}::SpecifiedValue as SpecifiedValueInfo>".format(p)
|
||||
for p in subprops_for_value_info
|
||||
]
|
||||
%>
|
||||
impl SpecifiedValueInfo for Longhands {
|
||||
const SUPPORTED_TYPES: u8 = 0
|
||||
% for p in subprops_for_value_info:
|
||||
| ${p}::SUPPORTED_TYPES
|
||||
% endfor
|
||||
;
|
||||
|
||||
fn collect_completion_keywords(f: KeywordsCollectFn) {
|
||||
% for p in subprops_for_value_info:
|
||||
${p}::collect_completion_keywords(f);
|
||||
% endfor
|
||||
<longhands::system_font::SystemFont as SpecifiedValueInfo>::collect_completion_keywords(f);
|
||||
}
|
||||
}
|
||||
</%helpers:shorthand>
|
||||
|
||||
<%helpers:shorthand name="font-variant"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue