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

@ -73,6 +73,7 @@ use style::selector_parser::{PseudoElement, RestyleDamage};
use style::servo::restyle_damage::ServoRestyleDamage;
use style::values::computed::Image;
use style::values::generics::counters::ContentItem;
use style::LocalName;
/// The results of flow construction for a DOM node.
#[derive(Clone)]
@ -865,6 +866,15 @@ where
Box::new(UnscannedTextFragmentInfo::new(string.into(), None));
SpecificFragmentInfo::UnscannedText(info)
},
ContentItem::Attr(attr) => {
let element = node.as_element().expect("Expected an element");
let attr_val = element
.get_attr(&attr.namespace_url, &LocalName::from(&*attr.attribute));
let string = attr_val.map_or("".to_string(), |s| s.to_string());
let info =
Box::new(UnscannedTextFragmentInfo::new(string.into(), None));
SpecificFragmentInfo::UnscannedText(info)
},
content_item => {
let content_item =
Box::new(GeneratedContentInfo::ContentItem(content_item));

View file

@ -198,10 +198,6 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
RenderingMode::Suffix(".\u{00a0}"),
)
},
GeneratedContentInfo::Empty |
GeneratedContentInfo::ContentItem(ContentItem::String(_)) => {
// Nothing to do here.
},
GeneratedContentInfo::ContentItem(ContentItem::Counter(
ref counter_name,
counter_style,
@ -272,8 +268,11 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> {
self.traversal.quote -= 1
}
},
GeneratedContentInfo::Empty |
GeneratedContentInfo::ContentItem(ContentItem::String(_)) |
GeneratedContentInfo::ContentItem(ContentItem::Attr(_)) |
GeneratedContentInfo::ContentItem(ContentItem::Image(..)) => {
unreachable!("Servo doesn't parse content: url(..) nor image-set(..) yet")
// Nothing to do here.
},
}
};

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)?))
}),

View file

