aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-05 07:26:30 -0500
committerGitHub <noreply@github.com>2016-11-05 07:26:30 -0500
commitf7875dad1a43792ff3869f292990d03d30ebd9eb (patch)
tree9b792ce7df6f67522e6273b2e7b9686badacb933
parent516be8f85c0c79b16c3841c60d887661abe91e81 (diff)
parent81ee81cbb03ef313e268a9401f5ffe06f0cfee82 (diff)
downloadservo-f7875dad1a43792ff3869f292990d03d30ebd9eb.tar.gz
servo-f7875dad1a43792ff3869f292990d03d30ebd9eb.zip
Auto merge of #14060 - servo:gfx-azure, r=nox
Remove the direct azure dependencies from gfx, layout and layout_thread. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14060) <!-- Reviewable:end -->
-rw-r--r--components/gfx/Cargo.toml1
-rw-r--r--components/gfx/display_list/mod.rs17
-rw-r--r--components/gfx/lib.rs1
-rw-r--r--components/layout/Cargo.toml1
-rw-r--r--components/layout/display_list_builder.rs49
-rw-r--r--components/layout/lib.rs1
-rw-r--r--components/layout/webrender_helpers.rs46
-rw-r--r--components/layout_thread/Cargo.toml1
-rw-r--r--components/layout_thread/lib.rs16
-rw-r--r--components/servo/Cargo.lock3
-rw-r--r--ports/cef/Cargo.lock3
11 files changed, 52 insertions, 87 deletions
diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml
index 8c1eaeeea90..fd516a2e853 100644
--- a/components/gfx/Cargo.toml
+++ b/components/gfx/Cargo.toml
@@ -12,7 +12,6 @@ path = "lib.rs"
[dependencies]
app_units = "0.3"
-azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
bitflags = "0.7"
euclid = "0.10.1"
fnv = "1.0"
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index d4afcc60875..99b1fc0b21c 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -15,7 +15,6 @@
//! low-level drawing primitives.
use app_units::Au;
-use azure::azure_hl::Color;
use euclid::{Matrix4D, Point2D, Rect, Size2D};
use euclid::num::{One, Zero};
use euclid::rect::TypedRect;
@@ -35,14 +34,10 @@ use style_traits::cursor::Cursor;
use text::TextRun;
use text::glyph::ByteIndex;
use util::geometry::{self, max_rect};
-use webrender_traits::{self, WebGLContextId};
+use webrender_traits::{self, ColorF, GradientStop, WebGLContextId};
pub use style::dom::OpaqueNode;
-// It seems cleaner to have layout code not mention Azure directly, so let's just reexport this for
-// layout to use.
-pub use azure::azure_hl::GradientStop;
-
/// The factor that we multiply the blur radius by in order to inflate the boundaries of display
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
pub static BLUR_INFLATION_FACTOR: i32 = 3;
@@ -750,7 +745,7 @@ pub struct SolidColorDisplayItem {
pub base: BaseDisplayItem,
/// The color.
- pub color: Color,
+ pub color: ColorF,
}
/// Paints text.
@@ -767,7 +762,7 @@ pub struct TextDisplayItem {
pub range: Range<ByteIndex>,
/// The color of the text.
- pub text_color: Color,
+ pub text_color: ColorF,
/// The position of the start of the baseline of this text.
pub baseline_origin: Point2D<Au>,
@@ -851,7 +846,7 @@ pub struct BorderDisplayItem {
pub border_widths: SideOffsets2D<Au>,
/// Border colors.
- pub color: SideOffsets2D<Color>,
+ pub color: SideOffsets2D<ColorF>,
/// Border styles.
pub style: SideOffsets2D<border_style::T>,
@@ -932,7 +927,7 @@ pub struct LineDisplayItem {
pub base: BaseDisplayItem,
/// The line segment color.
- pub color: Color,
+ pub color: ColorF,
/// The line segment style.
pub style: border_style::T
@@ -951,7 +946,7 @@ pub struct BoxShadowDisplayItem {
pub offset: Point2D<Au>,
/// The color of this shadow.
- pub color: Color,
+ pub color: ColorF,
/// The blur radius for this shadow.
pub blur_radius: Au,
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index adf15b13c16..700ed171dd6 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -18,7 +18,6 @@
extern crate alloc;
extern crate app_units;
-extern crate azure;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate bitflags;
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index c5e9fd3aeb5..49af18e17d4 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -11,7 +11,6 @@ path = "lib.rs"
[dependencies]
app_units = "0.3"
-azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
bitflags = "0.7"
canvas_traits = {path = "../canvas_traits"}
cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]}
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 8a592585511..17b3e07f716 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -11,7 +11,6 @@
#![deny(unsafe_code)]
use app_units::{AU_PER_PX, Au};
-use azure::azure_hl::Color;
use block::{BlockFlow, BlockStackingContextType};
use canvas_traits::{CanvasData, CanvasMsg, FromLayoutMsg};
use context::SharedLayoutContext;
@@ -24,7 +23,7 @@ use fragment::SpecificFragmentInfo;
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem};
use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion};
use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList, DisplayListSection};
-use gfx::display_list::{GradientDisplayItem, GradientStop, IframeDisplayItem, ImageDisplayItem};
+use gfx::display_list::{GradientDisplayItem, IframeDisplayItem, ImageDisplayItem};
use gfx::display_list::{LineDisplayItem, OpaqueNode};
use gfx::display_list::{SolidColorDisplayItem, StackingContext, StackingContextType};
use gfx::display_list::{TextDisplayItem, TextOrientation, WebGLDisplayItem, WebRenderImageInfo};
@@ -60,16 +59,32 @@ use style_traits::cursor::Cursor;
use table_cell::CollapsedBordersForCell;
use url::Url;
use util::opts;
+use webrender_traits::{ColorF, GradientStop};
-static THREAD_TINT_COLORS: [Color; 8] = [
- Color { r: 6.0 / 255.0, g: 153.0 / 255.0, b: 198.0 / 255.0, a: 0.7 },
- Color { r: 255.0 / 255.0, g: 212.0 / 255.0, b: 83.0 / 255.0, a: 0.7 },
- Color { r: 116.0 / 255.0, g: 29.0 / 255.0, b: 109.0 / 255.0, a: 0.7 },
- Color { r: 204.0 / 255.0, g: 158.0 / 255.0, b: 199.0 / 255.0, a: 0.7 },
- Color { r: 242.0 / 255.0, g: 46.0 / 255.0, b: 121.0 / 255.0, a: 0.7 },
- Color { r: 116.0 / 255.0, g: 203.0 / 255.0, b: 196.0 / 255.0, a: 0.7 },
- Color { r: 255.0 / 255.0, g: 249.0 / 255.0, b: 201.0 / 255.0, a: 0.7 },
- Color { r: 137.0 / 255.0, g: 196.0 / 255.0, b: 78.0 / 255.0, a: 0.7 },
+trait RgbColor {
+ fn rgb(r: u8, g: u8, b: u8) -> Self;
+}
+
+impl RgbColor for ColorF {
+ fn rgb(r: u8, g: u8, b: u8) -> Self {
+ ColorF {
+ r: (r as f32) / (255.0 as f32),
+ g: (g as f32) / (255.0 as f32),
+ b: (b as f32) / (255.0 as f32),
+ a: 1.0 as f32
+ }
+ }
+}
+
+static THREAD_TINT_COLORS: [ColorF; 8] = [
+ ColorF { r: 6.0 / 255.0, g: 153.0 / 255.0, b: 198.0 / 255.0, a: 0.7 },
+ ColorF { r: 255.0 / 255.0, g: 212.0 / 255.0, b: 83.0 / 255.0, a: 0.7 },
+ ColorF { r: 116.0 / 255.0, g: 29.0 / 255.0, b: 109.0 / 255.0, a: 0.7 },
+ ColorF { r: 204.0 / 255.0, g: 158.0 / 255.0, b: 199.0 / 255.0, a: 0.7 },
+ ColorF { r: 242.0 / 255.0, g: 46.0 / 255.0, b: 121.0 / 255.0, a: 0.7 },
+ ColorF { r: 116.0 / 255.0, g: 203.0 / 255.0, b: 196.0 / 255.0, a: 0.7 },
+ ColorF { r: 255.0 / 255.0, g: 249.0 / 255.0, b: 201.0 / 255.0, a: 0.7 },
+ ColorF { r: 137.0 / 255.0, g: 196.0 / 255.0, b: 78.0 / 255.0, a: 0.7 },
];
fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
@@ -1053,7 +1068,7 @@ impl FragmentDisplayListBuilding for Fragment {
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
base: base,
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
- color: SideOffsets2D::new_all_same(Color::rgb(0, 0, 200)),
+ color: SideOffsets2D::new_all_same(ColorF::rgb(0, 0, 200)),
style: SideOffsets2D::new_all_same(border_style::T::solid),
radius: Default::default(),
}));
@@ -1073,7 +1088,7 @@ impl FragmentDisplayListBuilding for Fragment {
DisplayListSection::Content);
state.add_display_item(DisplayItem::Line(box LineDisplayItem {
base: base,
- color: Color::rgb(0, 200, 0),
+ color: ColorF::rgb(0, 200, 0),
style: border_style::T::dashed,
}));
}
@@ -1091,7 +1106,7 @@ impl FragmentDisplayListBuilding for Fragment {
state.add_display_item(DisplayItem::Border(box BorderDisplayItem {
base: base,
border_widths: SideOffsets2D::new_all_same(Au::from_px(1)),
- color: SideOffsets2D::new_all_same(Color::rgb(0, 0, 200)),
+ color: SideOffsets2D::new_all_same(ColorF::rgb(0, 0, 200)),
style: SideOffsets2D::new_all_same(border_style::T::solid),
radius: Default::default(),
}));
@@ -2191,12 +2206,12 @@ fn shadow_bounds(content_rect: &Rect<Au>, blur_radius: Au, spread_radius: Au) ->
/// 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;
+ fn to_gfx_color(&self) -> ColorF;
}
impl ToGfxColor for RGBA {
- fn to_gfx_color(&self) -> Color {
- Color::rgba(self.red, self.green, self.blue, self.alpha)
+ fn to_gfx_color(&self) -> ColorF {
+ ColorF::new(self.red, self.green, self.blue, self.alpha)
}
}
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index c0131b5064a..8284f2fc835 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -16,7 +16,6 @@
#![plugin(plugins)]
extern crate app_units;
-extern crate azure;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate bitflags;
diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs
index 8d32029daa8..cf239f79258 100644
--- a/components/layout/webrender_helpers.rs
+++ b/components/layout/webrender_helpers.rs
@@ -8,11 +8,10 @@
// completely converting layout to directly generate WebRender display lists, for example.
use app_units::Au;
-use azure::azure_hl::Color;
use euclid::{Point2D, Rect, Size2D};
use gfx::display_list::{BorderRadii, BoxShadowClipMode, ClippingRegion};
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal};
-use gfx::display_list::{GradientStop, StackingContext, StackingContextType};
+use gfx::display_list::{StackingContext, StackingContextType};
use gfx_traits::{FragmentType, ScrollPolicy, StackingContextId, ScrollRootId};
use style::computed_values::{image_rendering, mix_blend_mode};
use style::computed_values::filter::{self, Filter};
@@ -122,29 +121,6 @@ impl ToRectF for Rect<Au> {
}
}
-trait ToColorF {
- fn to_colorf(&self) -> webrender_traits::ColorF;
-}
-
-impl ToColorF for Color {
- fn to_colorf(&self) -> webrender_traits::ColorF {
- webrender_traits::ColorF::new(self.r, self.g, self.b, self.a)
- }
-}
-
-trait ToGradientStop {
- fn to_gradient_stop(&self) -> webrender_traits::GradientStop;
-}
-
-impl ToGradientStop for GradientStop {
- fn to_gradient_stop(&self) -> webrender_traits::GradientStop {
- webrender_traits::GradientStop {
- offset: self.offset,
- color: self.color.to_colorf(),
- }
- }
-}
-
trait ToClipRegion {
fn to_clip_region(&self, frame_builder: &mut WebRenderFrameBuilder)
-> webrender_traits::ClipRegion;
@@ -352,7 +328,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
frame_builder: &mut WebRenderFrameBuilder) {
match *self {
DisplayItem::SolidColor(ref item) => {
- let color = item.color.to_colorf();
+ let color = item.color;
if color.a > 0.0 {
builder.push_rect(item.base.bounds.to_rectf(),
item.base.clip.to_clip_region(frame_builder),
@@ -388,7 +364,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
item.base.clip.to_clip_region(frame_builder),
glyphs,
item.text_run.font_key,
- item.text_color.to_colorf(),
+ item.text_color,
item.text_run.actual_pt_size,
item.blur_radius,
&mut frame_builder.auxiliary_lists_builder);
@@ -416,22 +392,22 @@ impl WebRenderDisplayItemConverter for DisplayItem {
let rect = item.base.bounds.to_rectf();
let left = webrender_traits::BorderSide {
width: item.border_widths.left.to_f32_px(),
- color: item.color.left.to_colorf(),
+ color: item.color.left,
style: item.style.left.to_border_style(),
};
let top = webrender_traits::BorderSide {
width: item.border_widths.top.to_f32_px(),
- color: item.color.top.to_colorf(),
+ color: item.color.top,
style: item.style.top.to_border_style(),
};
let right = webrender_traits::BorderSide {
width: item.border_widths.right.to_f32_px(),
- color: item.color.right.to_colorf(),
+ color: item.color.right,
style: item.style.right.to_border_style(),
};
let bottom = webrender_traits::BorderSide {
width: item.border_widths.bottom.to_f32_px(),
- color: item.color.bottom.to_colorf(),
+ color: item.color.bottom,
style: item.style.bottom.to_border_style(),
};
let radius = item.radius.to_border_radius();
@@ -447,15 +423,11 @@ impl WebRenderDisplayItemConverter for DisplayItem {
let rect = item.base.bounds.to_rectf();
let start_point = item.start_point.to_pointf();
let end_point = item.end_point.to_pointf();
- let mut stops = Vec::new();
- for stop in &item.stops {
- stops.push(stop.to_gradient_stop());
- }
builder.push_gradient(rect,
item.base.clip.to_clip_region(frame_builder),
start_point,
end_point,
- stops,
+ item.stops.clone(),
&mut frame_builder.auxiliary_lists_builder);
}
DisplayItem::Line(..) => {
@@ -468,7 +440,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
item.base.clip.to_clip_region(frame_builder),
box_bounds,
item.offset.to_pointf(),
- item.color.to_colorf(),
+ item.color,
item.blur_radius.to_f32_px(),
item.spread_radius.to_f32_px(),
item.border_radius.to_f32_px(),
diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml
index d704b9b18c0..cc97c74697f 100644
--- a/components/layout_thread/Cargo.toml
+++ b/components/layout_thread/Cargo.toml
@@ -11,7 +11,6 @@ path = "lib.rs"
[dependencies]
app_units = "0.3"
-azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
euclid = "0.10.1"
fnv = "1.0"
gfx = {path = "../gfx"}
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 222851588ee..537d5935596 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -13,7 +13,6 @@
#![plugin(plugins)]
extern crate app_units;
-extern crate azure;
extern crate core;
extern crate euclid;
extern crate fnv;
@@ -46,7 +45,6 @@ extern crate util;
extern crate webrender_traits;
use app_units::Au;
-use azure::azure_hl::Color;
use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::scale_factor::ScaleFactor;
@@ -969,11 +967,6 @@ impl LayoutThread {
epoch,
&mut frame_builder);
let root_background_color = get_root_flow_background_color(layout_root);
- let root_background_color =
- webrender_traits::ColorF::new(root_background_color.r,
- root_background_color.g,
- root_background_color.b,
- root_background_color.a);
let viewport_size = Size2D::new(self.viewport_size.width.to_f32_px(),
self.viewport_size.height.to_f32_px());
@@ -1491,18 +1484,19 @@ impl LayoutThread {
// clearing the frame buffer to white. This ensures that setting a background
// color on an iframe element, while the iframe content itself has a default
// transparent background color is handled correctly.
-fn get_root_flow_background_color(flow: &mut Flow) -> Color {
+fn get_root_flow_background_color(flow: &mut Flow) -> webrender_traits::ColorF {
+ let transparent = webrender_traits::ColorF { r: 0.0, g: 0.0, b: 0.0, a: 0.0 };
if !flow.is_block_like() {
- return Color::transparent()
+ return transparent;
}
let block_flow = flow.as_mut_block();
let kid = match block_flow.base.children.iter_mut().next() {
- None => return Color::transparent(),
+ None => return transparent,
Some(kid) => kid,
};
if !kid.is_block_like() {
- return Color::transparent()
+ return transparent;
}
let kid_block_flow = kid.as_block();
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 0fc0750defb..54d72a5f4d8 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -811,7 +811,6 @@ name = "gfx"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1194,7 +1193,6 @@ name = "layout"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1243,7 +1241,6 @@ name = "layout_thread"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 3dda7f2461e..173cd20bbed 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -725,7 +725,6 @@ name = "gfx"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1099,7 +1098,6 @@ name = "layout"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas_traits 0.0.1",
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1141,7 +1139,6 @@ name = "layout_thread"
version = "0.0.1"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "azure 0.9.1 (git+https://github.com/servo/rust-azure)",
"euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",