зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1612148 - Replace transform style defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D61388 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
05132313b8
Коммит
2770364f87
|
@ -1639,7 +1639,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
|
|||
// to update the overflow areas of all potentially affected frames.
|
||||
if ((hint & nsChangeHint_UpdateUsesOpacity) &&
|
||||
frame->StyleDisplay()->mTransformStyle ==
|
||||
NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D) {
|
||||
StyleTransformStyle::Preserve3d) {
|
||||
hint |= nsChangeHint_UpdateSubtreeOverflow;
|
||||
}
|
||||
|
||||
|
|
|
@ -1747,7 +1747,7 @@ bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
|
|||
return false;
|
||||
}
|
||||
const nsStyleDisplay* disp = StyleDisplayWithOptionalParam(aStyleDisplay);
|
||||
if (disp->mTransformStyle != NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
if (disp->mTransformStyle != StyleTransformStyle::Preserve3d ||
|
||||
!IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -482,6 +482,7 @@ cbindgen-types = [
|
|||
{ gecko = "StyleZIndex", servo = "values::computed::ZIndex" },
|
||||
{ gecko = "StyleGenericZIndex", servo = "values::generics::position::ZIndex" },
|
||||
{ gecko = "StyleTransformOrigin", servo = "values::computed::TransformOrigin" },
|
||||
{ gecko = "StyleTransformStyle", servo = "values::computed::TransformStyle" },
|
||||
{ gecko = "StyleGenericBorderRadius", servo = "values::generics::border::BorderRadius" },
|
||||
{ gecko = "StyleLetterSpacing", servo = "values::computed::text::LetterSpacing" },
|
||||
{ gecko = "StyleGenericLineHeight", servo = "values::generics::text::LineHeight" },
|
||||
|
|
|
@ -778,9 +778,6 @@ enum class StyleColorAdjust : uint8_t {
|
|||
#define NS_STYLE_BACKFACE_VISIBILITY_VISIBLE 1
|
||||
#define NS_STYLE_BACKFACE_VISIBILITY_HIDDEN 0
|
||||
|
||||
#define NS_STYLE_TRANSFORM_STYLE_FLAT 0
|
||||
#define NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D 1
|
||||
|
||||
// blending
|
||||
#define NS_STYLE_BLEND_NORMAL 0
|
||||
#define NS_STYLE_BLEND_MULTIPLY 1
|
||||
|
|
|
@ -2699,7 +2699,7 @@ nsStyleDisplay::nsStyleDisplay(const Document& aDocument)
|
|||
mTranslate(StyleTranslate::None()),
|
||||
mScale(StyleScale::None()),
|
||||
mBackfaceVisibility(NS_STYLE_BACKFACE_VISIBILITY_VISIBLE),
|
||||
mTransformStyle(NS_STYLE_TRANSFORM_STYLE_FLAT),
|
||||
mTransformStyle(StyleTransformStyle::Flat),
|
||||
mTransformBox(StyleGeometryBox::BorderBox),
|
||||
mOffsetPath(StyleOffsetPath::None()),
|
||||
mOffsetDistance(LengthPercentage::Zero()),
|
||||
|
|
|
@ -1527,7 +1527,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
|||
mozilla::StyleScale mScale;
|
||||
|
||||
uint8_t mBackfaceVisibility;
|
||||
uint8_t mTransformStyle;
|
||||
mozilla::StyleTransformStyle mTransformStyle;
|
||||
StyleGeometryBox mTransformBox;
|
||||
|
||||
mozilla::StyleOffsetPath mOffsetPath;
|
||||
|
@ -1763,7 +1763,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
|
|||
* property. */
|
||||
bool HasTransformStyle() const {
|
||||
return HasTransformProperty() || HasIndividualTransform() ||
|
||||
mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
mTransformStyle == mozilla::StyleTransformStyle::Preserve3d ||
|
||||
(mWillChange.bits & mozilla::StyleWillChangeBits::TRANSFORM) ||
|
||||
!mOffsetPath.IsNone();
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -593,7 +593,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,
|
||||
|
|
|
@ -196,6 +196,7 @@ include = [
|
|||
"ComputedJustifyItems",
|
||||
"AlignContent",
|
||||
"JustifyContent",
|
||||
"TransformStyle",
|
||||
]
|
||||
item_types = ["enums", "structs", "unions", "typedefs", "functions", "constants"]
|
||||
renaming_overrides_prefixing = true
|
||||
|
|
Загрузка…
Ссылка в новой задаче