Oriol Brufau 2024-03-30 14:30:13 +01:00 committed by GitHub
parent a7ad92d9a3
commit fff9ef87e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 97 additions and 181 deletions

View file

@ -21,9 +21,10 @@ fn srgb_legacy_from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Absol
// Color
#[test]
fn test_rgba_color_interepolation_preserves_transparent() {
let transparent = AbsoluteColor::TRANSPARENT_BLACK;
assert_eq!(
interpolate_color(AbsoluteColor::TRANSPARENT, AbsoluteColor::TRANSPARENT, 0.5),
AbsoluteColor::TRANSPARENT
interpolate_color(transparent, transparent, 0.5),
transparent
);
}

View file

@ -4,11 +4,10 @@
use cssparser::{Parser, ParserInput};
use euclid::{Scale, Size2D};
use servo_arc::Arc;
use style::applicable_declarations::CascadePriority;
use style::context::QuirksMode;
use style::custom_properties::{
CustomPropertiesBuilder, CustomPropertiesMap, Name, SpecifiedValue,
ComputedCustomProperties, CustomPropertiesBuilder, Name, SpecifiedValue,
};
use style::media_queries::{Device, MediaType};
use style::properties::{CustomDeclaration, CustomDeclarationValue};
@ -19,8 +18,8 @@ use test::{self, Bencher};
fn cascade(
name_and_value: &[(&str, &str)],
inherited: Option<&Arc<CustomPropertiesMap>>,
) -> Option<Arc<CustomPropertiesMap>> {
inherited: &ComputedCustomProperties,
) -> ComputedCustomProperties {
let declarations = name_and_value
.iter()
.map(|&(name, value)| {
@ -39,7 +38,7 @@ fn cascade(
Scale::new(1.0),
);
let stylist = Stylist::new(device, QuirksMode::NoQuirks);
let mut builder = CustomPropertiesBuilder::new(inherited, &stylist);
let mut builder = CustomPropertiesBuilder::new(inherited, &stylist, false);
for declaration in &declarations {
builder.cascade(
@ -54,11 +53,14 @@ fn cascade(
#[bench]
fn cascade_custom_simple(b: &mut Bencher) {
b.iter(|| {
let parent = cascade(&[("foo", "10px"), ("bar", "100px")], None);
let parent = cascade(
&[("foo", "10px"), ("bar", "100px")],
&ComputedCustomProperties::default(),
);
test::black_box(cascade(
&[("baz", "calc(40em + 4px)"), ("bazz", "calc(30em + 4px)")],
parent.as_ref(),
&parent,
))
})
}

View file

@ -1,12 +0,0 @@
[opacity-valid.html]
[e.style['opacity'\] = "clamp(50%, 0%, 70%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "clamp(50%, 80%, 70%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "min(50%, 0%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "max(0%, 50%)" should set the property value]
expected: FAIL

View file

@ -1,2 +0,0 @@
[rlh-in-monospace.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[getComputedStyle-calc-mixed-units-002.html]
[testing width: calc(8lh + 7px)]
expected: FAIL

View file

@ -1,2 +0,0 @@
[lh-unit-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[lh-unit-002.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[lh-unit-005.html]
[lh relative to line-height inherited from parent]
expected: FAIL

View file

@ -1,3 +0,0 @@
[rlh-invalidation.html]
[CSS Values and Units Test: rlh invalidation]
expected: FAIL

View file

@ -82,21 +82,3 @@
[widows: inherit]
expected: FAIL
[content: attr( |bar )]
expected: FAIL
[content: attr(foo-bar, "fallback")]
expected: FAIL
[content: attr(foo_bar, "fallback")]
expected: FAIL
[content: attr(|bar, "fallback")]
expected: FAIL
[content: attr(foo, "")]
expected: FAIL
[content: attr( |foo , "" )]
expected: FAIL

View file

@ -1,3 +0,0 @@
[parent-style-relative-units.html]
[Font-size based on canvas element line-height]
expected: FAIL

View file

@ -1,12 +0,0 @@
[opacity-valid.html]
[e.style['opacity'\] = "clamp(50%, 0%, 70%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "clamp(50%, 80%, 70%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "min(50%, 0%)" should set the property value]
expected: FAIL
[e.style['opacity'\] = "max(0%, 50%)" should set the property value]
expected: FAIL

View file

@ -1,2 +0,0 @@
[rlh-in-monospace.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[getComputedStyle-calc-mixed-units-002.html]
[testing width: calc(8lh + 7px)]
expected: FAIL

View file

@ -1,2 +0,0 @@
[lh-unit-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[lh-unit-002.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[lh-unit-005.html]
[lh relative to line-height inherited from parent]
expected: FAIL

View file

@ -1,3 +0,0 @@
[rlh-invalidation.html]
[CSS Values and Units Test: rlh invalidation]
expected: FAIL

View file

@ -148,21 +148,3 @@
[unicode-bidi: inherit]
expected: FAIL
[content: attr( |bar )]
expected: FAIL
[content: attr(foo-bar, "fallback")]
expected: FAIL
[content: attr(foo_bar, "fallback")]
expected: FAIL
[content: attr(|bar, "fallback")]
expected: FAIL
[content: attr(foo, "")]
expected: FAIL
[content: attr( |foo , "" )]
expected: FAIL

View file

@ -1,3 +0,0 @@
[parent-style-relative-units.html]
[Font-size based on canvas element line-height]
expected: FAIL