| OLD | NEW |
| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) | 473 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT
imerFired) |
| 474 , m_hasViewportUnits(false) | 474 , m_hasViewportUnits(false) |
| 475 , m_styleRecalcElementCounter(0) | 475 , m_styleRecalcElementCounter(0) |
| 476 , m_parserSyncPolicy(AllowAsynchronousParsing) | 476 , m_parserSyncPolicy(AllowAsynchronousParsing) |
| 477 { | 477 { |
| 478 if (m_frame) { | 478 if (m_frame) { |
| 479 ASSERT(m_frame->page()); | 479 ASSERT(m_frame->page()); |
| 480 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 480 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
| 481 | 481 |
| 482 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 482 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
| 483 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); |
| 484 } else if (m_importsController) { |
| 485 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); |
| 486 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); |
| 487 } else { |
| 488 m_fetcher = ResourceFetcher::create(nullptr); |
| 483 } | 489 } |
| 484 | 490 |
| 485 if (!m_fetcher) | |
| 486 m_fetcher = FrameFetchContext::createContextAndFetcher(nullptr); | |
| 487 static_cast<FrameFetchContext&>(m_fetcher->context()).setDocument(this); | |
| 488 | |
| 489 // We depend on the url getting immediately set in subframes, but we | 491 // We depend on the url getting immediately set in subframes, but we |
| 490 // also depend on the url NOT getting immediately set in opened windows. | 492 // also depend on the url NOT getting immediately set in opened windows. |
| 491 // See fast/dom/early-frame-url.html | 493 // See fast/dom/early-frame-url.html |
| 492 // and fast/dom/location-new-window-no-crash.html, respectively. | 494 // and fast/dom/location-new-window-no-crash.html, respectively. |
| 493 // FIXME: Can/should we unify this behavior? | 495 // FIXME: Can/should we unify this behavior? |
| 494 if (initializer.shouldSetURL()) | 496 if (initializer.shouldSetURL()) |
| 495 setURL(initializer.url()); | 497 setURL(initializer.url()); |
| 496 | 498 |
| 497 initSecurityContext(initializer); | 499 initSecurityContext(initializer); |
| 498 initDNSPrefetch(); | 500 initDNSPrefetch(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 HTMLImportsController::removeFrom(*this); | 569 HTMLImportsController::removeFrom(*this); |
| 568 | 570 |
| 569 m_timeline->detachFromDocument(); | 571 m_timeline->detachFromDocument(); |
| 570 | 572 |
| 571 // We need to destroy CSSFontSelector before destroying m_fetcher. | 573 // We need to destroy CSSFontSelector before destroying m_fetcher. |
| 572 m_styleEngine->detachFromDocument(); | 574 m_styleEngine->detachFromDocument(); |
| 573 | 575 |
| 574 if (m_elemSheet) | 576 if (m_elemSheet) |
| 575 m_elemSheet->clearOwnerNode(); | 577 m_elemSheet->clearOwnerNode(); |
| 576 | 578 |
| 577 // It's possible for multiple Documents to end up referencing the same Resou
rceFetcher (e.g., SVGImages | |
| 578 // load the initial empty document and the SVGDocument with the same Documen
tLoader). | |
| 579 FrameFetchContext& context = static_cast<FrameFetchContext&>(m_fetcher->cont
ext()); | |
| 580 if (context.document() == this) | |
| 581 context.setDocument(nullptr); | |
| 582 m_fetcher.clear(); | |
| 583 | |
| 584 // We must call clearRareData() here since a Document class inherits TreeSco
pe | 579 // We must call clearRareData() here since a Document class inherits TreeSco
pe |
| 585 // as well as Node. See a comment on TreeScope.h for the reason. | 580 // as well as Node. See a comment on TreeScope.h for the reason. |
| 586 if (hasRareData()) | 581 if (hasRareData()) |
| 587 clearRareData(); | 582 clearRareData(); |
| 588 | 583 |
| 589 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); | 584 ASSERT(m_listsInvalidatedAtDocument.isEmpty()); |
| 590 | 585 |
| 591 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) | 586 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); ++i) |
| 592 ASSERT(!m_nodeListCounts[i]); | 587 ASSERT(!m_nodeListCounts[i]); |
| 593 | 588 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 { | 824 { |
| 830 if (!m_customElementMicrotaskRunQueue) | 825 if (!m_customElementMicrotaskRunQueue) |
| 831 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); | 826 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat
e(); |
| 832 return m_customElementMicrotaskRunQueue.get(); | 827 return m_customElementMicrotaskRunQueue.get(); |
| 833 } | 828 } |
| 834 | 829 |
| 835 void Document::setImportsController(HTMLImportsController* controller) | 830 void Document::setImportsController(HTMLImportsController* controller) |
| 836 { | 831 { |
| 837 ASSERT(!m_importsController || !controller); | 832 ASSERT(!m_importsController || !controller); |
| 838 m_importsController = controller; | 833 m_importsController = controller; |
| 834 if (!m_importsController) |
| 835 m_fetcher->clearContext(); |
| 839 } | 836 } |
| 840 | 837 |
| 841 HTMLImportLoader* Document::importLoader() const | 838 HTMLImportLoader* Document::importLoader() const |
| 842 { | 839 { |
| 843 if (!m_importsController) | 840 if (!m_importsController) |
| 844 return 0; | 841 return 0; |
| 845 return m_importsController->loaderFor(*this); | 842 return m_importsController->loaderFor(*this); |
| 846 } | 843 } |
| 847 | 844 |
| 848 bool Document::haveImportsLoaded() const | 845 bool Document::haveImportsLoaded() const |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 | 2130 |
| 2134 } | 2131 } |
| 2135 | 2132 |
| 2136 m_layoutView = 0; | 2133 m_layoutView = 0; |
| 2137 ContainerNode::detach(context); | 2134 ContainerNode::detach(context); |
| 2138 | 2135 |
| 2139 styleEngine().didDetach(); | 2136 styleEngine().didDetach(); |
| 2140 | 2137 |
| 2141 frameHost()->eventHandlerRegistry().documentDetached(*this); | 2138 frameHost()->eventHandlerRegistry().documentDetached(*this); |
| 2142 | 2139 |
| 2140 // If this Document is associated with a live DocumentLoader, the |
| 2141 // DocumentLoader will take care of clearing the FetchContext. Deferring |
| 2142 // to the DocumentLoader when possible also prevents prematurely clearing |
| 2143 // the context in the case where multiple Documents end up associated with |
| 2144 // a single DocumentLoader (e.g., navigating to a javascript: url). |
| 2145 if (!loader()) |
| 2146 m_fetcher->clearContext(); |
| 2147 |
| 2143 // This is required, as our LocalFrame might delete itself as soon as it det
aches | 2148 // This is required, as our LocalFrame might delete itself as soon as it det
aches |
| 2144 // us. However, this violates Node::detach() semantics, as it's never | 2149 // us. However, this violates Node::detach() semantics, as it's never |
| 2145 // possible to re-attach. Eventually Document::detach() should be renamed, | 2150 // possible to re-attach. Eventually Document::detach() should be renamed, |
| 2146 // or this setting of the frame to 0 could be made explicit in each of the | 2151 // or this setting of the frame to 0 could be made explicit in each of the |
| 2147 // callers of Document::detach(). | 2152 // callers of Document::detach(). |
| 2148 m_frame = nullptr; | 2153 m_frame = nullptr; |
| 2149 | 2154 |
| 2150 if (m_mediaQueryMatcher) | 2155 if (m_mediaQueryMatcher) |
| 2151 m_mediaQueryMatcher->documentDetached(); | 2156 m_mediaQueryMatcher->documentDetached(); |
| 2152 | 2157 |
| (...skipping 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5751 #ifndef NDEBUG | 5756 #ifndef NDEBUG |
| 5752 using namespace blink; | 5757 using namespace blink; |
| 5753 void showLiveDocumentInstances() | 5758 void showLiveDocumentInstances() |
| 5754 { | 5759 { |
| 5755 WeakDocumentSet& set = liveDocumentSet(); | 5760 WeakDocumentSet& set = liveDocumentSet(); |
| 5756 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5761 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5757 for (Document* document : set) | 5762 for (Document* document : set) |
| 5758 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5763 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5759 } | 5764 } |
| 5760 #endif | 5765 #endif |
| OLD | NEW |