From f08e851f81c63fd7aecacb54831f965dee45cf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 Dec 2016 01:31:08 +0100 Subject: [PATCH] style: Update bindings because of bug 1325006 --- components/style/build_gecko.rs | 1 + components/style/gecko/values.rs | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 7f9fe425137..81c49fa5909 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -230,6 +230,7 @@ mod bindings { "mozilla::DisplayItemClip", // Needed because bindgen generates // specialization tests for this even // though it shouldn't. + "mozilla::StyleShapeRadius", ".*ThreadSafe.*Holder", "AnonymousContent", "AudioContext", diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index cf5b90c71fc..6cbe4242e62 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -6,8 +6,7 @@ use app_units::Au; use cssparser::RGBA; -use gecko_bindings::structs::{NS_RADIUS_CLOSEST_SIDE, NS_RADIUS_FARTHEST_SIDE}; -use gecko_bindings::structs::nsStyleCoord; +use gecko_bindings::structs::{nsStyleCoord, StyleShapeRadius}; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue}; use std::cmp::max; use values::{Auto, Either}; @@ -140,10 +139,10 @@ impl GeckoStyleCoordConvertible for ShapeRadius { fn to_gecko_style_coord(&self, coord: &mut T) { match *self { ShapeRadius::ClosestSide => { - coord.set_value(CoordDataValue::Enumerated(NS_RADIUS_CLOSEST_SIDE)) + coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::ClosestSide as u32)) } ShapeRadius::FarthestSide => { - coord.set_value(CoordDataValue::Enumerated(NS_RADIUS_FARTHEST_SIDE)) + coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::FarthestSide as u32)) } ShapeRadius::Length(lop) => lop.to_gecko_style_coord(coord), } @@ -151,8 +150,15 @@ impl GeckoStyleCoordConvertible for ShapeRadius { fn from_gecko_style_coord(coord: &T) -> Option { match coord.as_value() { - CoordDataValue::Enumerated(NS_RADIUS_CLOSEST_SIDE) => Some(ShapeRadius::ClosestSide), - CoordDataValue::Enumerated(NS_RADIUS_FARTHEST_SIDE) => Some(ShapeRadius::FarthestSide), + CoordDataValue::Enumerated(v) => { + if v == StyleShapeRadius::ClosestSide as u32 { + Some(ShapeRadius::ClosestSide) + } else if v == StyleShapeRadius::FarthestSide as u32 { + Some(ShapeRadius::FarthestSide) + } else { + None + } + } _ => LengthOrPercentage::from_gecko_style_coord(coord).map(ShapeRadius::Length), } }