| 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 * |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 // Protect startText and endText against mutation event handlers removing th
e last ref | 149 // Protect startText and endText against mutation event handlers removing th
e last ref |
| 150 RefPtr<Text> startText = const_cast<Text*>(earliestLogicallyAdjacentTextNode
(this)); | 150 RefPtr<Text> startText = const_cast<Text*>(earliestLogicallyAdjacentTextNode
(this)); |
| 151 RefPtr<Text> endText = const_cast<Text*>(latestLogicallyAdjacentTextNode(thi
s)); | 151 RefPtr<Text> endText = const_cast<Text*>(latestLogicallyAdjacentTextNode(thi
s)); |
| 152 | 152 |
| 153 RefPtr<Text> protectedThis(this); // Mutation event handlers could cause our
last ref to go away | 153 RefPtr<Text> protectedThis(this); // Mutation event handlers could cause our
last ref to go away |
| 154 RefPtr<ContainerNode> parent = parentNode(); // Protect against mutation han
dlers moving this node during traversal | 154 RefPtr<ContainerNode> parent = parentNode(); // Protect against mutation han
dlers moving this node during traversal |
| 155 for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->par
entNode() == parent;) { | 155 for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->par
entNode() == parent;) { |
| 156 RefPtr<Node> nodeToRemove(n.release()); | 156 RefPtr<Node> nodeToRemove(n.release()); |
| 157 n = nodeToRemove->nextSibling(); | 157 n = nodeToRemove->nextSibling(); |
| 158 parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION_STATE); | 158 parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION); |
| 159 } | 159 } |
| 160 | 160 |
| 161 if (this != endText) { | 161 if (this != endText) { |
| 162 Node* onePastEndText = endText->nextSibling(); | 162 Node* onePastEndText = endText->nextSibling(); |
| 163 for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTe
xtNode() && n->parentNode() == parent;) { | 163 for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTe
xtNode() && n->parentNode() == parent;) { |
| 164 RefPtr<Node> nodeToRemove(n.release()); | 164 RefPtr<Node> nodeToRemove(n.release()); |
| 165 n = nodeToRemove->nextSibling(); | 165 n = nodeToRemove->nextSibling(); |
| 166 parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION_STATE); | 166 parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (newText.isEmpty()) { | 170 if (newText.isEmpty()) { |
| 171 if (parent && parentNode() == parent) | 171 if (parent && parentNode() == parent) |
| 172 parent->removeChild(this, IGNORE_EXCEPTION_STATE); | 172 parent->removeChild(this, IGNORE_EXCEPTION); |
| 173 return 0; | 173 return 0; |
| 174 } | 174 } |
| 175 | 175 |
| 176 setData(newText); | 176 setData(newText); |
| 177 return protectedThis.release(); | 177 return protectedThis.release(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 String Text::nodeName() const | 180 String Text::nodeName() const |
| 181 { | 181 { |
| 182 return textAtom.string(); | 182 return textAtom.string(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 result.appendLiteral("; "); | 348 result.appendLiteral("; "); |
| 349 result.appendLiteral("value="); | 349 result.appendLiteral("value="); |
| 350 result.append(s); | 350 result.append(s); |
| 351 } | 351 } |
| 352 | 352 |
| 353 strncpy(buffer, result.toString().utf8().data(), length - 1); | 353 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 354 } | 354 } |
| 355 #endif | 355 #endif |
| 356 | 356 |
| 357 } // namespace WebCore | 357 } // namespace WebCore |
| OLD | NEW |