ASSIGNED105729
Mouse cursor is not reset when a new page is loaded
https://bugs.webkit.org/show_bug.cgi?id=105729
Summary Mouse cursor is not reset when a new page is loaded
Chris Dumez
Reported 2012-12-24 10:45:37 PST
The mouse cursor is not reset when a new page is loaded. As a result, the cursor from the previous page is shown until the cursor is moved. This causes flakiness in our layout tests as well. I was able to reproduce the flakiness by running: Tools/Scripts/run-webkit-tests --efl --debug -2 -p --child-processes=1 fast/css/color-correction.html fast/css/crash-on-custom-cursor-when-loading.html fast/css/create_element_align.xhtml fast/css/color-correction.html loads the purple-srgb.png resource in the cache, then fast/css/crash-on-custom-cursor-when-loading.html shows a custom mouse cursor (purple-srgb.png), finally the custom cursor is still shown on fast/css/create_element_align.xhtml, which is wrong. As a consequence, fast/css/create_element_align.xhtml and others are flakey when running pixel tests.
Attachments
Patch (12.48 KB, patch)
2012-12-24 11:02 PST, Chris Dumez
no flags
Patch (12.57 KB, patch)
2012-12-24 11:08 PST, Chris Dumez
webkit.review.bot: commit-queue-
Patch (8.44 KB, patch)
2012-12-24 12:51 PST, Chris Dumez
no flags
Patch (12.60 KB, patch)
2012-12-24 12:52 PST, Chris Dumez
no flags
Patch (12.53 KB, patch)
2013-01-01 02:38 PST, Chris Dumez
darin: review-
Chris Dumez
Comment 1 2012-12-24 11:02:19 PST
WebKit Review Bot
Comment 2 2012-12-24 11:04:53 PST
Attachment 180681 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 LayoutTests/platform/chromium/TestExpectations:4236: Test lacks BUG modifier. [test/expectations] [5] LayoutTests/platform/gtk/TestExpectations:55: Test lacks BUG modifier. [test/expectations] [5] Total errors found: 2 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 3 2012-12-24 11:05:05 PST
I doubt this belongs in FrameLoader directly...
Chris Dumez
Comment 4 2012-12-24 11:05:17 PST
Sadly, I couldn't make it a reftest (the custom cursor would not show). I can reproduce the issue only for pixel tests so the new test is a pixel test.
Chris Dumez
Comment 5 2012-12-24 11:08:49 PST
Created attachment 180682 [details] Patch Fix style errors.
Chris Dumez
Comment 6 2012-12-24 11:20:53 PST
(In reply to comment #3) > I doubt this belongs in FrameLoader directly... Thanks for taking I did not know where else I should reset the mouse cursor from. The mouse cursor is currently set in Source/WebCore/page/EventHandler.cpp but I need to know when a new page is loaded to reset it. Therefore, I thought of the FrameLoader. Do you have a suggestion where I should move it to if you think adding this to the FrameLoader is a bad idea? I could do the same from the FrameLoader client but then it would be port-specific.
WebKit Review Bot
Comment 7 2012-12-24 12:16:58 PST
Comment on attachment 180682 [details] Patch Attachment 180682 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/15507536 New failing tests: fast/parser/document-write-ignores-later-network-bytes.html fast/frames/frame-unload-crash2.html
Chris Dumez
Comment 8 2012-12-24 12:51:25 PST
Created attachment 180687 [details] Patch Add null check for m_frame->view(). Should fix regression for fast/frames/frame-unload-crash2.html
Chris Dumez
Comment 9 2012-12-24 12:52:11 PST
Alexey Proskuryakov
Comment 10 2012-12-31 19:14:14 PST
It's weird for loading machinery to be also responsible for cursors. It is complicated enough already. What is the easiest way to reproduce this in a browser? I don't think that I'm seeing this in Safari.
Chris Dumez
Comment 11 2013-01-01 00:58:50 PST
(In reply to comment #10) > It's weird for loading machinery to be also responsible for cursors. It is complicated enough already. > > What is the easiest way to reproduce this in a browser? I don't think that I'm seeing this in Safari. I have created a small page to reproduce this easily in a browser: http://hydr0g3n.free.fr/testcursor/ Just hover the link (custom cursor should appear), then click the link and keep the mouse cursor still. The custom cursor will stay after the new page is loaded. I can reproduce the issue in EFL's MiniBrowser and with Chromium but not with Safari.
Chris Dumez
Comment 12 2013-01-01 02:38:07 PST
Created attachment 180987 [details] Patch Move cursor reset code to FrameLoader::transitionToCommitted() since it seems slightly better than FrameLoader::commitProvisionalLoad(). I know it would be nice to move this out of the FrameLoader but I haven't found the right place for this yet. It would be nice to keep the fix in non port-specific code.
Eric Seidel (no email)
Comment 13 2013-01-01 09:25:22 PST
Manually setting the cursor is pretty lame, but that may be our API in WebCore. What happens if the cursor is already set to something else when the load is committed? For example, what happens if you click the link, but before the load completes you move your cursor over the URL bar? It shoudl be an i-bar, but this code is now going to reset it forcefully to a pointer when the page loads.
Chris Dumez
Comment 14 2013-01-01 10:02:31 PST
(In reply to comment #13) > Manually setting the cursor is pretty lame, but that may be our API in WebCore. What happens if the cursor is already set to something else when the load is committed? > > For example, what happens if you click the link, but before the load completes you move your cursor over the URL bar? It shoudl be an i-bar, but this code is now going to reset it forcefully to a pointer when the page loads. Right, resetting to a pointer is not a good idea. We need to update the mouse cursor instead. I'll check EventHandler::dispatchFakeMouseMoveEventSoon(). It seems to be used to update the cursor in cases such as scrolling already.
Alexey Proskuryakov
Comment 15 2013-01-01 10:20:54 PST
So how does Safari do this?
Darin Adler
Comment 16 2013-01-15 15:53:06 PST
Comment on attachment 180987 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=180987&action=review Seems like a good idea to get the cursor set, but we need to do this some way other than setting it explicitly to the pointer cursor. > Source/WebCore/loader/FrameLoader.cpp:1813 > + // Make sure the mouse cursor is reset. > + if (isLoadingMainFrame()) > + m_frame->page()->chrome()->client()->setCursor(pointerCursor()); This is not right. We want to set the cursor to the appropriate cursor for the new page, not unconditionally set it to a pointer. We don’t want the cursor to flash to a pointer every time a new page is loaded, if we’re going from one page to the next.
Chris Dumez
Comment 17 2013-01-21 11:04:11 PST
Unfortunately, EventHandler::dispatchFakeMouseMoveEventSoon() does not have the intended effect in this case because EventHandler::clear() is called by FrameLoader::clear() when a new page is loaded. EventHandler::clear() resets m_mousePositionIsUnknown to true and clears m_lastKnownMousePosition. EventHandler::dispatchFakeMouseMoveEventSoon() requires the last mouse position to be known in order to work.
Note You need to log in before you can comment on or make changes to this bug.