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

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

Issue 268993002: For non-editable content, selection editor commands are disabled Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 m_capturesDragging = false; 756 m_capturesDragging = false;
757 m_mouseDownMayStartDrag = false; 757 m_mouseDownMayStartDrag = false;
758 m_mouseDownMayStartSelect = false; 758 m_mouseDownMayStartSelect = false;
759 m_mouseDownMayStartAutoscroll = false; 759 m_mouseDownMayStartAutoscroll = false;
760 m_mouseDownWasInSubframe = false; 760 m_mouseDownWasInSubframe = false;
761 761
762 bool handled = false; 762 bool handled = false;
763 763
764 // Clear the selection if the mouse didn't move after the last mouse 764 // Clear the selection if the mouse didn't move after the last mouse
765 // press and it's not a context menu click. We do this so when clicking 765 // press and it's not a context menu click. We do this so when clicking
766 // on the selection, the selection goes away. However, if we are 766 // on the selection, the selection goes away. For readonly texts
767 // editing, place the caret. 767 // we do need to know the position of the caret for any selection
768 // using keyboard shortcuts as its currently working in non-webkit
769 // based browsers for ex: firefox. Therefore, place the caret even
770 // for non-ediatble texts.
Inactive 2014/05/13 19:28:52 "non-editable"
b.rout 2014/05/14 07:00:46 will correct it. Thanks. On 2014/05/13 19:28:52,
768 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection 771 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection
769 && m_dragStartPos == event.event().position() 772 && m_dragStartPos == event.event().position()
770 && m_frame->selection().isRange() 773 && m_frame->selection().isRange()
771 && event.event().button() != RightButton) { 774 && event.event().button() != RightButton) {
772 VisibleSelection newSelection; 775 VisibleSelection newSelection;
773 Node* node = event.targetNode(); 776 Node* node = event.targetNode();
774 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr owsingEnabled(); 777 if (node && node->renderer()) {
775 if (node && node->renderer() && (caretBrowsing || node->rendererIsEditab le())) {
776 VisiblePosition pos = VisiblePosition(node->renderer()->positionForP oint(event.localPoint())); 778 VisiblePosition pos = VisiblePosition(node->renderer()->positionForP oint(event.localPoint()));
777 newSelection = VisibleSelection(pos); 779 newSelection = VisibleSelection(pos);
778 } 780 }
779 781
780 setSelectionIfNeeded(m_frame->selection(), newSelection); 782 setSelectionIfNeeded(m_frame->selection(), newSelection);
781 783
782 handled = true; 784 handled = true;
783 } 785 }
784 786
785 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered); 787 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered);
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after
3730 unsigned EventHandler::accessKeyModifiers() 3732 unsigned EventHandler::accessKeyModifiers()
3731 { 3733 {
3732 #if OS(MACOSX) 3734 #if OS(MACOSX)
3733 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3735 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3734 #else 3736 #else
3735 return PlatformEvent::AltKey; 3737 return PlatformEvent::AltKey;
3736 #endif 3738 #endif
3737 } 3739 }
3738 3740
3739 } // namespace WebCore 3741 } // namespace WebCore
OLDNEW
« Source/core/editing/EditorCommand.cpp ('K') | « Source/core/editing/EditorCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698