Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylo: Make border-spacing animatable #16624

Merged
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -3255,6 +3255,13 @@ fn static_assert() {
self.gecko.mBorderSpacingCol = other.gecko.mBorderSpacingCol;
self.gecko.mBorderSpacingRow = other.gecko.mBorderSpacingRow;
}

pub fn clone_border_spacing(&self) -> longhands::border_spacing::computed_value::T {
longhands::border_spacing::computed_value::T {
horizontal: Au(self.gecko.mBorderSpacingCol),
vertical: Au(self.gecko.mBorderSpacingRow)
}
}
</%self:impl_trait>


@@ -20,7 +20,7 @@ ${helpers.single_keyword("caption-side", "top bottom",
animation_value_type="none",
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side")}

<%helpers:longhand name="border-spacing" animation_value_type="none" boxed="True"
<%helpers:longhand name="border-spacing" animation_value_type="ComputedValue" boxed="True"
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing">
use app_units::Au;
use std::fmt;
@@ -29,7 +29,7 @@ ${helpers.single_keyword("caption-side", "top bottom",

pub mod computed_value {
use app_units::Au;
use properties::animated_properties::Interpolate;
use properties::animated_properties::{ComputeDistance, Interpolate};

#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@@ -48,6 +48,19 @@ ${helpers.single_keyword("caption-side", "top bottom",
})
}
}

impl ComputeDistance for T {
#[inline]
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
self.compute_squared_distance(other).map(|sd| sd.sqrt())
}

#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
Ok(try!(self.horizontal.compute_squared_distance(&other.horizontal)) +
try!(self.vertical.compute_squared_distance(&other.vertical)))
}
}
}

impl HasViewportPercentage for SpecifiedValue {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.