Support vertical-align in geckolib

This commit is contained in:
Matt Brubeck 2016-05-16 11:14:21 -07:00
parent f998a6113e
commit 36699c5748
2 changed files with 25 additions and 4 deletions

View file

@ -625,7 +625,7 @@ fn static_assert() {
</%self:impl_trait>
<%self:impl_trait style_struct_name="Box" skip_longhands="display overflow-y">
<%self:impl_trait style_struct_name="Box" skip_longhands="display overflow-y vertical-align">
// We manually-implement the |display| property until we get general
// infrastructure for preffing certain values.
@ -659,6 +659,23 @@ fn static_assert() {
}
}
fn set_vertical_align(&mut self, v: longhands::vertical_align::computed_value::T) {
<% keyword = data.longhands_by_name["vertical-align"].keyword %>
use style::properties::longhands::vertical_align::computed_value::T;
// FIXME: Align binary representations and ditch |match| for cast + static_asserts
match v {
% for value in keyword.values_for('gecko'):
T::${to_rust_ident(value)} =>
self.gecko.mVerticalAlign.set_int(structs::${keyword.gecko_constant(value)} as i32),
% endfor
T::LengthOrPercentage(v) => self.gecko.mVerticalAlign.set(v),
}
}
fn copy_vertical_align_from(&mut self, other: &Self) {
self.gecko.mVerticalAlign.mUnit = other.gecko.mVerticalAlign.mUnit;
self.gecko.mVerticalAlign.mValue = other.gecko.mVerticalAlign.mValue;
}
</%self:impl_trait>
<%self:impl_trait style_struct_name="Background" skip_longhands="background-color" skip_additionals="*">