Bug 142705

Summary: [iOS] scroll snap points are animating to the wrong position.
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: Layout and RenderingAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Critical CC: benjamin, bfulgham, buildbot, cmarcelo, commit-queue, dino, jamesr, luiz, rniwa, simon.fraser, thorton, tonikitoo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=142706
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews105 for mac-mavericks-wk2
none
Archive of layout-test-results from ews100 for mac-mavericks
none
Patch v2 (Revised to correct test crash) simon.fraser: review+

Description Brent Fulgham 2015-03-14 20:31:36 PDT
Mainframe scroll snap animation on iOS are not landing on the right spots. The amount we are "off" of expected varies with markup.
Comment 1 Brent Fulgham 2015-03-14 20:32:23 PDT
<rdar://problem/20136946>
Comment 2 Brent Fulgham 2015-03-14 20:48:22 PDT
Created attachment 248664 [details]
Patch
Comment 3 Brent Fulgham 2015-03-14 20:53:09 PDT
Scroll snapping was landing in the wrong place on iOS because of two problems:
(1) It was searching for the closest snap offset point using unscaled 'screen' pixels,
    which caused it to always choose one of the earliest snap point options.
(2) It was then selecting a scaled snap point coordinate and passing it back to UIKit
    to animate the snap. This caused it to select a target point beyond the 'screen'
    pixel we want to hit.

The solution to both problems are to scale the scroll destination UIKit suggests so that
we search among the scaled points with a valid value. Then, we need to scale the returned
value back to screen units before handing it back to UIKit to process.
Comment 4 Build Bot 2015-03-14 21:07:10 PDT
Comment on attachment 248664 [details]
Patch

Attachment 248664 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5213893995528192

New failing tests:
css3/scroll-snap/scroll-snap-position-values.html
css3/scroll-snap/scroll-snap-initial.html
Comment 5 Build Bot 2015-03-14 21:07:17 PDT
Created attachment 248665 [details]
Archive of layout-test-results from ews105 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 6 Brent Fulgham 2015-03-14 21:08:09 PDT
I will correct the test expectations when landing.
Comment 7 Build Bot 2015-03-14 21:13:38 PDT
Comment on attachment 248664 [details]
Patch

Attachment 248664 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6102462599528448

New failing tests:
css3/scroll-snap/scroll-snap-position-values.html
css3/scroll-snap/scroll-snap-initial.html
Comment 8 Build Bot 2015-03-14 21:13:44 PDT
Created attachment 248666 [details]
Archive of layout-test-results from ews100 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 9 Brent Fulgham 2015-03-14 21:52:56 PDT
Created attachment 248669 [details]
Patch v2 (Revised to correct test crash)
Comment 10 Brent Fulgham 2015-03-14 22:11:49 PDT
Committed r181504: <http://trac.webkit.org/changeset/181504>