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 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |