style: Update bindings because of bug 1325006

This commit is contained in:
Emilio Cobos Álvarez 2016-12-25 01:31:08 +01:00
parent 0b1ae16029
commit f08e851f81
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 13 additions and 6 deletions

View file

@ -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",

View file

@ -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<T: CoordDataMut>(&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<T: CoordData>(coord: &T) -> Option<Self> {
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),
}
}