Source/WebCore: Updating mouse cursor on style changes without emitting fake mousemov...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2013 12:38:41 +0000 (12:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2013 12:38:41 +0000 (12:38 +0000)
commite095b6eb4b18f022ade46f6f002711f5255a6236
treea8f1542d6925895498feffc61a48defe00b253c8
parent09d3a2206a1dd15d4c4cf1a96cc9e5fa10d6726c
Source/WebCore: Updating mouse cursor on style changes without emitting fake mousemove event
https://bugs.webkit.org/show_bug.cgi?id=101857

Patch by Aivo Paas <aivopaas@gmail.com> on 2013-04-05
Reviewed by Allan Sandfeld Jensen.

Mouse cursor changes in styles used to be reflected in UI through dispatching a fake
mousemove event. The old approach has some flaws: it emits a mousemove event in
javascript when there is no mouse movement involved (bug 85343); the fake mousemove
event is cancelled while there is a mouse button held down - cursor won't change
until mouse is moved or the button released (bug 53341).

The new approach does not use the fake mousemove event. Instead, it uses only the logic
needed for the actual cursor change to happen.

EventHandler::selectCursor was refactored to not take a whole mouse event but instead work with
HitTestResult so that EventHandler::updateCursor must not create a useless PlatformEvent.

Fixes: https://bugs.webkit.org/show_bug.cgi?id=85343 (mousemove event on cursor change)
       https://bugs.webkit.org/show_bug.cgi?id=53341 (no cursor change when mouse button down)

Tests: fast/events/mouse-cursor-change.html
       fast/events/mouse-cursor-no-mousemove.html

* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::cursorUpdateTimerFired):
(WebCore::EventHandler::updateCursor):
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::scheduleCursorUpdate):
* page/EventHandler.h:
* page/FrameView.cpp:
(WebCore::FrameView::shouldSetCursor):
* page/FrameView.h:
* page/MouseEventWithHitTestResults.cpp:
(WebCore::MouseEventWithHitTestResults::isOverLink):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::isOverLink):
* rendering/HitTestResult.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::styleDidChange):

LayoutTests: Updating mouse cursor on style changes without emitting fake mousemove event
https://bugs.webkit.org/show_bug.cgi?id=101857
Changing CSS cursor should work no matter is mouse button is pressed or not
https://bugs.webkit.org/show_bug.cgi?id=53341

Patch by Aivo Paas <aivopaas@gmail.com> on 2013-04-05
Reviewed by Allan Sandfeld Jensen.

Added tests for changing cursor on mousemove, mousedown, mouseup and mousemove
while mouse button being held down. Also added test to verify that a mousemove
event is not fired for changing cursor when mouse is not moving.

* fast/events/mouse-cursor-change-expected.txt: Added.
* fast/events/mouse-cursor-change.html: Added.
* fast/events/mouse-cursor-no-mousemove-expected.txt: Added.
* fast/events/mouse-cursor-no-mousemove.html: Added.
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/mouse-cursor-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/mouse-cursor-change.html [new file with mode: 0644]
LayoutTests/fast/events/mouse-cursor-no-mousemove-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/mouse-cursor-no-mousemove.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/MouseEventWithHitTestResults.cpp
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/HitTestResult.h
Source/WebCore/rendering/RenderObject.cpp