Auto merge of #17783 - BorisChiou:stylo/animation/restrictions, r=nox

stylo: Bug 1374233 - Clamp interpolated values for properties which need to be restricted

Some properties only accept non-negative values, or values greater than or equal to one. It is possible to produce an negative interpolated values while using negative timing functions, so we have to apply a restriction to these values to avoid getting invalid values.

For example, line-height must be non-negative, but the output progress of some timing functions (e,g. cubic-bezier(0.25, -2, 0.75, 1)) may be a negative value, so the interpolated result of line-height is also negative.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix Bug 1374233.
- [X] These changes do not require tests because we have tests in Gecko side already.

<!-- 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/17783)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-07 11:05:17 -05:00 committed by GitHub
commit 016ea11cba
56 changed files with 1039 additions and 371 deletions

View file

@ -1393,7 +1393,7 @@ impl FragmentDisplayListBuilding for Fragment {
box_shadow.base.horizontal,
box_shadow.base.vertical,
)),
box_shadow.base.blur,
box_shadow.base.blur.0,
box_shadow.spread,
);
@ -1408,7 +1408,7 @@ impl FragmentDisplayListBuilding for Fragment {
box_bounds: *absolute_bounds,
color: style.resolve_color(box_shadow.base.color).to_gfx_color(),
offset: Vector2D::new(box_shadow.base.horizontal, box_shadow.base.vertical),
blur_radius: box_shadow.base.blur,
blur_radius: box_shadow.base.blur.0,
spread_radius: box_shadow.spread,
border_radius: model::specified_border_radius(style.get_border()
.border_top_left_radius,
@ -1577,7 +1577,7 @@ impl FragmentDisplayListBuilding for Fragment {
clip: &Rect<Au>) {
use style::values::Either;
let width = style.get_outline().outline_width;
let width = style.get_outline().outline_width.0;
if width == Au(0) {
return
}
@ -2054,7 +2054,7 @@ impl FragmentDisplayListBuilding for Fragment {
let effects = self.style().get_effects();
let mut filters = effects.filter.0.clone();
if effects.opacity != 1.0 {
filters.push(Filter::Opacity(effects.opacity))
filters.push(Filter::Opacity(effects.opacity.into()))
}
let context_type = match mode {
@ -2129,7 +2129,7 @@ impl FragmentDisplayListBuilding for Fragment {
for shadow in text_shadows.iter().rev() {
state.add_display_item(DisplayItem::PushTextShadow(box PushTextShadowDisplayItem {
base: base.clone(),
blur_radius: shadow.blur,
blur_radius: shadow.blur.0,
offset: Vector2D::new(shadow.horizontal, shadow.vertical),
color: self.style().resolve_color(shadow.color).to_gfx_color(),
}));