Bug 135670

Summary: Consolidate logic for calculating scrollbar page step size
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: Layout and RenderingAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch simon.fraser: review+

Description Brent Fulgham 2014-08-06 14:04:50 PDT
There are a number of places in WebCore where the same complicated declaration is used:

        int pageStep = std::max(std::max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);

To ensure that the correct rounding/truncating and clamping are used in all of these places, we should create a method that does this job for us:

        int pageStep = Scrollbar::pageStep(clientWidth);
Comment 1 Brent Fulgham 2014-08-06 14:11:03 PDT
Furthermore, attempt to reduce small scroll calculation errors by properly rounding fractional step amounts by using lroundf during the calculation of the step size.
Comment 2 Brent Fulgham 2014-08-06 14:12:45 PDT
Created attachment 236134 [details]
Patch
Comment 3 Radar WebKit Bug Importer 2014-08-06 16:00:44 PDT
<rdar://problem/17938368>
Comment 4 Brent Fulgham 2014-08-06 16:04:24 PDT
Committed r172182: <http://trac.webkit.org/changeset/172182>