mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
layout: Round clientTop
, etc queries to pixels properly (#31187)
* layout: Round getClientRect queries to pixels properly Instead of just flooring all pixels in getClientRect queries, we should round the rectangle. * Fix scrollWidth/scrollHeight too, and tests * Tests passing * Test expectation for legacy layout --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
bbba839278
commit
bbe505e52b
9 changed files with 194 additions and 25 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue