Title: [181189] trunk
Revision
181189
Author
bfulg...@apple.com
Date
2015-03-06 15:39:57 -0800 (Fri, 06 Mar 2015)

Log Message

Add 'initial' keyword support for scroll snap CSS properties
https://bugs.webkit.org/show_bug.cgi?id=136345
<rdar://problem/18162325>

Reviewed by Dean Jackson.

Source/WebCore:

Tested by css3/scroll-snap/scroll-snap-initial.html

The existing implementation already had 'initial' keyword support, but did not fully follow
the CSS specification. In particular, the 'initial' state for the scroll-snap-points-x and
scroll-snap-points-y properties was not handled correctly.

Revise implementation to represent ScrollSnapPoints as a pointer, so that 'none' is a valid
state.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::scrollSnapPoints): If 'points' is null, return CSSValueNone.
* css/CSSPropertyNames.in: Provide custom initial/inherit handles for snap point x/y sets.
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertScrollSnapPoints): Update to represent ScrollSnapPoints
as a pointer.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX): Provide custom pointer-based
implementation for ScrollSnapPoints.
(WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX): Ditto.
(WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY): Ditto.
(WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY): Ditto."
* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::updateFromStyle): Handle ScrollSnapPoints as pointers.
(WebCore::updateSnapOffsetsForScrollableArea): Ditto.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::scrollSnapPointsX): Update to use pointer-based representation of ScrollSnapPoints.
(WebCore::RenderStyle::scrollSnapPointsY): Ditto.
(WebCore::RenderStyle::setScrollSnapPointsX): Ditto.
(WebCore::RenderStyle::setScrollSnapPointsY): Ditto.
(WebCore::RenderStyle::initialScrollSnapPointsX): Deleted.
(WebCore::RenderStyle::initialScrollSnapPointsY): Deleted.
* rendering/style/RenderStyle.h:
* rendering/style/StyleScrollSnapPoints.cpp:
(WebCore::StyleScrollSnapPoints::StyleScrollSnapPoints): Revise constructor to handle pointer argument.
* rendering/style/StyleScrollSnapPoints.h:

LayoutTests:

* css3/scroll-snap/scroll-snap-property-computed-style.js: Update for corrected 'initial' behavior.
* css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: Rebaselined.
* css3/scroll-snap/scroll-snap-initial.html: Added.
* css3/scroll-snap/scroll-snap-initial-expected.txt: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181188 => 181189)


--- trunk/LayoutTests/ChangeLog	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/ChangeLog	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1,3 +1,19 @@
+2015-03-06  Brent Fulgham  <bfulg...@apple.com>
+
+        Add 'initial' keyword support for scroll snap CSS properties
+        https://bugs.webkit.org/show_bug.cgi?id=136345
+        <rdar://problem/18162325>
+
+        Reviewed by Dean Jackson.
+
+        * css3/scroll-snap/scroll-snap-property-computed-style.js: Update for corrected 'initial' behavior.
+        * css3/scroll-snap/scroll-snap-property-computed-style-expected.txt: Rebaselined.
+        * css3/scroll-snap/scroll-snap-initial.html: Added.
+        * css3/scroll-snap/scroll-snap-initial-expected.txt: Added.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/win/TestExpectations:
+
 2015-03-06  Joseph Pecoraro  <pecor...@apple.com>
 
         ES6: Object Literal Extensions - Methods

