style: Fix formatting of recent changes.

This commit is contained in:
Emilio Cobos Álvarez 2019-08-15 15:41:34 +02:00
parent cea6966fd2
commit 4d8fc4b8f7
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
9 changed files with 157 additions and 160 deletions

View file

@ -187,8 +187,9 @@ impl PseudoElement {
PseudoElement::FirstLine => PropertyFlags::APPLIES_TO_FIRST_LINE, PseudoElement::FirstLine => PropertyFlags::APPLIES_TO_FIRST_LINE,
PseudoElement::Placeholder => PropertyFlags::APPLIES_TO_PLACEHOLDER, PseudoElement::Placeholder => PropertyFlags::APPLIES_TO_PLACEHOLDER,
PseudoElement::Cue => PropertyFlags::APPLIES_TO_CUE, PseudoElement::Cue => PropertyFlags::APPLIES_TO_CUE,
PseudoElement::Marker if static_prefs::pref!("layout.css.marker.restricted") => PseudoElement::Marker if static_prefs::pref!("layout.css.marker.restricted") => {
PropertyFlags::APPLIES_TO_MARKER, PropertyFlags::APPLIES_TO_MARKER
},
_ => return None, _ => return None,
}) })
} }

View file

@ -8,12 +8,12 @@
use crate::dom::TElement; use crate::dom::TElement;
use crate::properties::computed_value_flags::ComputedValueFlags; use crate::properties::computed_value_flags::ComputedValueFlags;
use crate::properties::longhands::display::computed_value::T as Display; use crate::properties::longhands::display::computed_value::T as Display;
#[cfg(feature = "gecko")]
use crate::values::specified::box_::DisplayInside;
use crate::properties::longhands::float::computed_value::T as Float; use crate::properties::longhands::float::computed_value::T as Float;
use crate::properties::longhands::overflow_x::computed_value::T as Overflow; use crate::properties::longhands::overflow_x::computed_value::T as Overflow;
use crate::properties::longhands::position::computed_value::T as Position; use crate::properties::longhands::position::computed_value::T as Position;
use crate::properties::{self, ComputedValues, StyleBuilder}; use crate::properties::{self, ComputedValues, StyleBuilder};
#[cfg(feature = "gecko")]
use crate::values::specified::box_::DisplayInside;
use app_units::Au; use app_units::Au;
/// A struct that implements all the adjustment methods. /// A struct that implements all the adjustment methods.
@ -209,8 +209,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
blockify_if!( blockify_if!(
self.style.pseudo.map_or(false, |p| p.is_marker()) && self.style.pseudo.map_or(false, |p| p.is_marker()) &&
self.style.get_parent_list().clone_list_style_position() == ListStylePosition::Outside && self.style.get_parent_list().clone_list_style_position() ==
layout_parent_style.get_box().clone_display().inside() != DisplayInside::Inline); ListStylePosition::Outside &&
layout_parent_style.get_box().clone_display().inside() != DisplayInside::Inline
);
if !blockify { if !blockify {
return; return;

View file

@ -76,10 +76,10 @@ pub use self::svg::MozContextProperties;
pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::table::XSpan; pub use self::table::XSpan;
pub use self::text::{TextDecorationLength, TextDecorationSkipInk};
pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight}; pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight};
pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing}; pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing};
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle}; pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
pub use self::text::{TextDecorationLength, TextDecorationSkipInk};
pub use self::time::Time; pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation}; pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
pub use self::transform::{TransformOrigin, TransformStyle, Translate}; pub use self::transform::{TransformOrigin, TransformStyle, Translate};

View file

@ -10,7 +10,7 @@ use crate::values::computed::length::{Length, LengthPercentage};
use crate::values::computed::{Context, NonNegativeLength, NonNegativeNumber, ToComputedValue}; use crate::values::computed::{Context, NonNegativeLength, NonNegativeNumber, ToComputedValue};
use crate::values::generics::text::InitialLetter as GenericInitialLetter; use crate::values::generics::text::InitialLetter as GenericInitialLetter;
use crate::values::generics::text::LineHeight as GenericLineHeight; use crate::values::generics::text::LineHeight as GenericLineHeight;
use crate::values::generics::text::{Spacing, GenericTextDecorationLength}; use crate::values::generics::text::{GenericTextDecorationLength, Spacing};
use crate::values::specified::text::{self as specified, TextOverflowSide}; use crate::values::specified::text::{self as specified, TextOverflowSide};
use crate::values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword}; use crate::values::specified::text::{TextEmphasisFillMode, TextEmphasisShapeKeyword};
use crate::values::{CSSFloat, CSSInteger}; use crate::values::{CSSFloat, CSSInteger};

