Bug 1339674 - Part 1. Update glue to clip-path. draft
authorcku <cku@mozilla.com>
Thu, 16 Mar 2017 14:38:54 +0800
changeset 499837 ef6e479f3e6e834ddeea51ca5d5d16dd5dc563ac
parent 499808 2c58be3627fe1597d19221887463d5b22c6c96b4
child 499838 7f12f0c2daa44112eb2abe8d3848b5b3dca0c179
push id49558
push userbmo:cku@mozilla.com
push dateThu, 16 Mar 2017 08:44:44 +0000
bugs1339674
milestone55.0a1
Bug 1339674 - Part 1. Update glue to clip-path. MozReview-Commit-ID: FyWy0XYQEXL
servo/components/style/gecko/conversions.rs
servo/components/style/properties/gecko.mako.rs
servo/components/style/values/specified/basic_shape.rs
--- a/servo/components/style/gecko/conversions.rs
+++ b/servo/components/style/gecko/conversions.rs
@@ -434,41 +434,41 @@ pub mod basic_shape {
             }
         }
     }
 
     impl From<GeometryBox> for StyleGeometryBox {
         fn from(reference: GeometryBox) -> Self {
             use gecko_bindings::structs::StyleGeometryBox::*;
             match reference {
-                GeometryBox::ShapeBox(ShapeBox::Content) => Content,
-                GeometryBox::ShapeBox(ShapeBox::Padding) => Padding,
-                GeometryBox::ShapeBox(ShapeBox::Border) => Border,
-                GeometryBox::ShapeBox(ShapeBox::Margin) => Margin,
-                GeometryBox::Fill => Fill,
-                GeometryBox::Stroke => Stroke,
-                GeometryBox::View => View,
+                GeometryBox::ShapeBox(ShapeBox::ContentBox) => ContentBox,
+                GeometryBox::ShapeBox(ShapeBox::PaddingBox) => PaddingBox,
+                GeometryBox::ShapeBox(ShapeBox::BorderBox) => BorderBox,
+                GeometryBox::ShapeBox(ShapeBox::MarginBox) => MarginBox,
+                GeometryBox::FillBox => FillBox,
+                GeometryBox::StrokeBox => StrokeBox,
+                GeometryBox::ViewBox => ViewBox,
             }
         }
     }
 
     // Will panic on NoBox
     // Ideally these would be implemented on Option<T>,
     // but coherence doesn't like that and TryFrom isn't stable
     impl From<StyleGeometryBox> for GeometryBox {
         fn from(reference: StyleGeometryBox) -> Self {
             use gecko_bindings::structs::StyleGeometryBox::*;
             match reference {
-                Content => GeometryBox::ShapeBox(ShapeBox::Content),
-                Padding => GeometryBox::ShapeBox(ShapeBox::Padding),
-                Border => GeometryBox::ShapeBox(ShapeBox::Border),
-                Margin => GeometryBox::ShapeBox(ShapeBox::Margin),
-                Fill => GeometryBox::Fill,
-                Stroke => GeometryBox::Stroke,
-                View => GeometryBox::View,
+                ContentBox => GeometryBox::ShapeBox(ShapeBox::ContentBox),
+                PaddingBox => GeometryBox::ShapeBox(ShapeBox::PaddingBox),
+                BorderBox => GeometryBox::ShapeBox(ShapeBox::BorderBox),
+                MarginBox => GeometryBox::ShapeBox(ShapeBox::MarginBox),
+                FillBox => GeometryBox::FillBox,
+                StrokeBox => GeometryBox::StrokeBox,
+                ViewBox => GeometryBox::ViewBox,
                 other => panic!("Unexpected StyleGeometryBox::{:?} while converting to GeometryBox", other),
             }
         }
     }
 }
 
 impl From<RulesMutateError> for nsresult {
     fn from(other: RulesMutateError) -> Self {
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1995,42 +1995,42 @@ fn static_assert() {
         }
     </%self:simple_image_array_property>
 
     <%self:simple_image_array_property name="clip" shorthand="${shorthand}" field_name="mClip">
         use gecko_bindings::structs::StyleGeometryBox;
         use properties::longhands::${shorthand}_clip::single_value::computed_value::T;
 
         match servo {
-            T::border_box => StyleGeometryBox::Border,
-            T::padding_box => StyleGeometryBox::Padding,
-            T::content_box => StyleGeometryBox::Content,
+            T::border_box => StyleGeometryBox::BorderBox,
+            T::padding_box => StyleGeometryBox::PaddingBox,
+            T::content_box => StyleGeometryBox::ContentBox,
             % if shorthand == "mask":
-            T::fill_box => StyleGeometryBox::Fill,
-            T::stroke_box => StyleGeometryBox::Stroke,
-            T::view_box => StyleGeometryBox::View,
+            T::fill_box => StyleGeometryBox::FillBox,
+            T::stroke_box => StyleGeometryBox::StrokeBox,
+            T::view_box => StyleGeometryBox::ViewBox,
             T::no_clip => StyleGeometryBox::NoClip,
             % elif shorthand == "background":
             T::text => StyleGeometryBox::Text,
             % endif
         }
     </%self:simple_image_array_property>
 
     <%self:simple_image_array_property name="origin" shorthand="${shorthand}" field_name="mOrigin">
         use gecko_bindings::structs::StyleGeometryBox;
         use properties::longhands::${shorthand}_origin::single_value::computed_value::T;
 
         match servo {
-            T::border_box => StyleGeometryBox::Border,
-            T::padding_box => StyleGeometryBox::Padding,
-            T::content_box => StyleGeometryBox::Content,
+            T::border_box => StyleGeometryBox::BorderBox,
+            T::padding_box => StyleGeometryBox::PaddingBox,
+            T::content_box => StyleGeometryBox::ContentBox,
             % if shorthand == "mask":
-            T::fill_box => StyleGeometryBox::Fill,
-            T::stroke_box => StyleGeometryBox::Stroke,
-            T::view_box => StyleGeometryBox::View,
+            T::fill_box => StyleGeometryBox::FillBox,
+            T::stroke_box => StyleGeometryBox::StrokeBox,
+            T::view_box => StyleGeometryBox::ViewBox,
             % endif
         }
     </%self:simple_image_array_property>
 
     % for orientation in [("x", "Horizontal"), ("y", "Vertical")]:
     pub fn copy_${shorthand}_position_${orientation[0]}_from(&mut self, other: &Self) {
         use gecko_bindings::structs::nsStyleImageLayers_LayerType as LayerType;
 
--- a/servo/components/style/values/specified/basic_shape.rs
+++ b/servo/components/style/values/specified/basic_shape.rs
@@ -854,78 +854,78 @@ impl ToCss for FillRule {
     }
 }
 
 /// https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
 #[derive(Clone, PartialEq, Copy, Debug)]
 #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
 #[allow(missing_docs)]
 pub enum GeometryBox {
-    Fill,
-    Stroke,
-    View,
+    FillBox,
+    StrokeBox,
+    ViewBox,
     ShapeBox(ShapeBox),
 }
 
 impl Parse for GeometryBox {
     fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
         if let Ok(shape_box) = input.try(|i| ShapeBox::parse(context, i)) {
             Ok(GeometryBox::ShapeBox(shape_box))
         } else {
             match_ignore_ascii_case! { &try!(input.expect_ident()),
-                "fill-box" => Ok(GeometryBox::Fill),
-                "stroke-box" => Ok(GeometryBox::Stroke),
-                "view-box" => Ok(GeometryBox::View),
+                "fill-box" => Ok(GeometryBox::FillBox),
+                "stroke-box" => Ok(GeometryBox::StrokeBox),
+                "view-box" => Ok(GeometryBox::ViewBox),
                 _ => Err(())
             }
         }
     }
 }
 
 impl ToCss for GeometryBox {
     fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
         match *self {
-            GeometryBox::Fill => dest.write_str("fill-box"),
-            GeometryBox::Stroke => dest.write_str("stroke-box"),
-            GeometryBox::View => dest.write_str("view-box"),
+            GeometryBox::FillBox => dest.write_str("fill-box"),
+            GeometryBox::StrokeBox => dest.write_str("stroke-box"),
+            GeometryBox::ViewBox => dest.write_str("view-box"),
             GeometryBox::ShapeBox(s) => s.to_css(dest),
         }
     }
 }
 
 impl ComputedValueAsSpecified for GeometryBox {}
 
 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
 #[derive(Clone, PartialEq, Copy, Debug)]
 #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
 #[allow(missing_docs)]
 pub enum ShapeBox {
-    Margin,
+    MarginBox,
     // https://drafts.csswg.org/css-backgrounds-3/#box
-    Border,
-    Padding,
-    Content,
+    BorderBox,
+    PaddingBox,
+    ContentBox,
 }
 
 impl Parse for ShapeBox {
     fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
         match_ignore_ascii_case! { &try!(input.expect_ident()),
-            "margin-box" => Ok(ShapeBox::Margin),
-            "border-box" => Ok(ShapeBox::Border),
-            "padding-box" => Ok(ShapeBox::Padding),
-            "content-box" => Ok(ShapeBox::Content),
+            "margin-box" => Ok(ShapeBox::MarginBox),
+            "border-box" => Ok(ShapeBox::BorderBox),
+            "padding-box" => Ok(ShapeBox::PaddingBox),
+            "content-box" => Ok(ShapeBox::ContentBox),
             _ => Err(())
         }
     }
 }
 
 impl ToCss for ShapeBox {
     fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
         match *self {
-            ShapeBox::Margin => dest.write_str("margin-box"),
-            ShapeBox::Border => dest.write_str("border-box"),
-            ShapeBox::Padding => dest.write_str("padding-box"),
-            ShapeBox::Content => dest.write_str("content-box"),
+            ShapeBox::MarginBox => dest.write_str("margin-box"),
+            ShapeBox::BorderBox => dest.write_str("border-box"),
+            ShapeBox::PaddingBox => dest.write_str("padding-box"),
+            ShapeBox::ContentBox => dest.write_str("content-box"),
         }
     }
 }
 
 impl ComputedValueAsSpecified for ShapeBox {}