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

Side by Side 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 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 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 } 2074 }
2075 2075
2076 bool isTextSecurityNode(const Node* node) { 2076 bool isTextSecurityNode(const Node* node) {
2077 return node && node->layoutObject() && 2077 return node && node->layoutObject() &&
2078 node->layoutObject()->style()->textSecurity() != TSNONE; 2078 node->layoutObject()->style()->textSecurity() != TSNONE;
2079 } 2079 }
2080 2080
2081 const StaticRangeVector* targetRangesForInputEvent(const Node& node) { 2081 const StaticRangeVector* targetRangesForInputEvent(const Node& node) {
2082 if (!hasRichlyEditableStyle(node)) 2082 if (!hasRichlyEditableStyle(node))
2083 return nullptr; 2083 return nullptr;
2084 return new StaticRangeVector( 2084 Range* range = createRange(
2085 1, StaticRange::create( 2085 firstEphemeralRangeOf(node.document()
2086 firstRangeOf(node.document() 2086 .frame()
2087 .frame() 2087 ->selection()
2088 ->selection() 2088 .computeVisibleSelectionInDOMTreeDeprecated()));
2089 .computeVisibleSelectionInDOMTreeDeprecated()))); 2089 if (!range)
2090 return nullptr;
2091 return new StaticRangeVector(1, StaticRange::create(range));
2090 } 2092 }
2091 2093
2092 DispatchEventResult dispatchBeforeInputInsertText(Node* target, 2094 DispatchEventResult dispatchBeforeInputInsertText(Node* target,
2093 const String& data) { 2095 const String& data) {
2094 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2096 if (!RuntimeEnabledFeatures::inputEventEnabled())
2095 return DispatchEventResult::NotCanceled; 2097 return DispatchEventResult::NotCanceled;
2096 if (!target) 2098 if (!target)
2097 return DispatchEventResult::NotCanceled; 2099 return DispatchEventResult::NotCanceled;
2098 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. 2100 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
2099 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype 2101 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 return InputType::DeleteWordBackward; 2171 return InputType::DeleteWordBackward;
2170 if (granularity == LineBoundary) 2172 if (granularity == LineBoundary)
2171 return InputType::DeleteLineBackward; 2173 return InputType::DeleteLineBackward;
2172 return InputType::DeleteContentBackward; 2174 return InputType::DeleteContentBackward;
2173 default: 2175 default:
2174 return InputType::None; 2176 return InputType::None;
2175 } 2177 }
2176 } 2178 }
2177 2179
2178 } // namespace blink 2180 } // 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