View file

@ -419,7 +419,7 @@ impl Parse for RepeatCount<specified::Integer> {
if i.value() > MAX_GRID_LINE { if i.value() > MAX_GRID_LINE {
i = specified::Integer::new(MAX_GRID_LINE); i = specified::Integer::new(MAX_GRID_LINE);
} }
return Ok(RepeatCount::Number(i)) return Ok(RepeatCount::Number(i));
} }
try_match_ident_ignore_ascii_case! { input, try_match_ident_ignore_ascii_case! { input,
"auto-fill" => Ok(RepeatCount::AutoFill), "auto-fill" => Ok(RepeatCount::AutoFill),
@ -527,7 +527,16 @@ impl<L, I> TrackListValue<L, I> {
/// A grid `<track-list>` type. /// A grid `<track-list>` type.
/// ///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list> /// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] #[derive(
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)]
#[repr(C)] #[repr(C)]
pub struct GenericTrackList<LengthPercentage, Integer> { pub struct GenericTrackList<LengthPercentage, Integer> {
/// The index in `values` where our `<auto-repeat>` value is, if in bounds. /// The index in `values` where our `<auto-repeat>` value is, if in bounds.

View file

@ -51,18 +51,7 @@ fn parse_unimplemented_in_servo_2020(_context: &ParserContext) -> bool {
/// the two basic qualities of how an element generates boxes /// the two basic qualities of how an element generates boxes
/// <https://drafts.csswg.org/css-display/#propdef-display> /// <https://drafts.csswg.org/css-display/#propdef-display>
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive( #[derive(Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, PartialEq, ToCss, ToShmem)]
MallocSizeOf,
ToShmem,
Clone,
Copy,
Debug,
Eq,
FromPrimitive,
Hash,
PartialEq,
ToCss,
)]
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
#[repr(u8)] #[repr(u8)]
pub enum DisplayOutside { pub enum DisplayOutside {
@ -76,18 +65,7 @@ pub enum DisplayOutside {
} }
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive( #[derive(Clone, Copy, Debug, Eq, FromPrimitive, Hash, MallocSizeOf, PartialEq, ToCss, ToShmem)]
MallocSizeOf,
ToShmem,
Clone,
Copy,
Debug,
Eq,
FromPrimitive,
Hash,
PartialEq,
ToCss,
)]
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
#[repr(u8)] #[repr(u8)]
pub enum DisplayInside { pub enum DisplayInside {
@ -150,68 +128,85 @@ pub struct Display(u16);
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
impl Display { impl Display {
// Our u16 bits are used as follows: LOOOOOOOIIIIIIII // Our u16 bits are used as follows: LOOOOOOOIIIIIIII
const LIST_ITEM_BIT : u16 = 0x8000; //^ const LIST_ITEM_BIT: u16 = 0x8000; //^
const DISPLAY_OUTSIDE_BITS : u16 = 7; // ^^^^^^^ const DISPLAY_OUTSIDE_BITS: u16 = 7; // ^^^^^^^
const DISPLAY_INSIDE_BITS : u16 = 8; // ^^^^^^^^ const DISPLAY_INSIDE_BITS: u16 = 8; // ^^^^^^^^
/// https://drafts.csswg.org/css-display/#the-display-properties /// https://drafts.csswg.org/css-display/#the-display-properties
pub const None : Self = Self::new(DisplayOutside::None, DisplayInside::None); pub const None: Self = Self::new(DisplayOutside::None, DisplayInside::None);
pub const Contents : Self = Self::new(DisplayOutside::None, DisplayInside::Contents); pub const Contents: Self = Self::new(DisplayOutside::None, DisplayInside::Contents);
pub const Inline : Self = Self::new(DisplayOutside::Inline, DisplayInside::Inline); pub const Inline: Self = Self::new(DisplayOutside::Inline, DisplayInside::Inline);
pub const InlineBlock : Self = Self::new(DisplayOutside::Inline, DisplayInside::FlowRoot); pub const InlineBlock: Self = Self::new(DisplayOutside::Inline, DisplayInside::FlowRoot);
pub const Block : Self = Self::new(DisplayOutside::Block, DisplayInside::Block); pub const Block: Self = Self::new(DisplayOutside::Block, DisplayInside::Block);
pub const FlowRoot : Self = Self::new(DisplayOutside::Block, DisplayInside::FlowRoot); pub const FlowRoot: Self = Self::new(DisplayOutside::Block, DisplayInside::FlowRoot);
pub const Flex : Self = Self::new(DisplayOutside::Block, DisplayInside::Flex); pub const Flex: Self = Self::new(DisplayOutside::Block, DisplayInside::Flex);
pub const InlineFlex : Self = Self::new(DisplayOutside::Inline, DisplayInside::Flex); pub const InlineFlex: Self = Self::new(DisplayOutside::Inline, DisplayInside::Flex);
pub const Grid : Self = Self::new(DisplayOutside::Block, DisplayInside::Grid); pub const Grid: Self = Self::new(DisplayOutside::Block, DisplayInside::Grid);
pub const InlineGrid : Self = Self::new(DisplayOutside::Inline, DisplayInside::Grid); pub const InlineGrid: Self = Self::new(DisplayOutside::Inline, DisplayInside::Grid);
pub const Table : Self = Self::new(DisplayOutside::Block, DisplayInside::Table); pub const Table: Self = Self::new(DisplayOutside::Block, DisplayInside::Table);
pub const InlineTable : Self = Self::new(DisplayOutside::Inline, DisplayInside::Table); pub const InlineTable: Self = Self::new(DisplayOutside::Inline, DisplayInside::Table);
pub const TableCaption : Self = Self::new(DisplayOutside::TableCaption, DisplayInside::Block); pub const TableCaption: Self = Self::new(DisplayOutside::TableCaption, DisplayInside::Block);
pub const Ruby : Self = Self::new(DisplayOutside::Inline, DisplayInside::Ruby); pub const Ruby: Self = Self::new(DisplayOutside::Inline, DisplayInside::Ruby);
pub const WebkitBox : Self = Self::new(DisplayOutside::Block, DisplayInside::WebkitBox); pub const WebkitBox: Self = Self::new(DisplayOutside::Block, DisplayInside::WebkitBox);
pub const WebkitInlineBox : Self = Self::new(DisplayOutside::Inline, DisplayInside::WebkitBox); pub const WebkitInlineBox: Self = Self::new(DisplayOutside::Inline, DisplayInside::WebkitBox);
pub const ListItem : Self = Self::new_list_item(DisplayOutside::Block, DisplayInside::Block); pub const ListItem: Self = Self::new_list_item(DisplayOutside::Block, DisplayInside::Block);
/// Internal table boxes. /// Internal table boxes.
pub const TableRowGroup : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableRowGroup); pub const TableRowGroup: Self =
pub const TableHeaderGroup : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableHeaderGroup); Self::new(DisplayOutside::InternalTable, DisplayInside::TableRowGroup);
pub const TableFooterGroup : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableFooterGroup); pub const TableHeaderGroup: Self = Self::new(
pub const TableColumn : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableColumn); DisplayOutside::InternalTable,
pub const TableColumnGroup : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableColumnGroup); DisplayInside::TableHeaderGroup,
pub const TableRow : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableRow); );
pub const TableCell : Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableCell); pub const TableFooterGroup: Self = Self::new(
DisplayOutside::InternalTable,
DisplayInside::TableFooterGroup,
);
pub const TableColumn: Self =
Self::new(DisplayOutside::InternalTable, DisplayInside::TableColumn);
pub const TableColumnGroup: Self = Self::new(
DisplayOutside::InternalTable,
DisplayInside::TableColumnGroup,
);
pub const TableRow: Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableRow);
pub const TableCell: Self = Self::new(DisplayOutside::InternalTable, DisplayInside::TableCell);
/// Internal ruby boxes. /// Internal ruby boxes.
pub const RubyBase : Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyBase); pub const RubyBase: Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyBase);
pub const RubyBaseContainer : Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyBaseContainer); pub const RubyBaseContainer: Self = Self::new(
pub const RubyText : Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyText); DisplayOutside::InternalRuby,
pub const RubyTextContainer : Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyTextContainer); DisplayInside::RubyBaseContainer,
);
pub const RubyText: Self = Self::new(DisplayOutside::InternalRuby, DisplayInside::RubyText);
pub const RubyTextContainer: Self = Self::new(
DisplayOutside::InternalRuby,
DisplayInside::RubyTextContainer,
);
/// XUL boxes. /// XUL boxes.
pub const MozBox : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozBox); pub const MozBox: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozBox);
pub const MozInlineBox : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineBox); pub const MozInlineBox: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineBox);
pub const MozGrid : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGrid); pub const MozGrid: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGrid);
pub const MozInlineGrid : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineGrid); pub const MozInlineGrid: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineGrid);
pub const MozGridGroup : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGridGroup); pub const MozGridGroup: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGridGroup);
pub const MozGridLine : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGridLine); pub const MozGridLine: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGridLine);
pub const MozStack : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozStack); pub const MozStack: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozStack);
pub const MozInlineStack : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineStack); pub const MozInlineStack: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozInlineStack);
pub const MozDeck : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozDeck); pub const MozDeck: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozDeck);
pub const MozGroupbox : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGroupbox); pub const MozGroupbox: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozGroupbox);
pub const MozPopup : Self = Self::new(DisplayOutside::XUL, DisplayInside::MozPopup); pub const MozPopup: Self = Self::new(DisplayOutside::XUL, DisplayInside::MozPopup);
/// Make a raw display value from <display-outside> and <display-inside> values. /// Make a raw display value from <display-outside> and <display-inside> values.
#[inline] #[inline]
const fn new(outside:DisplayOutside, inside:DisplayInside) -> Self { const fn new(outside: DisplayOutside, inside: DisplayInside) -> Self {
let o : u16 = ((outside as u8) as u16) << Self::DISPLAY_INSIDE_BITS; let o: u16 = ((outside as u8) as u16) << Self::DISPLAY_INSIDE_BITS;
let i : u16 = (inside as u8) as u16; let i: u16 = (inside as u8) as u16;
Self(o | i) Self(o | i)
} }
/// Make a list-item display value from <display-outside> and <display-inside>. /// Make a list-item display value from <display-outside> and <display-inside>.
#[inline] #[inline]
const fn new_list_item(outside:DisplayOutside, inside:DisplayInside) -> Self { const fn new_list_item(outside: DisplayOutside, inside: DisplayInside) -> Self {
let v = Self::new(outside, inside); let v = Self::new(outside, inside);
Self(v.0 | Self::LIST_ITEM_BIT) Self(v.0 | Self::LIST_ITEM_BIT)
} }
@ -220,7 +215,7 @@ impl Display {
/// We store `flow` as a synthetic `block` or `inline` inside-value to simplify /// We store `flow` as a synthetic `block` or `inline` inside-value to simplify
/// our layout code. /// our layout code.
#[inline] #[inline]
fn from3(outside:DisplayOutside, inside:DisplayInside, list_item:bool) -> Self { fn from3(outside: DisplayOutside, inside: DisplayInside, list_item: bool) -> Self {
let inside = match inside { let inside = match inside {
DisplayInside::Flow => match outside { DisplayInside::Flow => match outside {
DisplayOutside::Inline => DisplayInside::Inline, DisplayOutside::Inline => DisplayInside::Inline,
@ -245,8 +240,9 @@ impl Display {
#[inline] #[inline]
pub fn outside(&self) -> DisplayOutside { pub fn outside(&self) -> DisplayOutside {
DisplayOutside::from_u16( DisplayOutside::from_u16(
(self.0 >> Self::DISPLAY_INSIDE_BITS) & ((1 << Self::DISPLAY_OUTSIDE_BITS) - 1) (self.0 >> Self::DISPLAY_INSIDE_BITS) & ((1 << Self::DISPLAY_OUTSIDE_BITS) - 1),
).unwrap() )
.unwrap()
} }
/// Returns whether this `display` value is some kind of list-item. /// Returns whether this `display` value is some kind of list-item.
@ -403,7 +399,7 @@ impl Display {
} }
match self.outside() { match self.outside() {
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,
inside => inside, inside => inside,
}; };
@ -443,12 +439,10 @@ impl Display {
}; };
Display::from3(DisplayOutside::Inline, inside, self.is_list_item()) Display::from3(DisplayOutside::Inline, inside, self.is_list_item())
}, },
DisplayOutside::XUL => { DisplayOutside::XUL => match self.inside() {
match self.inside() { DisplayInside::MozBox => Display::MozInlineBox,
DisplayInside::MozBox => Display::MozInlineBox, DisplayInside::MozStack => Display::MozInlineStack,
DisplayInside::MozStack => Display::MozInlineStack, _ => *self,
_ => *self,
}
}, },
_ => *self, _ => *self,
} }
@ -477,8 +471,11 @@ impl ToCss for Display {
where where
W: fmt::Write, W: fmt::Write,
{ {
debug_assert_ne!(self.inside(), DisplayInside::Flow, debug_assert_ne!(
"`flow` never appears in `display` computed value"); self.inside(),
DisplayInside::Flow,
"`flow` never appears in `display` computed value"
);
let outside = self.outside(); let outside = self.outside();
let inside = match self.inside() { let inside = match self.inside() {
DisplayInside::Block | DisplayInside::Inline => DisplayInside::Flow, DisplayInside::Block | DisplayInside::Inline => DisplayInside::Flow,
@ -499,10 +496,8 @@ impl ToCss for Display {
(DisplayOutside::Inline, DisplayInside::Table) => { (DisplayOutside::Inline, DisplayInside::Table) => {
dest.write_str("inline-")?; dest.write_str("inline-")?;
inside.to_css(dest) inside.to_css(dest)
} },
(DisplayOutside::Block, DisplayInside::Ruby) => { (DisplayOutside::Block, DisplayInside::Ruby) => dest.write_str("block ruby"),
dest.write_str("block ruby")
}
(_, inside) => { (_, inside) => {
if self.is_list_item() { if self.is_list_item() {
if outside != DisplayOutside::Block { if outside != DisplayOutside::Block {
@ -517,8 +512,8 @@ impl ToCss for Display {
} else { } else {
inside.to_css(dest) inside.to_css(dest)
} }
} },
} },
} }
} }
} }
@ -565,17 +560,16 @@ fn parse_display_inside_for_list_item<'i, 't>(
} }
/// Test a <display-inside> Result for same values as above. /// Test a <display-inside> Result for same values as above.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
fn is_valid_inside_for_list_item<'i>( fn is_valid_inside_for_list_item<'i>(inside: &Result<DisplayInside, ParseError<'i>>) -> bool {
inside: &Result<DisplayInside, ParseError<'i>>, matches!(
) -> bool { inside,
matches!(inside, Ok(DisplayInside::Flow) | Ok(DisplayInside::FlowRoot)) Ok(DisplayInside::Flow) | Ok(DisplayInside::FlowRoot)
)
} }
/// Parse `list-item`. /// Parse `list-item`.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
fn parse_list_item<'i, 't>( fn parse_list_item<'i, 't>(input: &mut Parser<'i, 't>) -> Result<(), ParseError<'i>> {
input: &mut Parser<'i, 't>,
) -> Result<(), ParseError<'i>> {
Ok(try_match_ident_ignore_ascii_case! { input, Ok(try_match_ident_ignore_ascii_case! { input,
"list-item" => (), "list-item" => (),
}) })
@ -617,15 +611,13 @@ impl Parse for Display {
} }
if got_list_item || inside.is_ok() || outside.is_ok() { if got_list_item || inside.is_ok() || outside.is_ok() {
let inside = inside.unwrap_or(DisplayInside::Flow); let inside = inside.unwrap_or(DisplayInside::Flow);
let outside = outside.unwrap_or( let outside = outside.unwrap_or(match inside {
match inside { // "If <display-outside> is omitted, the elements outside display type
// "If <display-outside> is omitted, the elements outside display type // defaults to block — except for ruby, which defaults to inline."
// defaults to block — except for ruby, which defaults to inline." // https://drafts.csswg.org/css-display/#inside-model
// https://drafts.csswg.org/css-display/#inside-model DisplayInside::Ruby => DisplayOutside::Inline,
DisplayInside::Ruby => DisplayOutside::Inline, _ => DisplayOutside::Block,
_ => DisplayOutside::Block, });
}
);
return Ok(Display::from3(outside, inside, got_list_item)); return Ok(Display::from3(outside, inside, got_list_item));
} }
@ -671,38 +663,39 @@ impl Parse for Display {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
impl SpecifiedValueInfo for Display { impl SpecifiedValueInfo for Display {
fn collect_completion_keywords(f: KeywordsCollectFn) { fn collect_completion_keywords(f: KeywordsCollectFn) {
f(&["block", f(&[
"contents", "block",
"flex", "contents",
"flow-root", "flex",
"grid", "flow-root",
"inline", "grid",
"inline-block", "inline",
"inline-flex", "inline-block",
"inline-grid", "inline-flex",
"inline-table", "inline-grid",
"inline list-item", "inline-table",
"inline flow-root list-item", "inline list-item",
"list-item", "inline flow-root list-item",
"none", "list-item",
"block ruby", "none",
"ruby", "block ruby",
"ruby-base", "ruby",
"ruby-base-container", "ruby-base",
"ruby-text", "ruby-base-container",
"ruby-text-container", "ruby-text",
"table", "ruby-text-container",
"table-caption", "table",
"table-cell", "table-caption",
"table-column", "table-cell",
"table-column-group", "table-column",
"table-footer-group", "table-column-group",
"table-header-group", "table-footer-group",
"table-row", "table-header-group",
"table-row-group", "table-row",
"-webkit-box", "table-row-group",
"-webkit-inline-box", "-webkit-box",
]); "-webkit-inline-box",
]);
} }
} }

View file

@ -169,8 +169,7 @@ impl TrackRepeat<LengthPercentage, Integer> {
let mut current_names; let mut current_names;
loop { loop {
current_names = current_names = input.try(parse_line_names).unwrap_or_default();
input.try(parse_line_names).unwrap_or_default();
if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) { if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) {
if !track_size.is_fixed() { if !track_size.is_fixed() {
if is_auto { if is_auto {
@ -193,11 +192,7 @@ impl TrackRepeat<LengthPercentage, Integer> {
// one `TrackSize`. But in current version of the spec, this is deprecated // one `TrackSize`. But in current version of the spec, this is deprecated
// but we are adding this for gecko parity. We should remove this when // but we are adding this for gecko parity. We should remove this when
// gecko implements new spec. // gecko implements new spec.
names.push( names.push(input.try(parse_line_names).unwrap_or_default());
input
.try(parse_line_names)
.unwrap_or_default()
);
break; break;
} }
} else { } else {
@ -239,11 +234,7 @@ impl Parse for TrackList<LengthPercentage, Integer> {
// assume that everything is <fixed-size>. This flag is useful when we encounter <auto-repeat> // assume that everything is <fixed-size>. This flag is useful when we encounter <auto-repeat>
let mut at_least_one_not_fixed = false; let mut at_least_one_not_fixed = false;
loop { loop {
current_names.extend_from_slice( current_names.extend_from_slice(&mut input.try(parse_line_names).unwrap_or_default());
&mut input
.try(parse_line_names)
.unwrap_or_default()
);
if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) { if let Ok(track_size) = input.try(|i| TrackSize::parse(context, i)) {
if !track_size.is_fixed() { if !track_size.is_fixed() {
at_least_one_not_fixed = true; at_least_one_not_fixed = true;

View file

@ -12,7 +12,7 @@ use crate::values::computed::text::TextOverflow as ComputedTextOverflow;
use crate::values::computed::{Context, ToComputedValue}; use crate::values::computed::{Context, ToComputedValue};
use crate::values::generics::text::InitialLetter as GenericInitialLetter; use crate::values::generics::text::InitialLetter as GenericInitialLetter;
use crate::values::generics::text::LineHeight as GenericLineHeight; use crate::values::generics::text::LineHeight as GenericLineHeight;
use crate::values::generics::text::{Spacing, GenericTextDecorationLength}; use crate::values::generics::text::{GenericTextDecorationLength, Spacing};
use crate::values::specified::length::NonNegativeLengthPercentage; use crate::values::specified::length::NonNegativeLengthPercentage;
use crate::values::specified::length::{FontRelativeLength, Length}; use crate::values::specified::length::{FontRelativeLength, Length};
use crate::values::specified::length::{LengthPercentage, NoCalcLength}; use crate::values::specified::length::{LengthPercentage, NoCalcLength};
@ -1053,6 +1053,6 @@ impl TextDecorationLength {
/// Whether this is the `Auto` value. /// Whether this is the `Auto` value.
#[inline] #[inline]
pub fn is_auto(&self) -> bool { pub fn is_auto(&self) -> bool {
matches!(*self, GenericTextDecorationLength::Auto) matches!(*self, GenericTextDecorationLength::Auto)
} }
} }

View file

@ -56,6 +56,7 @@ files = [
"./components/net/tests/parsable_mime/text", "./components/net/tests/parsable_mime/text",
# Mako does not lend itself easily to splitting long lines # Mako does not lend itself easily to splitting long lines
"./components/style/properties/helpers/animated_properties.mako.rs", "./components/style/properties/helpers/animated_properties.mako.rs",
"./components/style/properties/shorthands/text.mako.rs",
# Long regexes are long. # Long regexes are long.
"./components/style/gecko/regen_atoms.py", "./components/style/gecko/regen_atoms.py",
# Helper macro where actually a pseudo-element per line makes sense. # Helper macro where actually a pseudo-element per line makes sense.