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

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: Re-calculate range when selection changed 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 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 ->selection() 2058 ->selection()
2059 .computeVisibleSelectionInDOMTreeDeprecated()); 2059 .computeVisibleSelectionInDOMTreeDeprecated());
2060 if (range.isNull()) 2060 if (range.isNull())
2061 return nullptr; 2061 return nullptr;
2062 return new StaticRangeVector(1, StaticRange::create(range)); 2062 return new StaticRangeVector(1, StaticRange::create(range));
2063 } 2063 }
2064 2064
2065 DispatchEventResult dispatchBeforeInputInsertText( 2065 DispatchEventResult dispatchBeforeInputInsertText(
2066 Node* target, 2066 Node* target,
2067 const String& data, 2067 const String& data,
2068 InputEvent::InputType inputType) { 2068 InputEvent::InputType inputType,
2069 const StaticRangeVector* ranges) {
2069 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2070 if (!RuntimeEnabledFeatures::inputEventEnabled())
2070 return DispatchEventResult::NotCanceled; 2071 return DispatchEventResult::NotCanceled;
2071 if (!target) 2072 if (!target)
2072 return DispatchEventResult::NotCanceled; 2073 return DispatchEventResult::NotCanceled;
2073 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. 2074 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
2074 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype 2075 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
2075 InputEvent* beforeInputEvent = InputEvent::createBeforeInput( 2076 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(
2076 inputType, data, inputTypeIsCancelable(inputType), 2077 inputType, data, inputTypeIsCancelable(inputType),
2077 InputEvent::EventIsComposing::NotComposing, 2078 InputEvent::EventIsComposing::NotComposing,
2078 targetRangesForInputEvent(*target)); 2079 ranges ? ranges : targetRangesForInputEvent(*target));
2079 return target->dispatchEvent(beforeInputEvent); 2080 return target->dispatchEvent(beforeInputEvent);
2080 } 2081 }
2081 2082
2082 DispatchEventResult dispatchBeforeInputEditorCommand( 2083 DispatchEventResult dispatchBeforeInputEditorCommand(
2083 Node* target, 2084 Node* target,
2084 InputEvent::InputType inputType, 2085 InputEvent::InputType inputType,
2085 const StaticRangeVector* ranges) { 2086 const StaticRangeVector* ranges) {
2086 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2087 if (!RuntimeEnabledFeatures::inputEventEnabled())
2087 return DispatchEventResult::NotCanceled; 2088 return DispatchEventResult::NotCanceled;
2088 if (!target) 2089 if (!target)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 return InputType::DeleteWordBackward; 2144 return InputType::DeleteWordBackward;
2144 if (granularity == LineBoundary) 2145 if (granularity == LineBoundary)
2145 return InputType::DeleteLineBackward; 2146 return InputType::DeleteLineBackward;
2146 return InputType::DeleteContentBackward; 2147 return InputType::DeleteContentBackward;
2147 default: 2148 default:
2148 return InputType::None; 2149 return InputType::None;
2149 } 2150 }
2150 } 2151 }
2151 2152
2152 } // namespace blink 2153 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698