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

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2779813002: [InputEvent] Don't modify selection when transpose was canceled (Closed)
Patch Set: yosin's review: Use const& Created 3 years, 8 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
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 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 ->selection() 2097 ->selection()
2098 .computeVisibleSelectionInDOMTreeDeprecated()); 2098 .computeVisibleSelectionInDOMTreeDeprecated());
2099 if (range.isNull()) 2099 if (range.isNull())
2100 return nullptr; 2100 return nullptr;
2101 return new StaticRangeVector(1, StaticRange::create(range)); 2101 return new StaticRangeVector(1, StaticRange::create(range));
2102 } 2102 }
2103 2103
2104 DispatchEventResult dispatchBeforeInputInsertText( 2104 DispatchEventResult dispatchBeforeInputInsertText(
2105 Node* target, 2105 Node* target,
2106 const String& data, 2106 const String& data,
2107 InputEvent::InputType inputType) { 2107 InputEvent::InputType inputType,
2108 const StaticRangeVector* ranges) {
2108 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2109 if (!RuntimeEnabledFeatures::inputEventEnabled())
2109 return DispatchEventResult::NotCanceled; 2110 return DispatchEventResult::NotCanceled;
2110 if (!target) 2111 if (!target)
2111 return DispatchEventResult::NotCanceled; 2112 return DispatchEventResult::NotCanceled;
2112 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. 2113 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
2113 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype 2114 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
2114 InputEvent* beforeInputEvent = InputEvent::createBeforeInput( 2115 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(
2115 inputType, data, inputTypeIsCancelable(inputType), 2116 inputType, data, inputTypeIsCancelable(inputType),
2116 InputEvent::EventIsComposing::NotComposing, 2117 InputEvent::EventIsComposing::NotComposing,
2117 targetRangesForInputEvent(*target)); 2118 ranges ? ranges : targetRangesForInputEvent(*target));
2118 return target->dispatchEvent(beforeInputEvent); 2119 return target->dispatchEvent(beforeInputEvent);
2119 } 2120 }
2120 2121
2121 DispatchEventResult dispatchBeforeInputEditorCommand( 2122 DispatchEventResult dispatchBeforeInputEditorCommand(
2122 Node* target, 2123 Node* target,
2123 InputEvent::InputType inputType, 2124 InputEvent::InputType inputType,
2124 const StaticRangeVector* ranges) { 2125 const StaticRangeVector* ranges) {
2125 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2126 if (!RuntimeEnabledFeatures::inputEventEnabled())
2126 return DispatchEventResult::NotCanceled; 2127 return DispatchEventResult::NotCanceled;
2127 if (!target) 2128 if (!target)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 return InputType::DeleteSoftLineBackward; 2187 return InputType::DeleteSoftLineBackward;
2187 if (granularity == ParagraphBoundary) 2188 if (granularity == ParagraphBoundary)
2188 return InputType::DeleteHardLineBackward; 2189 return InputType::DeleteHardLineBackward;
2189 return InputType::DeleteContentBackward; 2190 return InputType::DeleteContentBackward;
2190 default: 2191 default:
2191 return InputType::None; 2192 return InputType::None;
2192 } 2193 }
2193 } 2194 }
2194 2195
2195 } // namespace blink 2196 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698