Added: trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial-expected.txt (0 => 181189)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial-expected.txt	2015-03-06 23:39:57 UTC (rev 181189)
@@ -0,0 +1,89 @@
+Tests 'initial' on scroll snap properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS noInitial.style['-webkit-scroll-snap-type'] is ""
+PASS window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-type') is "mandatory"
+PASS noInitial.style['-webkit-scroll-snap-points-x'] is ""
+PASS window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-points-x') is "repeat(100%)"
+PASS noInitial.style['-webkit-scroll-snap-points-y'] is ""
+PASS window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-points-y') is "repeat(100%)"
+PASS noInitial.style['-webkit-scroll-snap-destination'] is ""
+PASS window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-destination') is "10% 11%"
+PASS noInitial.style['-webkit-scroll-snap-coordinate'] is ""
+PASS window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-coordinate') is "none"
+PASS initialType.style['-webkit-scroll-snap-type'] is "initial"
+PASS window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-type') is "none"
+PASS initialType.style['-webkit-scroll-snap-points-x'] is ""
+PASS window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-points-x') is "repeat(100%)"
+PASS initialType.style['-webkit-scroll-snap-points-y'] is ""
+PASS window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-points-y') is "repeat(100%)"
+PASS initialType.style['-webkit-scroll-snap-destination'] is ""
+PASS window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-destination') is "0px 0px"
+PASS initialType.style['-webkit-scroll-snap-coordinate'] is ""
+PASS window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-coordinate') is "15px 122px"
+PASS initialXPoints.style['-webkit-scroll-snap-type'] is ""
+PASS window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-type') is "mandatory"
+PASS initialXPoints.style['-webkit-scroll-snap-points-x'] is "initial"
+PASS window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-points-x') is "none"
+PASS initialXPoints.style['-webkit-scroll-snap-points-y'] is ""
+PASS window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-points-y') is "repeat(100%)"
+PASS initialXPoints.style['-webkit-scroll-snap-destination'] is ""
+PASS window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-destination') is "50% 70%"
+PASS initialXPoints.style['-webkit-scroll-snap-coordinate'] is ""
+PASS window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-coordinate') is "100% 50%"
+PASS initialYPoints.style['-webkit-scroll-snap-type'] is ""
+PASS window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-type') is "mandatory"
+PASS initialYPoints.style['-webkit-scroll-snap-points-x'] is ""
+PASS window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-points-x') is "repeat(100%)"
+PASS initialYPoints.style['-webkit-scroll-snap-points-y'] is "initial"
+PASS window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-points-y') is "none"
+PASS initialYPoints.style['-webkit-scroll-snap-destination'] is ""
+PASS window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-destination') is "10px 20px"
+PASS initialYPoints.style['-webkit-scroll-snap-coordinate'] is ""
+PASS window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-coordinate') is "50% 100%"
+PASS initialDestination.style['-webkit-scroll-snap-type'] is ""
+PASS window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-type') is "proximity"
+PASS initialDestination.style['-webkit-scroll-snap-points-x'] is ""
+PASS window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-points-x') is "repeat(100%)"
+PASS initialDestination.style['-webkit-scroll-snap-points-y'] is ""
+PASS window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-points-y') is "repeat(100%)"
+PASS initialDestination.style['-webkit-scroll-snap-destination'] is "initial"
+PASS window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-destination') is "0px 0px"
+PASS initialDestination.style['-webkit-scroll-snap-coordinate'] is ""
+PASS window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-coordinate') is "10px 10px"
+PASS initialSnapCoordinate.style['-webkit-scroll-snap-type'] is ""
+PASS window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-type') is "mandatory"
+PASS initialSnapCoordinate.style['-webkit-scroll-snap-points-x'] is ""
+PASS window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-points-x') is "repeat(100%)"
+PASS initialSnapCoordinate.style['-webkit-scroll-snap-points-y'] is ""
+PASS window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-points-y') is "repeat(100%)"
+PASS initialSnapCoordinate.style['-webkit-scroll-snap-destination'] is ""
+PASS window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-destination') is "10% 10%"
+PASS initialSnapCoordinate.style['-webkit-scroll-snap-coordinate'] is "initial"
+PASS window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-coordinate') is "none"
+PASS allInitial.style['-webkit-scroll-snap-type'] is "initial"
+PASS window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-type') is "none"
+PASS allInitial.style['-webkit-scroll-snap-points-x'] is "initial"
+PASS window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-points-x') is "none"
+PASS allInitial.style['-webkit-scroll-snap-points-y'] is "initial"
+PASS window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-points-y') is "none"
+PASS allInitial.style['-webkit-scroll-snap-destination'] is "initial"
+PASS window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-destination') is "0px 0px"
+PASS allInitial.style['-webkit-scroll-snap-coordinate'] is "initial"
+PASS window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-coordinate') is "none"
+PASS allInitialY.style['-webkit-scroll-snap-type'] is "initial"
+PASS window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-type') is "none"
+PASS allInitialY.style['-webkit-scroll-snap-points-x'] is "initial"
+PASS window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-points-x') is "none"
+PASS allInitialY.style['-webkit-scroll-snap-points-y'] is "initial"
+PASS window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-points-y') is "none"
+PASS allInitialY.style['-webkit-scroll-snap-destination'] is "initial"
+PASS window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-destination') is "0px 0px"
+PASS allInitialY.style['-webkit-scroll-snap-coordinate'] is "initial"
+PASS window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-coordinate') is "none"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial.html (0 => 181189)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial.html	                        (rev 0)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-initial.html	2015-03-06 23:39:57 UTC (rev 181189)
@@ -0,0 +1,283 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            .horizontalGallery {
+                width: 400px;
+                height: 50px;
+                overflow-y: hidden;
+                overflow-x: auto;
+            }
+            .verticalGallery {
+                width: 400px;
+                height: 50px;
+                display: inline-block;
+                overflow-x: hidden;
+                overflow-y: auto;
+            }
+            .horizontalGalleryDrawer {
+                width: 3000px;
+                height: 50px;
+            }
+            .verticalGalleryDrawer {
+                width: 400px;
+                height: 300px;
+            }
+            .colorBox {
+                height: 50px;
+                width: 400px;
+                float: left;
+            }
+
+            .noInitial {
+                -webkit-scroll-snap-type: mandatory;
+                -webkit-scroll-snap-points-x: repeat(100%);
+                -webkit-scroll-snap-points-y: repeat(100%);
+                -webkit-scroll-snap-destination: 10% 11%;
+                -webkit-scroll-snap-coordinate: none;
+            }
+
+            .initialType {
+                -webkit-scroll-snap-type: initial;
+                -webkit-scroll-snap-points-x: repeat(100%);
+                -webkit-scroll-snap-points-y: repeat(100%);
+                -webkit-scroll-snap-destination: 0px 0px;
+                -webkit-scroll-snap-coordinate: 15px 122px;
+            }
+
+            .initialXPoints {
+                -webkit-scroll-snap-type: mandatory;
+                -webkit-scroll-snap-points-x: initial;
+                -webkit-scroll-snap-points-y: repeat(100%);
+                -webkit-scroll-snap-destination: 50% 70%;
+                -webkit-scroll-snap-coordinate: 100% 50%;
+            }
+
+            .initialYPoints {
+                -webkit-scroll-snap-type: mandatory;
+                -webkit-scroll-snap-points-x: repeat(100%);
+                -webkit-scroll-snap-points-y: initial;
+                -webkit-scroll-snap-destination: 10px 20px;
+                -webkit-scroll-snap-coordinate: 50% 100%;
+            }
+
+            .initialDestination {
+                -webkit-scroll-snap-type: proximity;
+                -webkit-scroll-snap-points-x: repeat(100%);
+                -webkit-scroll-snap-points-y: repeat(100%);
+                -webkit-scroll-snap-destination: initial;
+                -webkit-scroll-snap-coordinate: 10px 10px;
+            }
+
+            .initialSnapCoordinate {
+                -webkit-scroll-snap-type: mandatory;
+                -webkit-scroll-snap-points-x: repeat(100%);
+                -webkit-scroll-snap-points-y: repeat(100%);
+                -webkit-scroll-snap-destination: 10% 10%;
+                -webkit-scroll-snap-coordinate: initial;
+            }
+
+            .allInitial {
+                -webkit-scroll-snap-type: initial;
+                -webkit-scroll-snap-points-x: initial;
+                -webkit-scroll-snap-points-y: initial;
+                -webkit-scroll-snap-destination: initial;
+                -webkit-scroll-snap-coordinate: initial
+            }
+
+            #item0 { background-color: red; }
+            #item1 { background-color: green; }
+            #item2 { background-color: blue; }
+            #item3 { background-color: aqua; }
+            #item4 { background-color: yellow; }
+            #item5 { background-color: fuchsia; }
+        </style>
+        <script src=""
+    </head>
+    <body>
+        <div style="width: 400px">
+            <div id="noInitial" class="horizontalGallery noInitial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="initialType" class="horizontalGallery initialType" style="-webkit-scroll-snap-type: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="initialXPoints" class="horizontalGallery initialXPoints" style="-webkit-scroll-snap-points-x: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="initialYPoints" class="horizontalGallery initialYPoints" style="-webkit-scroll-snap-points-y: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="initialDestination" class="horizontalGallery initialDestination" style="-webkit-scroll-snap-destination: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="initialSnapCoordinate" class="horizontalGallery initialSnapCoordinate" style="-webkit-scroll-snap-coordinate: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="allInitial" class="horizontalGallery allInitial" style="-webkit-scroll-snap-type: initial; -webkit-scroll-snap-points-x: initial; -webkit-scroll-snap-points-y: initial; -webkit-scroll-snap-destination: initial; -webkit-scroll-snap-coordinate: initial">
+                <div class="horizontalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+            <div id="allInitialY" class="verticalGallery noInitial" style="-webkit-scroll-snap-type: initial; -webkit-scroll-snap-points-x: initial; -webkit-scroll-snap-points-y: initial; -webkit-scroll-snap-destination: initial; -webkit-scroll-snap-coordinate: initial">
+                <div class="verticalGalleryDrawer">
+                    <div id="item0" class="colorBox"></div>
+                    <div id="item1" class="colorBox"></div>
+                    <div id="item2" class="colorBox"></div>
+                    <div id="item3" class="colorBox"></div>
+                    <div id="item4" class="colorBox"></div>
+                    <div id="item5" class="colorBox"></div>
+                </div>
+            </div>
+        </div>
+        <div id="console"></div>
+        <script>
+        description("Tests 'initial' on scroll snap properties.");
+
+        var noInitial = document.getElementById('noInitial');
+        shouldBeEmptyString("noInitial.style['-webkit-scroll-snap-type']");
+        shouldBeEqualToString("window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-type')", "mandatory");
+        shouldBeEmptyString("noInitial.style['-webkit-scroll-snap-points-x']");
+        shouldBeEqualToString("window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-points-x')", "repeat(100%)");
+        shouldBeEmptyString("noInitial.style['-webkit-scroll-snap-points-y']");
+        shouldBeEqualToString("window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-points-y')", "repeat(100%)");
+        shouldBeEmptyString("noInitial.style['-webkit-scroll-snap-destination']");
+        shouldBeEqualToString("window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-destination')", "10% 11%");
+        shouldBeEmptyString("noInitial.style['-webkit-scroll-snap-coordinate']");
+        shouldBeEqualToString("window.getComputedStyle(noInitial).getPropertyValue('-webkit-scroll-snap-coordinate')", "none");
+
+        var initialType = document.getElementById('initialType');
+        shouldBeEqualToString("initialType.style['-webkit-scroll-snap-type']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-type')", "none");
+        shouldBeEmptyString("initialType.style['-webkit-scroll-snap-points-x']");
+        shouldBeEqualToString("window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-points-x')", "repeat(100%)");
+        shouldBeEmptyString("initialType.style['-webkit-scroll-snap-points-y']");
+        shouldBeEqualToString("window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-points-y')", "repeat(100%)");
+        shouldBeEmptyString("initialType.style['-webkit-scroll-snap-destination']");
+        shouldBeEqualToString("window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-destination')", "0px 0px");
+        shouldBeEmptyString("initialType.style['-webkit-scroll-snap-coordinate']");
+        shouldBeEqualToString("window.getComputedStyle(initialType).getPropertyValue('-webkit-scroll-snap-coordinate')", "15px 122px");
+
+        var initialXPoints = document.getElementById('initialXPoints');
+        shouldBeEmptyString("initialXPoints.style['-webkit-scroll-snap-type']");
+        shouldBeEqualToString("window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-type')", "mandatory");
+        shouldBeEqualToString("initialXPoints.style['-webkit-scroll-snap-points-x']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-points-x')", "none");
+        shouldBeEmptyString("initialXPoints.style['-webkit-scroll-snap-points-y']");
+        shouldBeEqualToString("window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-points-y')", "repeat(100%)");
+        shouldBeEmptyString("initialXPoints.style['-webkit-scroll-snap-destination']");
+        shouldBeEqualToString("window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-destination')", "50% 70%");
+        shouldBeEmptyString("initialXPoints.style['-webkit-scroll-snap-coordinate']");
+        shouldBeEqualToString("window.getComputedStyle(initialXPoints).getPropertyValue('-webkit-scroll-snap-coordinate')", "100% 50%");
+
+        var initialYPoints = document.getElementById('initialYPoints');
+        shouldBeEmptyString("initialYPoints.style['-webkit-scroll-snap-type']");
+        shouldBeEqualToString("window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-type')", "mandatory");
+        shouldBeEmptyString("initialYPoints.style['-webkit-scroll-snap-points-x']");
+        shouldBeEqualToString("window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-points-x')", "repeat(100%)");
+        shouldBeEqualToString("initialYPoints.style['-webkit-scroll-snap-points-y']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-points-y')", "none");
+        shouldBeEmptyString("initialYPoints.style['-webkit-scroll-snap-destination']");
+        shouldBeEqualToString("window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-destination')", "10px 20px");
+        shouldBeEmptyString("initialYPoints.style['-webkit-scroll-snap-coordinate']");
+        shouldBeEqualToString("window.getComputedStyle(initialYPoints).getPropertyValue('-webkit-scroll-snap-coordinate')", "50% 100%");
+
+        var initialDestination = document.getElementById('initialDestination');
+        shouldBeEmptyString("initialDestination.style['-webkit-scroll-snap-type']");
+        shouldBeEqualToString("window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-type')", "proximity");
+        shouldBeEmptyString("initialDestination.style['-webkit-scroll-snap-points-x']");
+        shouldBeEqualToString("window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-points-x')", "repeat(100%)");
+        shouldBeEmptyString("initialDestination.style['-webkit-scroll-snap-points-y']");
+        shouldBeEqualToString("window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-points-y')", "repeat(100%)");
+        shouldBeEqualToString("initialDestination.style['-webkit-scroll-snap-destination']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-destination')", "0px 0px");
+        shouldBeEmptyString("initialDestination.style['-webkit-scroll-snap-coordinate']");
+        shouldBeEqualToString("window.getComputedStyle(initialDestination).getPropertyValue('-webkit-scroll-snap-coordinate')", "10px 10px");
+
+        var initialSnapCoordinate = document.getElementById('initialSnapCoordinate');
+        shouldBeEmptyString("initialSnapCoordinate.style['-webkit-scroll-snap-type']");
+        shouldBeEqualToString("window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-type')", "mandatory");
+        shouldBeEmptyString("initialSnapCoordinate.style['-webkit-scroll-snap-points-x']");
+        shouldBeEqualToString("window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-points-x')", "repeat(100%)");
+        shouldBeEmptyString("initialSnapCoordinate.style['-webkit-scroll-snap-points-y']");
+        shouldBeEqualToString("window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-points-y')", "repeat(100%)");
+        shouldBeEmptyString("initialSnapCoordinate.style['-webkit-scroll-snap-destination']");
+        shouldBeEqualToString("window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-destination')", "10% 10%");
+        shouldBeEqualToString("initialSnapCoordinate.style['-webkit-scroll-snap-coordinate']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(initialSnapCoordinate).getPropertyValue('-webkit-scroll-snap-coordinate')", "none");
+
+        var allInitial = document.getElementById('allInitial');
+        shouldBeEqualToString("allInitial.style['-webkit-scroll-snap-type']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-type')", "none");
+        shouldBeEqualToString("allInitial.style['-webkit-scroll-snap-points-x']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-points-x')", "none");
+        shouldBeEqualToString("allInitial.style['-webkit-scroll-snap-points-y']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-points-y')", "none");
+        shouldBeEqualToString("allInitial.style['-webkit-scroll-snap-destination']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-destination')", "0px 0px");
+        shouldBeEqualToString("allInitial.style['-webkit-scroll-snap-coordinate']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitial).getPropertyValue('-webkit-scroll-snap-coordinate')", "none");
+
+        var allInitialY = document.getElementById('allInitialY');
+        shouldBeEqualToString("allInitialY.style['-webkit-scroll-snap-type']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-type')", "none");
+        shouldBeEqualToString("allInitialY.style['-webkit-scroll-snap-points-x']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-points-x')", "none");
+        shouldBeEqualToString("allInitialY.style['-webkit-scroll-snap-points-y']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-points-y')", "none");
+        shouldBeEqualToString("allInitialY.style['-webkit-scroll-snap-destination']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-destination')", "0px 0px");
+        shouldBeEqualToString("allInitialY.style['-webkit-scroll-snap-coordinate']", "initial");
+        shouldBeEqualToString("window.getComputedStyle(allInitialY).getPropertyValue('-webkit-scroll-snap-coordinate')", "none");
+        </script>
+        <script src=""
+    </body>
+</html>
+

Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style-expected.txt (181188 => 181189)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style-expected.txt	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style-expected.txt	2015-03-06 23:39:57 UTC (rev 181189)
@@ -8,16 +8,16 @@
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-type') is 'none'
 
 invalid points along x axis : hello world
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'none'
 
 invalid points along y axis : hello world
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'none'
 
 typo in point definition : repaet(50px)
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'none'
 
 another invalid point definition : ??px repeat(50px)
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'none'
 
 invalid destination : foo bar
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-destination') is '0px 0px'
@@ -50,10 +50,10 @@
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-type') is 'proximity'
 
 inherited points along x axis : inherit
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'none'
 
 initial points along x axis : initial
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'none'
 
 element points along x axis : elements
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is 'elements'
@@ -83,10 +83,10 @@
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-x') is '100px repeat(42px)'
 
 inherited points along y axis : inherit
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'none'
 
 initial points along y axis : initial
-PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'repeat(100%)'
+PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'none'
 
 element points along y axis : elements
 PASS window.getComputedStyle(document.body).getPropertyValue('-webkit-scroll-snap-points-y') is 'elements'

Modified: trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.js (181188 => 181189)


--- trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.js	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/css3/scroll-snap/scroll-snap-property-computed-style.js	2015-03-06 23:39:57 UTC (rev 181189)
@@ -17,10 +17,10 @@
 }
 
 testComputedScrollSnapRule("invalid snapping type", "type", "potato", "none");
-testComputedScrollSnapRule("invalid points along x axis", "points-x", "hello world", "repeat(100%)");
-testComputedScrollSnapRule("invalid points along y axis", "points-y", "hello world", "repeat(100%)");
-testComputedScrollSnapRule("typo in point definition", "points-x", "repaet(50px)", "repeat(100%)");
-testComputedScrollSnapRule("another invalid point definition", "points-x", "??px repeat(50px)", "repeat(100%)");
+testComputedScrollSnapRule("invalid points along x axis", "points-x", "hello world", "none");
+testComputedScrollSnapRule("invalid points along y axis", "points-y", "hello world", "none");
+testComputedScrollSnapRule("typo in point definition", "points-x", "repaet(50px)", "none");
+testComputedScrollSnapRule("another invalid point definition", "points-x", "??px repeat(50px)", "none");
 testComputedScrollSnapRule("invalid destination", "destination", "foo bar", "0px 0px");
 testComputedScrollSnapRule("short one destination value", "destination", "50%", "0px 0px");
 testComputedScrollSnapRule("extra destination value", "destination", "50px 100% 75px", "0px 0px");
@@ -33,8 +33,8 @@
 testComputedScrollSnapRule("mandatory type", "type", "mandatory", "mandatory");
 testComputedScrollSnapRule("proximity type", "type", "proximity", "proximity");
 
-testComputedScrollSnapRule("inherited points along x axis", "points-x", "inherit", "repeat(100%)");
-testComputedScrollSnapRule("initial points along x axis", "points-x", "initial", "repeat(100%)");
+testComputedScrollSnapRule("inherited points along x axis", "points-x", "inherit", "none");
+testComputedScrollSnapRule("initial points along x axis", "points-x", "initial", "none");
 testComputedScrollSnapRule("element points along x axis", "points-x", "elements", "elements");
 testComputedScrollSnapRule("percentage points along x axis", "points-x", "100% 50%", "100% 50%");
 testComputedScrollSnapRule("pixel points along x axis", "points-x", "100px 50px", "100px 50px");
@@ -45,8 +45,8 @@
 testComputedScrollSnapRule("percentage points along x axis with pixel repeat", "points-x", "100% 50% repeat(40px)", "100% 50% repeat(40px)");
 testComputedScrollSnapRule("pixel points along x axis with pixel repeat", "points-x", "100px repeat(42px)", "100px repeat(42px)");
 
-testComputedScrollSnapRule("inherited points along y axis", "points-y", "inherit", "repeat(100%)");
-testComputedScrollSnapRule("initial points along y axis", "points-y", "initial", "repeat(100%)");
+testComputedScrollSnapRule("inherited points along y axis", "points-y", "inherit", "none");
+testComputedScrollSnapRule("initial points along y axis", "points-y", "initial", "none");
 testComputedScrollSnapRule("element points along y axis", "points-y", "elements", "elements");
 testComputedScrollSnapRule("percentage points along y axis", "points-y", "100% 50%", "100% 50%");
 testComputedScrollSnapRule("pixel points along y axis", "points-y", "100px 50px", "100px 50px");

