Bug 104764 - Handling autoscroll in EventHandler should be re-factor
Summary: Handling autoscroll in EventHandler should be re-factor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: yosin
URL:
Keywords:
Depends on: 104991
Blocks: 39725
  Show dependency treegraph
 
Reported: 2012-12-11 21:55 PST by yosin
Modified: 2012-12-14 00:33 PST (History)
9 users (show)

See Also:


Attachments
Patch 1 (29.17 KB, patch)
2012-12-12 01:57 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 2 (29.29 KB, patch)
2012-12-12 02:34 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 3 (42.02 KB, patch)
2012-12-12 23:37 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 4 (42.01 KB, patch)
2012-12-12 23:48 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 5 (41.80 KB, patch)
2012-12-13 00:03 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 6 (42.92 KB, patch)
2012-12-13 00:54 PST, yosin
no flags Details | Formatted Diff | Diff
Patch 7 (42.87 KB, patch)
2012-12-13 22:08 PST, yosin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yosin 2012-12-11 21:55:36 PST
There are number of works regarding auto scrolling, e.g. drag-and-drop with autoscroll, drag-and-drop with gesture, and so on.
It seems code for handling auto scroll will be increased, e.g. https://bugs.webkit.org/attachment.cgi?id=177950&action=prettypatch

To make code of EventHandler clean and extensible, we should factor out autoscroll handling from EventHandler class.
Comment 1 yosin 2012-12-12 01:57:23 PST
Created attachment 179003 [details]
Patch 1
Comment 2 yosin 2012-12-12 01:58:40 PST
Comment on attachment 179003 [details]
Patch 1

Could you review this patch?
Thanks in advance.
Comment 3 Early Warning System Bot 2012-12-12 02:13:45 PST
Comment on attachment 179003 [details]
Patch 1

Attachment 179003 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/15280432
Comment 4 WebKit Review Bot 2012-12-12 02:19:00 PST
Comment on attachment 179003 [details]
Patch 1

Attachment 179003 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15280431
Comment 5 yosin 2012-12-12 02:34:21 PST
Created attachment 179010 [details]
Patch 2
Comment 6 yosin 2012-12-12 02:35:31 PST
Comment on attachment 179010 [details]
Patch 2

Could you review this patch?
Thanks in advance.

= Changes from the last patch =
* Fix compilation error on Linux
** Windows compilation was succeeded on Patch 1...
Comment 7 Build Bot 2012-12-12 03:10:49 PST
Comment on attachment 179010 [details]
Patch 2

Attachment 179010 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15275617
Comment 8 Hajime Morrita 2012-12-12 03:37:49 PST
Comment on attachment 179010 [details]
Patch 2

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

> Source/WebCore/page/EventHandler.cpp:1057
>  void EventHandler::stopAutoscrollTimer(bool rendererIsBeingDestroyed)

This is bad. We should make this just a delegation to AutoScrollController then 
AutoScrollController can notify back to event handler to do cleanup.
Hopefully more code could be move to the controller.

> Source/WebCore/page/EventHandler.cpp:3940
> +    , m_eventHandler(eventHandler)

Can we pass this as a function parameter instead of holding this as a member?
Cyclic reference is bad design and should be avoided as much as possible.

> Source/WebCore/page/EventHandler.cpp:4078
> +    bool east = m_panScrollStartPos.x() < (m_eventHandler->m_currentMousePosition.x() - ScrollView::noPanScrollRadius);

If we can change to pass EventHandler as a parameter. We even no longer need to pass it: We only need to pass m_currentMousePosition and FrameView.

> Source/WebCore/page/EventHandler.h:247
> +    enum AutoscrollType {

I think this is safe to be WebCore global. name looks unique enough.

> Source/WebCore/page/EventHandler.h:255
> +    class AutoscrollController {

Let's move this out from EventHandler definition. nested class often results maintenance burden.
Comment 9 yosin 2012-12-12 23:37:24 PST
Created attachment 179210 [details]
Patch 3
Comment 10 yosin 2012-12-12 23:48:51 PST
Created attachment 179211 [details]
Patch 4
Comment 11 yosin 2012-12-13 00:03:57 PST
Created attachment 179212 [details]
Patch 5
Comment 12 yosin 2012-12-13 00:06:18 PST
Comment on attachment 179212 [details]
Patch 5

Could you review this patch?
Thanks in advance.

= Changes since the last review =
* Move AutoscrollController class to its own files.
* Remove m_eventHandler from AutoscrollController
** Using m_autoscrollRenderer->frame()->eventHandler() if we needed.
* EventHandler::stopAutoscrollTimer() is just wrapper of AutoscrollController::stopAutoscrollTimer().
Comment 13 Hajime Morrita 2012-12-13 00:30:07 PST
Comment on attachment 179212 [details]
Patch 5

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

This looks much better!

> Source/WebCore/page/EventHandler.h:118
> +    AutoscrollController& autoscrollController() { return m_autoscrollController; }

Let's kill this. We can just provide didPanScrollStop() and didPanScrollStart() or something to limit the usage.

> Source/WebCore/page/EventHandler.h:404
> +    AutoscrollController m_autoscrollController;

And make this OwnPtr. Then we can hide AutoscrollController.h in EventHandler.cpp.
Comment 14 yosin 2012-12-13 00:54:38 PST
Created attachment 179224 [details]
Patch 6
Comment 15 yosin 2012-12-13 00:57:41 PST
Comment on attachment 179224 [details]
Patch 6

Could you review this patch?
Thanks in advance.

= Changes since the last review =
* In EventHandler, use OwnPtr for AutoscrollController instead of containment.
* Introduce didPanScrollStart/didPanScrollTop not to exposure AutoscrollControll.
Comment 16 Hajime Morrita 2012-12-13 01:02:35 PST
Comment on attachment 179224 [details]
Patch 6

Please wait until bots become green.
Comment 17 yosin 2012-12-13 17:46:52 PST
Comment on attachment 179224 [details]
Patch 6

Clearing flags on attachment: 179224

Committed r137691: <http://trac.webkit.org/changeset/137691>
Comment 18 yosin 2012-12-13 17:46:58 PST
All reviewed patches have been landed.  Closing bug.
Comment 19 Roger Fong 2012-12-13 18:47:24 PST
Regression caused:

http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r137691%20(30897)/results.html

platform/win/fast/events/panScroll-click-hyperlink.html	
platform/win/fast/events/panScroll-event-fired.html
platform/win/fast/events/panScroll-nested-divs.html

It says the tests fail because pan scrolling may not be supported on the platform.
However, seeing as this is just a refactor, that does not seem to be the case.

Reopening bug.
Comment 20 Hajime Morrita 2012-12-13 18:59:20 PST
(In reply to comment #19)
> Regression caused:
> 
> http://build.webkit.org/results/Apple%20Win%207%20Release%20(Tests)/r137691%20(30897)/results.html
> 
> platform/win/fast/events/panScroll-click-hyperlink.html    
> platform/win/fast/events/panScroll-event-fired.html
> platform/win/fast/events/panScroll-nested-divs.html
> 
> It says the tests fail because pan scrolling may not be supported on the platform.
> However, seeing as this is just a refactor, that does not seem to be the case.
> 
> Reopening bug.

Thanks for the taking care of this. Yes, this patch shouldn't change the behavior.
Comment 21 yosin 2012-12-13 19:45:19 PST
Sorry, rolling out now.
Comment 22 yosin 2012-12-13 19:48:01 PST
Reverted r137691 for reason:

panscroll test on AppleWin failed

Committed r137703: <http://trac.webkit.org/changeset/137703>
Comment 23 yosin 2012-12-13 22:08:22 PST
Created attachment 179418 [details]
Patch 7
Comment 24 yosin 2012-12-13 22:11:09 PST
Comment on attachment 179418 [details]
Patch 7

Could you review this patch?
Thanks in advance.

= Changes since the last patch =
* In EventHandler::handleMouseReleaseEvent, calling stopAutoscrollTimer() if autoscroll in progress. Previous patch does't check it.
** So, during pan-scrolling mouse up stops pan-scrolling, then some tests failed, e.g. panscroll-clicking-hyperlink.html
Comment 25 Hajime Morrita 2012-12-13 22:45:41 PST
On bug 104991, Yoshin is adding a test for Chromium port to cover this.
Comment 26 yosin 2012-12-14 00:33:27 PST
Comment on attachment 179418 [details]
Patch 7

Clearing flags on attachment: 179418

Committed r137726: <http://trac.webkit.org/changeset/137726>
Comment 27 yosin 2012-12-14 00:33:33 PST
All reviewed patches have been landed.  Closing bug.