Commit 0e349e3b authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Ribbonize IsValidMarkerStyleProperty

BUG=545324

Change-Id: I2ce865bf6c9bb07d258bdc568128341b1d08d9d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986798
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730156}
parent d89e0eee
...@@ -62,6 +62,10 @@ def check_property_parameters(property_to_check): ...@@ -62,6 +62,10 @@ def check_property_parameters(property_to_check):
assert not property_to_check['longhands'], \ assert not property_to_check['longhands'], \
'Shorthand %s should not be marked as valid_for_cue' % \ 'Shorthand %s should not be marked as valid_for_cue' % \
property_to_check['name'] property_to_check['name']
if property_to_check['valid_for_marker']:
assert not property_to_check['longhands'], \
'Shorthand %s should not be marked as valid_for_marker' % \
property_to_check['name']
class CSSProperties(object): class CSSProperties(object):
......
...@@ -44,6 +44,7 @@ namespace {{namespace}} { ...@@ -44,6 +44,7 @@ namespace {{namespace}} {
(property.is_animation_property and 'kAnimation' or ''), (property.is_animation_property and 'kAnimation' or ''),
(property.valid_for_first_letter and 'kValidForFirstLetter' or ''), (property.valid_for_first_letter and 'kValidForFirstLetter' or ''),
(property.valid_for_cue and 'kValidForCue' or ''), (property.valid_for_cue and 'kValidForCue' or ''),
(property.valid_for_marker and 'kValidForMarker' or ''),
] | reject('==', '') | join(' | ') %} ] | reject('==', '') | join(' | ') %}
{% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %} {% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %}
// {{property.name}} // {{property.name}}
......
...@@ -458,6 +458,14 @@ ...@@ -458,6 +458,14 @@
default: false, default: false,
valid_type: "bool", valid_type: "bool",
}, },
// - valid_for_marker: true
//
// https://drafts.csswg.org/css-pseudo-4/#marker-pseudo
valid_for_marker: {
default: false,
valid_type: "bool",
},
}, },
// Members in the data objects should appear in the same order as in the // Members in the data objects should appear in the same order as in the
...@@ -654,6 +662,7 @@ ...@@ -654,6 +662,7 @@
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "direction", name: "direction",
...@@ -668,6 +677,7 @@ ...@@ -668,6 +677,7 @@
type_name: "TextDirection", type_name: "TextDirection",
style_builder_custom_functions: ["value"], style_builder_custom_functions: ["value"],
priority: "High", priority: "High",
valid_for_marker: true,
}, },
{ {
name: "font-family", name: "font-family",
...@@ -681,6 +691,7 @@ ...@@ -681,6 +691,7 @@
priority: "High", priority: "High",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "font-kerning", name: "font-kerning",
...@@ -693,6 +704,7 @@ ...@@ -693,6 +704,7 @@
keywords: ["auto", "normal", "none"], keywords: ["auto", "normal", "none"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-optical-sizing", name: "font-optical-sizing",
...@@ -705,6 +717,7 @@ ...@@ -705,6 +717,7 @@
keywords: ["auto", "none"], keywords: ["auto", "none"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-size", name: "font-size",
...@@ -720,6 +733,7 @@ ...@@ -720,6 +733,7 @@
typedom_types: ["Keyword", "Length", "Percentage"], typedom_types: ["Keyword", "Length", "Percentage"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "font-size-adjust", name: "font-size-adjust",
...@@ -734,6 +748,7 @@ ...@@ -734,6 +748,7 @@
keywords: ["none"], keywords: ["none"],
typedom_types: ["Keyword", "Number"], typedom_types: ["Keyword", "Number"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-stretch", name: "font-stretch",
...@@ -751,6 +766,7 @@ ...@@ -751,6 +766,7 @@
typedom_types: ["Keyword", "Percentage"], typedom_types: ["Keyword", "Percentage"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "font-style", name: "font-style",
...@@ -765,6 +781,7 @@ ...@@ -765,6 +781,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "font-variant-ligatures", name: "font-variant-ligatures",
...@@ -783,6 +800,7 @@ ...@@ -783,6 +800,7 @@
], ],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-variant-caps", name: "font-variant-caps",
...@@ -798,6 +816,7 @@ ...@@ -798,6 +816,7 @@
], ],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-variant-east-asian", name: "font-variant-east-asian",
...@@ -813,6 +832,7 @@ ...@@ -813,6 +832,7 @@
], ],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-variant-numeric", name: "font-variant-numeric",
...@@ -829,6 +849,7 @@ ...@@ -829,6 +849,7 @@
], ],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-weight", name: "font-weight",
...@@ -844,6 +865,7 @@ ...@@ -844,6 +865,7 @@
typedom_types: ["Keyword", "Number"], typedom_types: ["Keyword", "Number"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "font-feature-settings", name: "font-feature-settings",
...@@ -857,6 +879,7 @@ ...@@ -857,6 +879,7 @@
keywords: ["normal"], keywords: ["normal"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_marker: true,
}, },
{ {
name: "font-variation-settings", name: "font-variation-settings",
...@@ -871,6 +894,7 @@ ...@@ -871,6 +894,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "-webkit-font-smoothing", name: "-webkit-font-smoothing",
...@@ -1724,6 +1748,7 @@ ...@@ -1724,6 +1748,7 @@
type_name: "ContentData", type_name: "ContentData",
computed_style_custom_functions: ["getter", "setter"], computed_style_custom_functions: ["getter", "setter"],
style_builder_custom_functions: ["initial", "inherit", "value"], style_builder_custom_functions: ["initial", "inherit", "value"],
valid_for_marker: true,
}, },
{ {
name: "counter-increment", name: "counter-increment",
...@@ -3426,6 +3451,7 @@ ...@@ -3426,6 +3451,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "none", default_value: "none",
name_for_methods: "TextCombine", name_for_methods: "TextCombine",
valid_for_marker: true,
}, },
{ {
name: "text-decoration-color", name: "text-decoration-color",
...@@ -3703,6 +3729,7 @@ ...@@ -3703,6 +3729,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "normal", default_value: "normal",
type_name: "UnicodeBidi", type_name: "UnicodeBidi",
valid_for_marker: true,
}, },
{ {
name: "vector-effect", name: "vector-effect",
...@@ -4340,6 +4367,7 @@ ...@@ -4340,6 +4367,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "normal", default_value: "normal",
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "widows", name: "widows",
...@@ -5469,6 +5497,7 @@ ...@@ -5469,6 +5497,7 @@
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true, valid_for_cue: true,
valid_for_marker: true,
}, },
{ {
name: "-internal-visited-caret-color", name: "-internal-visited-caret-color",
......
...@@ -55,6 +55,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { ...@@ -55,6 +55,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
} }
bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; } bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; }
bool IsValidForCue() const { return flags_ & kValidForCue; } bool IsValidForCue() const { return flags_ & kValidForCue; }
bool IsValidForMarker() const { return flags_ & kValidForMarker; }
bool IsRepeated() const { return repetition_separator_ != '\0'; } bool IsRepeated() const { return repetition_separator_ != '\0'; }
char RepetitionSeparator() const { return repetition_separator_; } char RepetitionSeparator() const { return repetition_separator_; }
...@@ -124,6 +125,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { ...@@ -124,6 +125,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
kValidForFirstLetter = 1 << 12, kValidForFirstLetter = 1 << 12,
// https://w3c.github.io/webvtt/#the-cue-pseudo-element // https://w3c.github.io/webvtt/#the-cue-pseudo-element
kValidForCue = 1 << 13, kValidForCue = 1 << 13,
// https://drafts.csswg.org/css-pseudo-4/#marker-pseudo
kValidForMarker = 1 << 14,
}; };
constexpr CSSProperty(CSSPropertyID property_id, constexpr CSSProperty(CSSPropertyID property_id,
......
...@@ -34,9 +34,9 @@ class CORE_EXPORT Variable : public Longhand { ...@@ -34,9 +34,9 @@ class CORE_EXPORT Variable : public Longhand {
protected: protected:
constexpr Variable(bool inherited) constexpr Variable(bool inherited)
: Longhand( : Longhand(CSSPropertyID::kVariable,
CSSPropertyID::kVariable, kProperty | (inherited ? kInherited : 0) |
kProperty | (inherited ? kInherited : 0) | kValidForFirstLetter, kValidForFirstLetter | kValidForMarker,
'\0') {} '\0') {}
}; };
......
...@@ -1355,44 +1355,6 @@ void StyleResolver::ApplyAnimatedStandardProperties( ...@@ -1355,44 +1355,6 @@ void StyleResolver::ApplyAnimatedStandardProperties(
} }
} }
static inline bool IsValidMarkerStyleProperty(CSSPropertyID id) {
switch (id) {
// Valid ::marker properties listed in spec:
// https://drafts.csswg.org/css-pseudo-4/#marker-pseudo
case CSSPropertyID::kColor:
case CSSPropertyID::kContent:
case CSSPropertyID::kDirection:
case CSSPropertyID::kFont:
case CSSPropertyID::kFontFamily:
case CSSPropertyID::kFontFeatureSettings:
case CSSPropertyID::kFontKerning:
case CSSPropertyID::kFontOpticalSizing:
case CSSPropertyID::kFontSize:
case CSSPropertyID::kFontSizeAdjust:
case CSSPropertyID::kFontStretch:
case CSSPropertyID::kFontStyle:
case CSSPropertyID::kFontVariant:
case CSSPropertyID::kFontVariantCaps:
case CSSPropertyID::kFontVariantEastAsian:
case CSSPropertyID::kFontVariantLigatures:
case CSSPropertyID::kFontVariantNumeric:
case CSSPropertyID::kFontVariationSettings:
case CSSPropertyID::kFontWeight:
case CSSPropertyID::kTextCombineUpright:
case CSSPropertyID::kUnicodeBidi:
case CSSPropertyID::kWhiteSpace:
return true;
// Not directly specified in spec, but variables should be supported nearly
// anywhere.
case CSSPropertyID::kVariable:
return true;
default:
return false;
}
}
static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter, static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter,
CSSPropertyID property, CSSPropertyID property,
const Document& document) { const Document& document) {
...@@ -1404,7 +1366,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter, ...@@ -1404,7 +1366,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter,
case ValidPropertyFilter::kCue: case ValidPropertyFilter::kCue:
return CSSProperty::Get(property).IsValidForCue(); return CSSProperty::Get(property).IsValidForCue();
case ValidPropertyFilter::kMarker: case ValidPropertyFilter::kMarker:
return IsValidMarkerStyleProperty(property); return CSSProperty::Get(property).IsValidForMarker();
} }
NOTREACHED(); NOTREACHED();
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment