mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Hint directionality of label content for crop="start" labels
Differential Revision: https://phabricator.services.mozilla.com/D168788
This commit is contained in:
parent
647434532d
commit
a55ae0ee90
1 changed files with 5 additions and 6 deletions
|
@ -198,7 +198,7 @@ impl Parse for Content {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut content = vec![];
|
let mut content = vec![];
|
||||||
let mut has_moz_keyword = false;
|
let mut has_alt_content = false;
|
||||||
loop {
|
loop {
|
||||||
{
|
{
|
||||||
if let Ok(image) = input.try_parse(|i| Image::parse_only_url(context, i)) {
|
if let Ok(image) = input.try_parse(|i| Image::parse_only_url(context, i)) {
|
||||||
|
@ -249,12 +249,12 @@ impl Parse for Content {
|
||||||
"no-close-quote" => generics::ContentItem::NoCloseQuote,
|
"no-close-quote" => generics::ContentItem::NoCloseQuote,
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
"-moz-alt-content" => {
|
"-moz-alt-content" => {
|
||||||
has_moz_keyword = true;
|
has_alt_content = true;
|
||||||
generics::ContentItem::MozAltContent
|
generics::ContentItem::MozAltContent
|
||||||
},
|
},
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
"-moz-label-content" if context.chrome_rules_enabled() => {
|
"-moz-label-content" if context.chrome_rules_enabled() => {
|
||||||
has_moz_keyword = true;
|
has_alt_content = true;
|
||||||
generics::ContentItem::MozLabelContent
|
generics::ContentItem::MozLabelContent
|
||||||
},
|
},
|
||||||
_ =>{
|
_ =>{
|
||||||
|
@ -272,9 +272,8 @@ impl Parse for Content {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We don't allow to parse `-moz-alt/label-content` in multiple
|
// We don't allow to parse `-moz-alt-content` in multiple positions.
|
||||||
// positions.
|
if content.is_empty() || (has_alt_content && content.len() != 1) {
|
||||||
if content.is_empty() || (has_moz_keyword && content.len() != 1) {
|
|
||||||
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||||
}
|
}
|
||||||
Ok(generics::Content::Items(content.into()))
|
Ok(generics::Content::Items(content.into()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue