mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
make image-orientation animatable
This commit is contained in:
parent
25a46c40b3
commit
c5de3e56a2
2 changed files with 26 additions and 1 deletions
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue