Skip to content

Commit

Permalink
make image-orientation animatable
Browse files Browse the repository at this point in the history
  • Loading branch information
dadaa committed Aug 3, 2017
1 parent 25a46c4 commit c5de3e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -4546,6 +4546,31 @@ fn static_assert() {
pub fn reset_image_orientation(&mut self, other: &Self) {
self.copy_image_orientation_from(other)
}

pub fn clone_image_orientation(&self) -> longhands::image_orientation::computed_value::T {
use gecko_bindings::structs::{nsStyleImageOrientation_Bits, nsStyleImageOrientation_Angles};
use properties::longhands::image_orientation::computed_value::{Orientation, T};

let gecko_orientation = self.gecko.mImageOrientation.mOrientation;
if gecko_orientation & nsStyleImageOrientation_Bits::FROM_IMAGE_MASK as u8 != 0 {
T::FromImage
} else {
const ANGLE0: u8 = nsStyleImageOrientation_Angles::ANGLE_0 as u8;
const ANGLE90: u8 = nsStyleImageOrientation_Angles::ANGLE_90 as u8;
const ANGLE180: u8 = nsStyleImageOrientation_Angles::ANGLE_180 as u8;
const ANGLE270: u8 = nsStyleImageOrientation_Angles::ANGLE_270 as u8;

let flip = gecko_orientation & nsStyleImageOrientation_Bits::FLIP_MASK as u8 != 0;
let orientation = match gecko_orientation & nsStyleImageOrientation_Bits::ORIENTATION_MASK as u8 {
ANGLE0 => Orientation::Angle0,
ANGLE90 => Orientation::Angle90,
ANGLE180 => Orientation::Angle180,
ANGLE270 => Orientation::Angle270,
_ => unreachable!()
};
T::AngleWithFlipped(orientation, flip)
}
}
</%self:impl_trait>

<%self:impl_trait style_struct_name="InheritedTable"
Expand Down
2 changes: 1 addition & 1 deletion components/style/properties/longhand/inherited_box.mako.rs
Expand Up @@ -59,7 +59,7 @@ ${helpers.single_keyword("image-rendering",
// Image Orientation
<%helpers:longhand name="image-orientation"
products="gecko"
animation_value_type="none"
animation_value_type="discrete"
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \
/// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation">
use std::fmt;
Expand Down

0 comments on commit c5de3e5

Please sign in to comment.