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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2644063002: Make SynchronousMutationObserver::didMergeTextNodes() to take both merged and merging nodes (Closed)
Patch Set: 2017-01-19T17:22:18 Created 3 years, 11 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
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 4249 matching lines...) Expand 10 before | Expand all | Expand 10 after
4260 } 4260 }
4261 4261
4262 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) { 4262 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) {
4263 for (Range* range : m_ranges) 4263 for (Range* range : m_ranges)
4264 range->didRemoveText(text, offset, length); 4264 range->didRemoveText(text, offset, length);
4265 4265
4266 m_markers->removeMarkers(text, offset, length); 4266 m_markers->removeMarkers(text, offset, length);
4267 m_markers->shiftMarkers(text, offset + length, 0 - length); 4267 m_markers->shiftMarkers(text, offset + length, 0 - length);
4268 } 4268 }
4269 4269
4270 void Document::didMergeTextNodes(Text& oldNode, unsigned offset) { 4270 void Document::didMergeTextNodes(const Text& mergedNode,
4271 const Text& nodeToBeRemoved,
4272 unsigned oldLength) {
4273 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved));
4271 if (!m_ranges.isEmpty()) { 4274 if (!m_ranges.isEmpty()) {
4272 NodeWithIndex oldNodeWithIndex(oldNode);
4273 for (Range* range : m_ranges) 4275 for (Range* range : m_ranges)
4274 range->didMergeTextNodes(oldNodeWithIndex, offset); 4276 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength);
4275 } 4277 }
4276 4278
4277 notifyMergeTextNodes(oldNode, offset); 4279 notifyMergeTextNodes(mergedNode, nodeToBeRemovedWithIndex, oldLength);
4278 if (m_frame) 4280 if (m_frame)
4279 m_frame->selection().didMergeTextNodes(oldNode, offset); 4281 m_frame->selection().didMergeTextNodes(nodeToBeRemoved, oldLength);
4280 4282
4281 // FIXME: This should update markers for spelling and grammar checking. 4283 // FIXME: This should update markers for spelling and grammar checking.
4282 } 4284 }
4283 4285
4284 void Document::didSplitTextNode(const Text& oldNode) { 4286 void Document::didSplitTextNode(const Text& oldNode) {
4285 for (Range* range : m_ranges) 4287 for (Range* range : m_ranges)
4286 range->didSplitTextNode(oldNode); 4288 range->didSplitTextNode(oldNode);
4287 4289
4288 notifySplitTextNode(oldNode); 4290 notifySplitTextNode(oldNode);
4289 if (m_frame) 4291 if (m_frame)
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
6538 } 6540 }
6539 6541
6540 void showLiveDocumentInstances() { 6542 void showLiveDocumentInstances() {
6541 WeakDocumentSet& set = liveDocumentSet(); 6543 WeakDocumentSet& set = liveDocumentSet();
6542 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6544 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6543 for (Document* document : set) 6545 for (Document* document : set)
6544 fprintf(stderr, "- Document %p URL: %s\n", document, 6546 fprintf(stderr, "- Document %p URL: %s\n", document,
6545 document->url().getString().utf8().data()); 6547 document->url().getString().utf8().data());
6546 } 6548 }
6547 #endif 6549 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698