Modified: trunk/LayoutTests/platform/efl/TestExpectations (181188 => 181189)


--- trunk/LayoutTests/platform/efl/TestExpectations	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2015-03-06 23:39:57 UTC (rev 181189)
@@ -59,6 +59,9 @@
 fast/dom/Window/slow-unload-handler.html
 fast/dom/Window/slow-unload-handler-only-frame-is-stopped.html
 
+# Need a scroll snap point implementation
+css3/scroll-snap [ Skip ]
+
 # ----------------------------------------
 # Tests which also fail in other platforms
 # ----------------------------------------

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (181188 => 181189)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2015-03-06 23:39:57 UTC (rev 181189)
@@ -620,7 +620,8 @@
 webkit.org/b/142291 fast/layers/no-clipping-overflow-hidden-hardware-acceleration.html [ ImageOnlyFailure ]
 webkit.org/b/142291 fast/regions/repaint/fixed-in-named-flow-cb-changed.html [ ImageOnlyFailure ]
 
-
+# TODO Scroll snap points
+css3/scroll-snap [ Skip ]
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/win/TestExpectations (181188 => 181189)


--- trunk/LayoutTests/platform/win/TestExpectations	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/LayoutTests/platform/win/TestExpectations	2015-03-06 23:39:57 UTC (rev 181189)
@@ -591,6 +591,9 @@
 
 # TODO Attachment elements do not provide a custom renderer
 webkit.org/b/142260 fast/attachment [ Skip ]
+
+# TODO Scroll snap points
+css3/scroll-snap [ Skip ]
 ################################################################################
 ###########    End Missing Functionality Prevents Testing         ##############
 ################################################################################

Modified: trunk/Source/WebCore/ChangeLog (181188 => 181189)


--- trunk/Source/WebCore/ChangeLog	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/ChangeLog	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1,3 +1,47 @@
+2015-03-06  Brent Fulgham  <bfulg...@apple.com>
+
+        Add 'initial' keyword support for scroll snap CSS properties
+        https://bugs.webkit.org/show_bug.cgi?id=136345
+        <rdar://problem/18162325>
+
+        Reviewed by Dean Jackson.
+
+        Tested by css3/scroll-snap/scroll-snap-initial.html
+
+        The existing implementation already had 'initial' keyword support, but did not fully follow
+        the CSS specification. In particular, the 'initial' state for the scroll-snap-points-x and
+        scroll-snap-points-y properties was not handled correctly.
+
+        Revise implementation to represent ScrollSnapPoints as a pointer, so that 'none' is a valid
+        state.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::scrollSnapPoints): If 'points' is null, return CSSValueNone.
+        * css/CSSPropertyNames.in: Provide custom initial/inherit handles for snap point x/y sets.
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertScrollSnapPoints): Update to represent ScrollSnapPoints
+        as a pointer.
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX): Provide custom pointer-based
+        implementation for ScrollSnapPoints.
+        (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX): Ditto.
+        (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY): Ditto.
+        (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY): Ditto."
+        * page/scrolling/AxisScrollSnapOffsets.cpp:
+        (WebCore::updateFromStyle): Handle ScrollSnapPoints as pointers.
+        (WebCore::updateSnapOffsetsForScrollableArea): Ditto.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::scrollSnapPointsX): Update to use pointer-based representation of ScrollSnapPoints.
+        (WebCore::RenderStyle::scrollSnapPointsY): Ditto.
+        (WebCore::RenderStyle::setScrollSnapPointsX): Ditto.
+        (WebCore::RenderStyle::setScrollSnapPointsY): Ditto.
+        (WebCore::RenderStyle::initialScrollSnapPointsX): Deleted.
+        (WebCore::RenderStyle::initialScrollSnapPointsY): Deleted.
+        * rendering/style/RenderStyle.h:
+        * rendering/style/StyleScrollSnapPoints.cpp:
+        (WebCore::StyleScrollSnapPoints::StyleScrollSnapPoints): Revise constructor to handle pointer argument.
+        * rendering/style/StyleScrollSnapPoints.h:
+
 2015-03-05  Roger Fong  <roger_f...@apple.com>
 
         Reskin Captions button and container on OSX.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (181188 => 181189)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1106,7 +1106,6 @@
 }
 
 #if ENABLE(CSS_SCROLL_SNAP)
