Bug 1341758 - add gecko glue code for image-orientation property. draft
authorJeremy Chen <jeremychen@mozilla.com>
Sun, 09 Apr 2017 17:12:00 +0800
changeset 559261 f07c8189ba675b59f848aab900bfef35752291ca
parent 559260 d5aba026e13f524f89be73c6eaee316e0a95cb0c
child 559262 65926c91aee3bedda70dafbca9971d58ea85ff82
push id53029
push userjichen@mozilla.com
push dateSun, 09 Apr 2017 09:15:47 +0000
bugs1341758
milestone55.0a1
Bug 1341758 - add gecko glue code for image-orientation property. With the newly added binding functions support, we shall reuse the same methods from Gecko to pass the computed value from Servo to Gecko. MozReview-Commit-ID: JGRK7PcK92w
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/inherited_box.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2771,30 +2771,53 @@ fn static_assert() {
 
     pub fn copy_filter_from(&mut self, other: &Self) {
         unsafe {
             Gecko_CopyFiltersFrom(&other.gecko as *const _ as *mut _, &mut self.gecko);
         }
     }
 </%self:impl_trait>
 
+<%self:impl_trait style_struct_name="InheritedBox"
+                  skip_longhands="image-orientation">
+    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 angle, flipped) => {
+                unsafe {
+                    bindings::Gecko_SetImageOrientation(&mut self.gecko, angle.radians() as f64, flipped);
+                }
+            }
+        }
+    }
+
+    pub fn copy_image_orientation_from(&mut self, other: &Self) {
+        unsafe {
+            bindings::Gecko_CopyImageOrientationFrom(&mut self.gecko, &other.gecko);
+        }
+    }
+</%self:impl_trait>
 
 <%self:impl_trait style_struct_name="InheritedTable"
                   skip_longhands="border-spacing">
 
     pub fn set_border_spacing(&mut self, v: longhands::border_spacing::computed_value::T) {
         self.gecko.mBorderSpacingCol = v.horizontal.0;
         self.gecko.mBorderSpacingRow = v.vertical.0;
     }
 
     pub fn copy_border_spacing_from(&mut self, other: &Self) {
         self.gecko.mBorderSpacingCol = other.gecko.mBorderSpacingCol;
         self.gecko.mBorderSpacingRow = other.gecko.mBorderSpacingRow;
     }
-
 </%self:impl_trait>
 
 
 <%self:impl_trait style_struct_name="InheritedText"
                   skip_longhands="text-align text-emphasis-style text-shadow line-height letter-spacing word-spacing
                                   -webkit-text-stroke-width text-emphasis-position -moz-tab-size -moz-text-size-adjust">
 
     <% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left " +
--- a/servo/components/style/properties/longhand/inherited_box.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_box.mako.rs
@@ -78,17 +78,17 @@
                          extra_gecko_values="optimizespeed optimizequality",
                          extra_servo_values="pixelated",
                          custom_consts=image_rendering_custom_consts,
                          animation_type="none",
                          spec="https://drafts.csswg.org/css-images/#propdef-image-rendering")}
 
 // Image Orientation
 <%helpers:longhand name="image-orientation"
-                   products="None"
+                   products="gecko"
                    animation_type="none"
     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;
     use style_traits::ToCss;
     use values::specified::Angle;
 
     use values::HasViewportPercentage;