Auto merge of #17814 - glennw:update-wr-text-decorations, r=emilio

Update WR (switch to new text-decorations API in WR).

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.

<!-- 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/17814)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-07-23 20:04:38 -07:00 committed by GitHub
commit 46ffcbaf7b
4 changed files with 18 additions and 8 deletions

4
Cargo.lock generated
View file

@ -3465,7 +3465,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender" name = "webrender"
version = "0.48.0" version = "0.48.0"
source = "git+https://github.com/servo/webrender#b83c200c657f6b6fb17d09f329ba77803420b46a" source = "git+https://github.com/servo/webrender#8fd634882111415a65da67e947f26eb170234f2f"
dependencies = [ dependencies = [
"app_units 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3494,7 +3494,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender_api" name = "webrender_api"
version = "0.48.0" version = "0.48.0"
source = "git+https://github.com/servo/webrender#b83c200c657f6b6fb17d09f329ba77803420b46a" source = "git+https://github.com/servo/webrender#8fd634882111415a65da67e947f26eb170234f2f"
dependencies = [ dependencies = [
"app_units 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -1146,7 +1146,8 @@ pub struct LineDisplayItem {
pub color: ColorF, pub color: ColorF,
/// The line segment style. /// 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. /// Paints a box shadow per CSS-BACKGROUNDS.

View file

@ -71,7 +71,7 @@ use style_traits::CSSPixel;
use style_traits::cursor::Cursor; use style_traits::cursor::Cursor;
use table_cell::CollapsedBordersForCell; use table_cell::CollapsedBordersForCell;
use webrender_api::{ClipId, ColorF, ComplexClipRegion, GradientStop, LocalClip, RepeatMode}; 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}; use webrender_helpers::{ToBorderRadius, ToMixBlendMode, ToRectF, ToTransformStyle};
trait ResolvePercentage { trait ResolvePercentage {
@ -1651,7 +1651,7 @@ impl FragmentDisplayListBuilding for Fragment {
state.add_display_item(DisplayItem::Line(box LineDisplayItem { state.add_display_item(DisplayItem::Line(box LineDisplayItem {
base: base, base: base,
color: ColorF::rgb(0, 200, 0), color: ColorF::rgb(0, 200, 0),
style: border_style::T::dashed, style: LineStyle::Dashed,
})); }));
} }
@ -2217,9 +2217,10 @@ impl FragmentDisplayListBuilding for Fragment {
self.style.get_cursor(Cursor::Default), self.style.get_cursor(Cursor::Default),
DisplayListSection::Content); DisplayListSection::Content);
state.add_display_item(DisplayItem::SolidColor(box SolidColorDisplayItem { state.add_display_item(DisplayItem::Line(box LineDisplayItem {
base: base, base: base,
color: color.to_gfx_color(), color: color.to_gfx_color(),
style: LineStyle::Solid,
})); }));
} }

View file

@ -432,8 +432,16 @@ impl WebRenderDisplayItemConverter for DisplayItem {
rect.size, rect.size,
webrender_api::LayoutSize::zero()); webrender_api::LayoutSize::zero());
} }
DisplayItem::Line(..) => { DisplayItem::Line(ref item) => {
println!("TODO DisplayItem::Line"); 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) => { DisplayItem::BoxShadow(ref item) => {
let rect = item.base.bounds.to_rectf(); let rect = item.base.bounds.to_rectf();