Skip to content

Commit

Permalink
Update WR (switch to new text-decorations API in WR).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gw3583 committed Jul 24, 2017
1 parent 548d65d commit dc82366
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion components/gfx/display_list/mod.rs
Expand Up @@ -1146,7 +1146,8 @@ pub struct LineDisplayItem {
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.
Expand Down
7 changes: 4 additions & 3 deletions components/layout/display_list_builder.rs
Expand Up @@ -71,7 +71,7 @@ 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 {
Expand Down Expand Up @@ -1651,7 +1651,7 @@ impl FragmentDisplayListBuilding for Fragment {
state.add_display_item(DisplayItem::Line(box LineDisplayItem {
base: base,
color: ColorF::rgb(0, 200, 0),
style: border_style::T::dashed,
style: LineStyle::Dashed,
}));
}

Expand Down Expand Up @@ -2217,9 +2217,10 @@ impl FragmentDisplayListBuilding for Fragment {
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,
}));
}

Expand Down
12 changes: 10 additions & 2 deletions components/layout/webrender_helpers.rs
Expand Up @@ -432,8 +432,16 @@ impl WebRenderDisplayItemConverter for DisplayItem {
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();
Expand Down

0 comments on commit dc82366

Please sign in to comment.