Revert "Backport several style changes from Gecko (5) (#30099)" (#30104)

This reverts commit 8e15389cae.
This commit is contained in:
Oriol Brufau 2023-08-16 08:24:42 +02:00 committed by GitHub
parent 8e15389cae
commit d6ae8dc112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
152 changed files with 4622 additions and 5862 deletions

View file

@ -21,6 +21,7 @@ servo_arc = {path = "../../../components/servo_arc"}
servo_atoms = {path = "../../../components/atoms"}
servo_config = {path = "../../../components/config"}
servo_url = {path = "../../../components/url"}
size_of_test = {path = "../../../components/size_of_test"}
style = {path = "../../../components/style", features = ["servo"]}
style_traits = {path = "../../../components/style_traits"}
std_test_override = { path = "../../../components/std_test_override" }

View file

@ -16,6 +16,9 @@ extern crate serde_json;
extern crate servo_arc;
extern crate servo_atoms;
extern crate servo_url;
#[macro_use]
extern crate size_of_test;
#[macro_use]
extern crate style;
extern crate style_traits;
extern crate test;
@ -27,6 +30,8 @@ mod logical_geometry;
mod parsing;
mod properties;
mod rule_tree;
mod size_of;
mod specified_values;
mod str;
mod stylesheets;
mod stylist;

View file

@ -0,0 +1,51 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use selectors::parser::{SelectorParseError, SelectorParseErrorKind};
use style::invalidation::element::invalidation_map::Dependency;
use style::properties;
size_of_test!(test_size_of_dependency, Dependency, 24);
size_of_test!(
test_size_of_property_declaration,
properties::PropertyDeclaration,
32
);
// This is huge, but we allocate it on the stack and then never move it,
// we only pass `&mut SourcePropertyDeclaration` references around.
size_of_test!(
test_size_of_parsed_declaration,
properties::SourcePropertyDeclaration,
568
);
size_of_test!(
test_size_of_selector_parse_error_kind,
SelectorParseErrorKind,
40
);
size_of_test!(
test_size_of_style_parse_error_kind,
::style_traits::StyleParseErrorKind,
56
);
size_of_test!(
test_size_of_value_parse_error_kind,
::style_traits::ValueParseErrorKind,
40
);
size_of_test!(test_size_of_selector_parse_error, SelectorParseError, 48);
size_of_test!(
test_size_of_style_traits_parse_error,
::style_traits::ParseError,
64
);
size_of_test!(
test_size_of_value_parse_error,
::style_traits::ValueParseError,
48
);

View file

@ -0,0 +1,50 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use style;
#[cfg(all(test, target_pointer_width = "64"))]
#[test]
fn size_of_specified_values() {
use std::mem::size_of;
let threshold = 24;
let mut bad_properties = vec![];
macro_rules! check_property {
( $( { $name: ident, $boxed: expr } )+ ) => {
$(
let size = size_of::<style::properties::longhands::$name::SpecifiedValue>();
let is_boxed = $boxed;
if (!is_boxed && size > threshold) || (is_boxed && size <= threshold) {
bad_properties.push((stringify!($name), size, is_boxed));
}
)+
}
}
longhand_properties_idents!(check_property);
let mut failing_messages = vec![];
for bad_prop in bad_properties {
if !bad_prop.2 {
failing_messages.push(
format!("Your changes have increased the size of {} SpecifiedValue to {}. The threshold is \
currently {}. SpecifiedValues affect size of PropertyDeclaration enum and \
increasing the size may negative affect style system performance. Please consider \
using `boxed=\"True\"` in this longhand.",
bad_prop.0, bad_prop.1, threshold));
} else if bad_prop.2 {
failing_messages.push(
format!("Your changes have decreased the size of {} SpecifiedValue to {}. Good work! \
The threshold is currently {}. Please consider removing `boxed=\"True\"` from this longhand.",
bad_prop.0, bad_prop.1, threshold));
}
}
if !failing_messages.is_empty() {
panic!("{}", failing_messages.join("\n\n"));
}
}

View file

@ -16,9 +16,10 @@ use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
use style::selector_map::SelectorMap;
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::shared_lock::SharedRwLock;
use style::stylesheets::layer_rule::LayerId;
use style::stylesheets::StyleRule;
use style::stylist::needs_revalidation_for_testing;
use style::stylist::{ContainerConditionId, LayerId, Rule, Stylist};
use style::stylist::{Rule, Stylist};
use style::thread_state::{self, ThreadState};
/// Helper method to get some Rules from selector strings.
@ -55,7 +56,6 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
locked.clone(),
i as u32,
LayerId::root(),
ContainerConditionId::none(),
)
})
.collect()

View file

