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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 StyleResolver* Document::styleResolver() const | 2108 StyleResolver* Document::styleResolver() const |
2109 { | 2109 { |
2110 return m_styleEngine->resolver(); | 2110 return m_styleEngine->resolver(); |
2111 } | 2111 } |
2112 | 2112 |
2113 StyleResolver& Document::ensureStyleResolver() const | 2113 StyleResolver& Document::ensureStyleResolver() const |
2114 { | 2114 { |
2115 return m_styleEngine->ensureResolver(); | 2115 return m_styleEngine->ensureResolver(); |
2116 } | 2116 } |
2117 | 2117 |
2118 void Document::attachLayoutTree(const AttachContext& context) | 2118 void Document::initialize() |
2119 { | 2119 { |
2120 DCHECK_EQ(m_lifecycle.state(), DocumentLifecycle::Inactive); | 2120 DCHECK_EQ(m_lifecycle.state(), DocumentLifecycle::Inactive); |
2121 DCHECK(!m_axObjectCache || this != &axObjectCacheOwner()); | 2121 DCHECK(!m_axObjectCache || this != &axObjectCacheOwner()); |
2122 | 2122 |
2123 m_layoutView = new LayoutView(this); | 2123 m_layoutView = new LayoutView(this); |
2124 setLayoutObject(m_layoutView); | 2124 setLayoutObject(m_layoutView); |
2125 | 2125 |
2126 m_layoutView->setIsInWindow(true); | 2126 m_layoutView->setIsInWindow(true); |
2127 m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); | 2127 m_layoutView->setStyle(StyleResolver::styleForDocument(*this)); |
2128 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
CompositingInputChange); | 2128 m_layoutView->compositor()->setNeedsCompositingUpdate(CompositingUpdateAfter
CompositingInputChange); |
2129 | 2129 |
2130 ContainerNode::attachLayoutTree(context); | 2130 ContainerNode::attachLayoutTree(); |
2131 | 2131 |
2132 // The TextAutosizer can't update layout view info while the Document is det
ached, so update now in case anything changed. | 2132 // The TextAutosizer can't update layout view info while the Document is det
ached, so update now in case anything changed. |
2133 if (TextAutosizer* autosizer = textAutosizer()) | 2133 if (TextAutosizer* autosizer = textAutosizer()) |
2134 autosizer->updatePageInfo(); | 2134 autosizer->updatePageInfo(); |
2135 | 2135 |
2136 m_frame->selection().documentAttached(this); | 2136 m_frame->selection().documentAttached(this); |
2137 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 2137 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
2138 | 2138 |
2139 if (view()) | 2139 if (view()) |
2140 view()->didAttachDocument(); | 2140 view()->didAttachDocument(); |
2141 | 2141 |
2142 // Needs to be called after view()->didAttachDocument(). | 2142 // Needs to be called after view()->didAttachDocument(). |
2143 m_rootScrollerController->didAttachDocument(); | 2143 m_rootScrollerController->didAttachDocument(); |
2144 } | 2144 } |
2145 | 2145 |
2146 void Document::detachLayoutTree(const AttachContext& context) | 2146 void Document::shutdown() |
2147 { | 2147 { |
2148 TRACE_EVENT0("blink", "Document::detach"); | 2148 TRACE_EVENT0("blink", "Document::shutdown"); |
2149 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); | 2149 RELEASE_ASSERT(!m_frame || m_frame->tree().childCount() == 0); |
2150 if (!isActive()) | 2150 if (!isActive()) |
2151 return; | 2151 return; |
2152 | 2152 |
2153 // Frame navigation can cause a new Document to be attached. Don't allow tha
t, since that will | 2153 // Frame navigation can cause a new Document to be attached. Don't allow tha
t, since that will |
2154 // cause a situation where LocalFrame still has a Document attached after th
is finishes! | 2154 // cause a situation where LocalFrame still has a Document attached after th
is finishes! |
2155 // Normally, it shouldn't actually be possible to trigger navigation here. H
owever, plugins | 2155 // Normally, it shouldn't actually be possible to trigger navigation here. H
owever, plugins |
2156 // (see below) can cause lots of crazy things to happen, since plugin detach
involves nested | 2156 // (see below) can cause lots of crazy things to happen, since plugin detach
involves nested |
2157 // message loops. | 2157 // message loops. |
2158 FrameNavigationDisabler navigationDisabler(*m_frame); | 2158 FrameNavigationDisabler navigationDisabler(*m_frame); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2205 m_focusedElement = nullptr; | 2205 m_focusedElement = nullptr; |
2206 if (frameHost()) | 2206 if (frameHost()) |
2207 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement, nu
llptr); | 2207 frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement, nu
llptr); |
2208 } | 2208 } |
2209 m_sequentialFocusNavigationStartingPoint = nullptr; | 2209 m_sequentialFocusNavigationStartingPoint = nullptr; |
2210 | 2210 |
2211 if (this == &axObjectCacheOwner()) | 2211 if (this == &axObjectCacheOwner()) |
2212 clearAXObjectCache(); | 2212 clearAXObjectCache(); |
2213 | 2213 |
2214 m_layoutView = nullptr; | 2214 m_layoutView = nullptr; |
2215 ContainerNode::detachLayoutTree(context); | 2215 ContainerNode::detachLayoutTree(); |
2216 | 2216 |
2217 if (this != &axObjectCacheOwner()) { | 2217 if (this != &axObjectCacheOwner()) { |
2218 if (AXObjectCache* cache = existingAXObjectCache()) { | 2218 if (AXObjectCache* cache = existingAXObjectCache()) { |
2219 // Documents that are not a root document use the AXObjectCache in | 2219 // Documents that are not a root document use the AXObjectCache in |
2220 // their root document. Node::removedFrom is called after the | 2220 // their root document. Node::removedFrom is called after the |
2221 // document has been detached so it can't find the root document. | 2221 // document has been detached so it can't find the root document. |
2222 // We do the removals here instead. | 2222 // We do the removals here instead. |
2223 for (Node& node : NodeTraversal::descendantsOf(*this)) { | 2223 for (Node& node : NodeTraversal::descendantsOf(*this)) { |
2224 cache->remove(&node); | 2224 cache->remove(&node); |
2225 } | 2225 } |
(...skipping 3823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6049 } | 6049 } |
6050 | 6050 |
6051 void showLiveDocumentInstances() | 6051 void showLiveDocumentInstances() |
6052 { | 6052 { |
6053 WeakDocumentSet& set = liveDocumentSet(); | 6053 WeakDocumentSet& set = liveDocumentSet(); |
6054 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6054 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6055 for (Document* document : set) | 6055 for (Document* document : set) |
6056 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6056 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
6057 } | 6057 } |
6058 #endif | 6058 #endif |
OLD | NEW |