diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index a88db8bf03e..69ad8440148 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> -<% from data import Method, to_rust_ident %> +<% from data import Keyword, Method, to_rust_ident %> <% data.new_style_struct("Box", inherited=False, @@ -126,8 +126,12 @@ ${helpers.single_keyword("clear", "none left right both", gecko_ffi_name="mBreak use cssparser::ToCss; use std::fmt; - <% vertical_align_keywords = ( - "baseline sub super top text-top middle bottom text-bottom".split()) %> + <% vertical_align = data.longhands_by_name["vertical-align"] %> + <% vertical_align.keyword = Keyword("vertical-align", + "baseline sub super top text-top middle bottom text-bottom", + extra_gecko_values="middle-with-baseline") %> + <% vertical_align_keywords = vertical_align.keyword.values_for(product) %> + #[allow(non_camel_case_types)] #[derive(Debug, Clone, PartialEq, Copy, HeapSizeOf)] pub enum SpecifiedValue { diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 75ef9c6215c..d9fec02b3b1 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -625,7 +625,7 @@ fn static_assert() { -<%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 style_struct_name="Background" skip_longhands="background-color" skip_additionals="*">