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

Side by Side 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, 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 } 2065 }
2066 2066
2067 bool isTextSecurityNode(const Node* node) { 2067 bool isTextSecurityNode(const Node* node) {
2068 return node && node->layoutObject() && 2068 return node && node->layoutObject() &&
2069 node->layoutObject()->style()->textSecurity() != TSNONE; 2069 node->layoutObject()->style()->textSecurity() != TSNONE;
2070 } 2070 }
2071 2071
2072 const StaticRangeVector* targetRangesForInputEvent(const Node& node) { 2072 const StaticRangeVector* targetRangesForInputEvent(const Node& node) {
2073 if (!hasRichlyEditableStyle(node)) 2073 if (!hasRichlyEditableStyle(node))
2074 return nullptr; 2074 return nullptr;
2075 return new StaticRangeVector( 2075 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.
2076 1, StaticRange::create( 2076 firstRangeOf(node.document()
2077 firstRangeOf(node.document() 2077 .frame()
2078 .frame() 2078 ->selection()
2079 ->selection() 2079 .computeVisibleSelectionInDOMTreeDeprecated());
2080 .computeVisibleSelectionInDOMTreeDeprecated()))); 2080 if (!range)
2081 return nullptr;
2082 return new StaticRangeVector(1, StaticRange::create(range));
2081 } 2083 }
2082 2084
2083 DispatchEventResult dispatchBeforeInputInsertText(Node* target, 2085 DispatchEventResult dispatchBeforeInputInsertText(Node* target,
2084 const String& data) { 2086 const String& data) {
2085 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2087 if (!RuntimeEnabledFeatures::inputEventEnabled())
2086 return DispatchEventResult::NotCanceled; 2088 return DispatchEventResult::NotCanceled;
2087 if (!target) 2089 if (!target)
2088 return DispatchEventResult::NotCanceled; 2090 return DispatchEventResult::NotCanceled;
2089 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. 2091 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
2090 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype 2092 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 return InputType::DeleteWordBackward; 2162 return InputType::DeleteWordBackward;
2161 if (granularity == LineBoundary) 2163 if (granularity == LineBoundary)
2162 return InputType::DeleteLineBackward; 2164 return InputType::DeleteLineBackward;
2163 return InputType::DeleteContentBackward; 2165 return InputType::DeleteContentBackward;
2164 default: 2166 default:
2165 return InputType::None; 2167 return InputType::None;
2166 } 2168 }
2167 } 2169 }
2168 2170
2169 } // namespace blink 2171 } // namespace blink
OLDNEW
« 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