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

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: Patch for landing 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 | « LayoutTests/editing/caret/caret-type-for-user-select-none-expected.txt ('k') | 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 if (panScrollInProgress()) 1098 if (panScrollInProgress())
1099 return NoCursorChange; 1099 return NoCursorChange;
1100 #endif 1100 #endif
1101 1101
1102 Node* node = event.targetNode(); 1102 Node* node = event.targetNode();
1103 RenderObject* renderer = node ? node->renderer() : 0; 1103 RenderObject* renderer = node ? node->renderer() : 0;
1104 RenderStyle* style = renderer ? renderer->style() : 0; 1104 RenderStyle* style = renderer ? renderer->style() : 0;
1105 bool horizontalText = !style || style->isHorizontalWritingMode(); 1105 bool horizontalText = !style || style->isHorizontalWritingMode();
1106 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor(); 1106 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
1107 1107
1108 // During selection, use an I-beam no matter what we're over.
1109 // If a drag may be starting or we're capturing mouse events for a particula r node, don't treat this as a selection.
1110 if (m_mousePressed && m_mouseDownMayStartSelect
1111 && !m_mouseDownMayStartDrag
1112 && m_frame->selection().isCaretOrRange() && !m_capturingMouseEventsNode)
1113 return iBeam;
1114
1115 if (renderer) { 1108 if (renderer) {
1116 Cursor overrideCursor; 1109 Cursor overrideCursor;
1117 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) { 1110 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) {
1118 case SetCursorBasedOnStyle: 1111 case SetCursorBasedOnStyle:
1119 break; 1112 break;
1120 case SetCursor: 1113 case SetCursor:
1121 return overrideCursor; 1114 return overrideCursor;
1122 case DoNotSetCursor: 1115 case DoNotSetCursor:
1123 return NoCursorChange; 1116 return NoCursorChange;
1124 } 1117 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 if (useHandCursor(node, event.isOverLink(), event.event().shiftKey())) 1154 if (useHandCursor(node, event.isOverLink(), event.event().shiftKey()))
1162 return handCursor(); 1155 return handCursor();
1163 1156
1164 bool inResizer = false; 1157 bool inResizer = false;
1165 if (renderer) { 1158 if (renderer) {
1166 if (RenderLayer* layer = renderer->enclosingLayer()) { 1159 if (RenderLayer* layer = renderer->enclosingLayer()) {
1167 if (FrameView* view = m_frame->view()) 1160 if (FrameView* view = m_frame->view())
1168 inResizer = layer->isPointInResizeControl(view->windowToCont ents(event.event().position()), ResizerForPointer); 1161 inResizer = layer->isPointInResizeControl(view->windowToCont ents(event.event().position()), ResizerForPointer);
1169 } 1162 }
1170 } 1163 }
1164
1165 // During selection, use an I-beam no matter what we're over.
1166 // If a drag may be starting or we're capturing mouse events for a parti cular node, don't treat this as a selection.
1167 if (m_mousePressed && m_mouseDownMayStartSelect
1168 && !m_mouseDownMayStartDrag
1169 && m_frame->selection().isCaretOrRange()
1170 && !m_capturingMouseEventsNode) {
1171 return iBeam;
1172 }
1173
1171 if ((editable || (renderer && renderer->isText() && node->canStartSelect ion())) && !inResizer && !scrollbar) 1174 if ((editable || (renderer && renderer->isText() && node->canStartSelect ion())) && !inResizer && !scrollbar)
1172 return iBeam; 1175 return iBeam;
1173 return pointerCursor(); 1176 return pointerCursor();
1174 } 1177 }
1175 case CURSOR_CROSS: 1178 case CURSOR_CROSS:
1176 return crossCursor(); 1179 return crossCursor();
1177 case CURSOR_POINTER: 1180 case CURSOR_POINTER:
1178 return handCursor(); 1181 return handCursor();
1179 case CURSOR_MOVE: 1182 case CURSOR_MOVE:
1180 return moveCursor(); 1183 return moveCursor();
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 unsigned EventHandler::accessKeyModifiers() 3846 unsigned EventHandler::accessKeyModifiers()
3844 { 3847 {
3845 #if OS(MACOSX) 3848 #if OS(MACOSX)
3846 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3849 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3847 #else 3850 #else
3848 return PlatformEvent::AltKey; 3851 return PlatformEvent::AltKey;
3849 #endif 3852 #endif
3850 } 3853 }
3851 3854
3852 } // namespace WebCore 3855 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/caret/caret-type-for-user-select-none-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698