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