style: Move caption-side outside of mako.

Make it an enum class, etc.

Differential Revision: https://phabricator.services.mozilla.com/D103978
This commit is contained in:
Emilio Cobos Álvarez 2021-02-07 12:33:45 +00:00
parent e084d8e9d2
commit 5fe702fa2b
6 changed files with 60 additions and 5 deletions

View file

@ -399,6 +399,7 @@ class Longhand(object):
"BackgroundRepeat", "BackgroundRepeat",
"BorderImageRepeat", "BorderImageRepeat",
"BorderStyle", "BorderStyle",
"table::CaptionSide",
"Clear", "Clear",
"ColumnCount", "ColumnCount",
"Contain", "Contain",

View file

@ -26,12 +26,12 @@ ${helpers.single_keyword(
servo_restyle_damage="rebuild_and_reflow", servo_restyle_damage="rebuild_and_reflow",
)} )}
${helpers.single_keyword( ${helpers.predefined_type(
"caption-side", "caption-side",
"top bottom", "table::CaptionSide",
"computed::table::CaptionSide::Top",
needs_context=False,
engines="gecko servo-2013", engines="gecko servo-2013",
extra_gecko_values="right left top-outside bottom-outside",
needs_conversion="True",
animation_value_type="discrete", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side", spec="https://drafts.csswg.org/css-tables/#propdef-caption-side",
servo_restyle_damage="rebuild_and_reflow", servo_restyle_damage="rebuild_and_reflow",
@ -46,5 +46,5 @@ ${helpers.predefined_type(
animation_value_type="BorderSpacing", animation_value_type="BorderSpacing",
boxed=True, boxed=True,
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing", spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing",
servo_restyle_damage = "reflow", servo_restyle_damage="reflow",
)} )}

View file

@ -125,6 +125,7 @@ pub mod position;
pub mod rect; pub mod rect;
pub mod resolution; pub mod resolution;
pub mod svg; pub mod svg;
pub mod table;
pub mod text; pub mod text;
pub mod time; pub mod time;
pub mod transform; pub mod transform;

View file

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Computed types for CSS values related to tables.
pub use super::specified::table::CaptionSide;

View file

@ -129,6 +129,7 @@ pub mod resolution;
pub mod source_size_list; pub mod source_size_list;
pub mod svg; pub mod svg;
pub mod svg_path; pub mod svg_path;
pub mod table;
pub mod text; pub mod text;
pub mod time; pub mod time;
pub mod transform; pub mod transform;

View file

@ -0,0 +1,45 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Specified types for CSS values related to tables.
/// Specified values for the `caption-side` property.
///
/// Note that despite having "physical" names, these are actually interpreted
/// according to the table's writing-mode: Top and Bottom are treated as
/// block-start and -end respectively, and Left and Right are treated as
/// line-start and -end.
///
/// https://drafts.csswg.org/css-tables/#propdef-caption-side
#[allow(missing_docs)]
#[derive(
Clone,
Copy,
Debug,
Eq,
FromPrimitive,
MallocSizeOf,
Ord,
Parse,
PartialEq,
PartialOrd,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
#[repr(u8)]
pub enum CaptionSide {
Top,
Bottom,
#[cfg(feature = "gecko")]
Right,
#[cfg(feature = "gecko")]
Left,
#[cfg(feature = "gecko")]
TopOutside,
#[cfg(feature = "gecko")]
BottomOutside,
}