From 564d12435af1a3a7324e5cdf0c0ead6ee705ed30 Mon Sep 17 00:00:00 2001 From: Dan Fox Date: Tue, 3 Mar 2015 17:59:44 +0000 Subject: [PATCH] Move ToGfxColor to display_list_builder.rs --- components/layout/display_list_builder.rs | 13 ++++++++++++- components/layout/layout_task.rs | 3 ++- components/layout/util.rs | 15 --------------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 7c56c574581..10585964543 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -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, 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) + } +} diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 6e7886cbecb..72a2948bfe2 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -10,6 +10,7 @@ use css::node_style::StyledNode; use construct::ConstructionResult; use context::{SharedLayoutContext, SharedLayoutContextWrapper}; +use display_list_builder::ToGfxColor; use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; use flow_ref::FlowRef; use fragment::{Fragment, FragmentBorderBoxIterator}; @@ -17,7 +18,7 @@ use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAI use layout_debug; use parallel::{self, UnsafeFlow}; use sequential; -use util::{LayoutDataAccess, LayoutDataWrapper, ToGfxColor}; +use util::{LayoutDataAccess, LayoutDataWrapper}; use opaque_node::OpaqueNodeMethods; use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; diff --git a/components/layout/util.rs b/components/layout/util.rs index 85c0e1a60d9..d8a2c3f38b9 100644 --- a/components/layout/util.rs +++ b/components/layout/util.rs @@ -9,14 +9,11 @@ use incremental::RestyleDamage; use parallel::DomParallelInfo; use wrapper::{LayoutNode, TLayoutNode}; -use azure::azure_hl::Color; -use gfx; use script::dom::node::SharedLayoutData; use script::layout_interface::LayoutChan; use std::mem; use std::cell::{Ref, RefMut}; use style::properties::ComputedValues; -use style; use std::sync::Arc; /// Data that layout associates with a node. @@ -118,15 +115,3 @@ impl<'ln> LayoutDataAccess for LayoutNode<'ln> { } } } - -/// 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 style::values::RGBA { - fn to_gfx_color(&self) -> Color { - gfx::color::rgba(self.red, self.green, self.blue, self.alpha) - } -}