Auto merge of #11258 - bholley:enumerated_unit, r=mbrubeck

Geckolib: Specify eStyleUnit_Enumerated instead of eStyleUnit_Integer for enumerated types

This is a regression from #11207.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11258)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-18 16:12:33 -07:00
commit c0c1a44cf2
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 {