Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1543)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 1121433003: Fix mouse cursor update timer to be page-global instead of per-frame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: bokan cr feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 70a4e3d1a50f9ae133edb824e092fe231b314fc1..11b051e2b090445001a2c501edbb030292cdf153 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -331,9 +331,7 @@ void EventHandler::clear()
m_longTapShouldInvokeContextMenu = false;
m_dragStartPos = LayoutPoint();
m_offsetFromResizeCorner = LayoutSize();
- m_currentMouseCursor = Cursor();
m_mouseDown = PlatformMouseEvent();
-
}
void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved)
@@ -1047,6 +1045,10 @@ void EventHandler::cursorUpdateTimerFired(Timer<EventHandler>*)
void EventHandler::updateCursor()
{
+ // We must do a cross-frame hit test because the frame that triggered the cursor
+ // update could be occluded by a different frame.
+ ASSERT(m_frame == m_frame->localFrameRoot());
+
if (m_mousePositionIsUnknown)
return;
@@ -1060,14 +1062,15 @@ void EventHandler::updateCursor()
m_frame->document()->updateLayout();
- HitTestRequest request(HitTestRequest::ReadOnly);
+ HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChildFrameContent);
HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosition));
layoutView->hitTest(result);
- OptionalCursor optionalCursor = selectCursor(result);
- if (optionalCursor.isCursorChange()) {
- m_currentMouseCursor = optionalCursor.cursor();
- view->setCursor(m_currentMouseCursor);
+ if (LocalFrame* frame = result.innerNodeFrame()) {
+ OptionalCursor optionalCursor = frame->eventHandler().selectCursor(result);
+ if (optionalCursor.isCursorChange()) {
+ view->setCursor(optionalCursor.cursor());
+ }
}
}
@@ -1079,10 +1082,8 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result)
Page* page = m_frame->page();
if (!page)
return NoCursorChange;
-#if OS(WIN)
if (panScrollInProgress())
return NoCursorChange;
-#endif
Node* node = result.innerPossiblyPseudoNode();
if (!node)
@@ -1520,8 +1521,7 @@ bool EventHandler::handleMouseMoveOrLeaveEvent(const PlatformMouseEvent& mouseEv
if (FrameView* view = m_frame->view()) {
OptionalCursor optionalCursor = selectCursor(mev.hitTestResult());
if (optionalCursor.isCursorChange()) {
- m_currentMouseCursor = optionalCursor.cursor();
- view->setCursor(m_currentMouseCursor);
+ view->setCursor(optionalCursor.cursor());
}
}
}
@@ -3134,6 +3134,10 @@ void EventHandler::scheduleHoverStateUpdate()
void EventHandler::scheduleCursorUpdate()
{
+ // We only want one timer for the page, rather than each frame having it's own timer
+ // competing which eachother (since there's only one mouse cursor).
+ ASSERT(m_frame == m_frame->localFrameRoot());
+
if (!m_cursorUpdateTimer.isActive())
m_cursorUpdateTimer.startOneShot(cursorUpdateInterval, FROM_HERE);
}
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698