@ -1,2 +0,0 @@
[content-037.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-038.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-039.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-040.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-041.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-042.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-043.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-046.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-047.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-048.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-052.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-053.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-054.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-057.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-063.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-065.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-067.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-068.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-070.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-072.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-073.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-075.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-076.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-077.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-080.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-081.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-082.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-083.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-085.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-086.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-089.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-090.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-091.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-096.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-097.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-099.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-100.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-103.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-105.xht]
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-107.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-108.xht]
type: reftest
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-109.xht]
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-110.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-111.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-112.xht]
type: reftest
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-113.xht]
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-114.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-115.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-116.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-117.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-118.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-119.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[content-121.xht]
type: reftest
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-122.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-123.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-126.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-127.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-129.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-131.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-132.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-135.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-136.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-138.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-141.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-143.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-144.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-145.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-146.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-147.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-149.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-150.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-152.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-153.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[content-155.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[at-supports-namespace-001.html]
expected: FAIL

View file

@ -38,18 +38,6 @@
[CSS Transitions: property <text-decoration-style> from [initial\] to [dashed\] at (0.3) should be [initial\]]
expected: FAIL
[CSS Transitions: property <text-decoration-style> from [initial\] to [dashed\] at (0.5) should be [dashed\]]
expected: FAIL
[CSS Transitions: property <text-decoration-style> from [initial\] to [dashed\] at (0.6) should be [dashed\]]
expected: FAIL
[CSS Transitions: property <text-decoration-style> from [initial\] to [dashed\] at (1) should be [dashed\]]
expected: FAIL
[CSS Transitions: property <text-decoration-style> from [initial\] to [dashed\] at (1.5) should be [dashed\]]
expected: FAIL
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (-0.3) should be [dashed\]]
expected: FAIL
@ -59,39 +47,6 @@
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (0.3) should be [dashed\]]
expected: FAIL
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (0.5) should be [dashed\]]
expected: FAIL
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (0.6) should be [dashed\]]
expected: FAIL
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (1) should be [dashed\]]
expected: FAIL
[CSS Transitions with transition: all: property <text-decoration-style> from [initial\] to [dashed\] at (1.5) should be [dashed\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (-0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (0) should be [initial\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (0.5) should be [dashed\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (0.6) should be [dashed\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (1) should be [dashed\]]
expected: FAIL
[CSS Animations: property <text-decoration-style> from [initial\] to [dashed\] at (1.5) should be [dashed\]]
expected: FAIL
[Web Animations: property <text-decoration-style> from [initial\] to [dashed\] at (-0.3) should be [initial\]]
expected: FAIL

View file

@ -5,18 +5,12 @@
[Property text-emphasis-style has initial value none]
expected: FAIL
[Property text-decoration-style has initial value solid]
expected: FAIL
[Property text-underline-position has initial value auto]
expected: FAIL
[Property text-emphasis-color has initial value rgba(2, 3, 4, 0.5)]
expected: FAIL
[Property text-decoration-color has initial value rgba(2, 3, 4, 0.5)]
expected: FAIL
[Property text-decoration-skip-ink inherits]
expected: FAIL
@ -29,15 +23,9 @@
[Property text-emphasis-position inherits]
expected: FAIL
[Property text-decoration-color does not inherit]
expected: FAIL
[Property text-emphasis-position has initial value over right]
expected: FAIL
[Property text-decoration-style does not inherit]
expected: FAIL
[Property text-emphasis-color inherits]
expected: FAIL

View file

@ -7,13 +7,3 @@
[Property text-decoration-color value 'rgb(0, 0, 255)' computes to 'rgb(0, 0, 255)']
expected: FAIL
[Property text-decoration-color value 'inherit']
expected: FAIL
[Property text-decoration-color value 'rgb(0, 0, 255)']
expected: FAIL
[Property text-decoration-color value 'currentcolor']
expected: FAIL

View file

@ -1,10 +0,0 @@
[text-decoration-color-valid.html]
[e.style['text-decoration-color'\] = "currentcolor" should set the property value]
expected: FAIL
[e.style['text-decoration-color'\] = "red" should set the property value]
expected: FAIL
[e.style['text-decoration-color'\] = "rgba(10, 20, 30, 0.4)" should set the property value]
expected: FAIL

View file

@ -13,19 +13,3 @@
[Property text-decoration-style value 'dashed' computes to 'dashed']
expected: FAIL
[Property text-decoration-style value 'wavy']
expected: FAIL
[Property text-decoration-style value 'double']
expected: FAIL
[Property text-decoration-style value 'dashed']
expected: FAIL
[Property text-decoration-style value 'dotted']
expected: FAIL
[Property text-decoration-style value 'solid']
expected: FAIL

View file

@ -1,16 +0,0 @@
[text-decoration-style-valid.html]
[e.style['text-decoration-style'\] = "wavy" should set the property value]
expected: FAIL
[e.style['text-decoration-style'\] = "solid" should set the property value]
expected: FAIL
[e.style['text-decoration-style'\] = "dotted" should set the property value]
expected: FAIL
[e.style['text-decoration-style'\] = "double" should set the property value]
expected: FAIL
[e.style['text-decoration-style'\] = "dashed" should set the property value]
expected: FAIL

View file

@ -1,2 +0,0 @@
[variable-generated-content-dynamic-001.html]
expected: FAIL

View file

@ -106,6 +106,3 @@
[Testing 'writing-mode'.]
expected: FAIL
[Testing 'text-decoration-style'.]
expected: FAIL

View file

@ -1,19 +1,7 @@
[serialize-values.html]
[content: url("http://localhost/")]
expected: FAIL
[content: url(http://localhost/)]
expected: FAIL
[content: counter(par-num, upper-roman)]
expected: FAIL
[content: attr(foo-bar)]
expected: FAIL
[content: attr(foo_bar)]
expected: FAIL
[list-style-type: decimal-leading-zero]
expected: FAIL

View file

@ -745,3 +745,18 @@
[Flex items blockified ("<div style='display:flex'><span>1</span><span>2</span></div>")]
expected: FAIL
[display:contents container ("<div style='display:contents'>abc")]
expected: FAIL
[display:contents container ("<div><div style='display:contents'>abc")]
expected: FAIL
[display:contents rendered ("<div>123<span style='display:contents'>abc")]
expected: FAIL
[display:contents not processed via textContent ("<div style='display:contents'> ")]
expected: FAIL
[display:contents not processed via textContent ("<div><div style='display:contents'> ")]
expected: FAIL

View file

@ -32,9 +32,6 @@
[fieldset with display: ruby]
expected: FAIL
[fieldset with display: flow-root]
expected: FAIL
[fieldset with display: ruby-base]
expected: FAIL
@ -58,4 +55,3 @@
[fieldset with display: block ruby]
expected: FAIL

View file

@ -5,9 +5,6 @@
[rendered legend with display: ruby-text-container]
expected: FAIL
[rendered legend with display: flow-root]
expected: FAIL
[rendered legend with display: table-column-group]
expected: FAIL
@ -116,9 +113,6 @@
[rendered legend with display: ruby-text-container; columns:1]
expected: FAIL
[rendered legend with display: flow-root; overflow:hidden;columns:1]
expected: FAIL
[rendered legend with display: ruby-base; overflow:hidden;columns:1]
expected: FAIL
@ -152,9 +146,6 @@
[rendered legend with display: table-row; overflow:hidden;columns:1]
expected: FAIL
[rendered legend with display: flow-root; overflow:hidden]
expected: FAIL
[rendered legend with display: inline-grid; columns:1]
expected: FAIL
@ -206,9 +197,6 @@
[rendered legend with display: table-column; columns:1]
expected: FAIL
[rendered legend with display: flow-root; columns:1]
expected: FAIL
[rendered legend with display: table-caption; columns:1]
expected: FAIL
@ -286,4 +274,3 @@
[rendered legend with display: table-cell; overflow:hidden]
expected: FAIL

View file

@ -1,7 +1,4 @@
[computed-style.html]
[computed display of <input type=color> with display: flow-root]
expected: FAIL
[computed display of <input type=submit> with display: ruby]
expected: FAIL
@ -53,9 +50,6 @@
[computed display of <button type=submit> with display: ruby-text]
expected: FAIL
[computed display of <button type=submit> with display: flow-root]
expected: FAIL
[computed display of <input type=submit> with display: contents]
expected: FAIL
@ -77,9 +71,6 @@
[computed display of <input type=color> with display: ruby]
expected: FAIL
[computed display of <input type=submit> with display: flow-root]
expected: FAIL
[computed display of <input type=color> with display: inline-grid]
expected: FAIL
@ -92,9 +83,6 @@
[computed display of <input type=reset> with display: contents]
expected: FAIL
[computed display of <input type=button> with display: flow-root]
expected: FAIL
[computed display of <input type=color> with display: ruby-base]
expected: FAIL
@ -110,18 +98,12 @@
[computed display of <input type=submit> with display: ruby-base]
expected: FAIL
[computed display of <input type=reset> with display: flow-root]
expected: FAIL
[computed display of <input type=button> with display: contents]
expected: FAIL
[computed display of <input type=submit> with display: ruby-text]
expected: FAIL
[computed display of <button type=submit> with display: contents]
expected: FAIL
[computed display of <input type=reset> with display: ruby-text]
expected: FAIL

View file

@ -20,9 +20,6 @@
[display: table]
expected: FAIL
[display: flow-root]
expected: FAIL
[display: ruby-text-container]
expected: FAIL
@ -49,4 +46,3 @@
[display: table-row]
expected: FAIL

View file

@ -5,9 +5,6 @@
[Property clip-path does not support quirky length]
expected: FAIL
[Property column-span does not support quirky length]
expected: FAIL
[Property mask does not support quirky length]
expected: FAIL