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):
assert not property_to_check['longhands'], \
'Shorthand %s should not be marked as valid_for_first_letter' % \
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):
......
......@@ -43,6 +43,7 @@ namespace {{namespace}} {
(property.ua and 'kUA' or ''),
(property.is_animation_property and 'kAnimation' or ''),
(property.valid_for_first_letter and 'kValidForFirstLetter' or ''),
(property.valid_for_cue and 'kValidForCue' or ''),
] | reject('==', '') | join(' | ') %}
{% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %}
// {{property.name}}
......
......@@ -450,6 +450,14 @@
default: false,
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
......@@ -645,6 +653,7 @@
typedom_types: ["Keyword"],
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "direction",
......@@ -671,6 +680,7 @@
converter: "ConvertFontFamily",
priority: "High",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "font-kerning",
......@@ -709,6 +719,7 @@
keywords: ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large", "larger", "smaller", "-webkit-xxx-large"],
typedom_types: ["Keyword", "Length", "Percentage"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "font-size-adjust",
......@@ -739,6 +750,7 @@
],
typedom_types: ["Keyword", "Percentage"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "font-style",
......@@ -752,6 +764,7 @@
keywords: ["normal", "italic", "oblique"],
typedom_types: ["Keyword"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "font-variant-ligatures",
......@@ -830,6 +843,7 @@
keywords: ["normal", "bold", "bolder", "lighter"],
typedom_types: ["Keyword", "Number"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "font-feature-settings",
......@@ -856,6 +870,7 @@
keywords: ["normal"],
typedom_types: ["Keyword"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-webkit-font-smoothing",
......@@ -1024,6 +1039,7 @@
fill_type: "Attachment",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-blend-mode",
......@@ -1053,6 +1069,7 @@
fill_type: "Clip",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-color",
......@@ -1073,6 +1090,7 @@
},
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-image",
......@@ -1087,6 +1105,7 @@
fill_type_getter: "GetImage",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-origin",
......@@ -1099,6 +1118,7 @@
fill_type: "Origin",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-position-x",
......@@ -1109,6 +1129,7 @@
fill_type: "PositionX",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-position-y",
......@@ -1119,6 +1140,7 @@
fill_type: "PositionY",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-repeat-x",
......@@ -1127,6 +1149,7 @@
fill_type: "RepeatX",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-repeat-y",
......@@ -1135,6 +1158,7 @@
fill_type: "RepeatY",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "background-size",
......@@ -1148,6 +1172,7 @@
fill_type: "Size",
},
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "baseline-shift",
......@@ -2229,6 +2254,7 @@
keywords: ["normal"],
typedom_types: ["Keyword", "Length", "Number", "Percentage"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "line-height-step",
......@@ -2567,6 +2593,7 @@
computed_style_custom_functions: ["setter"],
typedom_types: ["Number"],
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "order",
......@@ -2606,6 +2633,7 @@
converter: "ConvertStyleColor",
style_builder_template: "color",
affected_by_forced_colors: true,
valid_for_cue: true,
},
{
name: "outline-offset",
......@@ -2618,6 +2646,7 @@
computed_style_custom_functions: ["getter"],
converter: "ConvertComputedLength<int>",
typedom_types: ["Length"],
valid_for_cue: true,
},
{
name: "outline-style",
......@@ -2632,6 +2661,7 @@
default_value: "none",
type_name: "EBorderStyle",
style_builder_custom_functions: ["initial", "inherit", "value"],
valid_for_cue: true,
},
{
name: "outline-width",
......@@ -2646,6 +2676,7 @@
converter: "ConvertLineWidth<unsigned short>",
keywords: ["thin", "medium", "thick"],
typedom_types: ["Keyword", "Length"],
valid_for_cue: true,
},
{
name: "overflow-anchor",
......@@ -3411,6 +3442,7 @@
style_builder_template: "color",
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "text-decoration-line",
......@@ -3424,6 +3456,7 @@
type_name: "TextDecoration",
converter: "ConvertFlags<TextDecoration>",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "text-decoration-skip-ink",
......@@ -3435,6 +3468,7 @@
typedom_types: ["Keyword"],
default_value: "auto",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "text-decoration-style",
......@@ -3445,6 +3479,7 @@
typedom_types: ["Keyword"],
default_value: "solid",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "text-indent",
......@@ -3497,6 +3532,7 @@
typedom_types: ["Keyword"],
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "text-size-adjust",
......@@ -3695,6 +3731,7 @@
typedom_types: ["Keyword"],
default_value: "visible",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "x",
......@@ -4302,6 +4339,7 @@
],
typedom_types: ["Keyword"],
default_value: "normal",
valid_for_cue: true,
},
{
name: "widows",
......@@ -5430,6 +5468,7 @@
priority: "High",
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-visited-caret-color",
......@@ -5479,6 +5518,7 @@
},
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-visited-border-left-color",
......@@ -5609,6 +5649,7 @@
converter: "ConvertStyleColor",
style_builder_template: "visited_color",
affected_by_forced_colors: true,
valid_for_cue: true,
},
{
name: "-internal-visited-stroke",
......@@ -5636,6 +5677,7 @@
style_builder_template: "visited_color",
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-visited-text-emphasis-color",
......@@ -5712,6 +5754,7 @@
},
ua_property_for: "background-attachment",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-blend-mode",
......@@ -5731,6 +5774,7 @@
},
ua_property_for: "background-clip",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-color",
......@@ -5743,6 +5787,7 @@
ua_property_for: "background-color",
affected_by_forced_colors: true,
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-image",
......@@ -5753,6 +5798,7 @@
},
ua_property_for: "background-image",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-origin",
......@@ -5762,6 +5808,7 @@
},
ua_property_for: "background-origin",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-position-x",
......@@ -5771,6 +5818,7 @@
},
ua_property_for: "background-position-x",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-position-y",
......@@ -5780,6 +5828,7 @@
},
ua_property_for: "background-position-y",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-background-size",
......@@ -5789,6 +5838,7 @@
},
ua_property_for: "background-size",
valid_for_first_letter: true,
valid_for_cue: true,
},
{
name: "-internal-ua-border-bottom-color",
......
......@@ -54,6 +54,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
return flags_ & kIsAffectedByForcedColors;
}
bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; }
bool IsValidForCue() const { return flags_ & kValidForCue; }
bool IsRepeated() const { return repetition_separator_ != '\0'; }
char RepetitionSeparator() const { return repetition_separator_; }
......@@ -121,6 +122,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
kAnimation = 1 << 11,
// https://drafts.csswg.org/css-pseudo-4/#first-letter-styling
kValidForFirstLetter = 1 << 12,
// https://w3c.github.io/webvtt/#the-cue-pseudo-element
kValidForCue = 1 << 13,
};
constexpr CSSProperty(CSSPropertyID property_id,
......
......@@ -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) {
switch (id) {
// Valid ::marker properties listed in spec:
......@@ -1453,7 +1402,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter,
case ValidPropertyFilter::kFirstLetter:
return CSSProperty::Get(property).IsValidForFirstLetter();
case ValidPropertyFilter::kCue:
return IsValidCueStyleProperty(property);
return CSSProperty::Get(property).IsValidForCue();
case ValidPropertyFilter::kMarker:
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