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

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

Issue 2727293003: [InputEvent] Add null check before converting Range to StaticRange (Closed)
Patch Set: 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
« 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 d73063fa545314227b75691fbe8b7ba98250a51a..4606c4af964710dfefade2a04922cae82b99fb55 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -2072,12 +2072,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 =
yosin_UTC9 2017/03/03 05:11:50 We would like to do following after this patch: -
chongz 2017/03/03 15:53:50 Sure, will create another patch.
+ firstRangeOf(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