Move ToGfxColor to display_list_builder.rs

This commit is contained in:
Dan Fox 2015-03-03 17:59:44 +00:00
parent b424de2092
commit 564d12435a
3 changed files with 14 additions and 17 deletions

View file

@ -10,6 +10,7 @@
#![deny(unsafe_blocks)]
use azure::azure_hl::Color;
use block::BlockFlow;
use canvas::canvas_paint_task::CanvasMsg::SendPixelContents;
use context::LayoutContext;
@ -19,7 +20,6 @@ use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo};
use inline::InlineFlow;
use list_item::ListItemFlow;
use model;
use util::ToGfxColor;
use opaque_node::OpaqueNodeMethods;
use geom::{Point2D, Rect, Size2D, SideOffsets2D};
@ -1482,3 +1482,14 @@ fn shadow_bounds(content_rect: &Rect<Au>, blur_radius: Au, spread_radius: Au) ->
content_rect.inflate(inflation, inflation)
}
/// Allows a CSS color to be converted into a graphics color.
pub trait ToGfxColor {
/// Converts a CSS color to a graphics color.
fn to_gfx_color(&self) -> Color;
}
impl ToGfxColor for RGBA {
fn to_gfx_color(&self) -> Color {
color::rgba(self.red, self.green, self.blue, self.alpha)
}
}