Bug 1746187 - Add CSS support for the hyphenate-character property. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D133889
This commit is contained in:
Jonathan Kew 2021-12-16 13:47:55 +00:00
Родитель 7d46682c0e
Коммит 20ec7ce89f
11 изменённых файлов: 68 добавлений и 0 удалений

Просмотреть файл

@ -83,6 +83,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"grid-template-areas",
"grid-template-columns",
"grid-template-rows",
"hyphenate-character",
"hyphens",
"image-orientation",
"image-rendering",

Просмотреть файл

@ -3094,6 +3094,7 @@ exports.CSS_PROPERTIES = {
"text-underline-offset",
"text-underline-position",
"text-decoration-skip-ink",
"hyphenate-character",
"cursor",
"pointer-events",
"-moz-user-input",
@ -7277,6 +7278,21 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"hyphenate-character": {
"isInherited": true,
"subproperties": [
"hyphenate-character"
],
"supports": [],
"values": [
"auto",
"inherit",
"initial",
"revert",
"revert-layer",
"unset"
]
},
"hyphens": {
"isInherited": true,
"subproperties": [
@ -11622,6 +11638,10 @@ exports.PREFERENCES = [
"font-variation-settings",
"layout.css.font-variations.enabled"
],
[
"hyphenate-character",
"layout.css.hyphenate-character.enabled"
],
[
"justify-tracks",
"layout.css.grid-template-masonry-value.enabled"

Просмотреть файл

@ -589,6 +589,7 @@ cbindgen-types = [
{ gecko = "StyleDProperty", servo = "crate::values::specified::svg::DProperty" },
{ gecko = "StyleImageRendering", servo = "crate::values::computed::ImageRendering" },
{ gecko = "StyleScrollbarGutter", servo = "crate::values::computed::ScrollbarGutter" },
{ gecko = "StyleHyphenateCharacter", servo = "crate::values::computed::HyphenateCharacter" },
]
mapped-generic-types = [

Просмотреть файл

@ -927,6 +927,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
mozilla::StyleArcSlice<mozilla::StyleSimpleShadow> mTextShadow;
mozilla::StyleTextEmphasisStyle mTextEmphasisStyle;
mozilla::StyleHyphenateCharacter mHyphenateCharacter =
mozilla::StyleHyphenateCharacter::Auto();
mozilla::StyleWordBreak EffectiveWordBreak() const {
if (mWordBreak == mozilla::StyleWordBreak::BreakWord) {
return mozilla::StyleWordBreak::Normal;

Просмотреть файл

@ -7325,6 +7325,12 @@
mirror: always
rust: true
# Is support for CSS hyphenate-character enabled?
- name: layout.css.hyphenate-character.enabled
type: RelaxedAtomicBool
value: @IS_NIGHTLY_BUILD@
mirror: always
# Is support for CSS individual transform enabled?
- name: layout.css.individual-transform.enabled
type: bool

Просмотреть файл

@ -374,3 +374,15 @@ ${helpers.predefined_type(
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property",
)}
// hyphenation character
${helpers.predefined_type(
"hyphenate-character",
"HyphenateCharacter",
"computed::HyphenateCharacter::Auto",
engines="gecko",
gecko_pref="layout.css.hyphenate-character.enabled",
has_effect_on_gecko_scrollbars=False,
animation_value_type="discrete",
spec="https://www.w3.org/TR/css-text-4/#hyphenate-character",
)}

Просмотреть файл

@ -87,6 +87,7 @@ pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight};
pub use self::text::{OverflowWrap, RubyPosition, TextOverflow, WordBreak, WordSpacing};
pub use self::text::{TextAlign, TextAlignLast, TextEmphasisPosition, TextEmphasisStyle};
pub use self::text::{TextDecorationLength, TextDecorationSkipInk, TextJustify};
pub use self::text::HyphenateCharacter;
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
pub use self::transform::{TransformOrigin, TransformStyle, Translate};

Просмотреть файл

@ -24,6 +24,7 @@ pub use crate::values::specified::text::{
pub use crate::values::specified::{LineBreak, OverflowWrap, RubyPosition, WordBreak};
pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition};
pub use crate::values::specified::{TextDecorationSkipInk, TextJustify, TextTransform};
pub use crate::values::specified::HyphenateCharacter;
/// A computed value for the `initial-letter` property.
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;

Просмотреть файл

@ -90,6 +90,7 @@ pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight, TextAl
pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak};
pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};
pub use self::text::{TextDecorationLength, TextDecorationSkipInk, TextJustify, TextTransform};
pub use self::text::HyphenateCharacter;
pub use self::time::Time;
pub use self::transform::{Rotate, Scale, Transform};
pub use self::transform::{TransformOrigin, TransformStyle, Translate};

Просмотреть файл

@ -37,6 +37,27 @@ pub type WordSpacing = Spacing<LengthPercentage>;
/// A specified value for the `line-height` property.
pub type LineHeight = GenericLineHeight<NonNegativeNumber, NonNegativeLengthPercentage>;
/// A value for the `hyphenate-character` property.
#[derive(
Clone,
Debug,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
#[repr(C, u8)]
pub enum HyphenateCharacter {
/// `auto`
Auto,
/// `<string>`
String(crate::OwnedStr),
}
impl Parse for InitialLetter {
fn parse<'i, 't>(
context: &ParserContext,

Просмотреть файл

@ -237,6 +237,7 @@ include = [
"ImageRendering",
"ScrollbarGutter",
"ScrollDirection",
"HyphenateCharacter",
]
item_types = ["enums", "structs", "unions", "typedefs", "functions", "constants"]
renaming_overrides_prefixing = true