mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Move ToGfxColor to display_list_builder.rs
This commit is contained in:
parent
b424de2092
commit
564d12435a
3 changed files with 14 additions and 17 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#![deny(unsafe_blocks)]
|
#![deny(unsafe_blocks)]
|
||||||
|
|
||||||
|
use azure::azure_hl::Color;
|
||||||
use block::BlockFlow;
|
use block::BlockFlow;
|
||||||
use canvas::canvas_paint_task::CanvasMsg::SendPixelContents;
|
use canvas::canvas_paint_task::CanvasMsg::SendPixelContents;
|
||||||
use context::LayoutContext;
|
use context::LayoutContext;
|
||||||
|
@ -19,7 +20,6 @@ use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo};
|
||||||
use inline::InlineFlow;
|
use inline::InlineFlow;
|
||||||
use list_item::ListItemFlow;
|
use list_item::ListItemFlow;
|
||||||
use model;
|
use model;
|
||||||
use util::ToGfxColor;
|
|
||||||
use opaque_node::OpaqueNodeMethods;
|
use opaque_node::OpaqueNodeMethods;
|
||||||
|
|
||||||
use geom::{Point2D, Rect, Size2D, SideOffsets2D};
|
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)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
use css::node_style::StyledNode;
|
use css::node_style::StyledNode;
|
||||||
use construct::ConstructionResult;
|
use construct::ConstructionResult;
|
||||||
use context::{SharedLayoutContext, SharedLayoutContextWrapper};
|
use context::{SharedLayoutContext, SharedLayoutContextWrapper};
|
||||||
|
use display_list_builder::ToGfxColor;
|
||||||
use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||||
use flow_ref::FlowRef;
|
use flow_ref::FlowRef;
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator};
|
use fragment::{Fragment, FragmentBorderBoxIterator};
|
||||||
|
@ -17,7 +18,7 @@ use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAI
|
||||||
use layout_debug;
|
use layout_debug;
|
||||||
use parallel::{self, UnsafeFlow};
|
use parallel::{self, UnsafeFlow};
|
||||||
use sequential;
|
use sequential;
|
||||||
use util::{LayoutDataAccess, LayoutDataWrapper, ToGfxColor};
|
use util::{LayoutDataAccess, LayoutDataWrapper};
|
||||||
use opaque_node::OpaqueNodeMethods;
|
use opaque_node::OpaqueNodeMethods;
|
||||||
use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode};
|
use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode};
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,11 @@ use incremental::RestyleDamage;
|
||||||
use parallel::DomParallelInfo;
|
use parallel::DomParallelInfo;
|
||||||
use wrapper::{LayoutNode, TLayoutNode};
|
use wrapper::{LayoutNode, TLayoutNode};
|
||||||
|
|
||||||
use azure::azure_hl::Color;
|
|
||||||
use gfx;
|
|
||||||
use script::dom::node::SharedLayoutData;
|
use script::dom::node::SharedLayoutData;
|
||||||
use script::layout_interface::LayoutChan;
|
use script::layout_interface::LayoutChan;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cell::{Ref, RefMut};
|
use std::cell::{Ref, RefMut};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Data that layout associates with a node.
|
/// 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue