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

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

Issue 112953007: Make TreeScope::documentScope() return a reference and ensure m_documentScope is never NULL (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // We must call clearRareData() here since a Document class inherits TreeSco pe 540 // We must call clearRareData() here since a Document class inherits TreeSco pe
541 // as well as Node. See a comment on TreeScope.h for the reason. 541 // as well as Node. See a comment on TreeScope.h for the reason.
542 if (hasRareData()) 542 if (hasRareData())
543 clearRareData(); 543 clearRareData();
544 544
545 ASSERT(!m_listsInvalidatedAtDocument.size()); 545 ASSERT(!m_listsInvalidatedAtDocument.size());
546 546
547 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) 547 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++)
548 ASSERT(!m_nodeListCounts[i]); 548 ASSERT(!m_nodeListCounts[i]);
549 549
550 clearDocumentScope();
551 setClient(0); 550 setClient(0);
552 551
553 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); 552 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter);
554 } 553 }
555 554
556 void Document::dispose() 555 void Document::dispose()
557 { 556 {
558 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); 557 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
559 // We must make sure not to be retaining any of our children through 558 // We must make sure not to be retaining any of our children through
560 // these extra pointers or we will create a reference cycle. 559 // these extra pointers or we will create a reference cycle.
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 m_nodeIterators.add(ni); 3491 m_nodeIterators.add(ni);
3493 } 3492 }
3494 3493
3495 void Document::detachNodeIterator(NodeIterator* ni) 3494 void Document::detachNodeIterator(NodeIterator* ni)
3496 { 3495 {
3497 // The node iterator can be detached without having been attached if its roo t node didn't have a document 3496 // The node iterator can be detached without having been attached if its roo t node didn't have a document
3498 // when the iterator was created, but has it now. 3497 // when the iterator was created, but has it now.
3499 m_nodeIterators.remove(ni); 3498 m_nodeIterators.remove(ni);
3500 } 3499 }
3501 3500
3502 void Document::moveNodeIteratorsToNewDocument(Node* node, Document* newDocument) 3501 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
3503 { 3502 {
3504 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; 3503 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators;
3505 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList. end(); 3504 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList. end();
3506 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { 3505 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) {
3507 if ((*it)->root() == node) { 3506 if ((*it)->root() == node) {
3508 detachNodeIterator(*it); 3507 detachNodeIterator(*it);
3509 newDocument->attachNodeIterator(*it); 3508 newDocument.attachNodeIterator(*it);
3510 } 3509 }
3511 } 3510 }
3512 } 3511 }
3513 3512
3514 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) 3513 void Document::updateRangesAfterChildrenChanged(ContainerNode* container)
3515 { 3514 {
3516 if (!m_ranges.isEmpty()) { 3515 if (!m_ranges.isEmpty()) {
3517 HashSet<Range*>::const_iterator end = m_ranges.end(); 3516 HashSet<Range*>::const_iterator end = m_ranges.end();
3518 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; + +it) 3517 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; + +it)
3519 (*it)->nodeChildrenChanged(container); 3518 (*it)->nodeChildrenChanged(container);
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
5265 } 5264 }
5266 5265
5267 FastTextAutosizer* Document::fastTextAutosizer() 5266 FastTextAutosizer* Document::fastTextAutosizer()
5268 { 5267 {
5269 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5268 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5270 m_fastTextAutosizer = FastTextAutosizer::create(this); 5269 m_fastTextAutosizer = FastTextAutosizer::create(this);
5271 return m_fastTextAutosizer.get(); 5270 return m_fastTextAutosizer.get();
5272 } 5271 }
5273 5272
5274 } // namespace WebCore 5273 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698