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

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

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

Powered by Google App Engine
This is Rietveld 408576698