summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authormajidvp@chromium.org <majidvp@chromium.org>2015-06-05 16:24:00 +0000
committermajidvp@chromium.org <majidvp@chromium.org>2015-06-05 16:24:00 +0000
commitb7e22c800189a7a234b126a91e175eed271f5edc (patch)
tree532f990465b34d3d4a2da4ab4f9f131ad8ef86d2 /third_party
parenta0b1a6239653de9fce75ba1a16502e7a12bed0eb (diff)
downloadchromium_src-b7e22c800189a7a234b126a91e175eed271f5edc.zip
chromium_src-b7e22c800189a7a234b126a91e175eed271f5edc.tar.gz
chromium_src-b7e22c800189a7a234b126a91e175eed271f5edc.tar.bz2
Add CSS properties needed for scroll snap points
The code was partially ported over from webkit implementation but it had to be considerably rewritten to fit blink's CSS parsing. - scroll-snap-type: primitive - scroll-snap-coordinate: <position># - scroll-snap-destination: <position> - scroll-snap-points-x: repeat(<length>) - scroll-snap-points-y: repeat(<length>) Spec link: http://dev.w3.org/csswg/css-snappoints/#property-index BUG=311234 Review URL: https://codereview.chromium.org/1148873005 git-svn-id: svn://svn.chromium.org/blink/trunk@196586 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party')
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-listing-expected.txt5
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-listing-expected.txt5
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing-expected.txt120
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing.html80
-rw-r--r--third_party/WebKit/LayoutTests/svg/css/getComputedStyle-listing-expected.txt5
-rw-r--r--third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt5
-rw-r--r--third_party/WebKit/Source/core/core.gypi2
-rw-r--r--third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp7
-rw-r--r--third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h33
-rw-r--r--third_party/WebKit/Source/core/css/CSSProperties.in9
-rw-r--r--third_party/WebKit/Source/core/css/CSSValueKeywords.in5
-rw-r--r--third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp46
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp4
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp77
-rw-r--r--third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h8
-rw-r--r--third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp36
-rw-r--r--third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h7
-rw-r--r--third_party/WebKit/Source/core/frame/UseCounter.cpp7
-rw-r--r--third_party/WebKit/Source/core/style/ComputedStyle.cpp1
-rw-r--r--third_party/WebKit/Source/core/style/ComputedStyle.h18
-rw-r--r--third_party/WebKit/Source/core/style/ComputedStyleConstants.h6
-rw-r--r--third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp7
-rw-r--r--third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h4
-rw-r--r--third_party/WebKit/Source/core/style/StyleScrollSnapData.cpp71
-rw-r--r--third_party/WebKit/Source/core/style/StyleScrollSnapData.h65
-rw-r--r--third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in1
26 files changed, 623 insertions, 11 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-listing-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-listing-expected.txt
index ac6482c..8901b6f 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-listing-expected.txt
@@ -233,6 +233,11 @@ rx: 0px
ry: 0px
scroll-behavior: auto
scroll-blocks-on: none
+scroll-snap-coordinate: none
+scroll-snap-destination: 0px 0px
+scroll-snap-points-x: none
+scroll-snap-points-y: none
+scroll-snap-type: none
shape-image-threshold: 0
shape-margin: 0px
shape-outside: none
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-listing-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-listing-expected.txt
index da0a7ea..e5bc14f 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-listing-expected.txt
@@ -233,6 +233,11 @@ rx: 0px
ry: 0px
scroll-behavior: auto
scroll-blocks-on: none
+scroll-snap-coordinate: none
+scroll-snap-destination: 0px 0px
+scroll-snap-points-x: none
+scroll-snap-points-y: none
+scroll-snap-type: none
shape-image-threshold: 0
shape-margin: 0px
shape-outside: none
diff --git a/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing-expected.txt b/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing-expected.txt
new file mode 100644
index 0000000..ae9e927
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing-expected.txt
@@ -0,0 +1,120 @@
+Test the parsing and application of the scroll-snap-* properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test case: inherited type
+PASS style.scrollSnapType is "mandatory"
+
+Test case: initial type
+PASS style.scrollSnapType is "none"
+
+Test case: inherited points-x
+PASS style.scrollSnapPointsX is "repeat(20%)"
+
+Test case: initial points-x
+PASS style.scrollSnapPointsX is "none"
+
+Test case: inherited points-y
+PASS style.scrollSnapPointsY is "repeat(20%)"
+
+Test case: initial points-y
+PASS style.scrollSnapPointsY is "none"
+
+Test case: inherited destination
+PASS style.scrollSnapDestination is "20px 20px"
+
+Test case: initial destination
+PASS style.scrollSnapDestination is "0px 0px"
+
+Test case: inherited coordinate
+PASS style.scrollSnapCoordinate is "10px 10px"
+
+Test case: initial coordinate
+PASS style.scrollSnapCoordinate is "none"
+
+Test case: mandatory type
+PASS style.scrollSnapType is "mandatory"
+
+Test case: proximity type
+PASS style.scrollSnapType is "proximity"
+
+Test case: none type
+PASS style.scrollSnapType is "none"
+
+Test case: percentage points repeat along x axis
+PASS style.scrollSnapPointsX is "repeat(100%)"
+
+Test case: pixel points repeat along x axis
+PASS style.scrollSnapPointsX is "repeat(25px)"
+
+Test case: percentage points repeat along y axis
+PASS style.scrollSnapPointsY is "repeat(100%)"
+
+Test case: pixel points repeat along y axis
+PASS style.scrollSnapPointsY is "repeat(25px)"
+
+Test case: calc repeat along y axis
+PASS style.scrollSnapPointsY is "repeat(calc(25px + 1%))"
+
+Test case: pixel/pixel destination
+PASS style.scrollSnapDestination is "10px 50px"
+
+Test case: pixel/percentage destination
+PASS style.scrollSnapDestination is "20px 40%"
+
+Test case: unitless/pixel destination
+PASS style.scrollSnapDestination is "0px 10px"
+
+Test case: percentage/pixel destination
+PASS style.scrollSnapDestination is "0% 0px"
+
+Test case: percentage/percentage destination
+PASS style.scrollSnapDestination is "5% 100%"
+
+Test case: calc/percentage destination
+PASS style.scrollSnapDestination is "calc(20px + 10%) 40%"
+
+Test case: 3 piece percentage destination
+PASS style.scrollSnapDestination is "0% 50%"
+
+Test case: 1 piece destination with implied center
+PASS style.scrollSnapDestination is "50% 0%"
+
+Test case: single pixel coordinate
+PASS style.scrollSnapCoordinate is "50px 100px"
+
+Test case: single percentage coordinate
+PASS style.scrollSnapCoordinate is "50% 100%"
+
+Test case: 3 piece percentage coordinate
+PASS style.scrollSnapCoordinate is "0% 50%"
+
+Test case: 4 piece pixel coordinate
+PASS style.scrollSnapCoordinate is "10px 15px"
+
+Test case: 1 piece coordinate with implied center
+PASS style.scrollSnapCoordinate is "0% 50%"
+
+Test case: multiple pixel coordinates
+PASS style.scrollSnapCoordinate is "50px 100px, 150px 100px, 200px 100px"
+
+Test case: multiple percentage coordinates
+PASS style.scrollSnapCoordinate is "50% 100%, 0% 100%, 200% 100%"
+
+Test case: multiple mixed pixel/percentage/calc coordinates
+PASS style.scrollSnapCoordinate is "calc(100px + 10%) 100%, 150% 50%, 200px calc(10px + 5%)"
+
+Test case: reject invalid position list
+PASS style.scrollSnapCoordinate is "none"
+
+Test case: reject invalid position separator
+PASS style.scrollSnapCoordinate is "none"
+
+Test case: reject invalid position with terminating comma
+PASS style.scrollSnapCoordinate is "none"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing.html b/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing.html
new file mode 100644
index 0000000..5d4f338
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/scroll-snap-parsing.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<style>
+div#container {
+ scroll-snap-type: mandatory;
+ scroll-snap-points-x: repeat(20%);
+ scroll-snap-points-y: repeat(20%);
+ scroll-snap-destination: 20px 20px;
+ scroll-snap-coordinate: 10px 10px;
+}
+</style>
+
+<!-- test initial and inherited values first -->
+<div id="container">
+ <div class="test" property="scroll-snap-type" style="scroll-snap-type: inherit;" expected="mandatory" desc="inherited type" ></div>
+ <div class="test" property="scroll-snap-type" style="scroll-snap-type: initial;" expected="none" desc="initial type" ></div>
+ <div class="test" property="scroll-snap-points-x" style="scroll-snap-points-x: inherit;" expected="repeat(20%)" desc="inherited points-x" ></div>
+ <div class="test" property="scroll-snap-points-x" style="scroll-snap-points-x: initial;" expected="none" desc="initial points-x" ></div>
+ <div class="test" property="scroll-snap-points-y" style="scroll-snap-points-y: inherit;" expected="repeat(20%)" desc="inherited points-y" ></div>
+ <div class="test" property="scroll-snap-points-y" style="scroll-snap-points-y: initial;" expected="none" desc="initial points-y" ></div>
+ <div class="test" property="scroll-snap-destination" style="scroll-snap-destination: inherit;" expected="20px 20px" desc="inherited destination" ></div>
+ <div class="test" property="scroll-snap-destination" style="scroll-snap-destination: initial;" expected="0px 0px" desc="initial destination" ></div>
+ <div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: inherit;" expected="10px 10px" desc="inherited coordinate" ></div>
+ <div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: initial;" expected="none" desc="initial coordinate" ></div>
+</div>
+
+<div class="test" property="scroll-snap-type" style="scroll-snap-type: mandatory;" expected="mandatory" desc="mandatory type" ></div>
+<div class="test" property="scroll-snap-type" style="scroll-snap-type: proximity;" expected="proximity" desc="proximity type" ></div>
+<div class="test" property="scroll-snap-type" style="scroll-snap-type: none;" expected="none" desc="none type" ></div>
+
+<div class="test" property="scroll-snap-points-x" style="scroll-snap-points-x: repeat(100%);" expected="repeat(100%)" desc="percentage points repeat along x axis" ></div>
+<div class="test" property="scroll-snap-points-x" style="scroll-snap-points-x: repeat(25px);" expected="repeat(25px)" desc="pixel points repeat along x axis" ></div>
+<div class="test" property="scroll-snap-points-y" style="scroll-snap-points-y: repeat(100%);" expected="repeat(100%)" desc="percentage points repeat along y axis" ></div>
+<div class="test" property="scroll-snap-points-y" style="scroll-snap-points-y: repeat(25px);" expected="repeat(25px)" desc="pixel points repeat along y axis" ></div>
+<div class="test" property="scroll-snap-points-y" style="scroll-snap-points-y: repeat(calc(25px + 1%));" expected="repeat(calc(25px + 1%))" desc="calc repeat along y axis" ></div>
+
+
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: 10px 50px;" expected="10px 50px" desc="pixel/pixel destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: 20px 40%;" expected="20px 40%" desc="pixel/percentage destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: 0 10px;" expected="0px 10px" desc="unitless/pixel destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: 0% 0px;" expected="0% 0px" desc="percentage/pixel destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: 5% 100%;" expected="5% 100%" desc="percentage/percentage destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: calc(10% + 20px) 40%;" expected="calc(20px + 10%) 40%" desc="calc/percentage destination" ></div>
+
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: left top 50%;" expected="0% 50%" desc="3 piece percentage destination" ></div>
+<div class="test" property="scroll-snap-destination" style="scroll-snap-destination: top;" expected="50% 0%" desc="1 piece destination with implied center" ></div>
+
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50px 100px;" expected="50px 100px" desc="single pixel coordinate" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50% 100%;" expected="50% 100%" desc="single percentage coordinate" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: left top 50%;" expected="0% 50%" desc="3 piece percentage coordinate" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: left 10px top 15px;" expected="10px 15px" desc="4 piece pixel coordinate" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: left;" expected="0% 50%" desc="1 piece coordinate with implied center" ></div>
+
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50px 100px, 150px 100px, left 200px top 100px;" expected="50px 100px, 150px 100px, 200px 100px" desc="multiple pixel coordinates" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50% 100%, left top 100%, 200% 100%;" expected="50% 100%, 0% 100%, 200% 100%" desc="multiple percentage coordinates" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: calc(10% + 100px) 100%, 150%, 200px calc(5% + 10px);" expected="calc(100px + 10%) 100%, 150% 50%, 200px calc(10px + 5%)" desc="multiple mixed pixel/percentage/calc coordinates" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50px 100px, junk;" expected="none" desc="reject invalid position list" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50px 100px / 1px 1px;" expected="none" desc="reject invalid position separator" ></div>
+<div class="test" property="scroll-snap-coordinate" style="scroll-snap-coordinate: 50px 100px,;" expected="none" desc="reject invalid position with terminating comma" ></div>
+
+
+<script>
+description("Test the parsing and application of the scroll-snap-* properties.");
+
+var tests = document.querySelectorAll('.test');
+var style;
+for (var i = 0; i < tests.length; i++) {
+ debug('Test case: ' + tests[i].attributes.desc.value);
+ var property = camelCase(tests[i].attributes.property.value);
+ style = window.getComputedStyle(tests[i]);
+ shouldBeEqualToString('style.' + property, tests[i].attributes.expected.value);
+ debug('');
+}
+
+function camelCase(str) {
+ return str.replace(/-([a-z])/g, function (m, w) {
+ return w.toUpperCase();
+ });
+}
+</script>
diff --git a/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-listing-expected.txt b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-listing-expected.txt
index 7592e44..a724b23 100644
--- a/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-listing-expected.txt
@@ -233,6 +233,11 @@ rx: 0px
ry: 0px
scroll-behavior: auto
scroll-blocks-on: none
+scroll-snap-coordinate: none
+scroll-snap-destination: 0px 0px
+scroll-snap-points-x: none
+scroll-snap-points-y: none
+scroll-snap-type: none
shape-image-threshold: 0
shape-margin: 0px
shape-outside: none
diff --git a/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt b/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt
index 7742a4b..4180946 100644
--- a/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/css-properties-as-js-properties-expected.txt
@@ -210,6 +210,11 @@ rx
ry
scrollBehavior
scrollBlocksOn
+scrollSnapCoordinate
+scrollSnapDestination
+scrollSnapPointsX
+scrollSnapPointsY
+scrollSnapType
setProperty
shapeImageThreshold
shapeMargin
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index 8a9c3b8..3262b55 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -832,6 +832,8 @@
'style/StylePendingImage.h',
'style/StyleRareInheritedData.cpp',
'style/StyleRareNonInheritedData.cpp',
+ 'style/StyleScrollSnapData.cpp',
+ 'style/StyleScrollSnapData.h',
'style/StyleSelfAlignmentData.h',
'style/StyleSurroundData.cpp',
'style/StyleTransformData.cpp',
diff --git a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
index b25d8b9..4bf7c3f 100644
--- a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -329,7 +329,12 @@ static const CSSPropertyID staticComputableProperties[] = {
CSSPropertyY,
CSSPropertyR,
CSSPropertyRx,
- CSSPropertyRy
+ CSSPropertyRy,
+ CSSPropertyScrollSnapType,
+ CSSPropertyScrollSnapPointsX,
+ CSSPropertyScrollSnapPointsY,
+ CSSPropertyScrollSnapCoordinate,
+ CSSPropertyScrollSnapDestination
};
static const Vector<CSSPropertyID>& computableProperties()
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
index f3b1abe..7d72d61 100644
--- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -4719,6 +4719,39 @@ template<> inline CSSPrimitiveValue::operator ScrollBehavior() const
return ScrollBehaviorAuto;
}
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType snapType)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = CSS_VALUE_ID;
+ switch (snapType) {
+ case ScrollSnapTypeNone:
+ m_value.valueID = CSSValueNone;
+ break;
+ case ScrollSnapTypeMandatory:
+ m_value.valueID = CSSValueMandatory;
+ break;
+ case ScrollSnapTypeProximity:
+ m_value.valueID = CSSValueProximity;
+ break;
+ }
+}
+
+template<> inline CSSPrimitiveValue::operator ScrollSnapType() const
+{
+ switch (getValueID()) {
+ case CSSValueNone:
+ return ScrollSnapTypeNone;
+ case CSSValueMandatory:
+ return ScrollSnapTypeMandatory;
+ case CSSValueProximity:
+ return ScrollSnapTypeProximity;
+ default:
+ break;
+ }
+ ASSERT_NOT_REACHED();
+ return ScrollSnapTypeNone;
+}
+
} // namespace blink
#endif
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.in b/third_party/WebKit/Source/core/css/CSSProperties.in
index 964e114..d825fa6 100644
--- a/third_party/WebKit/Source/core/css/CSSProperties.in
+++ b/third_party/WebKit/Source/core/css/CSSProperties.in
@@ -225,7 +225,7 @@ motion-offset runtime_flag=CSSMotionPath, animatable, converter=convertLength
motion-path runtime_flag=CSSMotionPath, custom_all
motion-rotation runtime_flag=CSSMotionPath, animatable, custom_all
object-fit type_name=ObjectFit
-object-position animatable, converter=convertObjectPosition
+object-position animatable, converter=convertPosition
opacity animatable, type_name=float
order type_name=int
orphans animatable, inherited, type_name=short, custom_all
@@ -256,6 +256,11 @@ rx animatable, svg, converter=convertLength
ry animatable, svg, converter=convertLength
scroll-behavior runtime_flag=CSSOMSmoothScroll, type_name=ScrollBehavior
scroll-blocks-on runtime_flag=CSSScrollBlocksOn, converter=convertFlags<WebScrollBlocksOn>
+scroll-snap-type runtime_flag=CSSScrollSnapPoints, type_name=ScrollSnapType
+scroll-snap-points-x runtime_flag=CSSScrollSnapPoints, converter=convertSnapPoints
+scroll-snap-points-y runtime_flag=CSSScrollSnapPoints, converter=convertSnapPoints
+scroll-snap-destination runtime_flag=CSSScrollSnapPoints, converter=convertPosition
+scroll-snap-coordinate runtime_flag=CSSScrollSnapPoints, converter=convertSnapCoordinates
shape-image-threshold animatable, type_name=float
shape-margin animatable, converter=convertLength
shape-outside animatable, converter=convertShapeValue
@@ -534,4 +539,4 @@ transition longhands=transition-property;transition-duration;transition-timing-f
-webkit-transition-delay alias_for=transition-delay
-webkit-transition-duration alias_for=transition-duration
-webkit-transition-property alias_for=transition-property
--webkit-transition-timing-function alias_for=transition-timing-function
+-webkit-transition-timing-function alias_for=transition-timing-function \ No newline at end of file
diff --git a/third_party/WebKit/Source/core/css/CSSValueKeywords.in b/third_party/WebKit/Source/core/css/CSSValueKeywords.in
index a92003b..9b4177c 100644
--- a/third_party/WebKit/Source/core/css/CSSValueKeywords.in
+++ b/third_party/WebKit/Source/core/css/CSSValueKeywords.in
@@ -1075,3 +1075,8 @@ path
calc
-webkit-calc
+
+// scroll-snap-type
+// none
+mandatory
+proximity
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index ea627de..6e7bf24 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -1342,6 +1342,42 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(cons
return list.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const LengthPoint& destination, const ComputedStyle& style)
+{
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ list->append(zoomAdjustedPixelValueForLength(destination.x(), style));
+ list->append(zoomAdjustedPixelValueForLength(destination.y(), style));
+ return list.release();
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSnapPoints& points, const ComputedStyle& style)
+{
+ if (points.hasRepeat) {
+ RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(CSSValueRepeat);
+ repeat->append(zoomAdjustedPixelValueForLength(points.repeatOffset, style));
+ return repeat.release();
+ }
+
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordinates, const ComputedStyle& style)
+{
+ if (coordinates.isEmpty())
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+
+ RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+
+ for (auto& coordinate : coordinates) {
+ auto pair = CSSValueList::createSpaceSeparated();
+ pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style));
+ pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style));
+ list->append(pair);
+ }
+
+ return list.release();
+}
+
PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
{
const SVGComputedStyle& svgStyle = style.svgStyle();
@@ -2592,6 +2628,16 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
return zoomAdjustedPixelValueForLength(svgStyle.rx(), style);
case CSSPropertyRy:
return zoomAdjustedPixelValueForLength(svgStyle.ry(), style);
+ case CSSPropertyScrollSnapType:
+ return cssValuePool().createValue(style.scrollSnapType());
+ case CSSPropertyScrollSnapPointsX:
+ return valueForScrollSnapPoints(style.scrollSnapPointsX(), style);
+ case CSSPropertyScrollSnapPointsY:
+ return valueForScrollSnapPoints(style.scrollSnapPointsY(), style);
+ case CSSPropertyScrollSnapCoordinate:
+ return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style);
+ case CSSPropertyScrollSnapDestination:
+ return valueForScrollSnapDestination(style.scrollSnapDestination(), style);
case CSSPropertyAll:
return nullptr;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
index 396eefe..85143c1 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -357,6 +357,9 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
return valueID == CSSValueNormal || valueID == CSSValuePre || valueID == CSSValuePreWrap || valueID == CSSValuePreLine || valueID == CSSValueNowrap;
case CSSPropertyWordBreak: // normal | break-all | keep-all | break-word (this is a custom extension)
return valueID == CSSValueNormal || valueID == CSSValueBreakAll || valueID == CSSValueKeepAll || valueID == CSSValueBreakWord;
+ case CSSPropertyScrollSnapType: // none | mandatory | proximity
+ ASSERT(RuntimeEnabledFeatures::cssScrollSnapPointsEnabled());
+ return valueID == CSSValueNone || valueID == CSSValueMandatory || valueID == CSSValueProximity;
default:
ASSERT_NOT_REACHED();
return false;
@@ -450,6 +453,7 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
case CSSPropertyWhiteSpace:
case CSSPropertyWordBreak:
case CSSPropertyWordWrap:
+ case CSSPropertyScrollSnapType:
return true;
case CSSPropertyAlignItems:
case CSSPropertyAlignSelf:
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 77a81ee..da0a0ad 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -727,7 +727,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
return result;
}
case CSSPropertyObjectPosition:
- parsedValue = parseObjectPosition();
+ parsedValue = parsePosition(m_valueList);
break;
case CSSPropertyListStyleImage: // <uri> | none | inherit
case CSSPropertyBorderImageSource:
@@ -1495,6 +1495,17 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
validPrimitive = false;
break;
+ case CSSPropertyScrollSnapPointsX:
+ case CSSPropertyScrollSnapPointsY:
+ parsedValue = parseScrollSnapPoints();
+ break;
+ case CSSPropertyScrollSnapCoordinate:
+ parsedValue = parseScrollSnapCoordinate();
+ break;
+ case CSSPropertyScrollSnapDestination:
+ parsedValue = parsePosition(m_valueList);
+ break;
+
default:
return parseSVGValue(propId, important);
}
@@ -2008,6 +2019,44 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *
return true;
}
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapPoints()
+{
+ CSSParserValue* value = m_valueList->current();
+
+ if (value->id == CSSValueNone) {
+ m_valueList->next();
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ }
+
+ if (value->unit == CSSParserValue::Function && value->function->id == CSSValueRepeat) {
+ // The spec defines the following grammar: repeat( <length>)
+ CSSParserValueList* arguments = value->function->args.get();
+ if (!arguments || arguments->size() != 1)
+ return nullptr;
+
+ CSSParserValue* repeatValue = arguments->valueAt(0);
+ if (!validUnit(repeatValue, FNonNeg | FLength | FPercent))
+ return nullptr;
+
+ RefPtrWillBeRawPtr<CSSFunctionValue> result = CSSFunctionValue::create(CSSValueRepeat);
+ result->append(parseValidPrimitive(repeatValue->id, repeatValue));
+ m_valueList->next();
+ return result.release();
+ }
+
+ return nullptr;
+}
+
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate()
+{
+ if (m_valueList->current()->id == CSSValueNone) {
+ m_valueList->next();
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ }
+
+ return parsePositionList(m_valueList);
+}
+
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage()
{
CSSParserValue* value = m_valueList->current();
@@ -5549,16 +5598,37 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseObjectPosition()
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parsePosition(CSSParserValueList* valueList)
{
RefPtrWillBeRawPtr<CSSValue> xValue = nullptr;
RefPtrWillBeRawPtr<CSSValue> yValue = nullptr;
- parseFillPosition(m_valueList, xValue, yValue);
+ parseFillPosition(valueList, xValue, yValue);
if (!xValue || !yValue)
return nullptr;
return createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimitiveValue(yValue.get()), Pair::KeepIdenticalValues);
}
+// Parses a list of comma separated positions. i.e., <position>#
+PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parsePositionList(CSSParserValueList* valueList)
+{
+ RefPtrWillBeRawPtr<CSSValueList> positions = CSSValueList::createCommaSeparated();
+ while (true) {
+ // parsePosition consumes values until it reaches a separator [,/],
+ // an invalid token, or end of the list
+ RefPtrWillBeRawPtr<CSSValue> position = parsePosition(valueList);
+ if (!position)
+ return nullptr;
+ positions->append(position);
+
+ if (!valueList->current())
+ break;
+ if (!consumeComma(valueList) || !valueList->current())
+ return nullptr;
+ }
+
+ return positions.release();
+}
+
class BorderImageParseContext {
STACK_ALLOCATED();
public:
@@ -7150,6 +7220,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseFilter()
return list.release();
}
+
PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseTransformOrigin()
{
CSSParserValue* value = m_valueList->current();
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
index 7609ba1..e484489e 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
@@ -224,7 +224,8 @@ private:
bool parseFlex(CSSParserValueList* args, bool important);
- PassRefPtrWillBeRawPtr<CSSValue> parseObjectPosition();
+ PassRefPtrWillBeRawPtr<CSSValue> parsePosition(CSSParserValueList*);
+ PassRefPtrWillBeRawPtr<CSSValueList> parsePositionList(CSSParserValueList*);
// Image generators
bool parseCanvas(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&);
@@ -361,6 +362,11 @@ private:
void commitBorderImageProperty(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>, bool important);
+ PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPoints();
+ PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapDestination();
+ PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapCoordinate();
+ PassRefPtrWillBeRawPtr<CSSValue> parseScrollSnapPosition();
+
private:
// Inputs:
CSSParserValueList* m_valueList;
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
index 75b3a6c..ce5f709 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp
+++ b/third_party/WebKit/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
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
index d4c9786..e0ca698 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.h
@@ -34,6 +34,7 @@
#include "core/style/QuotesData.h"
#include "core/style/ShadowList.h"
#include "core/style/StyleReflection.h"
+#include "core/style/StyleScrollSnapData.h"
#include "core/style/TransformOrigin.h"
#include "platform/LengthSize.h"
#include "platform/fonts/FontDescription.h"
@@ -73,7 +74,7 @@ public:
static LineBoxContain convertLineBoxContain(StyleResolverState&, CSSValue*);
static Length convertLineHeight(StyleResolverState&, CSSValue*);
static float convertNumberOrPercentage(StyleResolverState&, CSSValue*);
- static LengthPoint convertObjectPosition(StyleResolverState&, CSSValue*);
+ static LengthPoint convertPosition(StyleResolverState&, CSSValue*);
static float convertPerspective(StyleResolverState&, CSSValue*);
static LengthPoint convertPerspectiveOrigin(StyleResolverState&, CSSValue*);
static Length convertQuirkyLength(StyleResolverState&, CSSValue*);
@@ -93,6 +94,10 @@ public:
static bool convertGridTrackList(CSSValue*, Vector<GridTrackSize>&, NamedGridLinesMap&, OrderedNamedGridLines&, StyleResolverState&);
static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap&, NamedGridLinesMap&, GridTrackSizingDirection);
static void convertOrderedNamedGridLinesMapToNamedGridLinesMap(const OrderedNamedGridLines&, NamedGridLinesMap&);
+
+ static ScrollSnapPoints convertSnapPoints(StyleResolverState&, CSSValue*);
+ static Vector<LengthPoint> convertSnapCoordinates(StyleResolverState&, CSSValue*);
+ static LengthPoint convertSnapDestination(StyleResolverState&, CSSValue*);
};
template <typename T>
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp
index 8fb948f..794e524 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
@@ -532,6 +532,11 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id)
case CSSPropertyAliasWebkitShapeImageThreshold: return 496;
case CSSPropertyAliasWebkitShapeMargin: return 497;
case CSSPropertyAliasWebkitShapeOutside: return 498;
+ case CSSPropertyScrollSnapType: return 499;
+ case CSSPropertyScrollSnapPointsX: return 500;
+ case CSSPropertyScrollSnapPointsY: return 501;
+ case CSSPropertyScrollSnapCoordinate: return 502;
+ case CSSPropertyScrollSnapDestination: return 503;
// 1. Add new features above this line (don't change the assigned numbers of the existing
// items).
@@ -548,7 +553,7 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id)
return 0;
}
-static int maximumCSSSampleId() { return 498; }
+static int maximumCSSSampleId() { return 503; }
void UseCounter::muteForInspector()
{
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index c01ddf9..1f89a4f 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -126,6 +126,7 @@ ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag)
rareNonInheritedData.access()->m_filter.init();
rareNonInheritedData.access()->m_grid.init();
rareNonInheritedData.access()->m_gridItem.init();
+ rareNonInheritedData.access()->m_scrollSnap.init();
rareInheritedData.init();
inherited.init();
m_svgStyle.init();
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index 90b28a5..71c1326 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -55,6 +55,7 @@
#include "core/style/StyleRareInheritedData.h"
#include "core/style/StyleRareNonInheritedData.h"
#include "core/style/StyleReflection.h"
+#include "core/style/StyleScrollSnapData.h"
#include "core/style/StyleSelfAlignmentData.h"
#include "core/style/StyleSurroundData.h"
#include "core/style/StyleTransformData.h"
@@ -949,6 +950,12 @@ public:
WebScrollBlocksOn scrollBlocksOn() const { return static_cast<WebScrollBlocksOn>(rareNonInheritedData->m_scrollBlocksOn); }
bool hasScrollBlocksOn() const { return scrollBlocksOn() != WebScrollBlocksOnNone; }
+ ScrollSnapType scrollSnapType() const { return static_cast<ScrollSnapType>(rareNonInheritedData->m_scrollSnapType); }
+ ScrollSnapPoints scrollSnapPointsX() const { return rareNonInheritedData->m_scrollSnap->m_xPoints; }
+ ScrollSnapPoints scrollSnapPointsY() const { return rareNonInheritedData->m_scrollSnap->m_yPoints; }
+ Vector<LengthPoint> scrollSnapCoordinate() const { return rareNonInheritedData->m_scrollSnap->m_coordinates; }
+ LengthPoint scrollSnapDestination() const { return rareNonInheritedData->m_scrollSnap->m_destination; }
+
const Vector<CSSPropertyID>& willChangeProperties() const { return rareNonInheritedData->m_willChange->m_properties; }
bool willChangeContents() const { return rareNonInheritedData->m_willChange->m_contents; }
bool willChangeScrollPosition() const { return rareNonInheritedData->m_willChange->m_scrollPosition; }
@@ -1377,6 +1384,12 @@ public:
void setScrollBehavior(ScrollBehavior b) { SET_VAR(rareNonInheritedData, m_scrollBehavior, b); }
void setScrollBlocksOn(WebScrollBlocksOn b) { SET_VAR(rareNonInheritedData, m_scrollBlocksOn, b); }
+ void setScrollSnapType(ScrollSnapType b) { SET_VAR(rareNonInheritedData, m_scrollSnapType, b); }
+ void setScrollSnapPointsX(const ScrollSnapPoints& b) { SET_VAR(rareNonInheritedData.access()->m_scrollSnap, m_xPoints, b); }
+ void setScrollSnapPointsY(const ScrollSnapPoints& b) { SET_VAR(rareNonInheritedData.access()->m_scrollSnap, m_yPoints, b); }
+ void setScrollSnapDestination(const LengthPoint& b) { SET_VAR(rareNonInheritedData.access()->m_scrollSnap, m_destination, b); }
+ void setScrollSnapCoordinate(const Vector<LengthPoint>& b) { SET_VAR(rareNonInheritedData.access()->m_scrollSnap, m_coordinates, b); }
+
void setWillChangeProperties(const Vector<CSSPropertyID>& properties) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_properties, properties); }
void setWillChangeContents(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_contents, b); }
void setWillChangeScrollPosition(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_scrollPosition, b); }
@@ -1654,6 +1667,11 @@ public:
static ShadowList* initialTextShadow() { return 0; }
static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorAuto; }
static WebScrollBlocksOn initialScrollBlocksOn() { return WebScrollBlocksOnNone; }
+ static ScrollSnapType initialScrollSnapType() { return ScrollSnapTypeNone; }
+ static ScrollSnapPoints initialScrollSnapPointsX() { return ScrollSnapPoints(); }
+ static ScrollSnapPoints initialScrollSnapPointsY() { return ScrollSnapPoints(); }
+ static LengthPoint initialScrollSnapDestination() { return LengthPoint(Length(0, Fixed), Length(0, Fixed)); }
+ static Vector<LengthPoint> initialScrollSnapCoordinate() { return Vector<LengthPoint>(); }
// The initial value is 'none' for grid tracks.
static Vector<GridTrackSize> initialGridTemplateColumns() { return Vector<GridTrackSize>(); }
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
index d3c9cf1..517eb6e 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
@@ -561,6 +561,12 @@ enum TextIndentType { TextIndentNormal, TextIndentHanging };
enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox };
+enum ScrollSnapType {
+ ScrollSnapTypeNone,
+ ScrollSnapTypeMandatory,
+ ScrollSnapTypeProximity
+};
+
} // namespace blink
#endif // ComputedStyleConstants_h
diff --git a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp
index bd64a75..384660f1 100644
--- a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp
+++ b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.cpp
@@ -41,7 +41,7 @@ public:
LineClampValue lineClamps;
DraggableRegionMode draggableRegions;
- void* dataRefs[8];
+ void* dataRefs[9];
void* ownPtrs[4];
void* refPtrs[4];
@@ -114,6 +114,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_isolation(ComputedStyle::initialIsolation())
, m_scrollBehavior(ComputedStyle::initialScrollBehavior())
, m_scrollBlocksOn(ComputedStyle::initialScrollBlocksOn())
+ , m_scrollSnapType(ComputedStyle::initialScrollSnapType())
, m_requiresAcceleratedCompositingForExternalReasons(false)
, m_hasInlineTransform(false)
, m_resize(ComputedStyle::initialResize())
@@ -140,6 +141,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_filter(o.m_filter)
, m_grid(o.m_grid)
, m_gridItem(o.m_gridItem)
+ , m_scrollSnap(o.m_scrollSnap)
, m_content(o.m_content ? o.m_content->clone() : nullptr)
, m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr)
, m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) : nullptr)
@@ -190,6 +192,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_isolation(o.m_isolation)
, m_scrollBehavior(o.m_scrollBehavior)
, m_scrollBlocksOn(o.m_scrollBlocksOn)
+ , m_scrollSnapType(o.m_scrollSnapType)
, m_requiresAcceleratedCompositingForExternalReasons(o.m_requiresAcceleratedCompositingForExternalReasons)
, m_hasInlineTransform(o.m_hasInlineTransform)
, m_resize(o.m_resize)
@@ -222,6 +225,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_filter == o.m_filter
&& m_grid == o.m_grid
&& m_gridItem == o.m_gridItem
+ && m_scrollSnap == o.m_scrollSnap
&& contentDataEquivalent(o)
&& counterDataEquivalent(o)
&& shadowDataEquivalent(o)
@@ -270,6 +274,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_isolation == o.m_isolation
&& m_scrollBehavior == o.m_scrollBehavior
&& m_scrollBlocksOn == o.m_scrollBlocksOn
+ && m_scrollBlocksOn == o.m_scrollSnapType
&& m_requiresAcceleratedCompositingForExternalReasons == o.m_requiresAcceleratedCompositingForExternalReasons
&& m_hasInlineTransform == o.m_hasInlineTransform
&& m_resize == o.m_resize
diff --git a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h
index afff968..c6c70a7 100644
--- a/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h
+++ b/third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h
@@ -38,6 +38,7 @@
#include "core/style/NinePieceImage.h"
#include "core/style/ShapeValue.h"
#include "core/style/StyleContentAlignmentData.h"
+#include "core/style/StyleScrollSnapData.h"
#include "core/style/StyleSelfAlignmentData.h"
#include "platform/LengthPoint.h"
#include "wtf/OwnPtr.h"
@@ -117,6 +118,7 @@ public:
DataRef<StyleGridData> m_grid;
DataRef<StyleGridItemData> m_gridItem;
+ DataRef<StyleScrollSnapData> m_scrollSnap;
OwnPtr<ContentData> m_content;
OwnPtr<CounterDirectiveMap> m_counterDirectives;
@@ -190,6 +192,8 @@ public:
unsigned m_scrollBlocksOn: 3; // WebScrollBlocksOn
+ unsigned m_scrollSnapType: 2; // ScrollSnapType
+
// Plugins require accelerated compositing for reasons external to blink.
// In which case, we need to update the ComputedStyle on the LayoutEmbeddedObject,
// so store this bit so that the style actually changes when the plugin
diff --git a/third_party/WebKit/Source/core/style/StyleScrollSnapData.cpp b/third_party/WebKit/Source/core/style/StyleScrollSnapData.cpp
new file mode 100644
index 0000000..e422e92
--- /dev/null
+++ b/third_party/WebKit/Source/core/style/StyleScrollSnapData.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StyleScrollSnapData.h"
+
+#include "core/style/ComputedStyle.h"
+
+namespace blink {
+
+ScrollSnapPoints::ScrollSnapPoints()
+ : repeatOffset(100, Percent)
+ , hasRepeat(false)
+ , usesElements(false)
+{
+}
+
+bool operator==(const ScrollSnapPoints& a, const ScrollSnapPoints& b)
+{
+ return a.repeatOffset == b.repeatOffset
+ && a.hasRepeat == b.hasRepeat
+ && a.usesElements == b.usesElements;
+}
+
+StyleScrollSnapData::StyleScrollSnapData()
+ : m_xPoints(ComputedStyle::initialScrollSnapPointsX())
+ , m_yPoints(ComputedStyle::initialScrollSnapPointsY())
+ , m_destination(ComputedStyle::initialScrollSnapDestination())
+ , m_coordinates(ComputedStyle::initialScrollSnapCoordinate())
+{
+}
+
+StyleScrollSnapData::StyleScrollSnapData(const StyleScrollSnapData& other)
+ : m_xPoints(other.m_xPoints)
+ , m_yPoints(other.m_yPoints)
+ , m_destination(other.m_destination)
+ , m_coordinates(other.m_coordinates)
+{
+}
+
+bool operator==(const StyleScrollSnapData& a, const StyleScrollSnapData& b)
+{
+ return a.m_xPoints == b.m_xPoints
+ && a.m_yPoints == b.m_yPoints
+ && a.m_destination == b.m_destination
+ && a.m_coordinates == b.m_coordinates;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/style/StyleScrollSnapData.h b/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
new file mode 100644
index 0000000..90c74b5
--- /dev/null
+++ b/third_party/WebKit/Source/core/style/StyleScrollSnapData.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StyleScrollSnapData_h
+#define StyleScrollSnapData_h
+
+#include "platform/LengthPoint.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+struct ScrollSnapPoints {
+ Length repeatOffset;
+ bool hasRepeat;
+ bool usesElements;
+ ScrollSnapPoints();
+};
+
+bool operator==(const ScrollSnapPoints&, const ScrollSnapPoints&);
+inline bool operator!=(const ScrollSnapPoints& a, const ScrollSnapPoints& b) { return !(a == b); }
+
+class StyleScrollSnapData : public RefCounted<StyleScrollSnapData> {
+public:
+ static PassRefPtr<StyleScrollSnapData> create() { return adoptRef(new StyleScrollSnapData); }
+ PassRefPtr<StyleScrollSnapData> copy() { return adoptRef(new StyleScrollSnapData(*this)); }
+
+ ScrollSnapPoints m_xPoints;
+ ScrollSnapPoints m_yPoints;
+ LengthPoint m_destination;
+ Vector<LengthPoint> m_coordinates;
+
+private:
+ StyleScrollSnapData();
+ StyleScrollSnapData(const StyleScrollSnapData&);
+};
+
+bool operator==(const StyleScrollSnapData&, const StyleScrollSnapData&);
+inline bool operator!=(const StyleScrollSnapData& a, const StyleScrollSnapData& b) { return !(a == b); }
+
+} // namespace blink
+
+#endif // StyleScrollSnapData_h
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
index 06daf9a..c9ddfc6 100644
--- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
+++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
@@ -48,6 +48,7 @@ CSSOMSmoothScroll status=experimental
CSSScrollBlocksOn status=experimental
CSSTouchActionPanDirections status=experimental
CSSViewport status=experimental
+CSSScrollSnapPoints status=test
// getPropertyCSSValue, CSSValue, etc. will be removed once layout tests no longer depend on them. crbug.com/331608
CustomSchemeHandler depends_on=NavigatorContentUtils, status=experimental
Database status=stable