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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 14612004: Remove CURSOR_VISIBILITY, it's always off (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix UseCounter Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/page/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 , m_mouseDownTimestamp(0) 304 , m_mouseDownTimestamp(0)
305 , m_widgetIsLatched(false) 305 , m_widgetIsLatched(false)
306 , m_originatingTouchPointTargetKey(0) 306 , m_originatingTouchPointTargetKey(0)
307 , m_touchPressed(false) 307 , m_touchPressed(false)
308 , m_scrollGestureHandlingNode(0) 308 , m_scrollGestureHandlingNode(0)
309 , m_lastHitTestResultOverWidget(false) 309 , m_lastHitTestResultOverWidget(false)
310 , m_maxMouseMovedDuration(0) 310 , m_maxMouseMovedDuration(0)
311 , m_baseEventType(PlatformEvent::NoType) 311 , m_baseEventType(PlatformEvent::NoType)
312 , m_didStartDrag(false) 312 , m_didStartDrag(false)
313 , m_didLongPressInvokeContextMenu(false) 313 , m_didLongPressInvokeContextMenu(false)
314 #if ENABLE(CURSOR_VISIBILITY)
315 , m_autoHideCursorTimer(this, &EventHandler::autoHideCursorTimerFired)
316 #endif
317 { 314 {
318 } 315 }
319 316
320 EventHandler::~EventHandler() 317 EventHandler::~EventHandler()
321 { 318 {
322 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); 319 ASSERT(!m_fakeMouseMoveEventTimer.isActive());
323 #if ENABLE(CURSOR_VISIBILITY)
324 ASSERT(!m_autoHideCursorTimer.isActive());
325 #endif
326 } 320 }
327 321
328 DragState& EventHandler::dragState() 322 DragState& EventHandler::dragState()
329 { 323 {
330 DEFINE_STATIC_LOCAL(DragState, state, ()); 324 DEFINE_STATIC_LOCAL(DragState, state, ());
331 return state; 325 return state;
332 } 326 }
333 327
334 void EventHandler::clear() 328 void EventHandler::clear()
335 { 329 {
336 m_hoverTimer.stop(); 330 m_hoverTimer.stop();
337 m_fakeMouseMoveEventTimer.stop(); 331 m_fakeMouseMoveEventTimer.stop();
338 #if ENABLE(CURSOR_VISIBILITY)
339 cancelAutoHideCursorTimer();
340 #endif
341 m_resizeLayer = 0; 332 m_resizeLayer = 0;
342 m_nodeUnderMouse = 0; 333 m_nodeUnderMouse = 0;
343 m_lastNodeUnderMouse = 0; 334 m_lastNodeUnderMouse = 0;
344 #if ENABLE(SVG) 335 #if ENABLE(SVG)
345 m_instanceUnderMouse = 0; 336 m_instanceUnderMouse = 0;
346 m_lastInstanceUnderMouse = 0; 337 m_lastInstanceUnderMouse = 0;
347 #endif 338 #endif
348 m_lastMouseMoveEventSubframe = 0; 339 m_lastMouseMoveEventSubframe = 0;
349 m_lastScrollbarUnderMouse = 0; 340 m_lastScrollbarUnderMouse = 0;
350 m_clickCount = 0; 341 m_clickCount = 0;
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 if (panScrollInProgress()) 1143 if (panScrollInProgress())
1153 return NoCursorChange; 1144 return NoCursorChange;
1154 #endif 1145 #endif
1155 1146
1156 Node* node = event.targetNode(); 1147 Node* node = event.targetNode();
1157 RenderObject* renderer = node ? node->renderer() : 0; 1148 RenderObject* renderer = node ? node->renderer() : 0;
1158 RenderStyle* style = renderer ? renderer->style() : 0; 1149 RenderStyle* style = renderer ? renderer->style() : 0;
1159 bool horizontalText = !style || style->isHorizontalWritingMode(); 1150 bool horizontalText = !style || style->isHorizontalWritingMode();
1160 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor(); 1151 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
1161 1152
1162 #if ENABLE(CURSOR_VISIBILITY)
1163 if (style && style->cursorVisibility() == CursorVisibilityAutoHide) {
1164 UseCounter::count(m_frame->document(), UseCounter::CursorVisibility);
1165 startAutoHideCursorTimer();
1166 } else
1167 cancelAutoHideCursorTimer();
1168 #endif
1169
1170 // During selection, use an I-beam no matter what we're over. 1153 // During selection, use an I-beam no matter what we're over.
1171 // If a drag may be starting or we're capturing mouse events for a particula r node, don't treat this as a selection. 1154 // If a drag may be starting or we're capturing mouse events for a particula r node, don't treat this as a selection.
1172 if (m_mousePressed && m_mouseDownMayStartSelect 1155 if (m_mousePressed && m_mouseDownMayStartSelect
1173 && !m_mouseDownMayStartDrag 1156 && !m_mouseDownMayStartDrag
1174 && m_frame->selection()->isCaretOrRange() && !m_capturingMouseEventsNode ) 1157 && m_frame->selection()->isCaretOrRange() && !m_capturingMouseEventsNode )
1175 return iBeam; 1158 return iBeam;
1176 1159
1177 if (renderer) { 1160 if (renderer) {
1178 Cursor overrideCursor; 1161 Cursor overrideCursor;
1179 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) { 1162 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 case CURSOR_WEBKIT_ZOOM_OUT: 1284 case CURSOR_WEBKIT_ZOOM_OUT:
1302 return zoomOutCursor(); 1285 return zoomOutCursor();
1303 case CURSOR_WEBKIT_GRAB: 1286 case CURSOR_WEBKIT_GRAB:
1304 return grabCursor(); 1287 return grabCursor();
1305 case CURSOR_WEBKIT_GRABBING: 1288 case CURSOR_WEBKIT_GRABBING:
1306 return grabbingCursor(); 1289 return grabbingCursor();
1307 } 1290 }
1308 return pointerCursor(); 1291 return pointerCursor();
1309 } 1292 }
1310 1293
1311 #if ENABLE(CURSOR_VISIBILITY)
1312 static const double timeWithoutMouseMovementBeforeHidingControls = 3;
1313
1314 void EventHandler::startAutoHideCursorTimer()
1315 {
1316 Page* page = m_frame->page();
1317 if (!page)
1318 return;
1319
1320 m_autoHideCursorTimer.startOneShot(timeWithoutMouseMovementBeforeHidingContr ols);
1321
1322 // The fake mouse move event screws up the auto-hide feature (by resetting t he auto-hide timer)
1323 // so cancel any pending fake mouse moves.
1324 if (m_fakeMouseMoveEventTimer.isActive())
1325 m_fakeMouseMoveEventTimer.stop();
1326 }
1327
1328 void EventHandler::cancelAutoHideCursorTimer()
1329 {
1330 if (m_autoHideCursorTimer.isActive())
1331 m_autoHideCursorTimer.stop();
1332 }
1333
1334 void EventHandler::autoHideCursorTimerFired(Timer<EventHandler>* timer)
1335 {
1336 ASSERT_UNUSED(timer, timer == &m_autoHideCursorTimer);
1337 m_currentMouseCursor = noneCursor();
1338 FrameView* view = m_frame->view();
1339 if (view && view->isActive())
1340 view->setCursor(m_currentMouseCursor);
1341 }
1342 #endif
1343
1344 static LayoutPoint documentPointForWindowPoint(Frame* frame, const IntPoint& win dowPoint) 1294 static LayoutPoint documentPointForWindowPoint(Frame* frame, const IntPoint& win dowPoint)
1345 { 1295 {
1346 FrameView* view = frame->view(); 1296 FrameView* view = frame->view();
1347 // FIXME: Is it really OK to use the wrong coordinates here when view is 0? 1297 // FIXME: Is it really OK to use the wrong coordinates here when view is 0?
1348 // Historically the code would just crash; this is clearly no worse than tha t. 1298 // Historically the code would just crash; this is clearly no worse than tha t.
1349 return view ? view->windowToContents(windowPoint) : windowPoint; 1299 return view ? view->windowToContents(windowPoint) : windowPoint;
1350 } 1300 }
1351 1301
1352 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) 1302 bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
1353 { 1303 {
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3955 unsigned EventHandler::accessKeyModifiers() 3905 unsigned EventHandler::accessKeyModifiers()
3956 { 3906 {
3957 #if OS(DARWIN) 3907 #if OS(DARWIN)
3958 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3908 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3959 #else 3909 #else
3960 return PlatformEvent::AltKey; 3910 return PlatformEvent::AltKey;
3961 #endif 3911 #endif
3962 } 3912 }
3963 3913
3964 } // namespace WebCore 3914 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | Source/core/page/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698