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

Unified Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1148873005: Parsing CSS properties for scroll snap points (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix comment Created 5 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
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleBuilderConverter.cpp
diff --git a/Source/core/css/resolver/StyleBuilderConverter.cpp b/Source/core/css/resolver/StyleBuilderConverter.cpp
index 75b3a6c10977c0ee2f40c4b100cec5a181b02f35..ce5f709da7bbfb671930d1f24eb580c82ea40550 100644
--- a/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -649,7 +649,7 @@ static Length convertPositionLength(StyleResolverState& state, CSSPrimitiveValue
return StyleBuilderConverter::convertLength(state, primitiveValue);
}
-LengthPoint StyleBuilderConverter::convertObjectPosition(StyleResolverState& state, CSSValue* value)
+LengthPoint StyleBuilderConverter::convertPosition(StyleResolverState& state, CSSValue* value)
{
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
Pair* pair = primitiveValue->getPairValue();
@@ -901,4 +901,38 @@ TransformOrigin StyleBuilderConverter::convertTransformOrigin(StyleResolverState
);
}
+ScrollSnapPoints StyleBuilderConverter::convertSnapPoints(StyleResolverState& state, CSSValue* value)
+{
+ // Handles: none | repeat(<length>)
+ ScrollSnapPoints points;
+ points.hasRepeat = false;
+
+ if (!value->isFunctionValue())
+ return points;
+
+ CSSFunctionValue* repeatFunction = toCSSFunctionValue(value);
+ ASSERT_WITH_SECURITY_IMPLICATION(repeatFunction->length() == 1);
+ points.repeatOffset = convertLength(state, toCSSPrimitiveValue(repeatFunction->item(0)));
+ points.hasRepeat = true;
+
+ return points;
+}
+
+Vector<LengthPoint> StyleBuilderConverter::convertSnapCoordinates(StyleResolverState& state, CSSValue* value)
+{
+ // Handles: none | <position>#
+ Vector<LengthPoint> coordinates;
+
+ if (!value->isValueList())
+ return coordinates;
+
+ CSSValueList* valueList = toCSSValueList(value);
+ coordinates.reserveInitialCapacity(valueList->length());
+ for (auto& snapCoordinate : *valueList) {
+ coordinates.uncheckedAppend(convertPosition(state, snapCoordinate.get()));
+ }
+
+ return coordinates;
+}
+
} // namespace blink
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.h ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698