Bug 1964952 - Move writing-mode out of mako. r=layout-reviewers,jfkthame
This makes this call work as expected: https://searchfox.org/mozilla-central/rev/4c065f1df299065c305fb48b36cdae571a43d97c/dom/view-transitions/ViewTransition.cpp#569 Right now the Gecko and Servo values don't really match. Nobody uses the sideways flag on this value. Differential Revision: https://phabricator.services.mozilla.com/D248229
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
9770b45d78
commit
77f43421b7
@@ -23,6 +23,38 @@ pub enum InlineBaseDirection {
|
||||
RightToLeft,
|
||||
}
|
||||
|
||||
/// The writing-mode property (different from the WritingMode enum).
|
||||
/// https://drafts.csswg.org/css-writing-modes/#block-flow
|
||||
/// Aliases come from https://drafts.csswg.org/css-writing-modes-4/#svg-writing-mode
|
||||
#[allow(missing_docs)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
FromPrimitive,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum WritingModeProperty {
|
||||
#[parse(aliases = "lr,lr-tb,rl,rl-tb")]
|
||||
HorizontalTb,
|
||||
#[parse(aliases = "tb,tb-rl")]
|
||||
VerticalRl,
|
||||
VerticalLr,
|
||||
#[cfg(feature = "gecko")]
|
||||
SidewaysRl,
|
||||
#[cfg(feature = "gecko")]
|
||||
SidewaysLr,
|
||||
}
|
||||
|
||||
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, Serialize)]
|
||||
#[repr(C)]
|
||||
@@ -82,7 +114,6 @@ impl WritingMode {
|
||||
/// Return a WritingMode bitflags from the relevant CSS properties.
|
||||
pub fn new(inheritedbox_style: &style_structs::InheritedBox) -> Self {
|
||||
use crate::properties::longhands::direction::computed_value::T as Direction;
|
||||
use crate::properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode;
|
||||
|
||||
let mut flags = WritingMode::empty();
|
||||
|
||||
@@ -97,18 +128,18 @@ impl WritingMode {
|
||||
}
|
||||
|
||||
match writing_mode {
|
||||
SpecifiedWritingMode::HorizontalTb => {
|
||||
WritingModeProperty::HorizontalTb => {
|
||||
if direction == Direction::Rtl {
|
||||
flags.insert(WritingMode::INLINE_REVERSED);
|
||||
}
|
||||
},
|
||||
SpecifiedWritingMode::VerticalRl => {
|
||||
WritingModeProperty::VerticalRl => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
if direction == Direction::Rtl {
|
||||
flags.insert(WritingMode::INLINE_REVERSED);
|
||||
}
|
||||
},
|
||||
SpecifiedWritingMode::VerticalLr => {
|
||||
WritingModeProperty::VerticalLr => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::VERTICAL_LR);
|
||||
flags.insert(WritingMode::LINE_INVERTED);
|
||||
@@ -117,7 +148,7 @@ impl WritingMode {
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "gecko")]
|
||||
SpecifiedWritingMode::SidewaysRl => {
|
||||
WritingModeProperty::SidewaysRl => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::VERTICAL_SIDEWAYS);
|
||||
if direction == Direction::Rtl {
|
||||
@@ -125,7 +156,7 @@ impl WritingMode {
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "gecko")]
|
||||
SpecifiedWritingMode::SidewaysLr => {
|
||||
WritingModeProperty::SidewaysLr => {
|
||||
flags.insert(WritingMode::VERTICAL);
|
||||
flags.insert(WritingMode::VERTICAL_LR);
|
||||
flags.insert(WritingMode::VERTICAL_SIDEWAYS);
|
||||
@@ -142,7 +173,7 @@ impl WritingMode {
|
||||
// text-orientation only has an effect for vertical-rl and
|
||||
// vertical-lr values of writing-mode.
|
||||
match writing_mode {
|
||||
SpecifiedWritingMode::VerticalRl | SpecifiedWritingMode::VerticalLr => {
|
||||
WritingModeProperty::VerticalRl | WritingModeProperty::VerticalLr => {
|
||||
match inheritedbox_style.clone_text_orientation() {
|
||||
TextOrientation::Mixed => {},
|
||||
TextOrientation::Upright => {
|
||||
|
||||
@@ -622,6 +622,7 @@ class Longhand(Property):
|
||||
"UserSelect",
|
||||
"VectorEffect",
|
||||
"WordBreak",
|
||||
"WritingModeProperty",
|
||||
"XSpan",
|
||||
"XTextScale",
|
||||
"ZIndex",
|
||||
|
||||
@@ -17,18 +17,14 @@ ${helpers.single_keyword(
|
||||
|
||||
// CSS Writing Modes Level 3
|
||||
// https://drafts.csswg.org/css-writing-modes-3
|
||||
${helpers.single_keyword(
|
||||
${helpers.predefined_type(
|
||||
"writing-mode",
|
||||
"horizontal-tb vertical-rl vertical-lr",
|
||||
"WritingModeProperty",
|
||||
"computed::WritingModeProperty::HorizontalTb",
|
||||
engines="gecko servo",
|
||||
extra_gecko_values="sideways-rl sideways-lr",
|
||||
gecko_aliases="lr=horizontal-tb lr-tb=horizontal-tb \
|
||||
rl=horizontal-tb rl-tb=horizontal-tb \
|
||||
tb=vertical-rl tb-rl=vertical-rl",
|
||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
|
||||
servo_pref="layout.writing-mode.enabled",
|
||||
animation_type="none",
|
||||
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
|
||||
gecko_enum_prefix="StyleWritingModeProperty",
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
affects="layout",
|
||||
)}
|
||||
|
||||
@@ -20,6 +20,7 @@ pub use crate::values::specified::box_::{
|
||||
ContainerType, ContentVisibility, Display, Float, Overflow, OverflowAnchor, OverflowClipBox,
|
||||
OverscrollBehavior, PositionProperty, ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop,
|
||||
ScrollSnapStrictness, ScrollSnapType, ScrollbarGutter, TouchAction, WillChange,
|
||||
WritingModeProperty,
|
||||
};
|
||||
|
||||
/// A computed value for the `vertical-align` property.
|
||||
|
||||
@@ -56,7 +56,7 @@ pub use self::box_::{
|
||||
ContainerName, ContainerType, ContentVisibility, Display, Float, LineClamp, Overflow,
|
||||
OverflowAnchor, OverflowClipBox, OverscrollBehavior, Perspective, PositionProperty, Resize,
|
||||
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType,
|
||||
ScrollbarGutter, TouchAction, VerticalAlign, WillChange, Zoom,
|
||||
ScrollbarGutter, TouchAction, VerticalAlign, WillChange, WritingModeProperty, Zoom,
|
||||
};
|
||||
pub use self::color::{
|
||||
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
||||
|
||||
@@ -13,6 +13,7 @@ use crate::values::generics::box_::{
|
||||
use crate::values::specified::length::{LengthPercentage, NonNegativeLength};
|
||||
use crate::values::specified::{AllowQuirks, Integer, NonNegativeNumberOrPercentage};
|
||||
use crate::values::CustomIdent;
|
||||
pub use crate::logical_geometry::WritingModeProperty;
|
||||
use cssparser::Parser;
|
||||
use num_traits::FromPrimitive;
|
||||
use std::fmt::{self, Write};
|
||||
|
||||
@@ -44,7 +44,8 @@ pub use self::box_::{
|
||||
ContainerName, ContainerType, ContentVisibility, Display, Float, LineClamp, Overflow,
|
||||
OverflowAnchor, OverflowClipBox, OverscrollBehavior, Perspective, PositionProperty, Resize,
|
||||
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType,
|
||||
ScrollbarGutter, TouchAction, VerticalAlign, WillChange, WillChangeBits, Zoom,
|
||||
ScrollbarGutter, TouchAction, VerticalAlign, WillChange, WillChangeBits, WritingModeProperty,
|
||||
Zoom,
|
||||
};
|
||||
pub use self::color::{
|
||||
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
||||
|
||||
@@ -280,6 +280,7 @@ include = [
|
||||
"CounterSet",
|
||||
"CounterIncrement",
|
||||
"WritingMode",
|
||||
"WritingModeProperty",
|
||||
"Content",
|
||||
"ContentItem",
|
||||
"AlignSelf",
|
||||
|
||||
Reference in New Issue
Block a user