Auto merge of #16006 - upsuper:box-ordinal-group, r=Manishearth

Implement -moz-box-ordinal-group property

This PR fixes #16000.

<!-- 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/16006)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-17 15:15:01 -07:00 committed by GitHub
commit 8f3f8098c3
12 changed files with 156 additions and 182 deletions

View file

@ -22,7 +22,6 @@ use properties::longhands::transform::computed_value::ComputedOperation as Trans
use properties::longhands::transform::computed_value::T as TransformList;
use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
use properties::longhands::visibility::computed_value::T as Visibility;
use properties::longhands::z_index::computed_value::T as ZIndex;
#[cfg(feature = "gecko")] use properties::{PropertyDeclarationId, LonghandId};
use std::cmp;
#[cfg(feature = "gecko")] use std::collections::HashMap;
@ -35,7 +34,6 @@ use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone
use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone};
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
use values::computed::{MaxLength, MinLength};
use values::computed::ColorOrAuto;
use values::computed::position::{HorizontalPosition, Position, VerticalPosition};
use values::computed::ToComputedValue;
use values::specified::Angle as SpecifiedAngle;
@ -406,6 +404,13 @@ impl Interpolate for Au {
}
}
impl Interpolate for Auto {
#[inline]
fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
Ok(Auto)
}
}
impl <T> Interpolate for Option<T>
where T: Interpolate,
{
@ -436,7 +441,7 @@ impl Interpolate for f64 {
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-number
/// https://drafts.csswg.org/css-transitions/#animtype-integer
impl Interpolate for i32 {
#[inline]
fn interpolate(&self, other: &i32, progress: f64) -> Result<Self, ()> {
@ -473,20 +478,6 @@ impl Interpolate for Visibility {
}
}
/// https://drafts.csswg.org/css-transitions/#animtype-integer
impl Interpolate for ZIndex {
#[inline]
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
match (*self, *other) {
(ZIndex::Number(ref this),
ZIndex::Number(ref other)) => {
this.interpolate(other, progress).map(ZIndex::Number)
}
_ => Err(()),
}
}
}
impl<T: Interpolate + Copy> Interpolate for Size2D<T> {
#[inline]
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
@ -1839,16 +1830,17 @@ impl Interpolate for TransformList {
}
}
/// https://drafts.csswg.org/css-transitions-1/#animtype-color
impl Interpolate for ColorOrAuto {
impl<T, U> Interpolate for Either<T, U>
where T: Interpolate + Copy, U: Interpolate + Copy,
{
#[inline]
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
match (*self, *other) {
(Either::First(ref this), Either::First(ref other)) => {
this.interpolate(&other, progress).map(Either::First)
},
(Either::Second(Auto), Either::Second(Auto)) => {
Ok(Either::Second(Auto))
(Either::Second(ref this), Either::Second(ref other)) => {
this.interpolate(&other, progress).map(Either::Second)
},
_ => {
let interpolated = if progress < 0.5 { *self } else { *other };