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

Ribbonize IsValidFirstLetterStyleProperty

BUG=545324

Change-Id: Ic90b7e417accdbf64b110f70db41369e2edec0cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986831Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730116}
parent d8bf4e00
......@@ -54,6 +54,10 @@ def check_property_parameters(property_to_check):
if property_to_check['alias_for']:
assert not property_to_check['is_internal'], \
'Internal aliases is not supported'
if property_to_check['valid_for_first_letter']:
assert not property_to_check['longhands'], \
'Shorthand %s should not be marked as valid_for_first_letter' % \
property_to_check['name']
class CSSProperties(object):
......
......@@ -42,6 +42,7 @@ namespace {{namespace}} {
(property.affected_by_forced_colors and 'kIsAffectedByForcedColors' or ''),
(property.ua and 'kUA' or ''),
(property.is_animation_property and 'kAnimation' or ''),
(property.valid_for_first_letter and 'kValidForFirstLetter' or ''),
] | reject('==', '') | join(' | ') %}
{% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %}
// {{property.name}}
......
......@@ -53,6 +53,7 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
bool IsAffectedByForcedColors() const {
return flags_ & kIsAffectedByForcedColors;
}
bool IsValidForFirstLetter() const { return flags_ & kValidForFirstLetter; }
bool IsRepeated() const { return repetition_separator_ != '\0'; }
char RepetitionSeparator() const { return repetition_separator_; }
......@@ -118,6 +119,8 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
// Animation properties have this flag set. (I.e. longhands of the
// 'animation' and 'transition' shorthands).
kAnimation = 1 << 11,
// https://drafts.csswg.org/css-pseudo-4/#first-letter-styling
kValidForFirstLetter = 1 << 12,
};
constexpr CSSProperty(CSSPropertyID property_id,
......
......@@ -34,9 +34,10 @@ class CORE_EXPORT Variable : public Longhand {
protected:
constexpr Variable(bool inherited)
: Longhand(CSSPropertyID::kVariable,
kProperty | (inherited ? kInherited : 0),
'\0') {}
: Longhand(
CSSPropertyID::kVariable,
kProperty | (inherited ? kInherited : 0) | kValidForFirstLetter,
'\0') {}
};
} // namespace blink
......
......@@ -1406,121 +1406,6 @@ static inline bool IsValidCueStyleProperty(CSSPropertyID id) {
return false;
}
static inline bool IsValidFirstLetterStyleProperty(CSSPropertyID id) {
switch (id) {
// Valid ::first-letter properties listed in spec:
// https://drafts.csswg.org/css-pseudo-4/#first-letter-styling
case CSSPropertyID::kBackgroundAttachment:
case CSSPropertyID::kBackgroundBlendMode:
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::kBorderBlockEnd:
case CSSPropertyID::kBorderBlockEndColor:
case CSSPropertyID::kBorderBlockEndStyle:
case CSSPropertyID::kBorderBlockEndWidth:
case CSSPropertyID::kBorderBlockStart:
case CSSPropertyID::kBorderBlockStartColor:
case CSSPropertyID::kBorderBlockStartStyle:
case CSSPropertyID::kBorderBlockStartWidth:
case CSSPropertyID::kBorderBottomColor:
case CSSPropertyID::kBorderBottomLeftRadius:
case CSSPropertyID::kBorderBottomRightRadius:
case CSSPropertyID::kBorderBottomStyle:
case CSSPropertyID::kBorderBottomWidth:
case CSSPropertyID::kBorderImageOutset:
case CSSPropertyID::kBorderImageRepeat:
case CSSPropertyID::kBorderImageSlice:
case CSSPropertyID::kBorderImageSource:
case CSSPropertyID::kBorderImageWidth:
case CSSPropertyID::kBorderInlineEnd:
case CSSPropertyID::kBorderInlineEndColor:
case CSSPropertyID::kBorderInlineEndStyle:
case CSSPropertyID::kBorderInlineEndWidth:
case CSSPropertyID::kBorderInlineStart:
case CSSPropertyID::kBorderInlineStartColor:
case CSSPropertyID::kBorderInlineStartStyle:
case CSSPropertyID::kBorderInlineStartWidth:
case CSSPropertyID::kBorderLeftColor:
case CSSPropertyID::kBorderLeftStyle:
case CSSPropertyID::kBorderLeftWidth:
case CSSPropertyID::kBorderRightColor:
case CSSPropertyID::kBorderRightStyle:
case CSSPropertyID::kBorderRightWidth:
case CSSPropertyID::kBorderTopColor:
case CSSPropertyID::kBorderTopLeftRadius:
case CSSPropertyID::kBorderTopRightRadius:
case CSSPropertyID::kBorderTopStyle:
case CSSPropertyID::kBorderTopWidth:
case CSSPropertyID::kBoxShadow:
case CSSPropertyID::kColor:
case CSSPropertyID::kFloat:
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::kFontVariantLigatures:
case CSSPropertyID::kFontVariantNumeric:
case CSSPropertyID::kFontVariantEastAsian:
case CSSPropertyID::kFontVariationSettings:
case CSSPropertyID::kFontWeight:
case CSSPropertyID::kLetterSpacing:
case CSSPropertyID::kLineHeight:
case CSSPropertyID::kMarginBlockEnd:
case CSSPropertyID::kMarginBlockStart:
case CSSPropertyID::kMarginBottom:
case CSSPropertyID::kMarginInlineEnd:
case CSSPropertyID::kMarginInlineStart:
case CSSPropertyID::kMarginLeft:
case CSSPropertyID::kMarginRight:
case CSSPropertyID::kMarginTop:
case CSSPropertyID::kOpacity:
case CSSPropertyID::kPaddingBottom:
case CSSPropertyID::kPaddingLeft:
case CSSPropertyID::kPaddingRight:
case CSSPropertyID::kPaddingTop:
case CSSPropertyID::kTextDecorationColor:
case CSSPropertyID::kTextDecorationLine:
case CSSPropertyID::kTextDecorationStyle:
case CSSPropertyID::kTextDecorationSkipInk:
case CSSPropertyID::kTextJustify:
case CSSPropertyID::kTextShadow:
case CSSPropertyID::kTextTransform:
case CSSPropertyID::kTextUnderlinePosition:
case CSSPropertyID::kVerticalAlign:
case CSSPropertyID::kWebkitBorderHorizontalSpacing:
case CSSPropertyID::kWebkitBorderImage:
case CSSPropertyID::kWebkitBorderVerticalSpacing:
case CSSPropertyID::kWebkitFontSmoothing:
case CSSPropertyID::kWordSpacing:
return true;
// Not directly specified in spec, but variables should be supported nearly
// anywhere.
case CSSPropertyID::kVariable:
// Properties that we currently support outside of spec.
case CSSPropertyID::kVisibility:
return true;
default:
return false;
}
}
static inline bool IsValidMarkerStyleProperty(CSSPropertyID id) {
switch (id) {
// Valid ::marker properties listed in spec:
......@@ -1566,7 +1451,7 @@ static bool PassesPropertyFilter(ValidPropertyFilter valid_property_filter,
case ValidPropertyFilter::kNoFilter:
return true;
case ValidPropertyFilter::kFirstLetter:
return IsValidFirstLetterStyleProperty(property);
return CSSProperty::Get(property).IsValidForFirstLetter();
case ValidPropertyFilter::kCue:
return IsValidCueStyleProperty(property);
case ValidPropertyFilter::kMarker:
......
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