Auto merge of #16494 - mantaroh:animate_column, r=hiro

Make column-count/column-gap/column-width animatable.

<!-- Please describe your changes on the following line: -->

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1355732.

---
<!-- 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] There are tests for these changes, a test case will be landed in web-platform-tests in https://bugzilla.mozilla.org/show_bug.cgi?id=1355732

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16494)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-17 03:26:57 -05:00 committed by GitHub
commit 5c29afd0a7
3 changed files with 24 additions and 7 deletions

View file

@ -679,6 +679,7 @@ impl Debug for ${style_struct.gecko_struct_name} {
"LengthOrPercentageOrAuto": impl_style_coord, "LengthOrPercentageOrAuto": impl_style_coord,
"LengthOrPercentageOrNone": impl_style_coord, "LengthOrPercentageOrNone": impl_style_coord,
"LengthOrNone": impl_style_coord, "LengthOrNone": impl_style_coord,
"LengthOrNormal": impl_style_coord,
"MaxLength": impl_style_coord, "MaxLength": impl_style_coord,
"MinLength": impl_style_coord, "MinLength": impl_style_coord,
"Number": impl_simple, "Number": impl_simple,
@ -3610,6 +3611,17 @@ clip-path
${impl_simple_copy('column_count', 'mColumnCount')} ${impl_simple_copy('column_count', 'mColumnCount')}
pub fn clone_column_count(&self) -> longhands::column_count::computed_value::T {
use gecko_bindings::structs::NS_STYLE_COLUMN_COUNT_AUTO;
if self.gecko.mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO {
debug_assert!((self.gecko.mColumnCount as i32) >= 0 &&
(self.gecko.mColumnCount as i32) < i32::max_value());
Either::First(self.gecko.mColumnCount as i32)
} else {
Either::Second(Auto)
}
}
<% impl_app_units("column_rule_width", "mColumnRuleWidth", need_clone=True, <% impl_app_units("column_rule_width", "mColumnRuleWidth", need_clone=True,
round_to_pixels=True) %> round_to_pixels=True) %>
</%self:impl_trait> </%self:impl_trait>

View file

@ -29,7 +29,7 @@ use std::fmt;
use style_traits::ToCss; use style_traits::ToCss;
use super::ComputedValues; use super::ComputedValues;
use values::CSSFloat; use values::CSSFloat;
use values::{Auto, Either}; use values::{Auto, Either, Normal};
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone}; use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone};
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage}; use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
@ -515,6 +515,13 @@ impl Interpolate for Auto {
} }
} }
impl Interpolate for Normal {
#[inline]
fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
Ok(Normal)
}
}
impl <T> Interpolate for Option<T> impl <T> Interpolate for Option<T>
where T: Interpolate, where T: Interpolate,
{ {

View file

@ -6,20 +6,19 @@
<% data.new_style_struct("Column", inherited=False) %> <% data.new_style_struct("Column", inherited=False) %>
// FIXME: This prop should be animatable.
${helpers.predefined_type("column-width", ${helpers.predefined_type("column-width",
"length::LengthOrAuto", "length::LengthOrAuto",
"Either::Second(Auto)", "Either::Second(Auto)",
initial_specified_value="Either::Second(Auto)", initial_specified_value="Either::Second(Auto)",
parse_method="parse_non_negative_length", parse_method="parse_non_negative_length",
extra_prefixes="moz", extra_prefixes="moz",
animation_type="none", animation_type="normal",
experimental=True, experimental=True,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")} spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")}
// FIXME: This prop should be animatable. ${helpers.predefined_type("column-count",
${helpers.predefined_type("column-count", "IntegerOrAuto", "IntegerOrAuto",
"Either::Second(Auto)", "Either::Second(Auto)",
parse_method="parse_positive", parse_method="parse_positive",
initial_specified_value="Either::Second(Auto)", initial_specified_value="Either::Second(Auto)",
@ -28,14 +27,13 @@ ${helpers.predefined_type("column-count", "IntegerOrAuto",
extra_prefixes="moz", extra_prefixes="moz",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")} spec="https://drafts.csswg.org/css-multicol/#propdef-column-count")}
// FIXME: This prop should be animatable.
${helpers.predefined_type("column-gap", ${helpers.predefined_type("column-gap",
"length::LengthOrNormal", "length::LengthOrNormal",
"Either::Second(Normal)", "Either::Second(Normal)",
parse_method='parse_non_negative_length', parse_method='parse_non_negative_length',
extra_prefixes="moz", extra_prefixes="moz",
experimental=True, experimental=True,
animation_type="none", animation_type="normal",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")} spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz", ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",