-
 static Ref<CSSValueList> scrollSnapDestination(RenderStyle& style, const LengthSize& destination)
 {
     auto list = CSSValueList::createSpaceSeparated();
@@ -1115,15 +1114,18 @@
     return list;
 }
 
-static Ref<CSSValue> scrollSnapPoints(RenderStyle& style, const ScrollSnapPoints& points)
+static Ref<CSSValue> scrollSnapPoints(RenderStyle& style, const ScrollSnapPoints* points)
 {
-    if (points.usesElements)
+    if (!points)
+        return cssValuePool().createIdentifierValue(CSSValueNone);
+
+    if (points->usesElements)
         return cssValuePool().createIdentifierValue(CSSValueElements);
     auto list = CSSValueList::createSpaceSeparated();
-    for (auto& point : points.offsets)
+    for (auto& point : points->offsets)
         list.get().append(percentageOrZoomAdjustedValue(point, &style));
-    if (points.hasRepeat)
-        list.get().append(cssValuePool().createValue(LengthRepeat::create(percentageOrZoomAdjustedValue(points.repeatOffset, &style))));
+    if (points->hasRepeat)
+        list.get().append(cssValuePool().createValue(LengthRepeat::create(percentageOrZoomAdjustedValue(points->repeatOffset, &style))));
     return WTF::move(list);
 }
 
@@ -1143,7 +1145,6 @@
 
     return WTF::move(list);
 }
-
 #endif
 
 static Ref<CSSValueList> getDelayValue(const AnimationList* animList)

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (181188 => 181189)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2015-03-06 23:39:57 UTC (rev 181189)
@@ -560,8 +560,8 @@
 -webkit-print-color-adjust [Inherited]
 -webkit-rtl-ordering [Inherited, Setter=setRTLOrdering, Initial=initialRTLOrdering]
 #if defined(ENABLE_CSS_SCROLL_SNAP)
--webkit-scroll-snap-points-x [Converter=ScrollSnapPoints]
--webkit-scroll-snap-points-y [Converter=ScrollSnapPoints]
+-webkit-scroll-snap-points-x [Converter=ScrollSnapPoints, Custom=Initial|Inherit]
+-webkit-scroll-snap-points-y [Converter=ScrollSnapPoints, Custom=Initial|Inherit]
 -webkit-scroll-snap-type
 -webkit-scroll-snap-destination [Converter=SnapCoordinatePair]
 -webkit-scroll-snap-coordinate [Converter=ScrollSnapCoordinates, NameForMethods=ScrollSnapCoordinates]

Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (181188 => 181189)


--- trunk/Source/WebCore/css/StyleBuilderConverter.h	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h	2015-03-06 23:39:57 UTC (rev 181189)
@@ -90,7 +90,7 @@
     static TextDecorationSkip convertTextDecorationSkip(StyleResolver&, CSSValue&);
     static PassRefPtr<ShapeValue> convertShapeValue(StyleResolver&, CSSValue&);
 #if ENABLE(CSS_SCROLL_SNAP)
-    static ScrollSnapPoints convertScrollSnapPoints(StyleResolver&, CSSValue&);
+    static std::unique_ptr<ScrollSnapPoints> convertScrollSnapPoints(StyleResolver&, CSSValue&);
     static LengthSize convertSnapCoordinatePair(StyleResolver&, CSSValue&, size_t offset = 0);
     static Vector<LengthSize> convertScrollSnapCoordinates(StyleResolver&, CSSValue&);
 #endif
@@ -708,27 +708,27 @@
     return downcast<CSSPrimitiveValue>(value).convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(styleResolver.state().cssToLengthConversionData());
 }
 
-inline ScrollSnapPoints StyleBuilderConverter::convertScrollSnapPoints(StyleResolver& styleResolver, CSSValue& value)
+inline std::unique_ptr<ScrollSnapPoints> StyleBuilderConverter::convertScrollSnapPoints(StyleResolver& styleResolver, CSSValue& value)
 {
-    ScrollSnapPoints points;
+    auto points = std::make_unique<ScrollSnapPoints>();
 
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueElements);
-        points.usesElements = true;
+        points->usesElements = true;
         return points;
     }
 
-    points.hasRepeat = false;
+    points->hasRepeat = false;
     for (auto& currentValue : downcast<CSSValueList>(value)) {
         auto& itemValue = downcast<CSSPrimitiveValue>(currentValue.get());
         if (auto* lengthRepeat = itemValue.getLengthRepeatValue()) {
             if (auto* interval = lengthRepeat->interval()) {
-                points.repeatOffset = parseSnapCoordinate(styleResolver, *interval);
-                points.hasRepeat = true;
+                points->repeatOffset = parseSnapCoordinate(styleResolver, *interval);
+                points->hasRepeat = true;
                 break;
             }
         }
-        points.offsets.append(parseSnapCoordinate(styleResolver, itemValue));
+        points->offsets.append(parseSnapCoordinate(styleResolver, itemValue));
     }
 
     return points;

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (181188 => 181189)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2015-03-06 23:39:57 UTC (rev 181189)
@@ -128,6 +128,12 @@
 #endif
     static void applyValueWebkitWritingMode(StyleResolver&, CSSValue&);
     static void applyValueAlt(StyleResolver&, CSSValue&);
+#if ENABLE(CSS_SCROLL_SNAP)
+    static void applyInitialWebkitScrollSnapPointsX(StyleResolver&);
+    static void applyInheritWebkitScrollSnapPointsX(StyleResolver&);
+    static void applyInitialWebkitScrollSnapPointsY(StyleResolver&);
+    static void applyInheritWebkitScrollSnapPointsY(StyleResolver&);
+#endif
 
 private:
     static void resetEffectiveZoom(StyleResolver&);
@@ -1693,6 +1699,28 @@
         styleResolver.style()->setContentAltText(emptyAtom);
 }
 
+#if ENABLE(CSS_SCROLL_SNAP)
+inline void StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setScrollSnapPointsX(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setScrollSnapPointsX(styleResolver.parentStyle()->scrollSnapPointsX() ? std::make_unique<ScrollSnapPoints>(*styleResolver.parentStyle()->scrollSnapPointsX()) : nullptr);
+}
+
+inline void StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setScrollSnapPointsY(nullptr);
+}
+
+inline void StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY(StyleResolver& styleResolver)
+{
+    styleResolver.style()->setScrollSnapPointsY(styleResolver.parentStyle()->scrollSnapPointsY() ? std::make_unique<ScrollSnapPoints>(*styleResolver.parentStyle()->scrollSnapPointsY()) : nullptr);
+}
+#endif
+
 } // namespace WebCore
 
 #endif // StyleBuilderCustom_h

Modified: trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp (181188 => 181189)


--- trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -75,10 +75,10 @@
         snapOffsetSubsequence.append(0);
 
     bool isHorizontalAxis = axis == ScrollEventAxis::Horizontal;
-    auto& points = isHorizontalAxis ? style.scrollSnapPointsX() : style.scrollSnapPointsY();
+    auto* points = isHorizontalAxis ? style.scrollSnapPointsX() : style.scrollSnapPointsY();
     auto& destination = style.scrollSnapDestination();
-    bool hasRepeat = points.hasRepeat;
-    LayoutUnit repeatOffset = valueForLength(points.repeatOffset, viewSize);
+    bool hasRepeat = points ? points->hasRepeat : false;
+    LayoutUnit repeatOffset = points ? valueForLength(points->repeatOffset, viewSize) : LayoutUnit();
     LayoutUnit destinationOffset = valueForLength(isHorizontalAxis ? destination.width() : destination.height(), viewSize);
     LayoutUnit curSnapPositionShift = 0;
     LayoutUnit maxScrollOffset = scrollSize - viewSize;
@@ -130,19 +130,22 @@
     Vector<LayoutUnit> horizontalSnapOffsetSubsequence;
     Vector<LayoutUnit> verticalSnapOffsetSubsequence;
 
-    if (scrollingElementStyle.scrollSnapPointsX().usesElements || scrollingElementStyle.scrollSnapPointsY().usesElements) {
-        bool shouldAddHorizontalChildOffsets = scrollingElementStyle.scrollSnapPointsX().usesElements && canComputeHorizontalOffsets;
-        bool shouldAddVerticalChildOffsets = scrollingElementStyle.scrollSnapPointsY().usesElements && canComputeVerticalOffsets;
+    bool scrollSnapPointsXUsesElements = scrollingElementStyle.scrollSnapPointsX() ? scrollingElementStyle.scrollSnapPointsX()->usesElements : false;
+    bool scrollSnapPointsYUsesElements = scrollingElementStyle.scrollSnapPointsY() ? scrollingElementStyle.scrollSnapPointsY()->usesElements : false;
+
+    if (scrollSnapPointsXUsesElements || scrollSnapPointsYUsesElements) {
+        bool shouldAddHorizontalChildOffsets = scrollSnapPointsXUsesElements && canComputeHorizontalOffsets;
+        bool shouldAddVerticalChildOffsets = scrollSnapPointsYUsesElements && canComputeVerticalOffsets;
         appendChildSnapOffsets(scrollingElement, shouldAddHorizontalChildOffsets, horizontalSnapOffsetSubsequence, shouldAddVerticalChildOffsets, verticalSnapOffsetSubsequence);
     }
 
-    if (!scrollingElementStyle.scrollSnapPointsX().usesElements && canComputeHorizontalOffsets) {
-        for (auto& snapLength : scrollingElementStyle.scrollSnapPointsX().offsets)
+    if (scrollingElementStyle.scrollSnapPointsX() && !scrollSnapPointsXUsesElements && canComputeHorizontalOffsets) {
+        for (auto& snapLength : scrollingElementStyle.scrollSnapPointsX()->offsets)
             horizontalSnapOffsetSubsequence.append(valueForLength(snapLength, viewWidth));
     }
 
-    if (!scrollingElementStyle.scrollSnapPointsY().usesElements && canComputeVerticalOffsets) {
-        for (auto& snapLength : scrollingElementStyle.scrollSnapPointsY().offsets)
+    if (scrollingElementStyle.scrollSnapPointsY() && !scrollSnapPointsYUsesElements && canComputeVerticalOffsets) {
+        for (auto& snapLength : scrollingElementStyle.scrollSnapPointsY()->offsets)
             verticalSnapOffsetSubsequence.append(valueForLength(snapLength, viewHeight));
     }
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (181188 => 181189)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1999 Antti Koivisto (koivi...@kde.org)
- * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
@@ -1865,17 +1865,6 @@
 }
 
 #if ENABLE(CSS_SCROLL_SNAP)
-
-ScrollSnapPoints RenderStyle::initialScrollSnapPointsX()
-{
-    return ScrollSnapPoints();
-}
-
-ScrollSnapPoints RenderStyle::initialScrollSnapPointsY()
-{
-    return ScrollSnapPoints();
-}
-
 LengthSize RenderStyle::initialScrollSnapDestination()
 {
     return defaultScrollSnapDestination();
@@ -1886,14 +1875,14 @@
     return Vector<LengthSize>();
 }
 
-const ScrollSnapPoints& RenderStyle::scrollSnapPointsX() const
+const ScrollSnapPoints* RenderStyle::scrollSnapPointsX() const
 {
-    return rareNonInheritedData->m_scrollSnapPoints->xPoints;
+    return rareNonInheritedData->m_scrollSnapPoints->xPoints.get();
 }
 
-const ScrollSnapPoints& RenderStyle::scrollSnapPointsY() const
+const ScrollSnapPoints* RenderStyle::scrollSnapPointsY() const
 {
-    return rareNonInheritedData->m_scrollSnapPoints->yPoints;
+    return rareNonInheritedData->m_scrollSnapPoints->yPoints.get();
 }
 
 const LengthSize& RenderStyle::scrollSnapDestination() const
@@ -1906,16 +1895,16 @@
     return rareNonInheritedData->m_scrollSnapPoints->coordinates;
 }
 
-void RenderStyle::setScrollSnapPointsX(ScrollSnapPoints points)
+void RenderStyle::setScrollSnapPointsX(std::unique_ptr<ScrollSnapPoints> points)
 {
-    if (rareNonInheritedData->m_scrollSnapPoints->xPoints == points)
+    if (rareNonInheritedData->m_scrollSnapPoints->xPoints.get() == points.get())
         return;
     rareNonInheritedData.access()->m_scrollSnapPoints.access()->xPoints = WTF::move(points);
 }
 
-void RenderStyle::setScrollSnapPointsY(ScrollSnapPoints points)
+void RenderStyle::setScrollSnapPointsY(std::unique_ptr<ScrollSnapPoints> points)
 {
-    if (rareNonInheritedData->m_scrollSnapPoints->yPoints == points)
+    if (rareNonInheritedData->m_scrollSnapPoints->yPoints.get() == points.get())
         return;
     rareNonInheritedData.access()->m_scrollSnapPoints.access()->yPoints = WTF::move(points);
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (181188 => 181189)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2015-03-06 23:39:57 UTC (rev 181189)
@@ -1080,8 +1080,8 @@
 
 #if ENABLE(CSS_SCROLL_SNAP)
     ScrollSnapType scrollSnapType() const { return static_cast<ScrollSnapType>(rareNonInheritedData->m_scrollSnapType); }
-    const ScrollSnapPoints& scrollSnapPointsX() const;
-    const ScrollSnapPoints& scrollSnapPointsY() const;
+    const ScrollSnapPoints* scrollSnapPointsX() const;
+    const ScrollSnapPoints* scrollSnapPointsY() const;
     const LengthSize& scrollSnapDestination() const;
     const Vector<LengthSize>& scrollSnapCoordinates() const;
 #endif
@@ -1625,8 +1625,8 @@
     
 #if ENABLE(CSS_SCROLL_SNAP)
     void setScrollSnapType(ScrollSnapType type) { SET_VAR(rareNonInheritedData, m_scrollSnapType, static_cast<unsigned>(type)); }
-    void setScrollSnapPointsX(ScrollSnapPoints);
-    void setScrollSnapPointsY(ScrollSnapPoints);
+    void setScrollSnapPointsX(std::unique_ptr<ScrollSnapPoints>);
+    void setScrollSnapPointsY(std::unique_ptr<ScrollSnapPoints>);
     void setScrollSnapDestination(LengthSize);
     void setScrollSnapCoordinates(Vector<LengthSize>);
 #endif
@@ -1959,16 +1959,16 @@
     static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
     static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
     static float initialImageResolution() { return 1; }
-    static StyleImage* initialBorderImageSource() { return 0; }
-    static StyleImage* initialMaskBoxImageSource() { return 0; }
+    static StyleImage* initialBorderImageSource() { return nullptr; }
+    static StyleImage* initialMaskBoxImageSource() { return nullptr; }
     static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
     static QuotesData* initialQuotes() { return nullptr; }
     static const AtomicString& initialContentAltText() { return emptyAtom; }
 
 #if ENABLE(CSS_SCROLL_SNAP)
     static ScrollSnapType initialScrollSnapType() { return ScrollSnapType::None; }
-    static ScrollSnapPoints initialScrollSnapPointsX();
-    static ScrollSnapPoints initialScrollSnapPointsY();
+    static ScrollSnapPoints* initialScrollSnapPointsX() { return nullptr; }
+    static ScrollSnapPoints* initialScrollSnapPointsY() { return nullptr; }
     static LengthSize initialScrollSnapDestination();
     static Vector<LengthSize> initialScrollSnapCoordinates();
 #endif

Modified: trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp (181188 => 181189)


--- trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp	2015-03-06 23:39:57 UTC (rev 181189)
@@ -57,8 +57,8 @@
 
 inline StyleScrollSnapPoints::StyleScrollSnapPoints(const StyleScrollSnapPoints& other)
     : RefCounted()
-    , xPoints(other.xPoints)
-    , yPoints(other.yPoints)
+    , xPoints(other.xPoints ? std::make_unique<ScrollSnapPoints>(*other.xPoints) : nullptr)
+    , yPoints(other.yPoints ? std::make_unique<ScrollSnapPoints>(*other.yPoints) : nullptr)
     , destination(other.destination)
     , coordinates(other.coordinates)
 {

Modified: trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.h (181188 => 181189)


--- trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.h	2015-03-06 23:13:53 UTC (rev 181188)
+++ trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.h	2015-03-06 23:39:57 UTC (rev 181189)
@@ -53,8 +53,8 @@
     static Ref<StyleScrollSnapPoints> create() { return adoptRef(*new StyleScrollSnapPoints); }
     Ref<StyleScrollSnapPoints> copy() const;
 
-    ScrollSnapPoints xPoints;
-    ScrollSnapPoints yPoints;
+    std::unique_ptr<ScrollSnapPoints> xPoints;
+    std::unique_ptr<ScrollSnapPoints> yPoints;
     LengthSize destination;
     Vector<LengthSize> coordinates;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to