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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Make requested changes, rebase (HashMap::remove() => HashMap::erase()) 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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after
6659 } 6654 }
6660 6655
6661 void showLiveDocumentInstances() { 6656 void showLiveDocumentInstances() {
6662 WeakDocumentSet& set = liveDocumentSet(); 6657 WeakDocumentSet& set = liveDocumentSet();
6663 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6658 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6664 for (blink::Document* document : set) 6659 for (blink::Document* document : set)
6665 fprintf(stderr, "- Document %p URL: %s\n", document, 6660 fprintf(stderr, "- Document %p URL: %s\n", document,
6666 document->url().getString().utf8().data()); 6661 document->url().getString().utf8().data());
6667 } 6662 }
6668 #endif 6663 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698