Specify eStyleUnit_Enumerated instead of eStyleUnit_Integer for enumerated types.

This commit is contained in:
Bobby Holley 2016-05-18 16:09:45 -07:00
parent fe116b4bd7
commit 9b8ead8964
2 changed files with 7 additions and 1 deletions

View file

@ -666,7 +666,7 @@ fn static_assert() {
match v { match v {
% for value in keyword.values_for('gecko'): % for value in keyword.values_for('gecko'):
T::${to_rust_ident(value)} => T::${to_rust_ident(value)} =>
self.gecko.mVerticalAlign.set_int(structs::${keyword.gecko_constant(value)} as i32), self.gecko.mVerticalAlign.set_enum(structs::${keyword.gecko_constant(value)} as i32),
% endfor % endfor
T::LengthOrPercentage(v) => self.gecko.mVerticalAlign.set(v), T::LengthOrPercentage(v) => self.gecko.mVerticalAlign.set(v),
} }

View file

@ -13,6 +13,7 @@ pub trait StyleCoordHelpers {
fn set_auto(&mut self); fn set_auto(&mut self);
fn set_coord(&mut self, val: Au); fn set_coord(&mut self, val: Au);
fn set_int(&mut self, val: i32); fn set_int(&mut self, val: i32);
fn set_enum(&mut self, val: i32);
fn set_percent(&mut self, val: f32); fn set_percent(&mut self, val: f32);
} }
@ -40,6 +41,11 @@ impl StyleCoordHelpers for nsStyleCoord {
self.mUnit = nsStyleUnit::eStyleUnit_Integer; self.mUnit = nsStyleUnit::eStyleUnit_Integer;
unsafe { *self.mValue.mInt.as_mut() = val; } unsafe { *self.mValue.mInt.as_mut() = val; }
} }
fn set_enum(&mut self, val: i32) {
self.mUnit = nsStyleUnit::eStyleUnit_Enumerated;
unsafe { *self.mValue.mInt.as_mut() = val; }
}
} }
pub trait ToGeckoStyleCoord { pub trait ToGeckoStyleCoord {