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)
}
}

View file

@ -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};

View file

@ -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)
}
}