diff --git a/src/components/gfx/display_list.rs b/src/components/gfx/display_list.rs index 1583b1fcf6d..74c3bc0b45a 100644 --- a/src/components/gfx/display_list.rs +++ b/src/components/gfx/display_list.rs @@ -19,6 +19,7 @@ use geometry::Au; use render_context::RenderContext; use text::SendableTextRun; +use core::cast::transmute_region; use geom::{Point2D, Rect, Size2D}; use servo_net::image::base::Image; use servo_util::range::Range; @@ -151,5 +152,21 @@ impl DisplayItem { } } } + + fn base<'a>(&'a self) -> &'a BaseDisplayItem { + // FIXME(tkuehn): Workaround for Rust region bug. + unsafe { + match *self { + SolidColorDisplayItemClass(ref solid_color) => transmute_region(&solid_color.base), + TextDisplayItemClass(ref text) => transmute_region(&text.base), + ImageDisplayItemClass(ref image_item) => transmute_region(&image_item.base), + BorderDisplayItemClass(ref border) => transmute_region(&border.base) + } + } + } + + fn bounds(&self) -> Rect { + self.base().bounds + } }