Skip to content

Commit

Permalink
stylo: Implement -moz-image-region
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: E6Iir2hWlbG
  • Loading branch information
Manishearth committed Feb 9, 2017
1 parent 6b0d390 commit 78dc5f6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
24 changes: 23 additions & 1 deletion components/style/properties/gecko.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ fn static_assert() {
</%self:impl_trait>

<%self:impl_trait style_struct_name="List"
skip_longhands="list-style-image list-style-type quotes"
skip_longhands="list-style-image list-style-type quotes -moz-image-region"
skip_additionals="*">

pub fn set_list_style_image(&mut self, image: longhands::list_style_image::computed_value::T) {
Expand Down Expand Up @@ -2100,6 +2100,28 @@ fn static_assert() {
unsafe { self.gecko.mQuotes.set(&other.gecko.mQuotes); }
}

#[allow(non_snake_case)]
pub fn set__moz_image_region(&mut self, v: longhands::_moz_image_region::computed_value::T) {
use values::Either;

match v {
Either::Second(_auto) => {
self.gecko.mImageRegion.x = 0;
self.gecko.mImageRegion.y = 0;
self.gecko.mImageRegion.width = 0;
self.gecko.mImageRegion.height = 0;
}
Either::First(rect) => {
self.gecko.mImageRegion.x = rect.left.0;
self.gecko.mImageRegion.y = rect.top.0;
self.gecko.mImageRegion.height = rect.bottom.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.y;
self.gecko.mImageRegion.width = rect.right.unwrap_or(Au(0)).0 - self.gecko.mImageRegion.x;
}
}
}

${impl_simple_copy('_moz_image_region', 'mImageRegion')}

</%self:impl_trait>

<%self:impl_trait style_struct_name="Effects"
Expand Down
8 changes: 8 additions & 0 deletions components/style/properties/longhand/list.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,11 @@ ${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_
}
}
</%helpers:longhand>

${helpers.predefined_type("-moz-image-region",
"ClipRectOrAuto",
"computed::ClipRectOrAuto::auto()",
animatable=False,
products="gecko",
boxed="True",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)")}

0 comments on commit 78dc5f6

Please sign in to comment.