style: Use rust types for vertical-align.

The previous commit removed the dependence on the discriminant value, so we
don't need to keep discriminants different from text-align anymore.

Differential Revision: https://phabricator.services.mozilla.com/D29361
This commit is contained in:
Emilio Cobos Álvarez 2019-05-01 13:08:34 +00:00
parent 8123007717
commit c990c9623d
5 changed files with 43 additions and 102 deletions

View file

@ -22,7 +22,6 @@ use crate::values::computed::url::ComputedImageUrl;
use crate::values::computed::{Angle, Gradient, Image};
use crate::values::computed::{Integer, LengthPercentage};
use crate::values::computed::{Length, Percentage, TextAlign};
use crate::values::generics::box_::VerticalAlign;
use crate::values::generics::grid::{TrackListValue, TrackSize};
use crate::values::generics::image::{CompatMode, Image as GenericImage};
use crate::values::generics::rect::Rect;
@ -875,26 +874,6 @@ where
}
}
impl<L> VerticalAlign<L> {
/// Converts an enumerated value coming from Gecko to a `VerticalAlign<L>`.
pub fn from_gecko_keyword(value: u32) -> Self {
match value {
structs::NS_STYLE_VERTICAL_ALIGN_BASELINE => VerticalAlign::Baseline,
structs::NS_STYLE_VERTICAL_ALIGN_SUB => VerticalAlign::Sub,
structs::NS_STYLE_VERTICAL_ALIGN_SUPER => VerticalAlign::Super,
structs::NS_STYLE_VERTICAL_ALIGN_TOP => VerticalAlign::Top,
structs::NS_STYLE_VERTICAL_ALIGN_TEXT_TOP => VerticalAlign::TextTop,
structs::NS_STYLE_VERTICAL_ALIGN_MIDDLE => VerticalAlign::Middle,
structs::NS_STYLE_VERTICAL_ALIGN_BOTTOM => VerticalAlign::Bottom,
structs::NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM => VerticalAlign::TextBottom,
structs::NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE => {
VerticalAlign::MozMiddleWithBaseline
},
_ => panic!("unexpected enumerated value for vertical-align"),
}
}
}
impl TextAlign {
/// Obtain a specified value from a Gecko keyword value
///