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

Unified Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp

Issue 2932593004: Update the snap points css properties (Closed)
Patch Set: Fix nits Created 3 years, 6 months 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
Index: third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fa30bb9f36671d573add83fe5b2160b87ef8c6dd
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIScrollSnapType.cpp
@@ -0,0 +1,34 @@
+// Copyright 2017 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/CSSPropertyAPIScrollSnapType.h"
+
+#include "core/css/CSSValuePair.h"
+#include "core/css/parser/CSSPropertyParserHelpers.h"
+
+namespace blink {
+
+const CSSValue* CSSPropertyAPIScrollSnapType::parseSingleValue(
+ CSSParserTokenRange& range,
+ const CSSParserContext& context,
+ const CSSParserLocalContext&) {
+ CSSValueID axis_id = range.Peek().Id();
+ if (axis_id != CSSValueNone && axis_id != CSSValueX && axis_id != CSSValueY &&
+ axis_id != CSSValueBlock && axis_id != CSSValueInline &&
+ axis_id != CSSValueBoth)
+ return nullptr;
+ CSSValue* axis_value = CSSPropertyParserHelpers::ConsumeIdent(range);
+ if (range.AtEnd() || axis_id == CSSValueNone)
+ return axis_value;
+
+ CSSValueID strictness_id = range.Peek().Id();
+ if (strictness_id != CSSValueProximity && strictness_id != CSSValueMandatory)
+ return axis_value;
+ CSSValue* strictness_value = CSSPropertyParserHelpers::ConsumeIdent(range);
+ CSSValuePair* pair = CSSValuePair::Create(axis_value, strictness_value,
+ CSSValuePair::kDropIdenticalValues);
+ return pair;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698