Auto merge of #15905 - mephisto41:add-border-gradient, r=emilio

Add gradient border support.

webrender add gradient border support in https://github.com/servo/webrender/pull/953. This pr add support in servo.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [X] These changes do not require tests because it should be covered by wpt

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/15905)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-26 02:29:16 -07:00 committed by GitHub
commit fd8127b23b
6 changed files with 174 additions and 31 deletions

View file

@ -351,20 +351,30 @@ impl WebRenderDisplayItemConverter for DisplayItem {
}
}
}
BorderDetails::Gradient(ref gradient) => {
webrender_traits::BorderDetails::Gradient(webrender_traits::GradientBorder {
gradient: builder.create_gradient(
gradient.gradient.start_point.to_pointf(),
gradient.gradient.end_point.to_pointf(),
gradient.gradient.stops.clone(),
ExtendMode::Clamp),
outset: gradient.outset,
})
}
};
builder.push_border(rect, clip, widths, details);
}
DisplayItem::Gradient(ref item) => {
let rect = item.base.bounds.to_rectf();
let start_point = item.start_point.to_pointf();
let end_point = item.end_point.to_pointf();
let start_point = item.gradient.start_point.to_pointf();
let end_point = item.gradient.end_point.to_pointf();
let clip = item.base.clip.to_clip_region(builder);
builder.push_gradient(rect,
clip,
start_point,
end_point,
item.stops.clone(),
item.gradient.stops.clone(),
ExtendMode::Clamp);
}
DisplayItem::Line(..) => {