scroll-snap-destination and scroll-snap-coordinate do not seem to work together properly
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2015 16:57:06 +0000 (16:57 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2015 16:57:06 +0000 (16:57 +0000)
commit7ac798f9d6af9a4ab1e963cb8d0846305c59c881
tree949fff70741f297c9afdf98353387a6c08a3fd7b
parent13203cf48053971b5b897d7cb7e3f5e7394d4a67
scroll-snap-destination and scroll-snap-coordinate do not seem to work together properly
https://bugs.webkit.org/show_bug.cgi?id=142552
<rdar://problem/20114743>

Reviewed by Dean Jackson.

Revise the snap point logic as follows:
(1) Put the snap point destination handling in a helper function to make the rest of the code
    easier to read.
(2) Make sure we always have a left-hand snap point (i.e., position 0), but don't add multiple
    left-hand snap points.
(3) Create a helper function to determine if we should be working with the scroll snap 'elements'
    behavior. We want to use this for scroll-snap-destination/scroll-snap-coordinate markup.
(4) Create per-element snap point offsets when using scroll-snap-destination/scroll-snap-coordinate.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseScrollSnapDestination): Add assertion to try to catch bad parser state.
* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::destinationOffsetForViewSize): Added helper function to consolidate logic for handling
destination coordinates.
(WebCore::updateFromStyle): Make sure a left-hand snap point is always provided.
(WebCore::styleUsesElements): Added helper function.
(WebCore::updateSnapOffsetsForScrollableArea): Revise logic to generate 'per-element' snap point
offsets.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181855 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp