OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 return NodeTraversal::nextPostOrder(*this); | 100 return NodeTraversal::nextPostOrder(*this); |
101 } | 101 } |
102 | 102 |
103 Text* Text::splitText(unsigned offset, ExceptionState& exceptionState) { | 103 Text* Text::splitText(unsigned offset, ExceptionState& exceptionState) { |
104 // IndexSizeError: Raised if the specified offset is negative or greater than | 104 // IndexSizeError: Raised if the specified offset is negative or greater than |
105 // the number of 16-bit units in data. | 105 // the number of 16-bit units in data. |
106 if (offset > length()) { | 106 if (offset > length()) { |
107 exceptionState.throwDOMException( | 107 exceptionState.throwDOMException( |
108 IndexSizeError, "The offset " + String::number(offset) + | 108 IndexSizeError, |
109 " is larger than the Text node's length."); | 109 "The offset " + String::number(offset) + |
| 110 " is larger than the Text node's length."); |
110 return nullptr; | 111 return nullptr; |
111 } | 112 } |
112 | 113 |
113 EventQueueScope scope; | 114 EventQueueScope scope; |
114 String oldStr = data(); | 115 String oldStr = data(); |
115 Text* newText = cloneWithData(oldStr.substring(offset)); | 116 Text* newText = cloneWithData(oldStr.substring(offset)); |
116 setDataWithoutUpdate(oldStr.substring(0, offset)); | 117 setDataWithoutUpdate(oldStr.substring(0, offset)); |
117 | 118 |
118 didModifyData(oldStr, CharacterData::UpdateFromNonParser); | 119 didModifyData(oldStr, CharacterData::UpdateFromNonParser); |
119 | 120 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 452 |
452 Text* Text::cloneWithData(const String& data) { | 453 Text* Text::cloneWithData(const String& data) { |
453 return create(document(), data); | 454 return create(document(), data); |
454 } | 455 } |
455 | 456 |
456 DEFINE_TRACE(Text) { | 457 DEFINE_TRACE(Text) { |
457 CharacterData::trace(visitor); | 458 CharacterData::trace(visitor); |
458 } | 459 } |
459 | 460 |
460 } // namespace blink | 461 } // namespace blink |
OLD | NEW |