servo: Merge #17814 - Update WR (switch to new text-decorations API in WR) (from glennw:update-wr-text-decorations); r=emilio
authorGlenn Watson <github@intuitionlibrary.com>
Sun, 23 Jul 2017 20:04:38 -0700
changeset 419201 a0181f9fc90a915f5762b64165e8968715c7ff11
parent 419200 42667c5ba946a1d9341d7d7ac4871ee46396de35
child 419202 6903156877e93ddb192e2d0f62a2baa8ff4a4707
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17814 - Update WR (switch to new text-decorations API in WR) (from glennw:update-wr-text-decorations); r=emilio This only makes use of the "Solid" text decoration type, which matches the existing support. WR now supports dotted, dashed and wavy text decorations, but supporting those will need some extra work in Servo to pass through the correct values. Source-Repo: https://github.com/servo/servo Source-Revision: 46ffcbaf7bc97df7c8ba3b82add0e03a01805ab4
servo/Cargo.lock
servo/components/gfx/display_list/mod.rs
servo/components/layout/display_list_builder.rs
servo/components/layout/webrender_helpers.rs
--- a/servo/Cargo.lock
+++ b/servo/Cargo.lock
@@ -3460,17 +3460,17 @@ dependencies = [
  "url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "uuid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "webrender"
 version = "0.48.0"
-source = "git+https://github.com/servo/webrender#b83c200c657f6b6fb17d09f329ba77803420b46a"
+source = "git+https://github.com/servo/webrender#8fd634882111415a65da67e947f26eb170234f2f"
 dependencies = [
  "app_units 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-text 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3489,17 +3489,17 @@ dependencies = [
  "thread_profiler 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
  "webrender_api 0.48.0 (git+https://github.com/servo/webrender)",
 ]
 
 [[package]]
 name = "webrender_api"
 version = "0.48.0"
-source = "git+https://github.com/servo/webrender#b83c200c657f6b6fb17d09f329ba77803420b46a"
+source = "git+https://github.com/servo/webrender#8fd634882111415a65da67e947f26eb170234f2f"
 dependencies = [
  "app_units 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/servo/components/gfx/display_list/mod.rs
+++ b/servo/components/gfx/display_list/mod.rs
@@ -1141,17 +1141,18 @@ impl<T> BorderRadii<T> where T: PartialE
 #[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
 pub struct LineDisplayItem {
     pub base: BaseDisplayItem,
 
     /// The line segment color.
     pub color: ColorF,
 
     /// The line segment style.
-    pub style: border_style::T
+    #[ignore_heap_size_of = "enum type in webrender"]
+    pub style: webrender_api::LineStyle,
 }
 
 /// Paints a box shadow per CSS-BACKGROUNDS.
 #[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
 pub struct BoxShadowDisplayItem {
     /// Fields common to all display items.
     pub base: BaseDisplayItem,
 
--- a/servo/components/layout/display_list_builder.rs
+++ b/servo/components/layout/display_list_builder.rs
@@ -66,17 +66,17 @@ use style::values::generics::image::{Cir
 use style::values::generics::image::{GradientItem as GenericGradientItem, GradientKind};
 use style::values::generics::image::{Image, ShapeExtent};
 use style::values::generics::image::PaintWorklet;
 use style::values::specified::position::{X, Y};
 use style_traits::CSSPixel;
 use style_traits::cursor::Cursor;
 use table_cell::CollapsedBordersForCell;
 use webrender_api::{ClipId, ColorF, ComplexClipRegion, GradientStop, LocalClip, RepeatMode};
-use webrender_api::{ScrollPolicy, TransformStyle};
+use webrender_api::{LineStyle, ScrollPolicy, TransformStyle};
 use webrender_helpers::{ToBorderRadius, ToMixBlendMode, ToRectF, ToTransformStyle};
 
 trait ResolvePercentage {
     fn resolve(&self, length: u32) -> u32;
 }
 
 impl ResolvePercentage for NumberOrPercentage {
     fn resolve(&self, length: u32) -> u32 {
@@ -1646,17 +1646,17 @@ impl FragmentDisplayListBuilding for Fra
         let base = state.create_base_display_item(&baseline,
                                                   LocalClip::from(clip.to_rectf()),
                                                   self.node,
                                                   style.get_cursor(Cursor::Default),
                                                   DisplayListSection::Content);
         state.add_display_item(DisplayItem::Line(box LineDisplayItem {
             base: base,
             color: ColorF::rgb(0, 200, 0),
-            style: border_style::T::dashed,
+            style: LineStyle::Dashed,
         }));
     }
 
     fn build_debug_borders_around_fragment(&self,
                                            state: &mut DisplayListBuildState,
                                            stacking_relative_border_box: &Rect<Au>,
                                            clip: &Rect<Au>) {
         // This prints a debug border around the border of this fragment.
@@ -2212,19 +2212,20 @@ impl FragmentDisplayListBuilding for Fra
                                                                       container_size);
         let base = state.create_base_display_item(
             &stacking_relative_box,
             LocalClip::from(clip.to_rectf()),
             self.node,
             self.style.get_cursor(Cursor::Default),
             DisplayListSection::Content);
 
-        state.add_display_item(DisplayItem::SolidColor(box SolidColorDisplayItem {
+        state.add_display_item(DisplayItem::Line(box LineDisplayItem {
             base: base,
             color: color.to_gfx_color(),
+            style: LineStyle::Solid,
         }));
     }
 
     fn unique_id(&self, id_type: IdType) -> u64 {
         let fragment_type = self.fragment_type();
         let id = match id_type {
             IdType::StackingContext | IdType::OverflowClip  => self.node.id() as usize,
             IdType::CSSClip => self as *const _ as usize,
--- a/servo/components/layout/webrender_helpers.rs
+++ b/servo/components/layout/webrender_helpers.rs
@@ -427,18 +427,26 @@ impl WebRenderDisplayItemConverter for D
                                                               item.gradient.stops.clone(),
                                                               extend_mode);
                 builder.push_radial_gradient(rect,
                                              Some(item.base.local_clip),
                                              gradient,
                                              rect.size,
                                              webrender_api::LayoutSize::zero());
             }
-            DisplayItem::Line(..) => {
-                println!("TODO DisplayItem::Line");
+            DisplayItem::Line(ref item) => {
+                let box_bounds = item.base.bounds.to_rectf();
+                builder.push_line(Some(item.base.local_clip),
+                                  box_bounds.origin.y + box_bounds.size.height,
+                                  box_bounds.origin.x,
+                                  box_bounds.origin.x + box_bounds.size.width,
+                                  webrender_api::LineOrientation::Horizontal,
+                                  box_bounds.size.height,
+                                  item.color,
+                                  item.style);
             }
             DisplayItem::BoxShadow(ref item) => {
                 let rect = item.base.bounds.to_rectf();
                 let box_bounds = item.box_bounds.to_rectf();
                 builder.push_box_shadow(rect,
                                         Some(item.base.local_clip),
                                         box_bounds,
                                         item.offset.to_vectorf(),