| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 replaceTextInNode(textNode, start.offsetInContainerNode(), count, text); | 113 replaceTextInNode(textNode, start.offsetInContainerNode(), count, text); |
| 114 | 114 |
| 115 Position endPosition = Position(textNode.release(), start.offsetInContainerN
ode() + text.length()); | 115 Position endPosition = Position(textNode.release(), start.offsetInContainerN
ode() + text.length()); |
| 116 setEndingSelectionWithoutValidation(start, endPosition); | 116 setEndingSelectionWithoutValidation(start, endPosition); |
| 117 if (!selectInsertedText) | 117 if (!selectInsertedText) |
| 118 setEndingSelection(VisibleSelection(endingSelection().visibleEnd(), endi
ngSelection().isDirectional())); | 118 setEndingSelection(VisibleSelection(endingSelection().visibleEnd(), endi
ngSelection().isDirectional())); |
| 119 | 119 |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void InsertTextCommand::doApply() | 123 void InsertTextCommand::doApply(EditingState*) |
| 124 { | 124 { |
| 125 ASSERT(m_text.find('\n') == kNotFound); | 125 ASSERT(m_text.find('\n') == kNotFound); |
| 126 | 126 |
| 127 if (!endingSelection().isNonOrphanedCaretOrRange()) | 127 if (!endingSelection().isNonOrphanedCaretOrRange()) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 // Delete the current selection. | 130 // Delete the current selection. |
| 131 // FIXME: This delete operation blows away the typing style. | 131 // FIXME: This delete operation blows away the typing style. |
| 132 if (endingSelection().isRange()) { | 132 if (endingSelection().isRange()) { |
| 133 if (performTrivialReplace(m_text, m_selectInsertedText)) | 133 if (performTrivialReplace(m_text, m_selectInsertedText)) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 splitTextNode(textNode, offset); | 265 splitTextNode(textNode, offset); |
| 266 insertNodeBefore(spanElement, textNode.release()); | 266 insertNodeBefore(spanElement, textNode.release()); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 // return the position following the new tab | 270 // return the position following the new tab |
| 271 return lastPositionInNode(spanElement.get()); | 271 return lastPositionInNode(spanElement.get()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |