Bug 49209

Summary: WebKit2 should exit auto scrolling mode when losing focus
Product: WebKit Reporter: Brian Weinstein <bweinstein>
Component: WebKit2Assignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, aroben, eric, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Attachments:
Description Flags
[PATCH] Fix
none
[PATCH] Fix in WebCore jhoneycutt: review+

Description Brian Weinstein 2010-11-08 14:18:03 PST
We do not exit pan scrolling mode when switching tabs in WebKit2.

In WebKit1, this was fixed by http://trac.webkit.org/changeset/50007, but the bug still exists in WebKit2.

Steps to reproduce:
1) Open two tabs, one that can scroll
2) Start panscrolling in the tab that can scroll
3) Switch focus to the other tab.

The pan scrolling icon stays active, even though it shouldn't.
Comment 1 Brian Weinstein 2010-11-08 14:25:05 PST
Created attachment 73285 [details]
[PATCH] Fix
Comment 2 Adam Roben (:aroben) 2010-11-08 14:27:57 PST
Comment on attachment 73285 [details]
[PATCH] Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=73285&action=review

Is it possible to make a test for this using TestWebKitAPI? You'd have to add code that can simulate a middle-click, and a way to make the WebView lose focus, and a way to detect whether the autoscroll timer was stopped.

> WebKit2/WebProcess/WebPage/WebPage.cpp:671
> +    FocusController* focusController = m_page->focusController();
> +    if (!isFocused)
> +        focusController->focusedOrMainFrame()->eventHandler()->stopAutoscrollTimer();
> +    focusController->setFocused(isFocused);

Should this code be in FocusController::setFocused instead?
Comment 3 Brian Weinstein 2010-11-08 14:44:59 PST
(In reply to comment #2)
> (From update of attachment 73285 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=73285&action=review
> 
> Is it possible to make a test for this using TestWebKitAPI? You'd have to add code that can simulate a middle-click, and a way to make the WebView lose focus, and a way to detect whether the autoscroll timer was stopped.

If it was a windows specific test, I could make sure the autoscroll timer was stopped by checking the scroll position before and after the timer was supposed to be killed, but I don't know if it's possible to test the gaining and losing focus of the web view.

> 
> > WebKit2/WebProcess/WebPage/WebPage.cpp:671
> > +    FocusController* focusController = m_page->focusController();
> > +    if (!isFocused)
> > +        focusController->focusedOrMainFrame()->eventHandler()->stopAutoscrollTimer();
> > +    focusController->setFocused(isFocused);
> 
> Should this code be in FocusController::setFocused instead?

No reason it shouldn't be, then it wouldn't be something that would need to be duplicated across WebKit platforms.
Comment 4 Brian Weinstein 2010-12-15 18:20:53 PST
Created attachment 76725 [details]
[PATCH] Fix in WebCore
Comment 5 WebKit Review Bot 2010-12-16 15:37:48 PST
http://trac.webkit.org/changeset/74170 might have broken Leopard Intel Debug (Tests)
Comment 6 Eric Seidel (no email) 2010-12-17 16:34:10 PST
Looks like this was landed but not closed.