Commit f3079690 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Ribbonize IsValidCueStyleProperty

BUG=545324

Change-Id: Ib7c79ad352a8d68a7815ca992f25280e5c980561
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986797
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730130}
parent 03b3cd97
...@@ -58,6 +58,10 @@ def check_property_parameters(property_to_check): ...@@ -58,6 +58,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_first_letter' % \ 'Shorthand %s should not be marked as valid_for_first_letter' % \
property_to_check['name'] property_to_check['name']
if property_to_check['valid_for_cue']:
assert not property_to_check['longhands'], \
'Shorthand %s should not be marked as valid_for_cue' % \
property_to_check['name']
class CSSProperties(object): class CSSProperties(object):
......
...@@ -43,6 +43,7 @@ namespace {{namespace}} { ...@@ -43,6 +43,7 @@ namespace {{namespace}} {
(property.ua and 'kUA' or ''), (property.ua and 'kUA' or ''),
(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 ''),
] | 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}}
......
...@@ -450,6 +450,14 @@ ...@@ -450,6 +450,14 @@
default: false, default: false,
valid_type: "bool", valid_type: "bool",
}, },
// - valid_for_cue: true
//
// https://w3c.github.io/webvtt/#the-cue-pseudo-element
valid_for_cue: {
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
...@@ -645,6 +653,7 @@ ...@@ -645,6 +653,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "direction", name: "direction",
...@@ -671,6 +680,7 @@ ...@@ -671,6 +680,7 @@
converter: "ConvertFontFamily", converter: "ConvertFontFamily",
priority: "High", priority: "High",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "font-kerning", name: "font-kerning",
...@@ -709,6 +719,7 @@ ...@@ -709,6 +719,7 @@
keywords: ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "larger", "smaller", "-webkit-xxx-large"], keywords: ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "larger", "smaller", "-webkit-xxx-large"],
typedom_types: ["Keyword", "Length", "Percentage"], typedom_types: ["Keyword", "Length", "Percentage"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "font-size-adjust", name: "font-size-adjust",
...@@ -739,6 +750,7 @@ ...@@ -739,6 +750,7 @@
], ],
typedom_types: ["Keyword", "Percentage"], typedom_types: ["Keyword", "Percentage"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "font-style", name: "font-style",
...@@ -752,6 +764,7 @@ ...@@ -752,6 +764,7 @@
keywords: ["normal", "italic", "oblique"], keywords: ["normal", "italic", "oblique"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "font-variant-ligatures", name: "font-variant-ligatures",
...@@ -830,6 +843,7 @@ ...@@ -830,6 +843,7 @@
keywords: ["normal", "bold", "bolder", "lighter"], keywords: ["normal", "bold", "bolder", "lighter"],
typedom_types: ["Keyword", "Number"], typedom_types: ["Keyword", "Number"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "font-feature-settings", name: "font-feature-settings",
...@@ -856,6 +870,7 @@ ...@@ -856,6 +870,7 @@
keywords: ["normal"], keywords: ["normal"],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-webkit-font-smoothing", name: "-webkit-font-smoothing",
...@@ -1024,6 +1039,7 @@ ...@@ -1024,6 +1039,7 @@
fill_type: "Attachment", fill_type: "Attachment",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-blend-mode", name: "background-blend-mode",
...@@ -1053,6 +1069,7 @@ ...@@ -1053,6 +1069,7 @@
fill_type: "Clip", fill_type: "Clip",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-color", name: "background-color",
...@@ -1073,6 +1090,7 @@ ...@@ -1073,6 +1090,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,
}, },
{ {
name: "background-image", name: "background-image",
...@@ -1087,6 +1105,7 @@ ...@@ -1087,6 +1105,7 @@
fill_type_getter: "GetImage", fill_type_getter: "GetImage",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-origin", name: "background-origin",
...@@ -1099,6 +1118,7 @@ ...@@ -1099,6 +1118,7 @@
fill_type: "Origin", fill_type: "Origin",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-position-x", name: "background-position-x",
...@@ -1109,6 +1129,7 @@ ...@@ -1109,6 +1129,7 @@
fill_type: "PositionX", fill_type: "PositionX",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-position-y", name: "background-position-y",
...@@ -1119,6 +1140,7 @@ ...@@ -1119,6 +1140,7 @@
fill_type: "PositionY", fill_type: "PositionY",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-repeat-x", name: "background-repeat-x",
...@@ -1127,6 +1149,7 @@ ...@@ -1127,6 +1149,7 @@
fill_type: "RepeatX", fill_type: "RepeatX",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-repeat-y", name: "background-repeat-y",
...@@ -1135,6 +1158,7 @@ ...@@ -1135,6 +1158,7 @@
fill_type: "RepeatY", fill_type: "RepeatY",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "background-size", name: "background-size",
...@@ -1148,6 +1172,7 @@ ...@@ -1148,6 +1172,7 @@
fill_type: "Size", fill_type: "Size",
}, },
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "baseline-shift", name: "baseline-shift",
...@@ -2229,6 +2254,7 @@ ...@@ -2229,6 +2254,7 @@
keywords: ["normal"], keywords: ["normal"],
typedom_types: ["Keyword", "Length", "Number", "Percentage"], typedom_types: ["Keyword", "Length", "Number", "Percentage"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "line-height-step", name: "line-height-step",
...@@ -2567,6 +2593,7 @@ ...@@ -2567,6 +2593,7 @@
computed_style_custom_functions: ["setter"], computed_style_custom_functions: ["setter"],
typedom_types: ["Number"], typedom_types: ["Number"],
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "order", name: "order",
...@@ -2606,6 +2633,7 @@ ...@@ -2606,6 +2633,7 @@
converter: "ConvertStyleColor", converter: "ConvertStyleColor",
style_builder_template: "color", style_builder_template: "color",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_cue: true,
}, },
{ {
name: "outline-offset", name: "outline-offset",
...@@ -2618,6 +2646,7 @@ ...@@ -2618,6 +2646,7 @@
computed_style_custom_functions: ["getter"], computed_style_custom_functions: ["getter"],
converter: "ConvertComputedLength<int>", converter: "ConvertComputedLength<int>",
typedom_types: ["Length"], typedom_types: ["Length"],
valid_for_cue: true,
}, },
{ {
name: "outline-style", name: "outline-style",
...@@ -2632,6 +2661,7 @@ ...@@ -2632,6 +2661,7 @@
default_value: "none", default_value: "none",
type_name: "EBorderStyle", type_name: "EBorderStyle",
style_builder_custom_functions: ["initial", "inherit", "value"], style_builder_custom_functions: ["initial", "inherit", "value"],
valid_for_cue: true,
}, },
{ {
name: "outline-width", name: "outline-width",
...@@ -2646,6 +2676,7 @@ ...@@ -2646,6 +2676,7 @@
converter: "ConvertLineWidth<unsigned short>", converter: "ConvertLineWidth<unsigned short>",
keywords: ["thin", "medium", "thick"], keywords: ["thin", "medium", "thick"],
typedom_types: ["Keyword", "Length"], typedom_types: ["Keyword", "Length"],
valid_for_cue: true,
}, },
{ {
name: "overflow-anchor", name: "overflow-anchor",
...@@ -3411,6 +3442,7 @@ ...@@ -3411,6 +3442,7 @@
style_builder_template: "color", style_builder_template: "color",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "text-decoration-line", name: "text-decoration-line",
...@@ -3424,6 +3456,7 @@ ...@@ -3424,6 +3456,7 @@
type_name: "TextDecoration", type_name: "TextDecoration",
converter: "ConvertFlags<TextDecoration>", converter: "ConvertFlags<TextDecoration>",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "text-decoration-skip-ink", name: "text-decoration-skip-ink",
...@@ -3435,6 +3468,7 @@ ...@@ -3435,6 +3468,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "auto", default_value: "auto",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "text-decoration-style", name: "text-decoration-style",
...@@ -3445,6 +3479,7 @@ ...@@ -3445,6 +3479,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "solid", default_value: "solid",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "text-indent", name: "text-indent",
...@@ -3497,6 +3532,7 @@ ...@@ -3497,6 +3532,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "text-size-adjust", name: "text-size-adjust",
...@@ -3695,6 +3731,7 @@ ...@@ -3695,6 +3731,7 @@
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "visible", default_value: "visible",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "x", name: "x",
...@@ -4302,6 +4339,7 @@ ...@@ -4302,6 +4339,7 @@
], ],
typedom_types: ["Keyword"], typedom_types: ["Keyword"],
default_value: "normal", default_value: "normal",
valid_for_cue: true,
}, },
{ {
name: "widows", name: "widows",
...@@ -5430,6 +5468,7 @@ ...@@ -5430,6 +5468,7 @@
priority: "High", priority: "High",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-visited-caret-color", name: "-internal-visited-caret-color",
...@@ -5479,6 +5518,7 @@ ...@@ -5479,6 +5518,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,
}, },
{ {
name: "-internal-visited-border-left-color", name: "-internal-visited-border-left-color",
...@@ -5609,6 +5649,7 @@ ...@@ -5609,6 +5649,7 @@
converter: "ConvertStyleColor", converter: "ConvertStyleColor",
style_builder_template: "visited_color", style_builder_template: "visited_color",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-visited-stroke", name: "-internal-visited-stroke",
...@@ -5636,6 +5677,7 @@ ...@@ -5636,6 +5677,7 @@
style_builder_template: "visited_color", style_builder_template: "visited_color",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-visited-text-emphasis-color", name: "-internal-visited-text-emphasis-color",
...@@ -5712,6 +5754,7 @@ ...@@ -5712,6 +5754,7 @@
}, },
ua_property_for: "background-attachment", ua_property_for: "background-attachment",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-blend-mode", name: "-internal-ua-background-blend-mode",
...@@ -5731,6 +5774,7 @@ ...@@ -5731,6 +5774,7 @@
}, },
ua_property_for: "background-clip", ua_property_for: "background-clip",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-color", name: "-internal-ua-background-color",
...@@ -5743,6 +5787,7 @@ ...@@ -5743,6 +5787,7 @@
ua_property_for: "background-color", ua_property_for: "background-color",
affected_by_forced_colors: true, affected_by_forced_colors: true,
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-image", name: "-internal-ua-background-image",
...@@ -5753,6 +5798,7 @@ ...@@ -5753,6 +5798,7 @@
}, },
ua_property_for: "background-image", ua_property_for: "background-image",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-origin", name: "-internal-ua-background-origin",
...@@ -5762,6 +5808,7 @@ ...@@ -5762,6 +5808,7 @@
}, },
ua_property_for: "background-origin", ua_property_for: "background-origin",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-position-x", name: "-internal-ua-background-position-x",
...@@ -5771,6 +5818,7 @@ ...@@ -5771,6 +5818,7 @@
}, },
ua_property_for: "background-position-x", ua_property_for: "background-position-x",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-position-y", name: "-internal-ua-background-position-y",
...@@ -5780,6 +5828,7 @@ ...@@ -5780,6 +5828,7 @@
}, },
ua_property_for: "background-position-y", ua_property_for: "background-position-y",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-background-size", name: "-internal-ua-background-size",
...@@ -5789,6 +5838,7 @@ ...@@ -5789,6 +5838,7 @@
}, },
ua_property_for: "background-size", ua_property_for: "background-size",
valid_for_first_letter: true, valid_for_first_letter: true,
valid_for_cue: true,
}, },
{ {
name: "-internal-ua-border-bottom-color", name: "-internal-ua-border-bottom-color",
......
...@@ -54,6 +54,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { ...@@ -54,6 +54,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
return flags_ & kIsAffectedByForcedColors; return flags_ & kIsAffectedByForcedColors;
} }
bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; } bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; }
bool IsValidForCue() const { return flags_ & kValidForCue; }
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_; }
...@@ -121,6 +122,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { ...@@ -121,6 +122,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
kAnimation = 1 << 11, kAnimation = 1 << 11,
// https://drafts.csswg.org/css-pseudo-4/#first-letter-styling // https://drafts.csswg.org/css-pseudo-4/#first-letter-styling
kValidForFirstLetter = 1 << 12, kValidForFirstLetter = 1 << 12,
// https://w3c.github.io/webvtt/#the-cue-pseudo-element
kValidForCue = 1 << 13,
}; };
constexpr CSSProperty(CSSPropertyID property_id, constexpr CSSProperty(CSSPropertyID property_id,
......
...@@ -1355,57 +1355,6 @@ void StyleResolver::ApplyAnimatedStandardProperties( ...@@ -1355,57 +1355,6 @@ void StyleResolver::ApplyAnimatedStandardProperties(
} }
} }
static inline bool IsValidCueStyleProperty(CSSPropertyID id) {
switch (id) {
case CSSPropertyID::kBackground:
case CSSPropertyID::kBackgroundAttachment:
case CSSPropertyID::kBackgroundClip:
case CSSPropertyID::kBackgroundColor:
case CSSPropertyID::kBackgroundImage:
case CSSPropertyID::kBackgroundOrigin:
case CSSPropertyID::kBackgroundPosition:
case CSSPropertyID::kBackgroundPositionX:
case CSSPropertyID::kBackgroundPositionY:
case CSSPropertyID::kBackgroundRepeat:
case CSSPropertyID::kBackgroundRepeatX:
case CSSPropertyID::kBackgroundRepeatY:
case CSSPropertyID::kBackgroundSize:
case CSSPropertyID::kColor:
case CSSPropertyID::kFont:
case CSSPropertyID::kFontFamily:
case CSSPropertyID::kFontSize:
case CSSPropertyID::kFontStretch:
case CSSPropertyID::kFontStyle:
case CSSPropertyID::kFontVariant:
case CSSPropertyID::kFontWeight:
case CSSPropertyID::kLineHeight:
case CSSPropertyID::kOpacity:
case CSSPropertyID::kOutline:
case CSSPropertyID::kOutlineColor:
case CSSPropertyID::kOutlineOffset:
case CSSPropertyID::kOutlineStyle:
case CSSPropertyID::kOutlineWidth:
case CSSPropertyID::kVisibility:
case CSSPropertyID::kWhiteSpace:
// FIXME: 'text-decoration' shorthand to be handled when available.
// See https://chromiumcodereview.appspot.com/19516002 for details.
case CSSPropertyID::kTextDecoration:
case CSSPropertyID::kTextShadow:
case CSSPropertyID::kBorderStyle:
return true;
case CSSPropertyID::kTextDecorationLine:
case CSSPropertyID::kTextDecorationStyle:
case CSSPropertyID::kTextDecorationColor:
case CSSPropertyID::kTextDecorationSkipInk:
return true;
case CSSPropertyID::kFontVariationSettings:
return true;
default:
break;
}
return false;
}
static inline bool IsValidMarkerStyleProperty(CSSPropertyID id) { static inline bool IsValidMarkerStyleProperty(CSSPropertyID id) {
switch (id) { switch (id) {
// Valid ::marker properties listed in spec: // Valid ::marker properties listed in spec:
...@@ -1453,7 +1402,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter, ...@@ -1453,7 +1402,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter,
case ValidPropertyFilter::kFirstLetter: case ValidPropertyFilter::kFirstLetter:
return CSSProperty::Get(property).IsValidForFirstLetter(); return CSSProperty::Get(property).IsValidForFirstLetter();
case ValidPropertyFilter::kCue: case ValidPropertyFilter::kCue:
return IsValidCueStyleProperty(property); return CSSProperty::Get(property).IsValidForCue();
case ValidPropertyFilter::kMarker: case ValidPropertyFilter::kMarker:
return IsValidMarkerStyleProperty(property); return IsValidMarkerStyleProperty(property);
} }
......
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