Skip to content

Commit

Permalink
style: Remove angle values from image-orientation.
Browse files Browse the repository at this point in the history
Bug: 1473450
Reviewed-by: emilio
MozReview-Commit-ID: FB74ILJM6Fm
  • Loading branch information
heycam authored and emilio committed Jul 16, 2018
1 parent 4e8d3fc commit f526af7
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 310 deletions.
1 change: 0 additions & 1 deletion components/style/properties/data.py
Expand Up @@ -285,7 +285,6 @@ def specified_is_copy(self):
"FontSynthesis",
"FontWeight",
"GridAutoFlow",
"ImageOrientation",
"InitialLetter",
"Integer",
"JustifyContent",
Expand Down
59 changes: 1 addition & 58 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -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"
Expand Down
17 changes: 9 additions & 8 deletions components/style/properties/longhands/inherited_box.mako.rs
Expand Up @@ -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",
)}
81 changes: 0 additions & 81 deletions components/style/values/computed/inherited_box.rs

This file was deleted.

2 changes: 0 additions & 2 deletions components/style/values/computed/mod.rs
Expand Up @@ -52,7 +52,6 @@ pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset};
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
pub use self::flex::FlexBasis;
pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect};
pub use self::inherited_box::{ImageOrientation, Orientation};
#[cfg(feature = "gecko")]
pub use self::gecko::ScrollSnapPoint;
pub use self::rect::LengthOrNumberRect;
Expand Down Expand Up @@ -99,7 +98,6 @@ pub mod font;
#[cfg(feature = "gecko")]
pub mod gecko;
pub mod image;
pub mod inherited_box;
pub mod length;
pub mod list;
pub mod outline;
Expand Down
158 changes: 0 additions & 158 deletions components/style/values/specified/inherited_box.rs

This file was deleted.

2 changes: 0 additions & 2 deletions components/style/values/specified/mod.rs
Expand Up @@ -49,7 +49,6 @@ pub use self::flex::FlexBasis;
pub use self::gecko::ScrollSnapPoint;
pub use self::image::{ColorStop, EndingShape as GradientEndingShape, Gradient};
pub use self::image::{GradientItem, GradientKind, Image, ImageLayer, MozImageRect};
pub use self::inherited_box::ImageOrientation;
pub use self::length::{AbsoluteLength, CalcLengthOrPercentage, CharacterWidth};
pub use self::length::{FontRelativeLength, Length, LengthOrNumber};
pub use self::length::{LengthOrPercentage, LengthOrPercentageOrAuto};
Expand Down Expand Up @@ -99,7 +98,6 @@ pub mod font;
pub mod gecko;
pub mod grid;
pub mod image;
pub mod inherited_box;
pub mod length;
pub mod list;
pub mod outline;
Expand Down

0 comments on commit f526af7

Please sign in to comment.