OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 } | 2119 } |
2120 | 2120 |
2121 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const { | 2121 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const { |
2122 return true; | 2122 return true; |
2123 } | 2123 } |
2124 | 2124 |
2125 EphemeralRange ReplaceSelectionCommand::insertedRange() const { | 2125 EphemeralRange ReplaceSelectionCommand::insertedRange() const { |
2126 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); | 2126 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); |
2127 } | 2127 } |
2128 | 2128 |
| 2129 String ReplaceSelectionCommand::textDataForInputEvent() const { |
| 2130 return m_documentFragment->textContent(); |
| 2131 } |
| 2132 |
| 2133 DataTransfer* ReplaceSelectionCommand::dataTransferForInputEvent() const { |
| 2134 switch (m_inputType) { |
| 2135 case InputEvent::InputType::InsertFromPaste: |
| 2136 case InputEvent::InputType::InsertFromDrop: |
| 2137 case InputEvent::InputType::InsertReplacementText: |
| 2138 return DataTransfer::createForInputEvent( |
| 2139 textDataForInputEvent(), createMarkup(m_documentFragment)); |
| 2140 default: |
| 2141 return CompositeEditCommand::dataTransferForInputEvent(); |
| 2142 } |
| 2143 } |
| 2144 |
2129 DEFINE_TRACE(ReplaceSelectionCommand) { | 2145 DEFINE_TRACE(ReplaceSelectionCommand) { |
2130 visitor->trace(m_startOfInsertedContent); | 2146 visitor->trace(m_startOfInsertedContent); |
2131 visitor->trace(m_endOfInsertedContent); | 2147 visitor->trace(m_endOfInsertedContent); |
2132 visitor->trace(m_insertionStyle); | 2148 visitor->trace(m_insertionStyle); |
2133 visitor->trace(m_documentFragment); | 2149 visitor->trace(m_documentFragment); |
2134 visitor->trace(m_startOfInsertedRange); | 2150 visitor->trace(m_startOfInsertedRange); |
2135 visitor->trace(m_endOfInsertedRange); | 2151 visitor->trace(m_endOfInsertedRange); |
2136 CompositeEditCommand::trace(visitor); | 2152 CompositeEditCommand::trace(visitor); |
2137 } | 2153 } |
2138 | 2154 |
2139 } // namespace blink | 2155 } // namespace blink |
OLD | NEW |