mirror of
https://github.com/servo/servo.git
synced 2025-08-17 19:35:33 +01:00
style: Remove angle values from image-orientation.
Bug: 1473450 Reviewed-by: emilio MozReview-Commit-ID: FB74ILJM6Fm
This commit is contained in:
parent
4e8d3fce38
commit
f526af7f01
7 changed files with 10 additions and 310 deletions
|
@ -285,7 +285,6 @@ class Longhand(object):
|
|||
"FontSynthesis",
|
||||
"FontWeight",
|
||||
"GridAutoFlow",
|
||||
"ImageOrientation",
|
||||
"InitialLetter",
|
||||
"Integer",
|
||||
"JustifyContent",
|
||||
|
|
|
@ -4533,64 +4533,7 @@ fn static_assert() {
|
|||
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="InheritedBox"
|
||||
skip_longhands="image-orientation">
|
||||
// FIXME: Gecko uses a tricky way to store computed value of image-orientation
|
||||
// within an u8. We could inline following glue codes by implementing all
|
||||
// those tricky parts for Servo as well. But, it's not done yet just for
|
||||
// convenience.
|
||||
pub fn set_image_orientation(&mut self, v: longhands::image_orientation::computed_value::T) {
|
||||
use properties::longhands::image_orientation::computed_value::T;
|
||||
match v {
|
||||
T::FromImage => {
|
||||
unsafe {
|
||||
bindings::Gecko_SetImageOrientationAsFromImage(&mut self.gecko);
|
||||
}
|
||||
},
|
||||
T::AngleWithFlipped(ref orientation, flipped) => {
|
||||
unsafe {
|
||||
bindings::Gecko_SetImageOrientation(&mut self.gecko, *orientation as u8, flipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_image_orientation_from(&mut self, other: &Self) {
|
||||
unsafe {
|
||||
bindings::Gecko_CopyImageOrientationFrom(&mut self.gecko, &other.gecko);
|
||||
}
|
||||
}
|
||||
|
||||
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_Angles;
|
||||
use properties::longhands::image_orientation::computed_value::T;
|
||||
use values::computed::Orientation;
|
||||
|
||||
let gecko_orientation = self.gecko.mImageOrientation.mOrientation;
|
||||
if gecko_orientation & structs::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 & structs::nsStyleImageOrientation_Bits_FLIP_MASK as u8 != 0;
|
||||
let orientation =
|
||||
match gecko_orientation & structs::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 style_struct_name="InheritedBox">
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="InheritedTable"
|
||||
|
|
|
@ -76,11 +76,12 @@ ${helpers.single_keyword(
|
|||
spec="https://drafts.csswg.org/css-images/#propdef-image-rendering",
|
||||
)}
|
||||
|
||||
${helpers.predefined_type("image-orientation",
|
||||
"ImageOrientation",
|
||||
"computed::ImageOrientation::zero()",
|
||||
products="gecko",
|
||||
animation_value_type="discrete",
|
||||
gecko_pref="layout.css.image-orientation.enabled",
|
||||
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \
|
||||
/// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation")}
|
||||
${helpers.single_keyword(
|
||||
"image-orientation",
|
||||
"none from-image",
|
||||
products="gecko",
|
||||
gecko_enum_prefix="StyleImageOrientation",
|
||||
animation_value_type="discrete",
|
||||
gecko_pref="layout.css.image-orientation.enabled",
|
||||
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation",
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue