diff options
author | Cameron McCormack <cam@mcc.id.au> | 2016-05-04 14:51:42 +1000 |
---|---|---|
committer | Cameron McCormack <cam@mcc.id.au> | 2016-05-05 15:42:15 +1000 |
commit | 84ef0de1600458f43c58eb3e259c7ac4f690fd59 (patch) | |
tree | b624df9f834e73adb0ae9f2fd02e5747ab3d3772 | |
parent | 04f976bfb2861e135ec2c20a710c233a9bf30b5f (diff) | |
download | servo-84ef0de1600458f43c58eb3e259c7ac4f690fd59.tar.gz servo-84ef0de1600458f43c58eb3e259c7ac4f690fd59.zip |
Support max-{width,height} in geckolib.
-rw-r--r-- | ports/geckolib/properties.mako.rs | 1 | ||||
-rw-r--r-- | ports/geckolib/values.rs | 22 |
2 files changed, 22 insertions, 1 deletions
diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 2d291dd9618..9faf4233f61 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -362,6 +362,7 @@ impl Debug for ${style_struct.gecko_ffi_name} { predefined_types = { "LengthOrPercentage": impl_style_coord, "LengthOrPercentageOrAuto": impl_style_coord, + "LengthOrPercentageOrNone": impl_style_coord, "Number": impl_simple, "Opacity": impl_simple, } diff --git a/ports/geckolib/values.rs b/ports/geckolib/values.rs index 99bf5f6fc40..172ce193b8a 100644 --- a/ports/geckolib/values.rs +++ b/ports/geckolib/values.rs @@ -4,7 +4,7 @@ use cssparser::RGBA; use gecko_style_structs::{nsStyleUnion, nsStyleUnit}; -use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; +use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; pub trait ToGeckoStyleCoord { fn to_gecko_style_coord(&self, unit: &mut nsStyleUnit, union: &mut nsStyleUnion); @@ -46,6 +46,26 @@ impl ToGeckoStyleCoord for LengthOrPercentageOrAuto { } } +impl ToGeckoStyleCoord for LengthOrPercentageOrNone { + fn to_gecko_style_coord(&self, unit: &mut nsStyleUnit, union: &mut nsStyleUnion) { + match *self { + LengthOrPercentageOrNone::Length(au) => { + *unit = nsStyleUnit::eStyleUnit_Coord; + unsafe { *union.mInt.as_mut() = au.0; } + }, + LengthOrPercentageOrNone::Percentage(p) => { + *unit = nsStyleUnit::eStyleUnit_Percent; + unsafe { *union.mFloat.as_mut() = p; } + }, + LengthOrPercentageOrNone::None => { + *unit = nsStyleUnit::eStyleUnit_None; + unsafe { *union.mInt.as_mut() = 0; } + }, + LengthOrPercentageOrNone::Calc(_) => unimplemented!(), + }; + } +} + pub fn convert_rgba_to_nscolor(rgba: &RGBA) -> u32 { (((rgba.alpha * 255.0).round() as u32) << 24) | (((rgba.blue * 255.0).round() as u32) << 16) | |