Bug 84178

Summary: Relax ScrollView::adjustScrollPositionWithinRange in case constrainsScrollingToContentEdge is false
Product: WebKit Reporter: Antonio Gomes <tonikitoo>
Component: PlatformAssignee: Antonio Gomes <tonikitoo>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, kenneth, manyoso, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 73144    
Attachments:
Description Flags
(wrong patch, please ignore) patch
none
(committed r114770, r=atreat) patch - the right patch this time none

Description Antonio Gomes 2012-04-17 11:56:28 PDT
Right now, when a port has delegatesScrolling set to FALSE, and constrainsScrollingToContentEdge set to FALSE (i.e. it accepts overscrolled position), calling ScrollView::setScrollPosition with an overscrolled position still gets the position clamped to the content size edges.

We could relax ::adjustScrollPositionWithinRange in that sense.
Comment 1 Antonio Gomes 2012-04-17 11:56:44 PDT
*** Bug 84176 has been marked as a duplicate of this bug. ***
Comment 2 Anders Carlsson 2012-04-17 11:58:45 PDT
I think doing so would break a lot of assumptions inside WebCore. I tried doing something like this in ScrollView::updateScrollbars and it did not work well.
Comment 3 Antonio Gomes 2012-04-17 12:12:06 PDT
(In reply to comment #2)
> I think doing so would break a lot of assumptions inside WebCore. I tried doing something like this in ScrollView::updateScrollbars and it did not work well.

Would you remember what kind of assumptions? We run with this since a while without problems...

If we do not have such a "relaxation" if user over scrolls a webpage, say to (0, -20) webcore would be tracking a scroll position of (0, 0).
Comment 4 Antonio Gomes 2012-04-17 12:20:47 PDT
Note that ScrollView::setScrollOffset does something similar already:

340 void ScrollView::setScrollOffset(const IntPoint& offset)
341 {                                                                          342     int horizontalOffset = offset.x();
343     int verticalOffset = offset.y();
344     if (constrainsScrollingToContentEdge()) {
345         horizontalOffset = max(min(horizontalOffset, contentsWidth() - visibleWidth()), 0);
346         verticalOffset = max(min(verticalOffset, contentsHeight() - visibleHeight()), 0); 
347     }        
....
Comment 5 Antonio Gomes 2012-04-17 12:23:42 PDT
Created attachment 137582 [details]
(wrong patch, please ignore) patch

Patch for discussion.

Call  sites of ScrollView::adjustScrollPositionWithinRange from ::setScrollPosition and ::updateScrollbars.
Comment 6 Antonio Gomes 2012-04-18 09:37:38 PDT
Created attachment 137708 [details]
(committed r114770, r=atreat) patch - the right patch this time
Comment 7 Antonio Gomes 2012-04-19 22:15:31 PDT
<tonikitoo> andersca, sir, would you have some minutes to talk about? https://bugs.webkit.org/show_bug.cgi?id=84178
<tonikitoo> (shame we can not talk in person during the summit :( )
<andersca>  tonikitoo: yes, I think I was wrong about my assumption
<andersca>  tonikitoo: if you have a Mac you can test if it breaks things by going to a page with a vertical scrollbar, scroll to the bottom
<andersca>  tonikitoo: then hit command-f to show the find banner and escape to hide it
<tonikitoo> scrollview::setscrollposition calls it I think
<andersca>  tonikitoo: and make sure that the behavior is the same even with your patch
...
<tonikitoo> andersca, just to let you know: I got it tested on a safari build with and without the patch, and behaviour looks the same
<andersca>  tonikitoo: excellent
Comment 8 Adam Treat 2012-04-20 11:43:33 PDT
Comment on attachment 137708 [details]
(committed r114770, r=atreat) patch - the right patch this time

lgtm and tested against mac port with no regression so r+
Comment 9 Antonio Gomes 2012-04-20 12:32:40 PDT
Comment on attachment 137708 [details]
(committed r114770, r=atreat) patch - the right patch this time

Committed http://trac.webkit.org/changeset/114770