-
Notifications
You must be signed in to change notification settings - Fork 131
feat(htmlcss): Chromium-parity L0 suite — 65 fixtures + 13 renderer fixes #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
072d24d
a5d4b29
ffd5c98
1082111
09f4ec2
b93bc62
9224fe4
1054ddc
d5a323c
957c1f3
584ea56
753e7e7
75b5327
7f83721
394e0cf
7818bda
ae93f20
64bdc6e
561e604
ab3408e
4ba80d5
7713293
7dd1576
b89badb
0413ed5
b0af892
f0bfb46
9380ae7
d502d9d
324fdae
1b13b15
608eaaa
e36ba1a
dc7c21e
55c37af
4511cd5
d0982ce
f08bf89
1650c3c
c902c0f
b8828a3
1ec9f81
20ad912
8d3f06c
90be00f
6fbc483
2d48548
6a6701b
cd0501d
62e6d88
52774d1
b401dd0
69a6e1e
2b196a6
19a5d41
70323cd
c6ee13c
776c6f8
9d17d93
0eea64b
8c98ff3
a305876
30b3634
5e1f9f1
fede08a
f293b7f
bcf235f
7cabe0c
a376f1b
157a32c
bde2280
2e8cc05
81cd840
cfde7fd
8689c76
f39db8f
7dad4f3
42ff8ab
82df66e
495030e
1750e28
33082ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -871,7 +871,7 @@ fn collect_inline_items(el: &StyledElement, items: &mut Vec<InlineRunItem>) { | |
| /// Returns `None` if the element has no visual box decoration. | ||
| fn build_inline_decoration(el: &StyledElement) -> Option<InlineBoxDecoration> { | ||
| let bg = el.background.first().and_then(|l| match l { | ||
| BackgroundLayer::Solid(c) if c.a > 0 => Some(*c), | ||
| BackgroundLayer::Solid { color, .. } if color.a > 0 => Some(*color), | ||
| _ => None, | ||
| }); | ||
|
|
||
|
|
@@ -1185,6 +1185,10 @@ fn extract_style(tag: &str, style: &ComputedValues) -> StyledElement { | |
| // Flex child | ||
| el.flex_grow = style.clone_flex_grow().0; | ||
| el.flex_shrink = style.clone_flex_shrink().0; | ||
| el.flex_basis = match &pos.flex_basis { | ||
| style::values::generics::flex::FlexBasis::Size(s) => extract_size(s), | ||
| style::values::generics::flex::FlexBasis::Content => CssLength::Auto, | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| // Grid container | ||
| if el.display == types::Display::Grid { | ||
|
|
@@ -1571,34 +1575,49 @@ fn extract_gradient_interpolation( | |
|
|
||
| fn extract_border_radius(style: &ComputedValues) -> CornerRadii { | ||
| let b = style.get_border(); | ||
| let lp = |lp: &style::values::computed::NonNegativeLengthPercentage| -> f32 { | ||
| lp.0.to_length().map(|l| l.px()).unwrap_or(0.0) | ||
| // Returns (px, percent_fraction). Percent is deferred to paint time, | ||
| // where the border-box w/h is known (CSS Backgrounds 3 §5.3). | ||
| let lp = |v: &style::values::computed::NonNegativeLengthPercentage| -> (f32, f32) { | ||
| match length_percentage_to_css(&v.0) { | ||
| CssLength::Px(p) => (p, 0.0), | ||
| CssLength::Percent(p) => (0.0, p), | ||
| CssLength::Calc { px, percent } => (px, percent), | ||
| CssLength::Auto => (0.0, 0.0), | ||
| } | ||
| }; | ||
| let (tl_x, tl_x_pct) = lp(&b.border_top_left_radius.0.width); | ||
| let (tl_y, tl_y_pct) = lp(&b.border_top_left_radius.0.height); | ||
| let (tr_x, tr_x_pct) = lp(&b.border_top_right_radius.0.width); | ||
| let (tr_y, tr_y_pct) = lp(&b.border_top_right_radius.0.height); | ||
| let (br_x, br_x_pct) = lp(&b.border_bottom_right_radius.0.width); | ||
| let (br_y, br_y_pct) = lp(&b.border_bottom_right_radius.0.height); | ||
| let (bl_x, bl_x_pct) = lp(&b.border_bottom_left_radius.0.width); | ||
| let (bl_y, bl_y_pct) = lp(&b.border_bottom_left_radius.0.height); | ||
| CornerRadii { | ||
| tl_x: lp(&b.border_top_left_radius.0.width), | ||
| tl_y: lp(&b.border_top_left_radius.0.height), | ||
| tr_x: lp(&b.border_top_right_radius.0.width), | ||
| tr_y: lp(&b.border_top_right_radius.0.height), | ||
| br_x: lp(&b.border_bottom_right_radius.0.width), | ||
| br_y: lp(&b.border_bottom_right_radius.0.height), | ||
| bl_x: lp(&b.border_bottom_left_radius.0.width), | ||
| bl_y: lp(&b.border_bottom_left_radius.0.height), | ||
| tl_x, | ||
| tl_y, | ||
| tr_x, | ||
| tr_y, | ||
| br_x, | ||
| br_y, | ||
| bl_x, | ||
| bl_y, | ||
| tl_x_pct, | ||
| tl_y_pct, | ||
| tr_x_pct, | ||
| tr_y_pct, | ||
| br_x_pct, | ||
| br_y_pct, | ||
| bl_x_pct, | ||
| bl_y_pct, | ||
| } | ||
| } | ||
|
|
||
| fn extract_size( | ||
| size: &GenericSize<style::values::computed::NonNegativeLengthPercentage>, | ||
| ) -> CssLength { | ||
| match size { | ||
| GenericSize::LengthPercentage(lp) => { | ||
| if let Some(len) = lp.0.to_length() { | ||
| CssLength::Px(len.px()) | ||
| } else if let Some(pct) = lp.0.to_percentage() { | ||
| CssLength::Percent(pct.0) | ||
| } else { | ||
| CssLength::Auto | ||
| } | ||
| } | ||
| GenericSize::LengthPercentage(lp) => length_percentage_to_css(&lp.0), | ||
| _ => CssLength::Auto, | ||
| } | ||
| } | ||
|
|
@@ -1610,15 +1629,7 @@ fn extract_max_size( | |
| ) -> CssLength { | ||
| use style::values::generics::length::GenericMaxSize; | ||
| match size { | ||
| GenericMaxSize::LengthPercentage(lp) => { | ||
| if let Some(len) = lp.0.to_length() { | ||
| CssLength::Px(len.px()) | ||
| } else if let Some(pct) = lp.0.to_percentage() { | ||
| CssLength::Percent(pct.0) | ||
| } else { | ||
| CssLength::Auto | ||
| } | ||
| } | ||
| GenericMaxSize::LengthPercentage(lp) => length_percentage_to_css(&lp.0), | ||
| _ => CssLength::Auto, // None, MaxContent, MinContent, FitContent, etc. | ||
| } | ||
| } | ||
|
|
@@ -1653,11 +1664,22 @@ fn extract_background(style: &ComputedValues, current_color: CGColor) -> Vec<Bac | |
| let bg = style.get_background(); | ||
| let mut layers: Vec<BackgroundLayer> = Vec::new(); | ||
|
|
||
| // 1. Background color (bottom layer) | ||
| // 1. Background color (bottom layer). Per CSS Backgrounds 3 §2.5 the | ||
| // color uses the `background-clip` value from the *final* layer | ||
| // entry in the list. | ||
| if let Some(abs) = bg.background_color.as_absolute() { | ||
| let c = abs_color_to_cg(abs); | ||
| if c.a > 0 { | ||
| layers.push(BackgroundLayer::Solid(c)); | ||
| let color_clip = bg | ||
| .background_clip | ||
| .0 | ||
| .last() | ||
| .map(extract_bg_clip) | ||
|
Comment on lines
+1673
to
+1677
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In Useful? React with 👍 / 👎. |
||
| .unwrap_or(BackgroundBox::BorderBox); | ||
| layers.push(BackgroundLayer::Solid { | ||
| color: c, | ||
| clip: color_clip, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -2771,10 +2793,10 @@ fn map_overflow(ov: style::values::specified::box_::Overflow) -> types::Overflow | |
| fn abs_color_to_cg(color: &AbsoluteColor) -> CGColor { | ||
| let srgb = color.to_color_space(ColorSpace::Srgb); | ||
| CGColor::from_rgba( | ||
| (srgb.components.0.clamp(0.0, 1.0) * 255.0) as u8, | ||
| (srgb.components.1.clamp(0.0, 1.0) * 255.0) as u8, | ||
| (srgb.components.2.clamp(0.0, 1.0) * 255.0) as u8, | ||
| (srgb.alpha.clamp(0.0, 1.0) * 255.0) as u8, | ||
| (srgb.components.0.clamp(0.0, 1.0) * 255.0).round() as u8, | ||
| (srgb.components.1.clamp(0.0, 1.0) * 255.0).round() as u8, | ||
| (srgb.components.2.clamp(0.0, 1.0) * 255.0).round() as u8, | ||
| (srgb.alpha.clamp(0.0, 1.0) * 255.0).round() as u8, | ||
| ) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor doc inconsistency: "viewport.height optional" vs earlier "mismatched dims score 0.0".
Line 478-480 above still says "Set height to match cg's cull height; mismatched dims score 0.0 at diff time (
@grida/reftestrequires identical dimensions)." That's still true, and Chromium'sfullPagewill capture whatever the document's actual height is — which matches cg'sviewport.heightdefault only when the fixture forces its own height (paint preset withmin-height: 800px).For a natural-sized layout fixture,
fullPageheight ≠viewport.heightand you'll still get a dimension-mismatch/score=0. Consider tightening the wording: "optional for fixtures that force their own height via the paint preset; layout fixtures with natural cull still need an explicitviewport.heightmatching cg's reportedWxH."🤖 Prompt for AI Agents