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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1b1841492a4f2676bad0bad3e347f3a1aee0cf99
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIWillChange.cpp
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/properties/CSSPropertyAPIWillChange.h"
+
+#include "core/css/CSSValueList.h"
+#include "core/css/parser/CSSParserTokenRange.h"
+#include "core/css/parser/CSSPropertyParser.h"
+#include "core/css/parser/CSSPropertyParserHelpers.h"
+
+namespace blink {
+
+const CSSValue* CSSPropertyAPIWillChange::parseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context) {
+ if (range.peek().id() == CSSValueAuto)
+ return CSSPropertyParserHelpers::consumeIdent(range);
+
+ CSSValueList* values = CSSValueList::createCommaSeparated();
+ // Every comma-separated list of identifiers is a valid will-change value,
+ // unless the list includes an explicitly disallowed identifier.
+ while (true) {
+ if (range.peek().type() != IdentToken)
+ return nullptr;
+ CSSPropertyID unresolvedProperty =
+ unresolvedCSSPropertyID(range.peek().value());
+ if (unresolvedProperty != CSSPropertyInvalid &&
+ unresolvedProperty != CSSPropertyVariable) {
+ DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
+ // Now "all" is used by both CSSValue and CSSPropertyValue.
+ // Need to return nullptr when currentValue is CSSPropertyAll.
+ if (unresolvedProperty == CSSPropertyWillChange ||
+ unresolvedProperty == CSSPropertyAll)
+ return nullptr;
+ values->append(*CSSCustomIdentValue::create(unresolvedProperty));
+ range.consumeIncludingWhitespace();
+ } else {
+ switch (range.peek().id()) {
+ case CSSValueNone:
+ case CSSValueAll:
+ case CSSValueAuto:
+ case CSSValueDefault:
+ case CSSValueInitial:
+ case CSSValueInherit:
+ return nullptr;
+ case CSSValueContents:
+ case CSSValueScrollPosition:
+ values->append(*CSSPropertyParserHelpers::consumeIdent(range));
+ break;
+ default:
+ range.consumeIncludingWhitespace();
+ break;
+ }
+ }
+
+ if (range.atEnd())
+ break;
+ if (!CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(range))
+ return nullptr;
+ }
+
+ return values;
+}
+
+} // namespace blink
« 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