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

Unified Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2763833006: [InputEvent] Add null check before converting Range to StaticRange (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-invalid-selection-crash.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index 329a39f1c9581c2f1db41206430ce4bd50b8a298..334c6e74659019cc3cbbd7852cc4ecd23cadc981 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -2081,12 +2081,14 @@ bool isTextSecurityNode(const Node* node) {
const StaticRangeVector* targetRangesForInputEvent(const Node& node) {
if (!hasRichlyEditableStyle(node))
return nullptr;
- return new StaticRangeVector(
- 1, StaticRange::create(
- firstRangeOf(node.document()
- .frame()
- ->selection()
- .computeVisibleSelectionInDOMTreeDeprecated())));
+ Range* range = createRange(
+ firstEphemeralRangeOf(node.document()
+ .frame()
+ ->selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()));
+ if (!range)
+ return nullptr;
+ return new StaticRangeVector(1, StaticRange::create(range));
}
DispatchEventResult dispatchBeforeInputInsertText(Node* target,
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-invalid-selection-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698