mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Add basic support for getClientRects()
queries (#31696)
This adds basic support for `getClientRects()` by sharing code with the implementation of `getBoundingClientRect()`. In addition to sharing code, it also shares all of the bugs. Primarily, scrolilng positions are not taken into account when return boundary rectangles.
This commit is contained in:
parent
3f3820b3dc
commit
47a4ce467f
15 changed files with 48 additions and 71 deletions
|
@ -525,3 +525,17 @@ impl From<LogicalRect<CSSPixelLength>> for LogicalRect<Au> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a `PhysicalRect<Length>` (one that uses CSSPixel as the unit) to an untyped `Rect<Au>`.
|
||||
pub fn physical_rect_to_au_rect(rect: PhysicalRect<Length>) -> euclid::default::Rect<Au> {
|
||||
euclid::default::Rect::new(
|
||||
euclid::default::Point2D::new(
|
||||
Au::from_f32_px(rect.origin.x.px()),
|
||||
Au::from_f32_px(rect.origin.y.px()),
|
||||
),
|
||||
euclid::default::Size2D::new(
|
||||
Au::from_f32_px(rect.size.width.px()),
|
||||
Au::from_f32_px(rect.size.height.px()),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue