mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Use Rect in InsetRect
This commit is contained in:
parent
6f3c46ca61
commit
150c9df246
6 changed files with 34 additions and 47 deletions
|
@ -369,6 +369,7 @@ pub mod basic_shape {
|
|||
use values::generics::basic_shape::{BasicShape as GenericBasicShape, InsetRect, Polygon};
|
||||
use values::generics::basic_shape::{Circle, Ellipse, FillRule};
|
||||
use values::generics::basic_shape::{GeometryBox, ShapeBox};
|
||||
use values::generics::rect::Rect;
|
||||
|
||||
// using Borrow so that we can have a non-moving .into()
|
||||
impl<T: Borrow<StyleBasicShape>> From<T> for BasicShape {
|
||||
|
@ -381,11 +382,14 @@ pub mod basic_shape {
|
|||
let b = LengthOrPercentage::from_gecko_style_coord(&other.mCoordinates[2]);
|
||||
let l = LengthOrPercentage::from_gecko_style_coord(&other.mCoordinates[3]);
|
||||
let round = (&other.mRadius).into();
|
||||
let rect = Rect::new(
|
||||
t.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
r.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
b.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
l.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
);
|
||||
GenericBasicShape::Inset(InsetRect {
|
||||
top: t.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
right: r.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
bottom: b.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
left: l.expect("inset() offset should be a length, percentage, or calc value"),
|
||||
rect: rect,
|
||||
round: Some(round),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue