Scroll-snap points do not handle margins and padding propertly
https://bugs.webkit.org/show_bug.cgi?id=144647
<rdar://problem/20829473>

Reviewed by Simon Fraser.

Source/WebCore:

The calculation of scroll snap points was incorrect because it did not account for margins or padding.
This was fixed by using the "paddingBoxRect" to represent the overall size of the view area, and
subtracting the relevant padding when computing the size of the scroll snap offsets.

Extend testing internals with accessor methods to retrieve string representations of the scroll snap
offsets and scroll snap coordinates computed during layout. These values are used in the new
'css3/scroll-snap/scroll-snap-offsets-and-coordinates.html' test.

New tests:
* css3/scroll-snap/scroll-snap-offsets-and-coordinates.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-borders.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-padding.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-rotated.html: Added.

* css/LengthFunctions.h: Expose the 'valueForLength' method so we can use it in WebCoreTestSupport.
* dom/Node.h: Expose the 'renderBox' method so we can use it in WebCoreTestSupport.
* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::appendChildSnapOffsets): Use 'contentBoxRect' for overall size, so that we don't use padding
as part of our offset calculations.
(WebCore::updateSnapOffsetsForScrollableArea): Ditto.
* rendering/RenderBox.h: Expose 'canBeScrolledAndHasScrollableArea' for use in WebCoreTestSupport.
* rendering/style/RenderStyle.h: Expose 'scrollSnapCoordinates' for use in WebCoreTestSupport.
* testing/Internals.cpp:
(WebCore::appendOffsets): Helper function.
(WebCore::Internals::scrollSnapOffsets): Added.
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Add new scroll-snap tests that cover elements with borders, padding, and rotation. Also correct the
cause of the 'scroll-snap-mandatory-overflow.html' test flakiness by making sure the mouse is always
inside the element when starting new wheel gestures.

Also add a new 'generic' test that confirms that we have expected results for scroll-snap coordinates
and calculated scroll-snap-offset values.
 
* css3/scroll-snap/scroll-snap-offsets.html: Added.
* platform/mac-wk2/TestExpectations: Remove flakiness annotation for scroll-snap-mandatory-overflow.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-iframe.html:
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-borders-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-borders.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-overflow.html:
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-padding-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-padding.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-rotated-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-rotated.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@183906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed