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

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

Issue 176863009: Have NodeWithIndex deal with references instead of pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | no next file » | 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 unsigned offset = length(); 82 unsigned offset = length();
83 String nextTextData = nextText->data(); 83 String nextTextData = nextText->data();
84 String oldTextData = data(); 84 String oldTextData = data();
85 setDataWithoutUpdate(data() + nextTextData); 85 setDataWithoutUpdate(data() + nextTextData);
86 updateTextRenderer(oldTextData.length(), 0); 86 updateTextRenderer(oldTextData.length(), 0);
87 87
88 // Empty nextText for layout update. 88 // Empty nextText for layout update.
89 nextText->setDataWithoutUpdate(emptyString()); 89 nextText->setDataWithoutUpdate(emptyString());
90 nextText->updateTextRenderer(0, nextTextData.length()); 90 nextText->updateTextRenderer(0, nextTextData.length());
91 91
92 document().didMergeTextNodes(nextText.get(), offset); 92 document().didMergeTextNodes(*nextText, offset);
93 93
94 // Restore nextText for mutation event. 94 // Restore nextText for mutation event.
95 nextText->setDataWithoutUpdate(nextTextData); 95 nextText->setDataWithoutUpdate(nextTextData);
96 nextText->updateTextRenderer(0, 0); 96 nextText->updateTextRenderer(0, 0);
97 97
98 document().incDOMTreeVersion(); 98 document().incDOMTreeVersion();
99 didModifyData(oldTextData); 99 didModifyData(oldTextData);
100 nextText->remove(IGNORE_EXCEPTION); 100 nextText->remove(IGNORE_EXCEPTION);
101 } 101 }
102 102
(...skipping 18 matching lines...) Expand all
121 121
122 if (parentNode()) 122 if (parentNode())
123 parentNode()->insertBefore(newText.get(), nextSibling(), exceptionState) ; 123 parentNode()->insertBefore(newText.get(), nextSibling(), exceptionState) ;
124 if (exceptionState.hadException()) 124 if (exceptionState.hadException())
125 return nullptr; 125 return nullptr;
126 126
127 if (renderer()) 127 if (renderer())
128 toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr.length ()); 128 toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr.length ());
129 129
130 if (parentNode()) 130 if (parentNode())
131 document().didSplitTextNode(this); 131 document().didSplitTextNode(*this);
132 132
133 return newText.release(); 133 return newText.release();
134 } 134 }
135 135
136 static const Text* earliestLogicallyAdjacentTextNode(const Text* t) 136 static const Text* earliestLogicallyAdjacentTextNode(const Text* t)
137 { 137 {
138 const Node* n = t; 138 const Node* n = t;
139 while ((n = n->previousSibling())) { 139 while ((n = n->previousSibling())) {
140 Node::NodeType type = n->nodeType(); 140 Node::NodeType type = n->nodeType();
141 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) { 141 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 result.appendLiteral("; "); 368 result.appendLiteral("; ");
369 result.appendLiteral("value="); 369 result.appendLiteral("value=");
370 result.append(s); 370 result.append(s);
371 } 371 }
372 372
373 strncpy(buffer, result.toString().utf8().data(), length - 1); 373 strncpy(buffer, result.toString().utf8().data(), length - 1);
374 } 374 }
375 #endif 375 #endif
376 376
377 } // namespace WebCore 377 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698