Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp

Issue 2550313003: Made CSSPropertyAPIWillChange which implements API for will-change (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/css/properties/CSSPropertyAPIWillChange.h"
6
7 #include "core/css/CSSValueList.h"
8 #include "core/css/parser/CSSParserTokenRange.h"
9 #include "core/css/parser/CSSPropertyParser.h"
10 #include "core/css/parser/CSSPropertyParserHelpers.h"
11
12 namespace blink {
13
14 const CSSValue* CSSPropertyAPIWillChange::parseSingleValue(
15 CSSParserTokenRange& range,
16 const CSSParserContext& context) {
17 if (range.peek().id() == CSSValueAuto)
18 return CSSPropertyParserHelpers::consumeIdent(range);
19
20 CSSValueList* values = CSSValueList::createCommaSeparated();
21 // Every comma-separated list of identifiers is a valid will-change value,
22 // unless the list includes an explicitly disallowed identifier.
23 while (true) {
24 if (range.peek().type() != IdentToken)
25 return nullptr;
26 CSSPropertyID unresolvedProperty =
27 unresolvedCSSPropertyID(range.peek().value());
28 if (unresolvedProperty != CSSPropertyInvalid &&
29 unresolvedProperty != CSSPropertyVariable) {
30 DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
31 // Now "all" is used by both CSSValue and CSSPropertyValue.
32 // Need to return nullptr when currentValue is CSSPropertyAll.
33 if (unresolvedProperty == CSSPropertyWillChange ||
34 unresolvedProperty == CSSPropertyAll)
35 return nullptr;
36 values->append(*CSSCustomIdentValue::create(unresolvedProperty));
37 range.consumeIncludingWhitespace();
38 } else {
39 switch (range.peek().id()) {
40 case CSSValueNone:
41 case CSSValueAll:
42 case CSSValueAuto:
43 case CSSValueDefault:
44 case CSSValueInitial:
45 case CSSValueInherit:
46 return nullptr;
47 case CSSValueContents:
48 case CSSValueScrollPosition:
49 values->append(*CSSPropertyParserHelpers::consumeIdent(range));
50 break;
51 default:
52 range.consumeIncludingWhitespace();
53 break;
54 }
55 }
56
57 if (range.atEnd())
58 break;
59 if (!CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(range))
60 return nullptr;
61 }
62
63 return values;
64 }
65
66 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698