mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Implement 'display:block ruby'.
Differential Revision: https://phabricator.services.mozilla.com/D40211
This commit is contained in:
parent
2d29e6edd4
commit
5949d42bf7
1 changed files with 9 additions and 47 deletions
|
@ -266,12 +266,12 @@ impl Display {
|
||||||
/// Returns whether this `display` value is one of the types for ruby.
|
/// Returns whether this `display` value is one of the types for ruby.
|
||||||
pub fn is_ruby_type(&self) -> bool {
|
pub fn is_ruby_type(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
*self,
|
self.inside(),
|
||||||
Display::Ruby |
|
DisplayInside::Ruby |
|
||||||
Display::RubyBase |
|
DisplayInside::RubyBase |
|
||||||
Display::RubyText |
|
DisplayInside::RubyText |
|
||||||
Display::RubyBaseContainer |
|
DisplayInside::RubyBaseContainer |
|
||||||
Display::RubyTextContainer
|
DisplayInside::RubyTextContainer
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,8 +405,6 @@ impl Display {
|
||||||
DisplayOutside::Inline => {
|
DisplayOutside::Inline => {
|
||||||
let inside = match self.inside() {
|
let inside = match self.inside() {
|
||||||
DisplayInside::Inline | DisplayInside::FlowRoot => DisplayInside::Block,
|
DisplayInside::Inline | DisplayInside::FlowRoot => DisplayInside::Block,
|
||||||
// FIXME: we don't handle `block ruby` in layout yet, remove this when we do:
|
|
||||||
DisplayInside::Ruby => DisplayInside::Block,
|
|
||||||
inside => inside,
|
inside => inside,
|
||||||
};
|
};
|
||||||
Display::from3(DisplayOutside::Block, inside, self.is_list_item())
|
Display::from3(DisplayOutside::Block, inside, self.is_list_item())
|
||||||
|
@ -541,21 +539,6 @@ fn parse_display_inside<'i, 't>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: this can be replaced with parse_display_inside once we
|
|
||||||
/// support `block ruby`.
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
fn parse_display_inside_for_block<'i, 't>(
|
|
||||||
input: &mut Parser<'i, 't>,
|
|
||||||
) -> Result<DisplayInside, ParseError<'i>> {
|
|
||||||
Ok(try_match_ident_ignore_ascii_case! { input,
|
|
||||||
"flow" => DisplayInside::Flow,
|
|
||||||
"flow-root" => DisplayInside::FlowRoot,
|
|
||||||
"table" => DisplayInside::Table,
|
|
||||||
"flex" => DisplayInside::Flex,
|
|
||||||
"grid" => DisplayInside::Grid,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <display-outside> = block | inline | run-in
|
/// <display-outside> = block | inline | run-in
|
||||||
/// https://drafts.csswg.org/css-display/#typedef-display-outside
|
/// https://drafts.csswg.org/css-display/#typedef-display-outside
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
@ -570,20 +553,6 @@ fn parse_display_outside<'i, 't>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: this can be replaced with parse_display_outside once we
|
|
||||||
/// support all its values for `ruby`.
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
fn parse_display_outside_for_ruby<'i, 't>(
|
|
||||||
input: &mut Parser<'i, 't>,
|
|
||||||
) -> Result<DisplayOutside, ParseError<'i>> {
|
|
||||||
Ok(try_match_ident_ignore_ascii_case! { input,
|
|
||||||
"inline" => DisplayOutside::Inline,
|
|
||||||
// FIXME: not supported in layout yet:
|
|
||||||
//"block" => DisplayOutside::Block,
|
|
||||||
//"run-in" => DisplayOutside::RunIn,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// (flow | flow-root)?
|
/// (flow | flow-root)?
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
fn parse_display_inside_for_list_item<'i, 't>(
|
fn parse_display_inside_for_list_item<'i, 't>(
|
||||||
|
@ -630,11 +599,7 @@ impl Parse for Display {
|
||||||
if !got_list_item && is_valid_inside_for_list_item(&inside) {
|
if !got_list_item && is_valid_inside_for_list_item(&inside) {
|
||||||
got_list_item = input.try(parse_list_item).is_ok();
|
got_list_item = input.try(parse_list_item).is_ok();
|
||||||
}
|
}
|
||||||
let outside = match inside {
|
let outside = input.try(parse_display_outside);
|
||||||
// FIXME we don't handle `block ruby` in layout yet.
|
|
||||||
Ok(DisplayInside::Ruby) => input.try(parse_display_outside_for_ruby),
|
|
||||||
_ => input.try(parse_display_outside),
|
|
||||||
};
|
|
||||||
if outside.is_ok() {
|
if outside.is_ok() {
|
||||||
if !got_list_item && (inside.is_err() || is_valid_inside_for_list_item(&inside)) {
|
if !got_list_item && (inside.is_err() || is_valid_inside_for_list_item(&inside)) {
|
||||||
got_list_item = input.try(parse_list_item).is_ok();
|
got_list_item = input.try(parse_list_item).is_ok();
|
||||||
|
@ -643,11 +608,7 @@ impl Parse for Display {
|
||||||
inside = if got_list_item {
|
inside = if got_list_item {
|
||||||
input.try(parse_display_inside_for_list_item)
|
input.try(parse_display_inside_for_list_item)
|
||||||
} else {
|
} else {
|
||||||
match outside {
|
input.try(parse_display_inside)
|
||||||
// FIXME we don't handle `block ruby` in layout yet.
|
|
||||||
Ok(DisplayOutside::Block) => input.try(parse_display_inside_for_block),
|
|
||||||
_ => input.try(parse_display_inside),
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if !got_list_item && is_valid_inside_for_list_item(&inside) {
|
if !got_list_item && is_valid_inside_for_list_item(&inside) {
|
||||||
got_list_item = input.try(parse_list_item).is_ok();
|
got_list_item = input.try(parse_list_item).is_ok();
|
||||||
|
@ -724,6 +685,7 @@ impl SpecifiedValueInfo for Display {
|
||||||
"inline flow-root list-item",
|
"inline flow-root list-item",
|
||||||
"list-item",
|
"list-item",
|
||||||
"none",
|
"none",
|
||||||
|
"block ruby",
|
||||||
"ruby",
|
"ruby",
|
||||||
"ruby-base",
|
"ruby-base",
|
||||||
"ruby-base-container",
|
"ruby-base-container",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue