summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-31 15:50:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:35:23 +0000
commit7b2ffa587235a47d4094787d72f38102089f402a (patch)
tree30e82af9cbab08a7fa028bb18f4f2987a3f74dfa /chromium/third_party/blink/renderer/core/css/parser/css_property_parser.cc
parentd94af01c90575348c4e81a418257f254b6f8d225 (diff)
downloadqtwebengine-chromium-7b2ffa587235a47d4094787d72f38102089f402a.tar.gz
BASELINE: Update Chromium to 76.0.3809.94
Change-Id: I321c3f5f929c105aec0f98c5091ef6108822e647 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
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.cc42
1 files changed, 31 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 e62c3348ec2..1da570e0fc8 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
@@ -27,6 +27,31 @@ using namespace css_property_parser_helpers;
class CSSIdentifierValue;
+namespace {
+
+const CSSValue* MaybeConsumeCSSWideKeyword(CSSParserTokenRange& range) {
+ CSSParserTokenRange local_range = range;
+
+ CSSValueID id = local_range.ConsumeIncludingWhitespace().Id();
+ if (!local_range.AtEnd())
+ return nullptr;
+
+ const CSSValue* value = nullptr;
+ if (id == CSSValueID::kInitial)
+ value = CSSInitialValue::Create();
+ if (id == CSSValueID::kInherit)
+ value = CSSInheritedValue::Create();
+ if (id == CSSValueID::kUnset)
+ value = cssvalue::CSSUnsetValue::Create();
+
+ if (value)
+ range = local_range;
+
+ return value;
+}
+
+} // namespace
+
CSSPropertyParser::CSSPropertyParser(
const CSSParserTokenRange& range,
const CSSParserContext* context,
@@ -74,6 +99,10 @@ const CSSValue* CSSPropertyParser::ParseSingleValue(
const CSSParserContext* context) {
DCHECK(context);
CSSPropertyParser parser(range, context, nullptr);
+
+ if (const CSSValue* value = MaybeConsumeCSSWideKeyword(parser.range_))
+ return value;
+
const CSSValue* value = ParseLonghand(property, CSSPropertyID::kInvalid,
*parser.context_, parser.range_);
if (!value || !parser.range_.AtEnd())
@@ -215,18 +244,9 @@ CSSValueID CssValueKeywordID(StringView string) {
bool CSSPropertyParser::ConsumeCSSWideKeyword(CSSPropertyID unresolved_property,
bool important) {
CSSParserTokenRange range_copy = range_;
- CSSValueID id = range_copy.ConsumeIncludingWhitespace().Id();
- if (!range_copy.AtEnd())
- return false;
- CSSValue* value = nullptr;
- if (id == CSSValueID::kInitial)
- value = CSSInitialValue::Create();
- else if (id == CSSValueID::kInherit)
- value = CSSInheritedValue::Create();
- else if (id == CSSValueID::kUnset)
- value = cssvalue::CSSUnsetValue::Create();
- else
+ const CSSValue* value = MaybeConsumeCSSWideKeyword(range_copy);
+ if (!value)
return false;
CSSPropertyID property = resolveCSSPropertyID(unresolved_property);