mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Implement label[value] and start/end cropping with CSS rather than XUL layout
This reduces the weird interactions that can appear on menus. This also progresses BiDi support, including for accesskeys. Differential Revision: https://phabricator.services.mozilla.com/D161498
This commit is contained in:
parent
aee17ed05c
commit
57da2712d0
2 changed files with 14 additions and 4 deletions
|
@ -264,6 +264,11 @@ pub enum GenericContentItem<I> {
|
||||||
/// `-moz-alt-content`.
|
/// `-moz-alt-content`.
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
MozAltContent,
|
MozAltContent,
|
||||||
|
/// `-moz-label-content`.
|
||||||
|
/// This is needed to make `accesskey` work for XUL labels. It's basically
|
||||||
|
/// attr(value) otherwise.
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
MozLabelContent,
|
||||||
/// `attr([namespace? `|`]? ident)`
|
/// `attr([namespace? `|`]? ident)`
|
||||||
Attr(Attr),
|
Attr(Attr),
|
||||||
/// image-set(url) | url(url)
|
/// image-set(url) | url(url)
|
||||||
|
|
|
@ -198,7 +198,7 @@ impl Parse for Content {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut content = vec![];
|
let mut content = vec![];
|
||||||
let mut has_alt_content = false;
|
let mut has_moz_keyword = 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,9 +249,13 @@ 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_alt_content = true;
|
has_moz_keyword = true;
|
||||||
generics::ContentItem::MozAltContent
|
generics::ContentItem::MozAltContent
|
||||||
},
|
},
|
||||||
|
"-moz-label-content" if context.chrome_rules_enabled() => {
|
||||||
|
has_moz_keyword = true;
|
||||||
|
generics::ContentItem::MozLabelContent
|
||||||
|
},
|
||||||
_ =>{
|
_ =>{
|
||||||
let ident = ident.clone();
|
let ident = ident.clone();
|
||||||
return Err(input.new_custom_error(
|
return Err(input.new_custom_error(
|
||||||
|
@ -267,8 +271,9 @@ impl Parse for Content {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We don't allow to parse `-moz-alt-content in multiple positions.
|
// We don't allow to parse `-moz-alt/label-content` in multiple
|
||||||
if content.is_empty() || (has_alt_content && content.len() != 1) {
|
// positions.
|
||||||
|
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