Skip to content

Commit

Permalink
Update bindings build script and glue for recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Dec 27, 2016
1 parent 9d320d5 commit fc808d9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion components/style/build_gecko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ mod bindings {
"StyleBasicShape",
"StyleBasicShapeType",
"StyleClipPath",
"StyleClipPathGeometryBox",
"StyleGeometryBox",
"StyleTransition",
"mozilla::UniquePtr",
"mozilla::DefaultDelete",
Expand Down
14 changes: 7 additions & 7 deletions components/style/gecko/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -465,9 +465,9 @@ pub mod basic_shape {
}
}

impl From<GeometryBox> for StyleClipPathGeometryBox {
impl From<GeometryBox> 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,
Expand All @@ -483,18 +483,18 @@ pub mod basic_shape {
// 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<StyleClipPathGeometryBox> for GeometryBox {
fn from(reference: StyleClipPathGeometryBox) -> Self {
use gecko_bindings::structs::StyleClipPathGeometryBox::*;
impl From<StyleGeometryBox> 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),
Margin => GeometryBox::ShapeBox(ShapeBox::Margin),
Fill => GeometryBox::Fill,
Stroke => GeometryBox::Stroke,
View => GeometryBox::View,
_ => panic!("unexpected StyleGeometryBox value"),
}
}
}
Expand Down
30 changes: 16 additions & 14 deletions components/style/properties/gecko.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) %>

Expand Down Expand Up @@ -1401,22 +1401,24 @@ 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 => 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>

<%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,
}
</%self:simple_image_array_property>

Expand Down Expand Up @@ -2236,7 +2238,7 @@ clip-path
</%self:simple_image_array_property>
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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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;

Expand All @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions components/style/properties/longhand/box.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fc808d9

Please sign in to comment.