Make Layout 2013 style a superset of Layout 2020 style

This is the first step toward removing the compile-time difference in
style between Layout 2020 and Layout 2013.
This commit is contained in:
Martin Robinson 2023-06-27 21:43:56 +02:00
parent a725380db0
commit d4b5fc1f65
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
97 changed files with 32 additions and 349 deletions

View file

@ -67,7 +67,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"column-span",
"none all",
engines="gecko servo-2020",
engines="gecko servo-2013 servo-2020",
servo_2020_pref="layout.2020.unimplemented",
animation_value_type="discrete",
gecko_enum_prefix="StyleColumnSpan",

View file

@ -41,7 +41,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"text-decoration-style",
"solid double dotted dashed wavy -moz-none",
engines="gecko servo-2020",
engines="gecko servo-2013 servo-2020",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style",
)}
@ -50,7 +50,7 @@ ${helpers.predefined_type(
"text-decoration-color",
"Color",
"computed_value::T::currentcolor()",
engines="gecko servo-2020",
engines="gecko servo-2013 servo-2020",
initial_specified_value="specified::Color::currentcolor()",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,

View file

@ -8,7 +8,6 @@
use crate::computed_values::list_style_type::T as ListStyleType;
#[cfg(feature = "gecko")]
use crate::values::generics::CounterStyle;
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
use crate::values::specified::Attr;
use crate::values::CustomIdent;
use std::fmt::{self, Write};
@ -272,7 +271,6 @@ pub enum GenericContentItem<I> {
#[cfg(feature = "gecko")]
MozAltContent,
/// `attr([namespace? `|`]? ident)`
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
Attr(Attr),
/// image-set(url) | url(url)
Image(I),

View file

@ -72,7 +72,6 @@ pub enum DisplayOutside {
#[repr(u8)]
pub enum DisplayInside {
None = 0,
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
Contents,
Flow,
FlowRoot,
@ -142,7 +141,6 @@ impl Display {
/// https://drafts.csswg.org/css-display/#the-display-properties
pub const None: Self = Self::new(DisplayOutside::None, DisplayInside::None);
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
pub const Contents: Self = Self::new(DisplayOutside::None, DisplayInside::Contents);
pub const Inline: Self = Self::new(DisplayOutside::Inline, DisplayInside::Flow);
pub const InlineBlock: Self = Self::new(DisplayOutside::Inline, DisplayInside::FlowRoot);
@ -352,7 +350,6 @@ impl Display {
///
/// Also used for :root style adjustments.
pub fn equivalent_block_display(&self, _is_root_element: bool) -> Self {
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
{
// Special handling for `contents` and `list-item`s on the root element.
if _is_root_element && (self.is_contents() || self.is_list_item()) {
@ -398,7 +395,6 @@ impl Display {
#[inline]
pub fn is_contents(&self) -> bool {
match *self {
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
Display::Contents => true,
_ => false,
}
@ -463,7 +459,6 @@ fn parse_display_inside<'i, 't>(
Ok(try_match_ident_ignore_ascii_case! { input,
"flow" => DisplayInside::Flow,
"flex" if flexbox_enabled() => DisplayInside::Flex,
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
"flow-root" => DisplayInside::FlowRoot,
#[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]
"table" => DisplayInside::Table,
@ -562,7 +557,6 @@ impl Parse for Display {
// Now parse the single-keyword `display` values.
Ok(try_match_ident_ignore_ascii_case! { input,
"none" => Display::None,
#[cfg(any(feature = "servo-layout-2020", feature = "gecko"))]
"contents" => Display::Contents,
"inline-block" => Display::InlineBlock,
#[cfg(any(feature = "servo-layout-2013", feature = "gecko"))]

View file

@ -12,7 +12,6 @@ use crate::values::generics::counters::CounterPair;
#[cfg(feature = "gecko")]
use crate::values::generics::CounterStyle;
use crate::values::specified::image::Image;
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
use crate::values::specified::Attr;
use crate::values::specified::Integer;
use crate::values::CustomIdent;
@ -202,7 +201,6 @@ impl Parse for Content {
let mut content = vec![];
let mut has_alt_content = false;
loop {
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
{
if let Ok(image) = input.try_parse(|i| Image::parse_only_url(context, i)) {
content.push(generics::ContentItem::Image(image));
@ -233,7 +231,6 @@ impl Parse for Content {
let style = Content::parse_counter_style(context, input);
Ok(generics::ContentItem::Counters(name, separator, style))
}),
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
"attr" => input.parse_nested_block(|input| {
Ok(generics::ContentItem::Attr(Attr::parse_function(context, input)?))
}),