Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: Source/WebCore/dom/Text.cpp

Issue 9569046: Merge 109362 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/Node.cpp ('k') | Source/WebCore/editing/markup.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Node.cpp ('k') | Source/WebCore/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698