| OLD | NEW |
| 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 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 Range* range = createRange( | 2092 Range* range = createRange( |
| 2093 firstEphemeralRangeOf(node.document() | 2093 firstEphemeralRangeOf(node.document() |
| 2094 .frame() | 2094 .frame() |
| 2095 ->selection() | 2095 ->selection() |
| 2096 .computeVisibleSelectionInDOMTreeDeprecated())); | 2096 .computeVisibleSelectionInDOMTreeDeprecated())); |
| 2097 if (!range) | 2097 if (!range) |
| 2098 return nullptr; | 2098 return nullptr; |
| 2099 return new StaticRangeVector(1, StaticRange::create(range)); | 2099 return new StaticRangeVector(1, StaticRange::create(range)); |
| 2100 } | 2100 } |
| 2101 | 2101 |
| 2102 DispatchEventResult dispatchBeforeInputInsertText(Node* target, | 2102 DispatchEventResult dispatchBeforeInputInsertText( |
| 2103 const String& data) { | 2103 Node* target, |
| 2104 const String& data, |
| 2105 InputEvent::InputType inputType) { |
| 2104 if (!RuntimeEnabledFeatures::inputEventEnabled()) | 2106 if (!RuntimeEnabledFeatures::inputEventEnabled()) |
| 2105 return DispatchEventResult::NotCanceled; | 2107 return DispatchEventResult::NotCanceled; |
| 2106 if (!target) | 2108 if (!target) |
| 2107 return DispatchEventResult::NotCanceled; | 2109 return DispatchEventResult::NotCanceled; |
| 2108 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. | 2110 // TODO(chongz): Pass appropriate |ranges| after it's defined on spec. |
| 2109 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype | 2111 // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype |
| 2110 InputEvent* beforeInputEvent = InputEvent::createBeforeInput( | 2112 InputEvent* beforeInputEvent = InputEvent::createBeforeInput( |
| 2111 InputEvent::InputType::InsertText, data, | 2113 inputType, data, inputTypeIsCancelable(inputType), |
| 2112 inputTypeIsCancelable(InputEvent::InputType::InsertText), | |
| 2113 InputEvent::EventIsComposing::NotComposing, | 2114 InputEvent::EventIsComposing::NotComposing, |
| 2114 targetRangesForInputEvent(*target)); | 2115 targetRangesForInputEvent(*target)); |
| 2115 return target->dispatchEvent(beforeInputEvent); | 2116 return target->dispatchEvent(beforeInputEvent); |
| 2116 } | 2117 } |
| 2117 | 2118 |
| 2118 DispatchEventResult dispatchBeforeInputEditorCommand( | 2119 DispatchEventResult dispatchBeforeInputEditorCommand( |
| 2119 Node* target, | 2120 Node* target, |
| 2120 InputEvent::InputType inputType, | 2121 InputEvent::InputType inputType, |
| 2121 const StaticRangeVector* ranges) { | 2122 const StaticRangeVector* ranges) { |
| 2122 if (!RuntimeEnabledFeatures::inputEventEnabled()) | 2123 if (!RuntimeEnabledFeatures::inputEventEnabled()) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 return InputType::DeleteWordBackward; | 2180 return InputType::DeleteWordBackward; |
| 2180 if (granularity == LineBoundary) | 2181 if (granularity == LineBoundary) |
| 2181 return InputType::DeleteLineBackward; | 2182 return InputType::DeleteLineBackward; |
| 2182 return InputType::DeleteContentBackward; | 2183 return InputType::DeleteContentBackward; |
| 2183 default: | 2184 default: |
| 2184 return InputType::None; | 2185 return InputType::None; |
| 2185 } | 2186 } |
| 2186 } | 2187 } |
| 2187 | 2188 |
| 2188 } // namespace blink | 2189 } // namespace blink |
| OLD | NEW |