From fc808d9030676313ad6987a4e4eb1c9500ac6bde Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Tue, 27 Dec 2016 10:30:24 +0800 Subject: [PATCH] Update bindings build script and glue for recent changes. --- components/style/build_gecko.rs | 2 +- components/style/gecko/conversions.rs | 14 ++++----- components/style/properties/gecko.mako.rs | 30 ++++++++++--------- .../style/properties/longhand/box.mako.rs | 8 ++--- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 81c49fa5909..7e5a40e8096 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -333,7 +333,7 @@ mod bindings { "StyleBasicShape", "StyleBasicShapeType", "StyleClipPath", - "StyleClipPathGeometryBox", + "StyleGeometryBox", "StyleTransition", "mozilla::UniquePtr", "mozilla::DefaultDelete", diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 9c2df76aabf..b9900f73e57 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -326,7 +326,7 @@ pub mod basic_shape { use gecko_bindings::structs; use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleFillRule}; use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners}; - use gecko_bindings::structs::StyleClipPathGeometryBox; + use gecko_bindings::structs::StyleGeometryBox; use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue}; use std::borrow::Borrow; use values::computed::{BorderRadiusSize, LengthOrPercentage}; @@ -465,9 +465,9 @@ pub mod basic_shape { } } - impl From for StyleClipPathGeometryBox { + impl From for StyleGeometryBox { fn from(reference: GeometryBox) -> Self { - use gecko_bindings::structs::StyleClipPathGeometryBox::*; + use gecko_bindings::structs::StyleGeometryBox::*; match reference { GeometryBox::ShapeBox(ShapeBox::Content) => Content, GeometryBox::ShapeBox(ShapeBox::Padding) => Padding, @@ -483,11 +483,10 @@ pub mod basic_shape { // Will panic on NoBox // Ideally these would be implemented on Option, // but coherence doesn't like that and TryFrom isn't stable - impl From for GeometryBox { - fn from(reference: StyleClipPathGeometryBox) -> Self { - use gecko_bindings::structs::StyleClipPathGeometryBox::*; + impl From for GeometryBox { + fn from(reference: StyleGeometryBox) -> Self { + use gecko_bindings::structs::StyleGeometryBox::*; match reference { - NoBox => panic!("Shouldn't convert NoBox to GeometryBox"), Content => GeometryBox::ShapeBox(ShapeBox::Content), Padding => GeometryBox::ShapeBox(ShapeBox::Padding), Border => GeometryBox::ShapeBox(ShapeBox::Border), @@ -495,6 +494,7 @@ pub mod basic_shape { Fill => GeometryBox::Fill, Stroke => GeometryBox::Stroke, View => GeometryBox::View, + _ => panic!("unexpected StyleGeometryBox value"), } } } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index d85aa8b63ab..0bba52cfc1b 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1062,10 +1062,10 @@ fn static_assert() { "table-header-group table-footer-group table-row table-column-group " + "table-column table-cell table-caption list-item flex none " + "inline-flex grid inline-grid ruby ruby-base ruby-base-container " + - "ruby-text ruby-text-container contents -webkit-box -webkit-inline-box " + - "-moz-box -moz-inline-box -moz-grid -moz-inline-grid -moz-grid-group " + - "-moz-grid-line -moz-stack -moz-inline-stack -moz-deck -moz-popup " + - "-moz-groupbox", + "ruby-text ruby-text-container contents flow-root -webkit-box " + + "-webkit-inline-box -moz-box -moz-inline-box -moz-grid -moz-inline-grid " + + "-moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck " + + "-moz-popup -moz-groupbox", gecko_enum_prefix="StyleDisplay", gecko_strip_moz_prefix=False) %> @@ -1401,22 +1401,24 @@ fn static_assert() { <%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 => structs::NS_STYLE_IMAGELAYER_CLIP_BORDER as u8, - T::padding_box => structs::NS_STYLE_IMAGELAYER_CLIP_PADDING as u8, - T::content_box => structs::NS_STYLE_IMAGELAYER_CLIP_CONTENT as u8, + T::border_box => StyleGeometryBox::Border, + T::padding_box => StyleGeometryBox::Padding, + T::content_box => StyleGeometryBox::Content, } <%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 => structs::NS_STYLE_IMAGELAYER_ORIGIN_BORDER as u8, - T::padding_box => structs::NS_STYLE_IMAGELAYER_ORIGIN_PADDING as u8, - T::content_box => structs::NS_STYLE_IMAGELAYER_ORIGIN_CONTENT as u8, + T::border_box => StyleGeometryBox::Border, + T::padding_box => StyleGeometryBox::Padding, + T::content_box => StyleGeometryBox::Content, } @@ -2236,7 +2238,7 @@ clip-path pub fn set_clip_path(&mut self, v: longhands::clip_path::computed_value::T) { use gecko_bindings::bindings::{Gecko_NewBasicShape, Gecko_DestroyClipPath}; - use gecko_bindings::structs::StyleClipPathGeometryBox; + use gecko_bindings::structs::StyleGeometryBox; use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType, StyleShapeSourceType}; use gecko_bindings::structs::{StyleClipPath, StyleFillRule}; use gecko::conversions::basic_shape::set_corners_from_radius; @@ -2257,7 +2259,7 @@ clip-path } ShapeSource::Shape(servo_shape, maybe_box) => { clip_path.mReferenceBox = maybe_box.map(Into::into) - .unwrap_or(StyleClipPathGeometryBox::NoBox); + .unwrap_or(StyleGeometryBox::NoBox); clip_path.mType = StyleShapeSourceType::Shape; fn init_shape(clip_path: &mut StyleClipPath, ty: StyleBasicShapeType) -> &mut StyleBasicShape { @@ -2342,7 +2344,7 @@ clip-path pub fn clone_clip_path(&self) -> longhands::clip_path::computed_value::T { use gecko_bindings::structs::StyleShapeSourceType; - use gecko_bindings::structs::StyleClipPathGeometryBox; + use gecko_bindings::structs::StyleGeometryBox; use values::computed::basic_shape::*; let ref clip_path = self.gecko.mClipPath; @@ -2356,7 +2358,7 @@ clip-path Default::default() } StyleShapeSourceType::Shape => { - let reference = if let StyleClipPathGeometryBox::NoBox = clip_path.mReferenceBox { + let reference = if let StyleGeometryBox::NoBox = clip_path.mReferenceBox { None } else { Some(clip_path.mReferenceBox.into()) diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index a47b7d590a2..b36fb5c679b 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -22,10 +22,10 @@ """.split() if product == "gecko": values += """inline-flex grid inline-grid ruby ruby-base ruby-base-container - ruby-text ruby-text-container contents -webkit-box -webkit-inline-box - -moz-box -moz-inline-box -moz-grid -moz-inline-grid -moz-grid-group - -moz-grid-line -moz-stack -moz-inline-stack -moz-deck -moz-popup - -moz-groupbox""".split() + ruby-text ruby-text-container contents flow-root -webkit-box + -webkit-inline-box -moz-box -moz-inline-box -moz-grid -moz-inline-grid + -moz-grid-group -moz-grid-line -moz-stack -moz-inline-stack -moz-deck + -moz-popup -moz-groupbox""".split() %> pub use self::computed_value::T as SpecifiedValue; use values::computed::ComputedValueAsSpecified;