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

Unified 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, 5 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/editing/EditorCommand.cpp ('k') | no next file » | 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 1ee2587626a0969843a1281f3661bd1b8d46963e..2569a6a1969e3039e070a39abf5ce7dee7ced7e4 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -774,16 +774,18 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
// Clear the selection if the mouse didn't move after the last mouse
// press and it's not a context menu click. We do this so when clicking
- // on the selection, the selection goes away. However, if we are
- // editing, place the caret.
+ // on the selection, the selection goes away. For readonly texts
+ // we do need to know the position of the caret for any selection
+ // using keyboard shortcuts as its currently working in non-webkit
+ // based browsers for ex: firefox. Therefore, place the caret even
+ // for non-editable texts.
if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != ExtendedSelection
&& m_dragStartPos == event.event().position()
&& m_frame->selection().isRange()
&& event.event().button() != RightButton) {
VisibleSelection newSelection;
Node* node = event.targetNode();
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
- if (node && node->renderer() && (caretBrowsing || node->hasEditableStyle())) {
+ if (node && node->renderer()) {
VisiblePosition pos = VisiblePosition(node->renderer()->positionForPoint(event.localPoint()));
newSelection = VisibleSelection(pos);
}
« no previous file with comments | « Source/core/editing/EditorCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698