stylo: Implement scroll-snap-coordinate

MozReview-Commit-ID: 6mr4ktfeEGT
This commit is contained in:
Manish Goregaokar 2017-02-06 17:45:09 -08:00 committed by Manish Goregaokar
parent a095565a8c
commit 20796ee94e
4 changed files with 62 additions and 4 deletions

View file

@ -1169,7 +1169,8 @@ fn static_assert() {
animation-iteration-count animation-timing-function
-moz-binding page-break-before page-break-after
scroll-snap-points-x scroll-snap-points-y transform
scroll-snap-type-y scroll-snap-destination perspective-origin transform-origin""" %>
scroll-snap-type-y scroll-snap-destination scroll-snap-coordinate
perspective-origin transform-origin""" %>
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
// We manually-implement the |display| property until we get general
@ -1347,6 +1348,34 @@ fn static_assert() {
${impl_simple_copy('scroll_snap_destination', 'mScrollSnapDestination')}
pub fn set_scroll_snap_coordinate(&mut self, v: longhands::scroll_snap_coordinate::computed_value::T) {
unsafe { self.gecko.mScrollSnapCoordinate.set_len_pod(v.0.len() as u32); }
for (gecko, servo) in self.gecko.mScrollSnapCoordinate
.iter_mut()
.zip(v.0.iter()) {
gecko.mXPosition = servo.horizontal.into();
gecko.mYPosition = servo.vertical.into();
}
}
pub fn copy_scroll_snap_coordinate_from(&mut self, other: &Self) {
unsafe {
self.gecko.mScrollSnapCoordinate
.set_len_pod(other.gecko.mScrollSnapCoordinate.len() as u32);
}
for (this, that) in self.gecko.mScrollSnapCoordinate
.iter_mut()
.zip(other.gecko.mScrollSnapCoordinate.iter()) {
*this = *that;
}
}
pub fn clone_scroll_snap_coordinate(&self) -> longhands::scroll_snap_coordinate::computed_value::T {
let vec = self.gecko.mScrollSnapCoordinate.iter().map(|f| f.into()).collect();
longhands::scroll_snap_coordinate::computed_value::T(vec)
}
<%def name="transform_function_arm(name, keyword, items)">
<%
pattern = None