Fix parsing methods of column-{gap,width}

This commit is contained in:
Nazım Can Altınova 2017-02-20 19:32:31 +03:00
parent d2ae3d8bed
commit 19978f2087
No known key found for this signature in database
GPG key ID: AF9BCD7CE6449954
5 changed files with 76 additions and 15 deletions

View file

@ -11,7 +11,7 @@ use cssparser::RGBA;
use gecko_bindings::structs::{nsStyleCoord, StyleShapeRadius};
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
use std::cmp::max;
use values::{Auto, Either, None_};
use values::{Auto, Either, None_, Normal};
use values::computed::{Angle, LengthOrPercentageOrNone, Number};
use values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use values::computed::basic_shape::ShapeRadius;
@ -223,6 +223,20 @@ impl GeckoStyleCoordConvertible for None_ {
}
}
impl GeckoStyleCoordConvertible for Normal {
fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
coord.set_value(CoordDataValue::Normal)
}
fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
if let CoordDataValue::Normal = coord.as_value() {
Some(Normal)
} else {
None
}
}
}
/// Convert a given RGBA value to `nscolor`.
pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 {
((rgba.alpha as u32) << 24) |