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

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

Issue 23461040: Selection should not set the cursor type to text over the explicitly set cursor type. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 if (panScrollInProgress()) 1111 if (panScrollInProgress())
1112 return NoCursorChange; 1112 return NoCursorChange;
1113 #endif 1113 #endif
1114 1114
1115 Node* node = event.targetNode(); 1115 Node* node = event.targetNode();
1116 RenderObject* renderer = node ? node->renderer() : 0; 1116 RenderObject* renderer = node ? node->renderer() : 0;
1117 RenderStyle* style = renderer ? renderer->style() : 0; 1117 RenderStyle* style = renderer ? renderer->style() : 0;
1118 bool horizontalText = !style || style->isHorizontalWritingMode(); 1118 bool horizontalText = !style || style->isHorizontalWritingMode();
1119 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor(); 1119 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
1120 1120
1121 // During selection, use an I-beam no matter what we're over.
1122 // If a drag may be starting or we're capturing mouse events for a particula r node, don't treat this as a selection.
1123 if (m_mousePressed && m_mouseDownMayStartSelect
1124 && !m_mouseDownMayStartDrag
1125 && m_frame->selection().isCaretOrRange() && !m_capturingMouseEventsNode)
1126 return iBeam;
1127
1128 if (renderer) { 1121 if (renderer) {
1129 Cursor overrideCursor; 1122 Cursor overrideCursor;
1130 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) { 1123 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) {
1131 case SetCursorBasedOnStyle: 1124 case SetCursorBasedOnStyle:
1132 break; 1125 break;
1133 case SetCursor: 1126 case SetCursor:
1134 return overrideCursor; 1127 return overrideCursor;
1135 case DoNotSetCursor: 1128 case DoNotSetCursor:
1136 return NoCursorChange; 1129 return NoCursorChange;
1137 } 1130 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 if (useHandCursor(node, event.isOverLink(), event.event().shiftKey())) 1167 if (useHandCursor(node, event.isOverLink(), event.event().shiftKey()))
1175 return handCursor(); 1168 return handCursor();
1176 1169
1177 bool inResizer = false; 1170 bool inResizer = false;
1178 if (renderer) { 1171 if (renderer) {
1179 if (RenderLayer* layer = renderer->enclosingLayer()) { 1172 if (RenderLayer* layer = renderer->enclosingLayer()) {
1180 if (FrameView* view = m_frame->view()) 1173 if (FrameView* view = m_frame->view())
1181 inResizer = layer->isPointInResizeControl(view->windowToCont ents(event.event().position()), ResizerForPointer); 1174 inResizer = layer->isPointInResizeControl(view->windowToCont ents(event.event().position()), ResizerForPointer);
1182 } 1175 }
1183 } 1176 }
1177
1178 // During selection, use an I-beam no matter what we're over.
1179 // If a drag may be starting or we're capturing mouse events for a parti cular node, don't treat this as a selection.
1180 if (m_mousePressed && m_mouseDownMayStartSelect
1181 && !m_mouseDownMayStartDrag
1182 && m_frame->selection().isCaretOrRange() && !m_capturingMouseEventsNode)
yosin_UTC9 2013/09/13 03:42:44 nit: Please align "&&" to m_mousePressed nit: Plea
1183 return iBeam;
1184
1184 if ((editable || (renderer && renderer->isText() && node->canStartSelect ion())) && !inResizer && !scrollbar) 1185 if ((editable || (renderer && renderer->isText() && node->canStartSelect ion())) && !inResizer && !scrollbar)
1185 return iBeam; 1186 return iBeam;
1186 return pointerCursor(); 1187 return pointerCursor();
1187 } 1188 }
1188 case CURSOR_CROSS: 1189 case CURSOR_CROSS:
1189 return crossCursor(); 1190 return crossCursor();
1190 case CURSOR_POINTER: 1191 case CURSOR_POINTER:
1191 return handCursor(); 1192 return handCursor();
1192 case CURSOR_MOVE: 1193 case CURSOR_MOVE:
1193 return moveCursor(); 1194 return moveCursor();
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3847 unsigned EventHandler::accessKeyModifiers() 3848 unsigned EventHandler::accessKeyModifiers()
3848 { 3849 {
3849 #if OS(DARWIN) 3850 #if OS(DARWIN)
3850 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3851 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3851 #else 3852 #else
3852 return PlatformEvent::AltKey; 3853 return PlatformEvent::AltKey;
3853 #endif 3854 #endif
3854 } 3855 }
3855 3856
3856 } // namespace WebCore 3857 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698