@ -0,0 +1,90 @@
[viewport-units-compute.html]
[100vi computes to 200px]
expected: FAIL
[100svw computes to 200px]
expected: FAIL
[100svi computes to 200px]
expected: FAIL
[100svmax computes to 200px]
expected: FAIL
[100lvw computes to 200px]
expected: FAIL
[100lvi computes to 200px]
expected: FAIL
[100lvmax computes to 200px]
expected: FAIL
[100dvw computes to 200px]
expected: FAIL
[100dvi computes to 200px]
expected: FAIL
[100dvmax computes to 200px]
expected: FAIL
[100vb computes to 100px]
expected: FAIL
[100svh computes to 100px]
expected: FAIL
[100svb computes to 100px]
expected: FAIL
[100svmin computes to 100px]
expected: FAIL
[100lvh computes to 100px]
expected: FAIL
[100lvb computes to 100px]
expected: FAIL
[100lvmin computes to 100px]
expected: FAIL
[100dvh computes to 100px]
expected: FAIL
[100dvb computes to 100px]
expected: FAIL
[100dvmin computes to 100px]
expected: FAIL
[1dvw computes to 2px]
expected: FAIL
[10dvw computes to 20px]
expected: FAIL
[1dvh computes to 1px]
expected: FAIL
[10dvh computes to 10px]
expected: FAIL
[calc(1dvw + 1dvw) computes to 4px]
expected: FAIL
[calc(1dvw + 1dvh) computes to 3px]
expected: FAIL
[calc(1dvw + 100px) computes to 102px]
expected: FAIL
[max(1svw, 1svh) computes to 2px]
expected: FAIL
[min(1lvw, 1lvh) computes to 1px]
expected: FAIL
[calc(1dvw + 10%) computes to 12px]
expected: FAIL

View file

@ -0,0 +1,60 @@
[viewport-units-keyframes.html]
[Interpolation from 0px to 100vi is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100svw is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100svi is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100svmax is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvw is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvi is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvmax is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvw is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvi is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvmax is 100px at 50%]
expected: FAIL
[Interpolation from 0px to 100vb is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100svh is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100svb is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100svmin is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvh is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvb is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100lvmin is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvh is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvb is 50px at 50%]
expected: FAIL
[Interpolation from 0px to 100dvmin is 50px at 50%]
expected: FAIL

View file

@ -1,4 +1,34 @@
[viewport-units-media-queries.html]
[@media(width:100vi) applies]
expected: FAIL
[@media(width:100svw) applies]
expected: FAIL
[@media(width:100svi) applies]
expected: FAIL
[@media(width:100svmax) applies]
expected: FAIL
[@media(width:100lvw) applies]
expected: FAIL
[@media(width:100lvi) applies]
expected: FAIL
[@media(width:100lvmax) applies]
expected: FAIL
[@media(width:100dvw) applies]
expected: FAIL
[@media(width:100dvi) applies]
expected: FAIL
[@media(width:100dvmax) applies]
expected: FAIL
[@media(height:100vh) applies]
expected: FAIL

View file

@ -0,0 +1,60 @@
[viewport-units-parsing.html]
[e.style['width'\] = "1vi" should set the property value]
expected: FAIL
[e.style['width'\] = "1vb" should set the property value]
expected: FAIL
[e.style['width'\] = "1svw" should set the property value]
expected: FAIL
[e.style['width'\] = "1svh" should set the property value]
expected: FAIL
[e.style['width'\] = "1svi" should set the property value]
expected: FAIL
[e.style['width'\] = "1svb" should set the property value]
expected: FAIL
[e.style['width'\] = "1svmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1svmax" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvw" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvh" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvi" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvb" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvmax" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvw" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvh" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvi" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvb" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvmax" should set the property value]
expected: FAIL

View file

@ -1,4 +1,34 @@
[viewport-units-media-queries.html]
[@media(width:100vi) applies]
expected: FAIL
[@media(width:100svw) applies]
expected: FAIL
[@media(width:100svi) applies]
expected: FAIL
[@media(width:100svmax) applies]
expected: FAIL
[@media(width:100lvw) applies]
expected: FAIL
[@media(width:100lvi) applies]
expected: FAIL
[@media(width:100lvmax) applies]
expected: FAIL
[@media(width:100dvw) applies]
expected: FAIL
[@media(width:100dvi) applies]
expected: FAIL
[@media(width:100dvmax) applies]
expected: FAIL
[@media(height:100vh) applies]
expected: FAIL

View file

@ -0,0 +1,60 @@
[viewport-units-parsing.html]
[e.style['width'\] = "1vi" should set the property value]
expected: FAIL
[e.style['width'\] = "1vb" should set the property value]
expected: FAIL
[e.style['width'\] = "1svw" should set the property value]
expected: FAIL
[e.style['width'\] = "1svh" should set the property value]
expected: FAIL
[e.style['width'\] = "1svi" should set the property value]
expected: FAIL
[e.style['width'\] = "1svb" should set the property value]
expected: FAIL
[e.style['width'\] = "1svmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1svmax" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvw" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvh" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvi" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvb" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1lvmax" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvw" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvh" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvi" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvb" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvmin" should set the property value]
expected: FAIL
[e.style['width'\] = "1dvmax" should set the property value]
expected: FAIL