mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
style: Use enums for text-align / text-align-last.
This also fixes some backwards logic in nsBlockFrame::ReflowDirtyLines, and adds some static assertions to nsGenericHTMLElement that almost cause a very subtle bug. Depends on D63792 Differential Revision: https://phabricator.services.mozilla.com/D63793
This commit is contained in:
parent
37c382a74b
commit
7af9a087aa
8 changed files with 47 additions and 61 deletions
|
@ -517,6 +517,35 @@ impl ToCss for TextTransformOther {
|
|||
}
|
||||
}
|
||||
|
||||
/// Specified and computed value of text-align-last.
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
FromPrimitive,
|
||||
Hash,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[allow(missing_docs)]
|
||||
#[repr(u8)]
|
||||
pub enum TextAlignLast {
|
||||
Auto,
|
||||
Start,
|
||||
End,
|
||||
Left,
|
||||
Right,
|
||||
Center,
|
||||
Justify,
|
||||
}
|
||||
|
||||
/// Specified value of text-align keyword value.
|
||||
#[derive(
|
||||
Clone,
|
||||
|
@ -535,14 +564,18 @@ impl ToCss for TextTransformOther {
|
|||
ToShmem,
|
||||
)]
|
||||
#[allow(missing_docs)]
|
||||
#[repr(u8)]
|
||||
pub enum TextAlignKeyword {
|
||||
Start,
|
||||
End,
|
||||
Left,
|
||||
Right,
|
||||
Center,
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2013"))]
|
||||
Justify,
|
||||
#[css(skip)]
|
||||
#[cfg(feature = "gecko")]
|
||||
Char,
|
||||
End,
|
||||
#[cfg(feature = "gecko")]
|
||||
MozCenter,
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -555,9 +588,6 @@ pub enum TextAlignKeyword {
|
|||
ServoLeft,
|
||||
#[cfg(feature = "servo-layout-2013")]
|
||||
ServoRight,
|
||||
#[css(skip)]
|
||||
#[cfg(feature = "gecko")]
|
||||
Char,
|
||||
}
|
||||
|
||||
/// Specified value of text-align property.
|
||||
|
@ -579,14 +609,6 @@ pub enum TextAlign {
|
|||
MozCenterOrInherit,
|
||||
}
|
||||
|
||||
impl TextAlign {
|
||||
/// Convert an enumerated value coming from Gecko to a `TextAlign`.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub fn from_gecko_keyword(kw: u32) -> Self {
|
||||
TextAlign::Keyword(TextAlignKeyword::from_gecko_keyword(kw))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for TextAlign {
|
||||
type ComputedValue = TextAlignKeyword;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue