diff options
Diffstat (limited to 'components/layout/webrender_helpers.rs')
-rw-r--r-- | components/layout/webrender_helpers.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs index 537d5f04267..dc8bf7bc9a5 100644 --- a/components/layout/webrender_helpers.rs +++ b/components/layout/webrender_helpers.rs @@ -8,7 +8,7 @@ // completely converting layout to directly generate WebRender display lists, for example. use app_units::Au; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use euclid::{Point2D, Vector2D, Rect, SideOffsets2D, Size2D}; use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClippingRegion}; use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType}; use msg::constellation_msg::PipelineId; @@ -86,12 +86,22 @@ trait ToPointF { fn to_pointf(&self) -> webrender_traits::LayoutPoint; } +trait ToVectorF { + fn to_vectorf(&self) -> webrender_traits::LayoutVector2D; +} + impl ToPointF for Point2D<Au> { fn to_pointf(&self) -> webrender_traits::LayoutPoint { webrender_traits::LayoutPoint::new(self.x.to_f32_px(), self.y.to_f32_px()) } } +impl ToVectorF for Vector2D<Au> { + fn to_vectorf(&self) -> webrender_traits::LayoutVector2D { + webrender_traits::LayoutVector2D::new(self.x.to_f32_px(), self.y.to_f32_px()) + } +} + impl ToSizeF for Size2D<Au> { fn to_sizef(&self) -> webrender_traits::LayoutSize { webrender_traits::LayoutSize::new(self.width.to_f32_px(), self.height.to_f32_px()) @@ -450,7 +460,7 @@ impl WebRenderDisplayItemConverter for DisplayItem { builder.push_box_shadow(rect, clip, box_bounds, - item.offset.to_pointf(), + item.offset.to_vectorf(), item.color, item.blur_radius.to_f32_px(), item.spread_radius.to_f32_px(), |