diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index cf5b90c71fc..409c52726fb 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -10,7 +10,7 @@ use gecko_bindings::structs::{NS_RADIUS_CLOSEST_SIDE, NS_RADIUS_FARTHEST_SIDE}; use gecko_bindings::structs::nsStyleCoord; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue}; use std::cmp::max; -use values::{Auto, Either}; +use values::{Auto, Either, None_}; use values::computed::{Angle, LengthOrPercentageOrNone, Number}; use values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use values::computed::basic_shape::ShapeRadius; @@ -201,6 +201,20 @@ impl GeckoStyleCoordConvertible for Auto { } } +impl GeckoStyleCoordConvertible for None_ { + fn to_gecko_style_coord(&self, coord: &mut T) { + coord.set_value(CoordDataValue::None) + } + + fn from_gecko_style_coord(coord: &T) -> Option { + if let CoordDataValue::None = coord.as_value() { + Some(None_) + } else { + None + } + } +} + pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 { (((rgba.alpha * 255.0).round() as u32) << 24) | (((rgba.blue * 255.0).round() as u32) << 16) | diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index d85aa8b63ab..30a26051c9b 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -505,6 +505,7 @@ impl Debug for ${style_struct.gecko_struct_name} { "LengthOrPercentage": impl_style_coord, "LengthOrPercentageOrAuto": impl_style_coord, "LengthOrPercentageOrNone": impl_style_coord, + "LengthOrNone": impl_style_coord, "Number": impl_simple, "Opacity": impl_simple, "CSSColor": impl_color, @@ -1053,7 +1054,7 @@ fn static_assert() { <% skip_box_longhands= """display overflow-y vertical-align -moz-binding page-break-before page-break-after scroll-snap-points-x scroll-snap-points-y transform - scroll-snap-type-y""" %> + scroll-snap-type-y perspective-origin""" %> <%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}"> // We manually-implement the |display| property until we get general @@ -1325,6 +1326,15 @@ fn static_assert() { ${impl_keyword('scroll_snap_type_y', 'mScrollSnapTypeY', scroll_snap_type_keyword, need_clone=False)} + pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) { + self.gecko.mPerspectiveOrigin[0].set(v.horizontal); + self.gecko.mPerspectiveOrigin[1].set(v.vertical); + } + + pub fn copy_perspective_origin_from(&mut self, other: &Self) { + self.gecko.mPerspectiveOrigin[0].copy_from(&other.gecko.mPerspectiveOrigin[0]); + self.gecko.mPerspectiveOrigin[1].copy_from(&other.gecko.mPerspectiveOrigin[1]); + } <%def name="simple_image_array_property(name, shorthand, field_name)"> diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 44988f466a5..367352c32f8 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -1531,12 +1531,12 @@ ${helpers.single_keyword("resize", ${helpers.predefined_type("perspective", "LengthOrNone", "Either::Second(None_)", - products="servo", + gecko_ffi_name="mChildPerspective", animatable=True)} // FIXME: This prop should be animatable // https://drafts.csswg.org/css-transforms/#perspective-origin-property -<%helpers:longhand name="perspective-origin" products="servo" animatable="False"> +<%helpers:longhand name="perspective-origin" animatable="False"> use std::fmt; use style_traits::ToCss; use values::HasViewportPercentage;