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

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

Issue 2755953004: Refactor DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: 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 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 if (containsV1ShadowTree()) 4324 if (containsV1ShadowTree())
4325 n.checkSlotChangeBeforeRemoved(); 4325 n.checkSlotChangeBeforeRemoved();
4326 4326
4327 if (n.inActiveDocument() && n.isElementNode()) 4327 if (n.inActiveDocument() && n.isElementNode())
4328 styleEngine().elementWillBeRemoved(toElement(n)); 4328 styleEngine().elementWillBeRemoved(toElement(n));
4329 } 4329 }
4330 4330
4331 void Document::didInsertText(Node* text, unsigned offset, unsigned length) { 4331 void Document::didInsertText(Node* text, unsigned offset, unsigned length) {
4332 for (Range* range : m_ranges) 4332 for (Range* range : m_ranges)
4333 range->didInsertText(text, offset, length); 4333 range->didInsertText(text, offset, length);
4334
4335 m_markers->shiftMarkers(text, offset, length);
4336 } 4334 }
4337 4335
4338 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) { 4336 void Document::didRemoveText(Node* text, unsigned offset, unsigned length) {
4339 for (Range* range : m_ranges) 4337 for (Range* range : m_ranges)
4340 range->didRemoveText(text, offset, length); 4338 range->didRemoveText(text, offset, length);
4341
4342 m_markers->removeMarkers(text, offset, length);
4343 m_markers->shiftMarkers(text, offset + length, 0 - length);
4344 } 4339 }
4345 4340
4346 void Document::didMergeTextNodes(const Text& mergedNode, 4341 void Document::didMergeTextNodes(const Text& mergedNode,
4347 const Text& nodeToBeRemoved, 4342 const Text& nodeToBeRemoved,
4348 unsigned oldLength) { 4343 unsigned oldLength) {
4349 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved)); 4344 NodeWithIndex nodeToBeRemovedWithIndex(const_cast<Text&>(nodeToBeRemoved));
4350 if (!m_ranges.isEmpty()) { 4345 if (!m_ranges.isEmpty()) {
4351 for (Range* range : m_ranges) 4346 for (Range* range : m_ranges)
4352 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength); 4347 range->didMergeTextNodes(nodeToBeRemovedWithIndex, oldLength);
4353 } 4348 }
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
6680 } 6675 }
6681 6676
6682 void showLiveDocumentInstances() { 6677 void showLiveDocumentInstances() {
6683 WeakDocumentSet& set = liveDocumentSet(); 6678 WeakDocumentSet& set = liveDocumentSet();
6684 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6679 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6685 for (blink::Document* document : set) 6680 for (blink::Document* document : set)
6686 fprintf(stderr, "- Document %p URL: %s\n", document, 6681 fprintf(stderr, "- Document %p URL: %s\n", document,
6687 document->url().getString().utf8().data()); 6682 document->url().getString().utf8().data());
6688 } 6683 }
6689 #endif 6684 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698