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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2693863003: [InputEvent] Change |getTargetRanges()| to return current selection by default (Closed)
Patch Set: yosin's review: Use const Node&, add null checks Created 3 years, 10 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
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index f2279f9bc81815f26cfe45c8433bdb3be203c0a0..097528b5e76d2d0c1d251d39078e71e25bc53f70 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -2709,8 +2709,9 @@ int Editor::Command::idForHistogram() const {
return isSupported() ? static_cast<int>(m_command->commandType) : 0;
}
-RangeVector* Editor::Command::getTargetRanges() const {
- if (!isSupported() || !m_frame)
+const RangeVector* Editor::Command::getTargetRanges() const {
+ const Node* target = eventTargetNodeForDocument(m_frame->document());
+ if (!isSupported() || !m_frame || !target || !hasRichlyEditableStyle(*target))
return nullptr;
switch (m_command->commandType) {
@@ -2740,7 +2741,7 @@ RangeVector* Editor::Command::getTargetRanges() const {
return RangesFromCurrentSelectionOrExtendCaret(*m_frame, DirectionForward,
WordGranularity);
default:
- return nullptr;
+ return targetRangesForInputEvent(*target);
}
}

Powered by Google App Engine
This is Rietveld 408576698