Bug 1561131: Adding parsing support for text-decoration-skip-ink r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D35831

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Charlie Marlow 2019-06-27 21:34:33 +00:00
parent 475dbeee0a
commit 8d6b1bcaa4
20 changed files with 83 additions and 20 deletions

View File

@ -144,6 +144,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
"text-anchor",
"text-combine-upright",
"text-decoration-line",
"text-decoration-skip-ink",
"text-decoration-style",
"text-emphasis-position",
"text-emphasis-style",

View File

@ -3186,6 +3186,7 @@ exports.CSS_PROPERTIES = {
"text-rendering",
"-moz-control-character-visibility",
"text-underline-offset",
"text-decoration-skip-ink",
"cursor",
"pointer-events",
"-moz-user-input",
@ -10721,6 +10722,10 @@ exports.PREFERENCES = [
"scrollbar-width",
"layout.css.scrollbar-width.enabled"
],
[
"text-decoration-skip-ink",
"layout.css.text-decoration-skip-ink.enabled"
],
[
"text-justify",
"layout.css.text-justify.enabled"

View File

@ -129,6 +129,7 @@ rusty-enums = [
"mozilla::StyleTextRendering",
"mozilla::StyleColorAdjust",
"mozilla::StyleFlexDirection",
"mozilla::StyleTextDecorationSkipInk",
"nsStyleImageType",
"nsStyleSVGPaintType",
"nsStyleSVGFallbackType",
@ -432,6 +433,7 @@ cbindgen-types = [
{ gecko = "StyleTextOverflow", servo = "values::computed::TextOverflow" },
{ gecko = "StyleOverflow", servo = "values::computed::Overflow" },
{ gecko = "StyleOverflowAnchor", servo = "values::computed::OverflowAnchor" },
{ gecko = "StyleTextDecorationSkipInk", servo = "values::computed::TextDecorationSkipInk" },
{ gecko = "StyleLength", servo = "values::computed::CSSPixelLength" },
{ gecko = "StyleLengthPercentage", servo = "values::computed::LengthPercentage" },
{ gecko = "StyleNonNegativeLengthPercentage", servo = "values::computed::NonNegativeLengthPercentage" },

View File

@ -3535,6 +3535,7 @@ nsStyleText::nsStyleText(const Document& aDocument)
mLineHeight(StyleLineHeight::Normal()),
mTextIndent(LengthPercentage::Zero()),
mTextUnderlineOffset(LengthOrAuto::Auto()),
mTextDecorationSkipInk(StyleTextDecorationSkipInk::Auto),
mWebkitTextStrokeWidth(0) {
MOZ_COUNT_CTOR(nsStyleText);
RefPtr<nsAtom> language = aDocument.GetContentLanguageAsAtomForStyle();
@ -3572,6 +3573,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
mLineHeight(aSource.mLineHeight),
mTextIndent(aSource.mTextIndent),
mTextUnderlineOffset(aSource.mTextUnderlineOffset),
mTextDecorationSkipInk(aSource.mTextDecorationSkipInk),
mWebkitTextStrokeWidth(aSource.mWebkitTextStrokeWidth),
mTextShadow(aSource.mTextShadow),
mTextEmphasisStyleString(aSource.mTextEmphasisStyleString) {
@ -3606,6 +3608,7 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aNewData) const {
(mLineHeight != aNewData.mLineHeight) ||
(mTextIndent != aNewData.mTextIndent) ||
(mTextUnderlineOffset != aNewData.mTextUnderlineOffset) ||
(mTextDecorationSkipInk != aNewData.mTextDecorationSkipInk) ||
(mTextJustify != aNewData.mTextJustify) ||
(mWordSpacing != aNewData.mWordSpacing) ||
(mMozTabSize != aNewData.mMozTabSize)) {

View File

@ -1230,6 +1230,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
mozilla::LengthPercentage mTextIndent;
mozilla::StyleLengthOrAuto mTextUnderlineOffset;
mozilla::StyleTextDecorationSkipInk mTextDecorationSkipInk;
nscoord mWebkitTextStrokeWidth; // coord

View File

@ -13,6 +13,7 @@ prefs =
layout.css.text-underline-offset.enabled=true
layout.css.text-decoration-width.enabled=true
layout.css.backdrop-filter.enabled=true
layout.css.text-decoration-skip-ink.enabled=true
support-files =
animation_utils.js
ccd-quirks.html

View File

@ -4839,6 +4839,14 @@ var gCSSProperties = {
other_values: [ "double", "dotted", "dashed", "wavy", "-moz-none" ],
invalid_values: [ "none", "groove", "ridge", "inset", "outset", "solid dashed", "wave" ]
},
"text-decoration-skip-ink": {
domProp: "textDecorationSkipInk",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: ["none"],
invalid_values: ["13", "15%", "-1", "0", "otto", "trash", "non", "nada", "!@#$%^", "none auto", "auto none"]
},
"text-underline-offset": {
domProp: "textUnderlineOffset",
inherited: true,

View File

@ -4735,6 +4735,14 @@ VARCACHE_PREF(
bool, false
)
// text decoration skip ink
VARCACHE_PREF(
Live,
"layout.css.text-decoration-skip-ink.enabled",
layout_css_text_decoration_skip_ink_enabled,
bool, false
)
// Is support for CSS column-span enabled?
VARCACHE_PREF(
Live,

View File

@ -336,6 +336,7 @@ class Longhand(object):
"MozScriptLevel",
"MozScriptMinSize",
"MozScriptSizeMultiplier",
"TextDecorationSkipInk",
"NonNegativeNumber",
"Number",
"OffsetRotate",

View File

@ -384,3 +384,15 @@ ${helpers.predefined_type(
gecko_pref="layout.css.text-underline-offset.enabled",
spec="https://drafts.csswg.org/css-text-decor-4/#underline-offset",
)}
// text decoration skip ink
${helpers.predefined_type(
"text-decoration-skip-ink",
"TextDecorationSkipInk",
"computed::TextDecorationSkipInk::Auto",
products="gecko",
needs_context=False,
animation_value_type="discrete",
gecko_pref="layout.css.text-decoration-skip-ink.enabled",
spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property",
)}

View File

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

View File

@ -19,7 +19,7 @@ use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
pub use crate::values::specified::TextAlignKeyword as TextAlign;
pub use crate::values::specified::TextTransform;
pub use crate::values::specified::{TextTransform, TextDecorationSkipInk};
pub use crate::values::specified::{LineBreak, OverflowWrap, WordBreak};
pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition};

View File

@ -78,7 +78,7 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
pub use self::svg_path::SVGPathData;
pub use self::table::XSpan;
pub use self::text::TextTransform;
pub use self::text::{TextTransform, TextDecorationSkipInk};
pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight, TextAlign};
pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak};
pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing};

View File

@ -1054,3 +1054,28 @@ pub enum OverflowWrap {
BreakWord,
Anywhere,
}
/// Implements text-decoration-skip-ink which takes the keywords auto | none
///
/// https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property
#[repr(u8)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(
Clone,
Copy,
Debug,
Eq,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
#[allow(missing_docs)]
pub enum TextDecorationSkipInk {
Auto,
None,
}

View File

@ -102,6 +102,7 @@ include = [
"NonNegativeLengthPercentageOrNormal",
"LengthOrAuto",
"NonNegativeLengthOrAuto",
"TextDecorationSkipInk",
"Rect",
"IntersectionObserverRootMargin",
"Size",

View File

@ -1,7 +1,2 @@
[text-decoration-skip-ink-computed.html]
[Property text-decoration-skip-ink value 'auto' computes to 'auto']
expected: FAIL
[Property text-decoration-skip-ink value 'none' computes to 'none']
expected: FAIL
prefs: [layout.css.text-decoration-skip-ink.enabled:true]

View File

@ -0,0 +1,2 @@
[text-decoration-skip-ink-invalid.html]
prefs: [layout.css.text-decoration-skip-ink.enabled:true]

View File

@ -1,7 +1,2 @@
[text-decoration-skip-ink-valid.html]
[e.style['text-decoration-skip-ink'\] = "none" should set the property value]
expected: FAIL
[e.style['text-decoration-skip-ink'\] = "auto" should set the property value]
expected: FAIL
prefs: [layout.css.text-decoration-skip-ink.enabled:true]

View File

@ -1,7 +1,2 @@
[text-decoration-skip-ink.html]
[Body must have text-decoration-skip-ink auto by default.]
expected: FAIL
[Property text-decoration-skip-ink must support values auto and none.]
expected: FAIL
prefs: [layout.css.text-decoration-skip-ink.enabled:true]

View File

@ -9,4 +9,11 @@
<script>
test_invalid_value("text-decoration-skip-ink", "edges");
test_invalid_value("text-decoration-skip-ink", "auto none");
test_invalid_value("text-decoration-skip-ink", "10px");
test_invalid_value("text-decoration-skip-ink", "-5em");
test_invalid_value("text-decoration-skip-ink", "otto");
test_invalid_value("text-decoration-skip-ink", "20%");
test_invalid_value("text-decoration-skip-ink", "-13%");
test_invalid_value("text-decoration-skip-ink", "0");
test_invalid_value("text-decoration-skip-ink", "non");
</script>