mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Implement parsing for baseline-source
Differential Revision: https://phabricator.services.mozilla.com/D173884
This commit is contained in:
parent
571136562d
commit
7a2b444a60
6 changed files with 64 additions and 10 deletions
|
@ -428,6 +428,7 @@ class Longhand(Property):
|
||||||
"AlignSelf",
|
"AlignSelf",
|
||||||
"Appearance",
|
"Appearance",
|
||||||
"AspectRatio",
|
"AspectRatio",
|
||||||
|
"BaselineSource",
|
||||||
"BreakBetween",
|
"BreakBetween",
|
||||||
"BreakWithin",
|
"BreakWithin",
|
||||||
"BackgroundRepeat",
|
"BackgroundRepeat",
|
||||||
|
@ -785,6 +786,8 @@ class PropertyRestrictions:
|
||||||
"-webkit-text-fill-color",
|
"-webkit-text-fill-color",
|
||||||
"-webkit-text-stroke-color",
|
"-webkit-text-stroke-color",
|
||||||
"vertical-align",
|
"vertical-align",
|
||||||
|
# Will become shorthand of vertical-align (Bug 1830771)
|
||||||
|
"baseline-source",
|
||||||
"line-height",
|
"line-height",
|
||||||
# Kinda like css-backgrounds?
|
# Kinda like css-backgrounds?
|
||||||
"background-blend-mode",
|
"background-blend-mode",
|
||||||
|
@ -818,6 +821,8 @@ class PropertyRestrictions:
|
||||||
"-webkit-text-fill-color",
|
"-webkit-text-fill-color",
|
||||||
"-webkit-text-stroke-color",
|
"-webkit-text-stroke-color",
|
||||||
"vertical-align",
|
"vertical-align",
|
||||||
|
# Will become shorthand of vertical-align (Bug 1830771)
|
||||||
|
"baseline-source",
|
||||||
"line-height",
|
"line-height",
|
||||||
# Kinda like css-backgrounds?
|
# Kinda like css-backgrounds?
|
||||||
"background-blend-mode",
|
"background-blend-mode",
|
||||||
|
|
|
@ -94,6 +94,16 @@ ${helpers.predefined_type(
|
||||||
servo_restyle_damage = "reflow",
|
servo_restyle_damage = "reflow",
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
${helpers.predefined_type(
|
||||||
|
"baseline-source",
|
||||||
|
"BaselineSource",
|
||||||
|
"computed::BaselineSource::Auto",
|
||||||
|
engines="gecko servo-2013",
|
||||||
|
animation_value_type="discrete",
|
||||||
|
spec="https://drafts.csswg.org/css-inline-3/#baseline-source",
|
||||||
|
servo_restyle_damage = "reflow",
|
||||||
|
)}
|
||||||
|
|
||||||
// CSS 2.1, Section 11 - Visual effects
|
// CSS 2.1, Section 11 - Visual effects
|
||||||
|
|
||||||
${helpers.single_keyword(
|
${helpers.single_keyword(
|
||||||
|
|
|
@ -13,10 +13,10 @@ use crate::values::generics::box_::{
|
||||||
use crate::values::specified::box_ as specified;
|
use crate::values::specified::box_ as specified;
|
||||||
|
|
||||||
pub use crate::values::specified::box_::{
|
pub use crate::values::specified::box_::{
|
||||||
Appearance, BreakBetween, BreakWithin, Clear as SpecifiedClear, Contain, ContainerName,
|
Appearance, BaselineSource, BreakBetween, BreakWithin, Clear as SpecifiedClear, Contain,
|
||||||
ContainerType, ContentVisibility, Display, Float as SpecifiedFloat, Overflow, OverflowAnchor,
|
ContainerName, ContainerType, ContentVisibility, Display, Float as SpecifiedFloat, Overflow,
|
||||||
OverflowClipBox, OverscrollBehavior, ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop,
|
OverflowAnchor, OverflowClipBox, OverscrollBehavior, ScrollSnapAlign, ScrollSnapAxis,
|
||||||
ScrollSnapStrictness, ScrollSnapType, ScrollbarGutter, TouchAction, WillChange,
|
ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType, ScrollbarGutter, TouchAction, WillChange,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A computed value for the `vertical-align` property.
|
/// A computed value for the `vertical-align` property.
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, S
|
||||||
pub use self::box_::{
|
pub use self::box_::{
|
||||||
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType,
|
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType,
|
||||||
};
|
};
|
||||||
pub use self::box_::{TouchAction, VerticalAlign, WillChange};
|
pub use self::box_::{BaselineSource, TouchAction, VerticalAlign, WillChange};
|
||||||
pub use self::color::{
|
pub use self::color::{
|
||||||
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::parser::{Parse, ParserContext};
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use crate::properties::{LonghandId, PropertyDeclarationId, PropertyId};
|
use crate::properties::{LonghandId, PropertyDeclarationId, PropertyId};
|
||||||
use crate::values::generics::box_::{
|
use crate::values::generics::box_::{
|
||||||
GenericLineClamp, GenericPerspective, GenericContainIntrinsicSize, GenericVerticalAlign,
|
GenericContainIntrinsicSize, GenericLineClamp, GenericPerspective, GenericVerticalAlign,
|
||||||
VerticalAlignKeyword,
|
VerticalAlignKeyword,
|
||||||
};
|
};
|
||||||
use crate::values::specified::length::{LengthPercentage, NonNegativeLength};
|
use crate::values::specified::length::{LengthPercentage, NonNegativeLength};
|
||||||
|
@ -606,6 +606,33 @@ impl Parse for VerticalAlign {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A specified value for the `baseline-source` property.
|
||||||
|
/// https://drafts.csswg.org/css-inline-3/#baseline-source
|
||||||
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
MallocSizeOf,
|
||||||
|
Parse,
|
||||||
|
PartialEq,
|
||||||
|
SpecifiedValueInfo,
|
||||||
|
ToCss,
|
||||||
|
ToShmem,
|
||||||
|
ToComputedValue,
|
||||||
|
ToResolvedValue,
|
||||||
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum BaselineSource {
|
||||||
|
/// `Last` for `inline-block`, `First` otherwise.
|
||||||
|
Auto,
|
||||||
|
/// Use first baseline for alignment.
|
||||||
|
First,
|
||||||
|
/// Use last baseline for alignment.
|
||||||
|
Last,
|
||||||
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis
|
/// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
|
@ -1176,7 +1203,20 @@ pub enum ContentVisibility {
|
||||||
Visible,
|
Visible,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToCss, Parse, ToResolvedValue, ToShmem)]
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
MallocSizeOf,
|
||||||
|
SpecifiedValueInfo,
|
||||||
|
ToComputedValue,
|
||||||
|
ToCss,
|
||||||
|
Parse,
|
||||||
|
ToResolvedValue,
|
||||||
|
ToShmem,
|
||||||
|
)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
/// https://drafts.csswg.org/css-contain-3/#container-type
|
/// https://drafts.csswg.org/css-contain-3/#container-type
|
||||||
|
@ -1237,8 +1277,7 @@ impl ContainerName {
|
||||||
if !for_query && first.eq_ignore_ascii_case("none") {
|
if !for_query && first.eq_ignore_ascii_case("none") {
|
||||||
return Ok(Self::none());
|
return Ok(Self::none());
|
||||||
}
|
}
|
||||||
const DISALLOWED_CONTAINER_NAMES: &'static [&'static str] =
|
const DISALLOWED_CONTAINER_NAMES: &'static [&'static str] = &["none", "not", "or", "and"];
|
||||||
&["none", "not", "or", "and"];
|
|
||||||
idents.push(CustomIdent::from_ident(
|
idents.push(CustomIdent::from_ident(
|
||||||
location,
|
location,
|
||||||
first,
|
first,
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub use self::box_::{Contain, Display};
|
||||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
||||||
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType};
|
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType};
|
||||||
pub use self::box_::{TouchAction, VerticalAlign, WillChange};
|
pub use self::box_::{BaselineSource, TouchAction, VerticalAlign, WillChange};
|
||||||
pub use self::color::{
|
pub use self::color::{
|
||||||
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
Color, ColorOrAuto, ColorPropertyValue, ColorScheme, ForcedColorAdjust, PrintColorAdjust,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue