mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
use app unit in box_fragement (#32349)
This commit is contained in:
parent
66edef8065
commit
26c585a0c5
20 changed files with 273 additions and 289 deletions
|
@ -216,6 +216,19 @@ impl fmt::Debug for LogicalRect<Length> {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for LogicalRect<Au> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Rect(i{}×b{} @ (i{},b{}))",
|
||||
self.size.inline.to_px(),
|
||||
self.size.block.to_px(),
|
||||
self.start_corner.inline.to_px(),
|
||||
self.start_corner.block.to_px(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> LogicalVec2<T> {
|
||||
pub fn to_physical(&self, mode: WritingMode) -> PhysicalSize<T> {
|
||||
// https://drafts.csswg.org/css-writing-modes/#logical-to-physical
|
||||
|
@ -525,17 +538,3 @@ 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