diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc index 1da570e0fc8..db6b8898d6d 100644 --- a/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc +++ b/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc @@ -168,9 +168,16 @@ bool CSSPropertyParser::ParseValueStart(CSSPropertyID unresolved_property, return false; } +static inline bool IsExposedInMode(const CSSProperty& property, + CSSParserMode mode) { + return mode == kUASheetMode ? property.IsUAExposed() + : property.IsWebExposed(); +} + template <typename CharacterType> static CSSPropertyID UnresolvedCSSPropertyID(const CharacterType* property_name, - unsigned length) { + unsigned length, + CSSParserMode mode) { if (length == 0) return CSSPropertyID::kInvalid; if (length >= 2 && property_name[0] == '-' && property_name[1] == '-') @@ -192,24 +199,26 @@ static CSSPropertyID UnresolvedCSSPropertyID(const CharacterType* property_name, const Property* hash_table_entry = FindProperty(name, length); if (!hash_table_entry) return CSSPropertyID::kInvalid; - CSSPropertyID property = static_cast<CSSPropertyID>(hash_table_entry->id); - if (!CSSProperty::Get(resolveCSSPropertyID(property)).IsEnabled()) - return CSSPropertyID::kInvalid; - return property; + CSSPropertyID property_id = static_cast<CSSPropertyID>(hash_table_entry->id); + const CSSProperty& property = + CSSProperty::Get(resolveCSSPropertyID(property_id)); + bool exposed = IsExposedInMode(property, mode); + return exposed ? property_id : CSSPropertyID::kInvalid; } CSSPropertyID unresolvedCSSPropertyID(const String& string) { unsigned length = string.length(); + CSSParserMode mode = kHTMLStandardMode; return string.Is8Bit() - ? UnresolvedCSSPropertyID(string.Characters8(), length) - : UnresolvedCSSPropertyID(string.Characters16(), length); + ? UnresolvedCSSPropertyID(string.Characters8(), length, mode) + : UnresolvedCSSPropertyID(string.Characters16(), length, mode); } -CSSPropertyID UnresolvedCSSPropertyID(StringView string) { +CSSPropertyID UnresolvedCSSPropertyID(StringView string, CSSParserMode mode) { unsigned length = string.length(); return string.Is8Bit() - ? UnresolvedCSSPropertyID(string.Characters8(), length) - : UnresolvedCSSPropertyID(string.Characters16(), length); + ? UnresolvedCSSPropertyID(string.Characters8(), length, mode) + : UnresolvedCSSPropertyID(string.Characters16(), length, mode); } template <typename CharacterType> @@ -379,7 +388,8 @@ bool CSSPropertyParser::ParseFontFaceDescriptor( // TODO(meade): This function should eventually take an AtRuleDescriptorID. const AtRuleDescriptorID id = CSSPropertyIDAsAtRuleDescriptor(resolved_property); - DCHECK_NE(id, AtRuleDescriptorID::Invalid); + if (id == AtRuleDescriptorID::Invalid) + return false; CSSValue* parsed_value = AtRuleDescriptorParser::ParseFontFaceDescriptor(id, range_, *context_); if (!parsed_value) |