servo: Merge #19749 - style: Move -moz-context-properties outside of mako (from gootorov:move_-moz-context-properties_from_mako); r=emilio
authorIgor Gutorov <igootorov@gmail.com>
Mon, 15 Jan 2018 06:04:30 -0600
changeset 399297 84925d82bda391516e88a0f8f50de0e6e07b3616
parent 399296 1024fb2fa343f1762c90b081649b4f0f944e9240
child 399298 492a154a477f9f38122a5214367a95b76c82b560
push id58061
push userservo-vcs-sync@mozilla.com
push dateMon, 15 Jan 2018 12:51:38 +0000
treeherderautoland@84925d82bda3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #19749 - style: Move -moz-context-properties outside of mako (from gootorov:move_-moz-context-properties_from_mako); r=emilio <!-- Please describe your changes on the following line: --> Sub-PR of #19015 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #19742 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 2ff3e119faab0488ebd4d790600d07695404f883
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/inherited_svg.mako.rs
servo/components/style/values/computed/mod.rs
servo/components/style/values/computed/svg.rs
servo/components/style/values/specified/mod.rs
servo/components/style/values/specified/svg.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -5250,26 +5250,26 @@ clip-path
     {
         let v = v.into_iter();
         unsafe {
             bindings::Gecko_nsStyleSVG_SetContextPropertiesLength(&mut self.gecko, v.len() as u32);
         }
 
         self.gecko.mContextPropsBits = 0;
         for (gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
-            if servo.0 == atom!("fill") {
+            if (servo.0).0 == atom!("fill") {
                 self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
-            } else if servo.0 == atom!("stroke") {
+            } else if (servo.0).0 == atom!("stroke") {
                 self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_STROKE as u8;
-            } else if servo.0 == atom!("fill-opacity") {
+            } else if (servo.0).0 == atom!("fill-opacity") {
                 self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL_OPACITY as u8;
-            } else if servo.0 == atom!("stroke-opacity") {
+            } else if (servo.0).0 == atom!("stroke-opacity") {
                 self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_STROKE_OPACITY as u8;
             }
-            gecko.mRawPtr = servo.0.into_addrefed();
+            gecko.mRawPtr = (servo.0).0.into_addrefed();
         }
     }
 
     #[allow(non_snake_case)]
     pub fn copy__moz_context_properties_from(&mut self, other: &Self) {
         unsafe {
             bindings::Gecko_nsStyleSVG_CopyContextProperties(&mut self.gecko, &other.gecko);
         }
--- a/servo/components/style/properties/longhand/inherited_svg.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_svg.mako.rs
@@ -131,29 +131,16 @@
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("paint-order", "SVGPaintOrder", "computed::SVGPaintOrder::normal()",
                           products="gecko",
                           animation_value_type="discrete",
                           gecko_pref="svg.paint-order.enabled",
                           spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder")}
 
-<%helpers:vector_longhand name="-moz-context-properties"
-                   animation_value_type="none"
-                   products="gecko"
-                   spec="Nonstandard (Internal-only)"
-                   allow_empty="True">
-    use values::CustomIdent;
-
-    pub type SpecifiedValue = CustomIdent;
-
-    pub mod computed_value {
-        pub type T = super::SpecifiedValue;
-    }
-
-
-    pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-                         -> Result<SpecifiedValue, ParseError<'i>> {
-        let location = input.current_source_location();
-        let i = input.expect_ident()?;
-        CustomIdent::from_ident(location, i, &["all", "none", "auto"])
-    }
-</%helpers:vector_longhand>
+${helpers.predefined_type("-moz-context-properties",
+                          "MozContextProperties",
+                          initial_value=None,
+                          vector=True,
+                          animation_value_type="none",
+                          products="gecko",
+                          spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties)",
+                          allow_empty=True)}
--- a/servo/components/style/values/computed/mod.rs
+++ b/servo/components/style/values/computed/mod.rs
@@ -58,16 +58,17 @@ pub use self::length::{CSSPixelLength, N
 pub use self::list::{ListStyleImage, Quotes};
 #[cfg(feature = "gecko")]
 pub use self::list::ListStyleType;
 pub use self::outline::OutlineStyle;
 pub use self::percentage::Percentage;
 pub use self::position::{Position, GridAutoFlow, GridTemplateAreas};
 pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
 pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
+pub use self::svg::MozContextProperties;
 pub use self::table::XSpan;
 pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextAlign, TextOverflow, WordSpacing};
 pub use self::time::Time;
 pub use self::transform::{TimingFunction, Transform, TransformOperation, TransformOrigin};
 pub use self::ui::MozForceBrokenImageIcon;
 
 #[cfg(feature = "gecko")]
 pub mod align;
--- a/servo/components/style/values/computed/svg.rs
+++ b/servo/components/style/values/computed/svg.rs
@@ -8,16 +8,18 @@ use app_units::Au;
 use values::RGBA;
 use values::computed::{ComputedUrl, LengthOrPercentage, NonNegativeLength};
 use values::computed::{NonNegativeNumber, NonNegativeLengthOrPercentage, Number};
 use values::computed::Opacity;
 use values::generics::svg as generic;
 
 pub use values::specified::SVGPaintOrder;
 
+pub use values::specified::MozContextProperties;
+
 /// Computed SVG Paint value
 pub type SVGPaint = generic::SVGPaint<RGBA, ComputedUrl>;
 /// Computed SVG Paint Kind value
 pub type SVGPaintKind = generic::SVGPaintKind<RGBA, ComputedUrl>;
 
 impl Default for SVGPaint {
     fn default() -> Self {
         SVGPaint {
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -54,16 +54,17 @@ pub use self::list::{ListStyleImage, Quo
 #[cfg(feature = "gecko")]
 pub use self::list::ListStyleType;
 pub use self::outline::OutlineStyle;
 pub use self::rect::LengthOrNumberRect;
 pub use self::percentage::Percentage;
 pub use self::position::{Position, PositionComponent, GridAutoFlow, GridTemplateAreas};
 pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
 pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
+pub use self::svg::MozContextProperties;
 pub use self::table::XSpan;
 pub use self::text::{InitialLetter, LetterSpacing, LineHeight, TextDecorationLine};
 pub use self::text::{TextAlign, TextAlignKeyword, TextOverflow, WordSpacing};
 pub use self::time::Time;
 pub use self::transform::{TimingFunction, Transform, TransformOrigin};
 pub use self::ui::MozForceBrokenImageIcon;
 pub use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
 
--- a/servo/components/style/values/specified/svg.rs
+++ b/servo/components/style/values/specified/svg.rs
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Specified types for SVG properties.
 
 use cssparser::Parser;
 use parser::{Parse, ParserContext};
 use std::fmt;
 use style_traits::{CommaWithSpace, ParseError, Separator, StyleParseErrorKind, ToCss};
+use values::CustomIdent;
 use values::generics::svg as generic;
 use values::specified::{LengthOrPercentage, NonNegativeLengthOrPercentage, NonNegativeNumber};
 use values::specified::{Number, Opacity, SpecifiedUrl};
 use values::specified::color::RGBAColor;
 
 /// Specified SVG Paint value
 pub type SVGPaint = generic::SVGPaint<RGBAColor, SpecifiedUrl>;
 
@@ -255,8 +256,24 @@ impl ToCss for SVGPaintOrder {
             if pos != 0 {
                 dest.write_str(" ")?
             }
             self.order_at(pos).to_css(dest)?;
         }
         Ok(())
     }
 }
+
+/// Specified MozContextProperties value.
+/// Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties)
+#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
+pub struct MozContextProperties(pub CustomIdent);
+
+impl Parse for MozContextProperties {
+    fn parse<'i, 't>(
+        _context: &ParserContext,
+        input: &mut Parser<'i, 't>
+    ) -> Result<MozContextProperties, ParseError<'i>> {
+        let location = input.current_source_location();
+        let i = input.expect_ident()?;
+        Ok(MozContextProperties(CustomIdent::from_ident(location, i, &["all", "none", "auto"])?))
+    }
+}