diff --git a/components/layout_2020/fragment_tree/fragment_tree.rs b/components/layout_2020/fragment_tree/fragment_tree.rs index 84abc02edc3..3244a8bd2bb 100644 --- a/components/layout_2020/fragment_tree/fragment_tree.rs +++ b/components/layout_2020/fragment_tree/fragment_tree.rs @@ -156,18 +156,20 @@ impl FragmentTree { return Some(Rect::zero()); } - let padding_rect = padding_rect.to_physical(style.writing_mode, containing_block); let border = style.get_border(); - Some(Rect::new( - Point2D::new( - border.border_left_width.to_px(), - border.border_top_width.to_px(), - ), - Size2D::new( - padding_rect.size.width.px() as i32, - padding_rect.size.height.px() as i32, - ), - )) + let padding_rect = padding_rect.to_physical(style.writing_mode, containing_block); + Some( + Rect::new( + Point2D::new( + border.border_left_width.to_f32_px(), + border.border_top_width.to_f32_px(), + ), + Size2D::new(padding_rect.size.width.px(), padding_rect.size.height.px()), + ) + .round() + .to_i32() + .to_untyped(), + ) }) .unwrap_or_else(Rect::zero) } diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index 9b652194e07..198b46f0de7 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -211,9 +211,12 @@ pub fn process_node_scroll_area_request( }; Rect::new( - Point2D::new(rect.origin.x.px() as i32, rect.origin.y.px() as i32), - Size2D::new(rect.size.width.px() as i32, rect.size.height.px() as i32), + Point2D::new(rect.origin.x.px(), rect.origin.y.px()), + Size2D::new(rect.size.width.px(), rect.size.height.px()), ) + .round() + .to_i32() + .to_untyped() } /// Return the resolved value of property for a given (pseudo)element. diff --git a/tests/wpt/meta-legacy-layout/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini b/tests/wpt/meta-legacy-layout/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini new file mode 100644 index 00000000000..e021cff99f4 --- /dev/null +++ b/tests/wpt/meta-legacy-layout/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini @@ -0,0 +1,24 @@ +[subpixel-sizes-and-offsets.tentative.html] + [clientWidth, offsetWidth and scrollWidth round 5.5 to 6] + expected: FAIL + + [clientWidth, offsetWidth and scrollWidth round 5.9 to 6] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.1 to 5] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.5 to 6] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.9 to 6] + expected: FAIL + + [clientLeft and clientTop don't round 44.9] + expected: FAIL + + [clientLeft and clientTop don't round 44.5] + expected: FAIL + + [clientLeft and clientTop don't round 44.1] + expected: FAIL diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 5264eba4e40..0b6c97c7099 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -562330,6 +562330,13 @@ {} ] ], + "subpixel-sizes-and-offsets.tentative.html": [ + "d198b9dde60c8cac16241c412d3e55f772166010", + [ + null, + {} + ] + ], "table-border-collapse-client-width-height.html": [ "a7a1a435b2279ccb07136ed295dcc25b38c2c87c", [ diff --git a/tests/wpt/meta/css/css-tables/fractional-percent-width.html.ini b/tests/wpt/meta/css/css-tables/fractional-percent-width.html.ini deleted file mode 100644 index b135a696409..00000000000 --- a/tests/wpt/meta/css/css-tables/fractional-percent-width.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[fractional-percent-width.html] - [.cell 2] - expected: FAIL - - [.cell 3] - expected: FAIL diff --git a/tests/wpt/meta/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini b/tests/wpt/meta/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini new file mode 100644 index 00000000000..e021cff99f4 --- /dev/null +++ b/tests/wpt/meta/css/cssom-view/subpixel-sizes-and-offsets.tentative.html.ini @@ -0,0 +1,24 @@ +[subpixel-sizes-and-offsets.tentative.html] + [clientWidth, offsetWidth and scrollWidth round 5.5 to 6] + expected: FAIL + + [clientWidth, offsetWidth and scrollWidth round 5.9 to 6] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.1 to 5] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.5 to 6] + expected: FAIL + + [clientHeight, offsetHeight and scrollHeight round 5.9 to 6] + expected: FAIL + + [clientLeft and clientTop don't round 44.9] + expected: FAIL + + [clientLeft and clientTop don't round 44.5] + expected: FAIL + + [clientLeft and clientTop don't round 44.1] + expected: FAIL diff --git a/tests/wpt/meta/css/cssom-view/table-border-collapse-client-width-height.html.ini b/tests/wpt/meta/css/cssom-view/table-border-collapse-client-width-height.html.ini deleted file mode 100644 index 5955810949c..00000000000 --- a/tests/wpt/meta/css/cssom-view/table-border-collapse-client-width-height.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-border-collapse-client-width-height.html] - [Table's clientWidth/Height and OffsetWidth/Height should be the same] - expected: FAIL diff --git a/tests/wpt/meta/css/cssom-view/table-border-separate-client-width-height.html.ini b/tests/wpt/meta/css/cssom-view/table-border-separate-client-width-height.html.ini deleted file mode 100644 index b33c7ce8804..00000000000 --- a/tests/wpt/meta/css/cssom-view/table-border-separate-client-width-height.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[table-border-separate-client-width-height.html] - [Table's clientWidth/Height and OffsetWidth/Height should be the same] - expected: FAIL diff --git a/tests/wpt/tests/css/cssom-view/subpixel-sizes-and-offsets.tentative.html b/tests/wpt/tests/css/cssom-view/subpixel-sizes-and-offsets.tentative.html new file mode 100644 index 00000000000..d198b9dde60 --- /dev/null +++ b/tests/wpt/tests/css/cssom-view/subpixel-sizes-and-offsets.tentative.html @@ -0,0 +1,121 @@ + +CSSOM View Module test: subpixel sizes and offsets + + + + + +
+
+
+
+
+ +
+ + +