| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/events/InputEvent.h" | 5 #include "core/events/InputEvent.h" |
| 6 | 6 |
| 7 #include "core/dom/Range.h" | 7 #include "core/dom/Range.h" |
| 8 #include "core/events/EventDispatcher.h" | 8 #include "core/events/EventDispatcher.h" |
| 9 #include "public/platform/WebEditingCommandType.h" | 9 #include "public/platform/WebEditingCommandType.h" |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return InputEvent::create(EventTypeNames::input, inputEventInit); | 162 return InputEvent::create(EventTypeNames::input, inputEventInit); |
| 163 } | 163 } |
| 164 | 164 |
| 165 String InputEvent::inputType() const { | 165 String InputEvent::inputType() const { |
| 166 return convertInputTypeToString(m_inputType); | 166 return convertInputTypeToString(m_inputType); |
| 167 } | 167 } |
| 168 | 168 |
| 169 StaticRangeVector InputEvent::getTargetRanges() const { | 169 StaticRangeVector InputEvent::getTargetRanges() const { |
| 170 StaticRangeVector staticRanges; | 170 StaticRangeVector staticRanges; |
| 171 for (const auto& range : m_ranges) | 171 for (const auto& range : m_ranges) |
| 172 staticRanges.append(StaticRange::create( | 172 staticRanges.push_back(StaticRange::create( |
| 173 range->ownerDocument(), range->startContainer(), range->startOffset(), | 173 range->ownerDocument(), range->startContainer(), range->startOffset(), |
| 174 range->endContainer(), range->endOffset())); | 174 range->endContainer(), range->endOffset())); |
| 175 return staticRanges; | 175 return staticRanges; |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool InputEvent::isInputEvent() const { | 178 bool InputEvent::isInputEvent() const { |
| 179 return true; | 179 return true; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // TODO(chongz): We should get rid of this |EventDispatchMediator| pattern and | 182 // TODO(chongz): We should get rid of this |EventDispatchMediator| pattern and |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // 3. We don't want authors to hold live |Range| indefinitely by holding | 217 // 3. We don't want authors to hold live |Range| indefinitely by holding |
| 218 // |InputEvent|, so we clear them after dispatch. | 218 // |InputEvent|, so we clear them after dispatch. |
| 219 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they | 219 // Authors should explicitly call |getTargetRanges()|->|toRange()| if they |
| 220 // want to keep a copy of |Range|. See Editing TF meeting notes: | 220 // want to keep a copy of |Range|. See Editing TF meeting notes: |
| 221 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWLG0
AM58/edit?usp=sharing | 221 // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWLG0
AM58/edit?usp=sharing |
| 222 event().m_ranges.clear(); | 222 event().m_ranges.clear(); |
| 223 return result; | 223 return result; |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |