mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Replace transform style defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D61388
This commit is contained in:
parent
16fd7cad0c
commit
625170ddd4
3 changed files with 3 additions and 24 deletions
|
@ -53,7 +53,6 @@ use crate::values::computed::BorderStyle;
|
|||
use crate::values::computed::font::FontSize;
|
||||
use crate::values::generics::column::ColumnCount;
|
||||
use crate::values::generics::image::ImageLayer;
|
||||
use crate::values::generics::transform::TransformStyle;
|
||||
use crate::values::generics::url::UrlOrNone;
|
||||
|
||||
|
||||
|
@ -1473,7 +1472,7 @@ fn static_assert() {
|
|||
animation-iteration-count animation-timing-function
|
||||
clear transition-duration transition-delay
|
||||
transition-timing-function transition-property
|
||||
transform-style shape-outside -webkit-line-clamp""" %>
|
||||
shape-outside -webkit-line-clamp""" %>
|
||||
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
||||
#[inline]
|
||||
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
|
||||
|
@ -1630,25 +1629,6 @@ fn static_assert() {
|
|||
self.copy_transition_property_from(other)
|
||||
}
|
||||
|
||||
// Hand-written because the Mako helpers transform `Preserve3d` into `PRESERVE3D`.
|
||||
pub fn set_transform_style(&mut self, v: TransformStyle) {
|
||||
self.gecko.mTransformStyle = match v {
|
||||
TransformStyle::Flat => structs::NS_STYLE_TRANSFORM_STYLE_FLAT as u8,
|
||||
TransformStyle::Preserve3d => structs::NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D as u8,
|
||||
};
|
||||
}
|
||||
|
||||
// Hand-written because the Mako helpers transform `Preserve3d` into `PRESERVE3D`.
|
||||
pub fn clone_transform_style(&self) -> TransformStyle {
|
||||
match self.gecko.mTransformStyle as u32 {
|
||||
structs::NS_STYLE_TRANSFORM_STYLE_FLAT => TransformStyle::Flat,
|
||||
structs::NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D => TransformStyle::Preserve3d,
|
||||
_ => panic!("illegal transform style"),
|
||||
}
|
||||
}
|
||||
|
||||
${impl_simple_copy('transform_style', 'mTransformStyle')}
|
||||
|
||||
${impl_transition_count('property', 'Property')}
|
||||
|
||||
pub fn animations_equals(&self, other: &Self) -> bool {
|
||||
|
|
|
@ -592,7 +592,7 @@ ${helpers.single_keyword(
|
|||
${helpers.predefined_type(
|
||||
"transform-style",
|
||||
"TransformStyle",
|
||||
"computed::TransformStyle::" + ("Flat" if engine == "gecko" else "Auto"),
|
||||
"computed::TransformStyle::Flat",
|
||||
engines="gecko servo-2013 servo-2020",
|
||||
servo_2020_pref="layout.2020.unimplemented",
|
||||
spec="https://drafts.csswg.org/css-transforms-2/#transform-style-property",
|
||||
|
|
|
@ -820,9 +820,8 @@ pub use self::GenericTranslate as Translate;
|
|||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum TransformStyle {
|
||||
#[cfg(feature = "servo")]
|
||||
Auto,
|
||||
Flat,
|
||||
#[css(keyword = "preserve-3d")]
|
||||
Preserve3d,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue