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

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: Added FIXMEs 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 m_nodeIterators.add(ni); 3484 m_nodeIterators.add(ni);
3486 } 3485 }
3487 3486
3488 void Document::detachNodeIterator(NodeIterator* ni) 3487 void Document::detachNodeIterator(NodeIterator* ni)
3489 { 3488 {
3490 // The node iterator can be detached without having been attached if its roo t node didn't have a document 3489 // The node iterator can be detached without having been attached if its roo t node didn't have a document
3491 // when the iterator was created, but has it now. 3490 // when the iterator was created, but has it now.
3492 m_nodeIterators.remove(ni); 3491 m_nodeIterators.remove(ni);
3493 } 3492 }
3494 3493
3495 void Document::moveNodeIteratorsToNewDocument(Node* node, Document* newDocument) 3494 void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
3496 { 3495 {
3497 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; 3496 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators;
3498 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList. end(); 3497 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList. end();
3499 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { 3498 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) {
3500 if ((*it)->root() == node) { 3499 if ((*it)->root() == node) {
3501 detachNodeIterator(*it); 3500 detachNodeIterator(*it);
3502 newDocument->attachNodeIterator(*it); 3501 newDocument.attachNodeIterator(*it);
3503 } 3502 }
3504 } 3503 }
3505 } 3504 }
3506 3505
3507 void Document::updateRangesAfterChildrenChanged(ContainerNode* container) 3506 void Document::updateRangesAfterChildrenChanged(ContainerNode* container)
3508 { 3507 {
3509 if (!m_ranges.isEmpty()) { 3508 if (!m_ranges.isEmpty()) {
3510 HashSet<Range*>::const_iterator end = m_ranges.end(); 3509 HashSet<Range*>::const_iterator end = m_ranges.end();
3511 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; + +it) 3510 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; + +it)
3512 (*it)->nodeChildrenChanged(container); 3511 (*it)->nodeChildrenChanged(container);
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5264 } 5263 }
5265 5264
5266 FastTextAutosizer* Document::fastTextAutosizer() 5265 FastTextAutosizer* Document::fastTextAutosizer()
5267 { 5266 {
5268 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5267 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5269 m_fastTextAutosizer = FastTextAutosizer::create(this); 5268 m_fastTextAutosizer = FastTextAutosizer::create(this);
5270 return m_fastTextAutosizer.get(); 5269 return m_fastTextAutosizer.get();
5271 } 5270 }
5272 5271
5273 } // namespace WebCore 5272 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698