Changeset 261686 in webkit
- Timestamp:
- May 14, 2020 5:31:01 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261685 r261686 1 2020-05-14 Antoine Quint <graouts@apple.com> 2 3 Cursor should not update on a 20ms timer 4 https://bugs.webkit.org/show_bug.cgi?id=211884 5 <rdar://problem/63220368> 6 7 Reviewed by Antti Koivisto. 8 9 Update a (flaky) test to not use setTimeout() to test a cursor change and instead use requestAnimationFrame() 10 since cursor updates are now guaranteed to be run before the next requestAnimationFrame() callback. 11 12 * fast/events/mouse-cursor-no-mousemove.html: 13 * platform/mac-wk1/TestExpectations: 14 1 15 2020-05-14 Philippe Normand <pnormand@igalia.com> 2 16 -
trunk/LayoutTests/fast/events/mouse-cursor-no-mousemove.html
r158113 r261686 15 15 <div id="console"></div> 16 16 <script> 17 var CURSOR_UPDATE_DELAY = 50;18 17 19 18 description("Test that there is no mousemove event fired when changing cursor."); … … 29 28 } 30 29 31 // Can't do anything useful here without eventSender 32 if (window.eventSender) { 30 (async function() 31 { 32 // Can't do anything useful here without eventSender 33 if (!window.eventSender) 34 return; 35 33 36 var node = document.getElementById('target'); 34 37 debug('TEST CASE: ' + node.textContent); … … 40 43 }); 41 44 node.style.cursor = 'help'; 42 setTimeout(function() { 43 debug('Cursor Info: ' + window.internals.getCurrentCursorInfo()); 44 debug(''); 45 }, CURSOR_UPDATE_DELAY); 45 46 // Cursor will be updated during the next animation frame. 47 await new Promise(requestAnimationFrame); 48 debug('Cursor Info: ' + window.internals.getCurrentCursorInfo()); 49 debug(''); 46 50 47 51 // Give some time for the change to resolve. Fake mousemove event that caused bug, is using a timer 48 setTimeout(function() { 49 document.getElementById('test-container').style.display = 'none'; 50 finishJSTest(); 51 }, 150); 52 } 52 await new Promise(resolve => setTimeout(resolve, 100)); 53 document.getElementById('test-container').style.display = 'none'; 54 finishJSTest(); 55 })(); 53 56 54 57 </script> -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r261678 r261686 937 937 webkit.org/b/209353 [ Release ] media/video-background-tab-playback.html [ Pass Failure ] 938 938 939 webkit.org/b/209494 fast/events/mouse-cursor-no-mousemove.html [ Pass Failure ]940 941 939 webkit.org/b/209560 imported/w3c/web-platform-tests/xhr/send-response-upload-event-progress.htm [ Pass Crash Failure ] 942 940 -
trunk/Source/WebCore/ChangeLog
r261685 r261686 1 2020-05-14 Antoine Quint <graouts@apple.com> 2 3 Cursor should not update on a 20ms timer 4 https://bugs.webkit.org/show_bug.cgi?id=211884 5 <rdar://problem/63220368> 6 7 Reviewed by Antti Koivisto. 8 9 Update the cursor during page rendering rather than using a 20ms timer. 10 11 * page/EventHandler.cpp: 12 (WebCore::EventHandler::EventHandler): 13 (WebCore::EventHandler::clear): 14 (WebCore::EventHandler::updateCursorIfNeeded): 15 (WebCore::EventHandler::handleMouseMoveEvent): 16 (WebCore::EventHandler::scheduleCursorUpdate): 17 (WebCore::EventHandler::cursorUpdateTimerFired): Deleted. 18 * page/EventHandler.h: 19 * page/Page.cpp: 20 (WebCore::Page::updateRendering): 21 1 22 2020-05-14 Philippe Normand <pnormand@igalia.com> 2 23 -
trunk/Source/WebCore/page/EventHandler.cpp
r261382 r261686 396 396 : m_frame(frame) 397 397 , m_hoverTimer(*this, &EventHandler::hoverTimerFired) 398 , m_cursorUpdateTimer(*this, &EventHandler::cursorUpdateTimerFired)399 398 #if PLATFORM(MAC) 400 399 , m_clearLatchingStateTimer(*this, &EventHandler::clearLatchedStateTimerFired) … … 433 432 { 434 433 m_hoverTimer.stop(); 435 m_ cursorUpdateTimer.stop();434 m_hasScheduledCursorUpdate = false; 436 435 #if !ENABLE(IOS_TOUCH_EVENTS) 437 436 m_fakeMouseMoveEventTimer.stop(); … … 1417 1416 } 1418 1417 1419 void EventHandler:: cursorUpdateTimerFired()1420 { 1421 ASSERT(m_frame.document());1422 updateCursor();1418 void EventHandler::updateCursorIfNeeded() 1419 { 1420 if (std::exchange(m_hasScheduledCursorUpdate, false)) 1421 updateCursor(); 1423 1422 } 1424 1423 … … 1983 1982 m_hoverTimer.stop(); 1984 1983 1985 m_ cursorUpdateTimer.stop();1984 m_hasScheduledCursorUpdate = false; 1986 1985 1987 1986 #if !ENABLE(IOS_TOUCH_EVENTS) … … 3142 3141 void EventHandler::scheduleCursorUpdate() 3143 3142 { 3144 if (Page* page = m_frame.page()) { 3145 if (!page->chrome().client().supportsSettingCursor()) 3146 return; 3147 } 3148 3149 if (!m_cursorUpdateTimer.isActive()) 3150 m_cursorUpdateTimer.startOneShot(cursorUpdateInterval); 3143 if (m_hasScheduledCursorUpdate) 3144 return; 3145 3146 auto* page = m_frame.page(); 3147 if (!page) 3148 return; 3149 3150 if (!page->chrome().client().supportsSettingCursor()) 3151 return; 3152 3153 m_hasScheduledCursorUpdate = true; 3154 page->scheduleRenderingUpdate(); 3151 3155 } 3152 3156 -
trunk/Source/WebCore/page/EventHandler.h
r261382 r261686 320 320 321 321 bool useHandCursor(Node*, bool isOverLink, bool shiftKey); 322 void updateCursorIfNeeded(); 322 323 void updateCursor(); 323 324 … … 376 377 377 378 void hoverTimerFired(); 378 void cursorUpdateTimerFired();379 379 380 380 bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = nullptr); … … 534 534 535 535 Timer m_hoverTimer; 536 Timer m_cursorUpdateTimer;536 bool m_hasScheduledCursorUpdate { false }; 537 537 538 538 #if PLATFORM(MAC) -
trunk/Source/WebCore/page/Page.cpp
r261663 r261686 53 53 #include "EmptyClients.h" 54 54 #include "Event.h" 55 #include "EventHandler.h" 55 56 #include "EventNames.h" 56 57 #include "ExtensionStyleSheets.h" … … 1364 1365 1365 1366 forEachDocument([] (Document& document) { 1367 if (auto* frame = document.frame()) 1368 frame->eventHandler().updateCursorIfNeeded(); 1369 }); 1370 1371 forEachDocument([] (Document& document) { 1366 1372 document.runResizeSteps(); 1367 1373 });
Note: See TracChangeset
for help on using the changeset viewer.