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

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

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: Fix nits, make test cases more clear Created 3 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
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 4307 matching lines...) Expand 10 before | Expand all | Expand 10 after
4318 if (containsV1ShadowTree()) 4318 if (containsV1ShadowTree())
4319 n.checkSlotChangeBeforeRemoved(); 4319 n.checkSlotChangeBeforeRemoved();
4320 4320
4321 if (n.inActiveDocument() && n.isElementNode()) 4321 if (n.inActiveDocument() && n.isElementNode())
4322 styleEngine().elementWillBeRemoved(toElement(n)); 4322 styleEngine().elementWillBeRemoved(toElement(n));
4323 } 4323 }
4324 4324
4325 void Document::didInsertText(Node* text, unsigned offset, unsigned length) { 4325 void Document::didInsertText(Node* text, unsigned offset, unsigned length) {
4326 for (Range* range : m_ranges) 4326 for (Range* range : m_ranges)
4327 range->didInsertText(text, offset, length); 4327 range->didInsertText(text, offset, length);
4328
4329 m_markers->shiftMarkers(text, offset, length);
4330 } 4328 }
4331 4329
4332 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) { 4330 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) {
4333 for (Range* range : m_ranges) 4331 for (Range* range : m_ranges)
4334 range->didRemoveText(text, offset, length); 4332 range->didRemoveText(text, offset, length);
4335
4336 m_markers->removeMarkers(text, offset, length);
4337 m_markers->shiftMarkers(text, offset + length, 0 - length);
4338 } 4333 }
4339 4334
4340 void Document::didMergeTextNodes(const Text& mergedNode, 4335 void Document::didMergeTextNodes(const Text& mergedNode,
4341 const Text& nodeToBeRemoved, 4336 const Text& nodeToBeRemoved,
4342 unsigned oldLength) { 4337 unsigned oldLength) {
4343 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved)); 4338 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved));
4344 if (!m_ranges.isEmpty()) { 4339 if (!m_ranges.isEmpty()) {
4345 for (Range* range : m_ranges) 4340 for (Range* range : m_ranges)
4346 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength); 4341 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength);
4347 } 4342 }
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
6662 } 6657 }
6663 6658
6664 void showLiveDocumentInstances() { 6659 void showLiveDocumentInstances() {
6665 WeakDocumentSet& set = liveDocumentSet(); 6660 WeakDocumentSet& set = liveDocumentSet();
6666 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6661 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6667 for (blink::Document* document : set) 6662 for (blink::Document* document : set)
6668 fprintf(stderr, "- Document %p URL: %s\n", document, 6663 fprintf(stderr, "- Document %p URL: %s\n", document,
6669 document->url().getString().utf8().data()); 6664 document->url().getString().utf8().data());
6670 } 6665 }
6671 #endif 6666 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698