diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2017-06-01 15:54:01 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-06-02 14:07:43 +0000 |
commit | 0a3506ebe5d7f431f0dd4dffa24ac32063b90ff1 (patch) | |
tree | f3d0b92fe7bc5b31426a838c354616fff335e82b /Source/WebCore/dom/Document.cpp | |
parent | 881da28418d380042aa95a97f0cbd42560a64f7c (diff) | |
download | qtwebkit-0a3506ebe5d7f431f0dd4dffa24ac32063b90ff1.tar.gz |
Import WebKit commit 3ca7a25a550e473d60bbbe321475c6c0ef114b31
Change-Id: I480668a0cb8114dccf7a1195190a993282875759
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'Source/WebCore/dom/Document.cpp')
-rw-r--r-- | Source/WebCore/dom/Document.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index c7d87bb6c..f34a1c15f 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -475,15 +475,11 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig , m_xmlStandalone(StandaloneUnspecified) , m_hasXMLDeclaration(false) , m_designMode(inherit) -#if !ASSERT_DISABLED - , m_inInvalidateNodeListAndCollectionCaches(false) -#endif #if ENABLE(DASHBOARD_SUPPORT) , m_hasAnnotatedRegions(false) , m_annotatedRegionsDirty(false) #endif , m_createRenderers(true) - , m_inPageCache(false) , m_accessKeyMapValid(false) , m_documentClasses(documentClasses) , m_isSynthesized(constructionFlags & Synthesized) @@ -588,7 +584,7 @@ Document::~Document() allDocuments().remove(this); ASSERT(!renderView()); - ASSERT(!m_inPageCache); + ASSERT(m_pageCacheState != InPageCache); ASSERT(m_ranges.isEmpty()); ASSERT(!m_parentTreeScope); ASSERT(!m_disabledFieldsetElementsCount); @@ -665,7 +661,7 @@ void Document::removedLastRef() // until after removeDetachedChildren returns, so we protect ourselves. incrementReferencingNodeCount(); - prepareForDestruction(); + RELEASE_ASSERT(!hasLivingRenderTree()); // We must make sure not to be retaining any of our children through // these extra pointers or we will create a reference cycle. m_focusedElement = nullptr; @@ -1993,7 +1989,7 @@ Ref<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element& el ASSERT(&element.document() == this); // On iOS request delegates called during styleForElement may result in re-entering WebKit and killing the style resolver. - ResourceLoadSuspender suspender; + Style::PostResolutionCallbackDisabler disabler(*this); TemporaryChange<bool> change(m_ignorePendingStylesheets, true); return element.resolveStyle(parentStyle); @@ -2197,7 +2193,7 @@ void Document::clearStyleResolver() void Document::createRenderTree() { ASSERT(!renderView()); - ASSERT(!m_inPageCache); + ASSERT(m_pageCacheState != InPageCache); ASSERT(!m_axObjectCache || this != &topDocument()); if (m_isNonRenderedPlaceholder) @@ -2261,7 +2257,7 @@ void Document::disconnectFromFrame() void Document::destroyRenderTree() { ASSERT(hasLivingRenderTree()); - ASSERT(!m_inPageCache); + ASSERT(m_pageCacheState != InPageCache); TemporaryChange<bool> change(m_renderTreeBeingDestroyed, true); @@ -2377,6 +2373,11 @@ void Document::removeAllEventListeners() #endif for (Node* node = firstChild(); node; node = NodeTraversal::next(*node)) node->removeAllEventListeners(); + +#if ENABLE(TOUCH_EVENTS) + m_touchEventTargets = nullptr; +#endif + m_wheelEventTargets = nullptr; } void Document::suspendDeviceMotionAndOrientationUpdates() @@ -3719,7 +3720,7 @@ bool Document::setFocusedElement(Element* element, FocusDirection direction) if (m_focusedElement == newFocusedElement) return true; - if (m_inPageCache) + if (inPageCache()) return false; bool focusChangeBlocked = false; @@ -3870,9 +3871,7 @@ void Document::unregisterNodeListForInvalidation(LiveNodeList& list) return; list.setRegisteredForInvalidationAtDocument(false); - ASSERT(m_inInvalidateNodeListAndCollectionCaches - ? m_listsInvalidatedAtDocument.isEmpty() - : m_listsInvalidatedAtDocument.contains(&list)); + ASSERT(m_listsInvalidatedAtDocument.contains(&list)); m_listsInvalidatedAtDocument.remove(&list); } @@ -4539,17 +4538,18 @@ URL Document::completeURL(const String& url) const return completeURL(url, m_baseURL); } -void Document::setInPageCache(bool flag) +void Document::setPageCacheState(PageCacheState state) { - if (m_inPageCache == flag) + if (m_pageCacheState == state) return; - m_inPageCache = flag; + m_pageCacheState = state; FrameView* v = view(); Page* page = this->page(); - if (flag) { + switch (state) { + case InPageCache: if (v) { // FIXME: There is some scrolling related work that needs to happen whenever a page goes into the // page cache and similar work that needs to occur when it comes out. This is where we do the work @@ -4571,9 +4571,13 @@ void Document::setInPageCache(bool flag) clearStyleResolver(); clearSelectorQueryCache(); clearSharedObjectPool(); - } else { + break; + case NotInPageCache: if (childNeedsStyleRecalc()) scheduleStyleRecalc(); + break; + case AboutToEnterPageCache: + break; } } @@ -4859,7 +4863,7 @@ Document& Document::topDocument() const { // FIXME: This special-casing avoids incorrectly determined top documents during the process // of AXObjectCache teardown or notification posting for cached or being-destroyed documents. - if (!m_inPageCache && !m_renderTreeBeingDestroyed) { + if (!inPageCache() && !m_renderTreeBeingDestroyed) { if (!m_frame) return const_cast<Document&>(*this); // This should always be non-null. |