Bug 144710

Summary: Scroll-snap point produces strange 'default' snap offset vector
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: Layout and RenderingAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED INVALID    
Severity: Normal CC: bfulgham, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=144647
Attachments:
Description Flags
Screenshot showing horizontal scrollbar none

Description Brent Fulgham 2015-05-06 14:25:19 PDT
When we have scroll-snap point markup that specifies a horizontal snap range, but not a vertical, we get a default value of "{0, 15}".

Example:
  .horizontalGallery {
      width: 300px;
      height: 300px;
      overflow-y: hidden;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      -webkit-scroll-snap-points-x: repeat(100%);
      -webkit-scroll-snap-type: mandatory;
  }

This produces snap points as follows:
  horizontal = { 0, 300, 600, 900, 1200, 1500 }, vertical = { 0, 15 }

I would expect to see either no snap points, or snap points for the two scroll extrema (i.e., vertical = { 0, 1500 }
Comment 1 Brent Fulgham 2015-05-06 14:29:17 PDT
We enter the 'updateFromStyle' helper function in AxisScrollSnapOffsets.cpp with no vertical offset values. These are being set as the default positions:
1. We always append 0 when we have a scrollable area.
2. We always append the value of 'scroll{Width|Height}' - 'view{Width|Height}'

In the test case 'scroll-snap-coordinates-borders.html', we somehow have a scrollable area that is 15 pixels larger than the view area. Could this be due to scrollbars?
Comment 2 Brent Fulgham 2015-05-06 15:52:30 PDT
Measuring the pixels on a screenshot shows that the horizontal scrollbar is 15 pixels high, which is why we appear to have a vertical scrollable area of 15 pixels.

I think this is working correctly.
Comment 3 Brent Fulgham 2015-05-06 15:53:05 PDT
Created attachment 252534 [details]
Screenshot showing horizontal scrollbar