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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format 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/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 26bf17db0c53a9673d98f5d2ddd5fca4eac0f832..2a14122049ae2a4f5cd9e3527334bb9f70a06ecb 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -2436,6 +2436,23 @@ bool CSSPropertyParser::ConsumeBorder(bool important) {
return range_.AtEnd();
}
+bool CSSPropertyParser::Consume2Values(const StylePropertyShorthand& shorthand,
+ bool important) {
+ DCHECK_EQ(shorthand.length(), 2u);
+ const CSSPropertyID* longhands = shorthand.properties();
+ const CSSValue* start = ParseSingleValue(longhands[0], shorthand.id());
+ if (!start)
+ return false;
+
+ const CSSValue* end = ParseSingleValue(longhands[1], shorthand.id());
+ if (!end)
+ end = start;
+ AddProperty(longhands[0], shorthand.id(), *start, important);
+ AddProperty(longhands[1], shorthand.id(), *end, important);
+
+ return range_.AtEnd();
+}
+
bool CSSPropertyParser::Consume4Values(const StylePropertyShorthand& shorthand,
bool important) {
DCHECK_EQ(shorthand.length(), 4u);
@@ -3418,6 +3435,18 @@ bool CSSPropertyParser::ParseShorthand(CSSPropertyID unresolved_property,
return ConsumePlaceItemsShorthand(important);
case CSSPropertyPlaceSelf:
return ConsumePlaceSelfShorthand(important);
+ case CSSPropertyScrollPadding:
+ return Consume4Values(scrollPaddingShorthand(), important);
+ case CSSPropertyScrollPaddingBlock:
+ return Consume2Values(scrollPaddingBlockShorthand(), important);
+ case CSSPropertyScrollPaddingInline:
+ return Consume2Values(scrollPaddingInlineShorthand(), important);
+ case CSSPropertyScrollSnapMargin:
+ return Consume4Values(scrollSnapMarginShorthand(), important);
+ case CSSPropertyScrollSnapMarginBlock:
+ return Consume2Values(scrollSnapMarginBlockShorthand(), important);
+ case CSSPropertyScrollSnapMarginInline:
+ return Consume2Values(scrollSnapMarginInlineShorthand(), important);
default:
return false;
}

Powered by Google App Engine
This is Rietveld 408576698