| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 PassRefPtr<Text> Text::replaceWholeText(const String& newText, ExceptionCode&) | 141 PassRefPtr<Text> Text::replaceWholeText(const String& newText, ExceptionCode&) |
| 142 { | 142 { |
| 143 // Remove all adjacent text nodes, and replace the contents of this one. | 143 // Remove all adjacent text nodes, and replace the contents of this one. |
| 144 | 144 |
| 145 // Protect startText and endText against mutation event handlers removing th
e last ref | 145 // Protect startText and endText against mutation event handlers removing th
e last ref |
| 146 RefPtr<Text> startText = const_cast<Text*>(earliestLogicallyAdjacentTextNode
(this)); | 146 RefPtr<Text> startText = const_cast<Text*>(earliestLogicallyAdjacentTextNode
(this)); |
| 147 RefPtr<Text> endText = const_cast<Text*>(latestLogicallyAdjacentTextNode(thi
s)); | 147 RefPtr<Text> endText = const_cast<Text*>(latestLogicallyAdjacentTextNode(thi
s)); |
| 148 | 148 |
| 149 RefPtr<Text> protectedThis(this); // Mutation event handlers could cause our
last ref to go away | 149 RefPtr<Text> protectedThis(this); // Mutation event handlers could cause our
last ref to go away |
| 150 ContainerNode* parent = parentNode(); // Protect against mutation handlers m
oving this node during traversal | 150 RefPtr<ContainerNode> parent = parentNode(); // Protect against mutation han
dlers moving this node during traversal |
| 151 ExceptionCode ignored = 0; | 151 ExceptionCode ignored = 0; |
| 152 for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->par
entNode() == parent;) { | 152 for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->par
entNode() == parent;) { |
| 153 RefPtr<Node> nodeToRemove(n.release()); | 153 RefPtr<Node> nodeToRemove(n.release()); |
| 154 n = nodeToRemove->nextSibling(); | 154 n = nodeToRemove->nextSibling(); |
| 155 parent->removeChild(nodeToRemove.get(), ignored); | 155 parent->removeChild(nodeToRemove.get(), ignored); |
| 156 } | 156 } |
| 157 | 157 |
| 158 if (this != endText) { | 158 if (this != endText) { |
| 159 Node* onePastEndText = endText->nextSibling(); | 159 Node* onePastEndText = endText->nextSibling(); |
| 160 for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTe
xtNode() && n->parentNode() == parent;) { | 160 for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTe
xtNode() && n->parentNode() == parent;) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 result += "; "; | 309 result += "; "; |
| 310 result += "value="; | 310 result += "value="; |
| 311 result += s; | 311 result += s; |
| 312 } | 312 } |
| 313 | 313 |
| 314 strncpy(buffer, result.utf8().data(), length - 1); | 314 strncpy(buffer, result.utf8().data(), length - 1); |
| 315 } | 315 } |
| 316 #endif | 316 #endif |
| 317 | 317 |
| 318 } // namespace WebCore | 318 } // namespace WebCore |
| OLD | NEW |