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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.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/resolver/StyleBuilderConverter.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index 294d084a8fb4f37708c6436d4941f5eca7aa8f0a..6d2b4c5f8dde64193b9eca2267636a82b88f4a72 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
@@ -1247,6 +1247,37 @@ TransformOrigin StyleBuilderConverter::ConvertTransformOrigin(
StyleBuilderConverter::ConvertComputedLength<float>(state, list.Item(2)));
}
+ScrollSnapType StyleBuilderConverter::ConvertSnapType(StyleResolverState&,
+ const CSSValue& value) {
+ ScrollSnapType snapType = ComputedStyle::InitialScrollSnapType();
+ if (value.IsValuePair()) {
+ const CSSValuePair& pair = ToCSSValuePair(value);
+ snapType.axis = ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAxis>();
+ snapType.strictness =
+ ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapStrictness>();
+ } else {
+ snapType.axis = ToCSSIdentifierValue(value).ConvertTo<SnapAxis>();
+ }
+ return snapType;
+}
+
+ScrollSnapAlign StyleBuilderConverter::ConvertSnapAlign(StyleResolverState&,
+ const CSSValue& value) {
+ ScrollSnapAlign snapAlign = ComputedStyle::InitialScrollSnapAlign();
+ if (value.IsValuePair()) {
+ const CSSValuePair& pair = ToCSSValuePair(value);
+ snapAlign.alignmentX =
+ ToCSSIdentifierValue(pair.First()).ConvertTo<SnapAlignment>();
+ snapAlign.alignmentY =
+ ToCSSIdentifierValue(pair.Second()).ConvertTo<SnapAlignment>();
+ } else {
+ snapAlign.alignmentX =
+ ToCSSIdentifierValue(value).ConvertTo<SnapAlignment>();
+ snapAlign.alignmentY = snapAlign.alignmentX;
+ }
+ return snapAlign;
+}
+
ScrollSnapPoints StyleBuilderConverter::ConvertSnapPoints(
StyleResolverState& state,
const CSSValue& value) {
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698