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: http://svn.webkit.org/repository/webkit/trunk@147739 268f45cc-cd09-0410-ab3c-d52691b4dbfc