mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Update bindings because of bug 1325006
This commit is contained in:
parent
0b1ae16029
commit
f08e851f81
2 changed files with 13 additions and 6 deletions
|
@ -230,6 +230,7 @@ mod bindings {
|
||||||
"mozilla::DisplayItemClip", // Needed because bindgen generates
|
"mozilla::DisplayItemClip", // Needed because bindgen generates
|
||||||
// specialization tests for this even
|
// specialization tests for this even
|
||||||
// though it shouldn't.
|
// though it shouldn't.
|
||||||
|
"mozilla::StyleShapeRadius",
|
||||||
".*ThreadSafe.*Holder",
|
".*ThreadSafe.*Holder",
|
||||||
"AnonymousContent",
|
"AnonymousContent",
|
||||||
"AudioContext",
|
"AudioContext",
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use gecko_bindings::structs::{NS_RADIUS_CLOSEST_SIDE, NS_RADIUS_FARTHEST_SIDE};
|
use gecko_bindings::structs::{nsStyleCoord, StyleShapeRadius};
|
||||||
use gecko_bindings::structs::nsStyleCoord;
|
|
||||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use values::{Auto, Either};
|
use values::{Auto, Either};
|
||||||
|
@ -140,10 +139,10 @@ impl GeckoStyleCoordConvertible for ShapeRadius {
|
||||||
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
|
||||||
match *self {
|
match *self {
|
||||||
ShapeRadius::ClosestSide => {
|
ShapeRadius::ClosestSide => {
|
||||||
coord.set_value(CoordDataValue::Enumerated(NS_RADIUS_CLOSEST_SIDE))
|
coord.set_value(CoordDataValue::Enumerated(StyleShapeRadius::ClosestSide as u32))
|
||||||
}
|
}
|
||||||
ShapeRadius::FarthestSide => {
|
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),
|
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> {
|
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
|
||||||
match coord.as_value() {
|
match coord.as_value() {
|
||||||
CoordDataValue::Enumerated(NS_RADIUS_CLOSEST_SIDE) => Some(ShapeRadius::ClosestSide),
|
CoordDataValue::Enumerated(v) => {
|
||||||
CoordDataValue::Enumerated(NS_RADIUS_FARTHEST_SIDE) => Some(ShapeRadius::FarthestSide),
|
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),
|
_ => LengthOrPercentage::from_gecko_style_coord(coord).map(ShapeRadius::Length),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue