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
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/dom/Text.h" | 23 #include "core/dom/Text.h" |
24 | 24 |
25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
26 #include "bindings/v8/ExceptionMessages.h" | |
27 #include "bindings/v8/ExceptionState.h" | 26 #include "bindings/v8/ExceptionState.h" |
28 #include "bindings/v8/ExceptionStatePlaceholder.h" | 27 #include "bindings/v8/ExceptionStatePlaceholder.h" |
29 #include "core/css/resolver/StyleResolver.h" | 28 #include "core/css/resolver/StyleResolver.h" |
30 #include "core/dom/ExceptionCode.h" | 29 #include "core/dom/ExceptionCode.h" |
31 #include "core/dom/NodeRenderStyle.h" | 30 #include "core/dom/NodeRenderStyle.h" |
32 #include "core/dom/NodeRenderingContext.h" | 31 #include "core/dom/NodeRenderingContext.h" |
33 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
34 #include "core/events/ScopedEventQueue.h" | 33 #include "core/events/ScopedEventQueue.h" |
35 #include "core/dom/shadow/ShadowRoot.h" | 34 #include "core/dom/shadow/ShadowRoot.h" |
36 #include "core/rendering/RenderCombineText.h" | 35 #include "core/rendering/RenderCombineText.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 100 } |
102 | 101 |
103 return NodeTraversal::nextPostOrder(*this); | 102 return NodeTraversal::nextPostOrder(*this); |
104 } | 103 } |
105 | 104 |
106 PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& exceptionState
) | 105 PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& exceptionState
) |
107 { | 106 { |
108 // IndexSizeError: Raised if the specified offset is negative or greater tha
n | 107 // IndexSizeError: Raised if the specified offset is negative or greater tha
n |
109 // the number of 16-bit units in data. | 108 // the number of 16-bit units in data. |
110 if (offset > length()) { | 109 if (offset > length()) { |
111 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail
edToExecute("splitText", "Text", "The offset " + String::number(offset) + " is l
arger than the Text node's length.")); | 110 exceptionState.throwDOMException(IndexSizeError, "The offset " + String:
:number(offset) + " is larger than the Text node's length."); |
112 return 0; | 111 return 0; |
113 } | 112 } |
114 | 113 |
115 EventQueueScope scope; | 114 EventQueueScope scope; |
116 String oldStr = data(); | 115 String oldStr = data(); |
117 RefPtr<Text> newText = cloneWithData(oldStr.substring(offset)); | 116 RefPtr<Text> newText = cloneWithData(oldStr.substring(offset)); |
118 setDataWithoutUpdate(oldStr.substring(0, offset)); | 117 setDataWithoutUpdate(oldStr.substring(0, offset)); |
119 | 118 |
120 didModifyData(oldStr); | 119 didModifyData(oldStr); |
121 | 120 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 result.appendLiteral("; "); | 373 result.appendLiteral("; "); |
375 result.appendLiteral("value="); | 374 result.appendLiteral("value="); |
376 result.append(s); | 375 result.append(s); |
377 } | 376 } |
378 | 377 |
379 strncpy(buffer, result.toString().utf8().data(), length - 1); | 378 strncpy(buffer, result.toString().utf8().data(), length - 1); |
380 } | 379 } |
381 #endif | 380 #endif |
382 | 381 |
383 } // namespace WebCore | 382 } // namespace WebCore |
OLD | NEW |