Changeset 162962 in webkit
- Timestamp:
- Jan 28, 2014, 2:32:05 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r162960 r162962 1 2014-01-28 Antti Koivisto <antti@apple.com> 2 3 Document::topDocument() should return a reference 4 https://bugs.webkit.org/show_bug.cgi?id=127786 5 6 Reviewed by Darin Adler. 7 8 * accessibility/AccessibilityObject.cpp: 9 (WebCore::AccessibilityObject::mainFrame): 10 (WebCore::AccessibilityObject::topDocument): 11 * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: 12 (-[WebAccessibilityObjectWrapper accessibilityContainer]): 13 * dom/Document.cpp: 14 (WebCore::Document::~Document): 15 (WebCore::Document::createRenderTree): 16 (WebCore::Document::destroyRenderTree): 17 (WebCore::Document::clearAXObjectCache): 18 (WebCore::Document::existingAXObjectCache): 19 (WebCore::Document::axObjectCache): 20 (WebCore::Document::implicitClose): 21 (WebCore::Document::topDocument): 22 (WebCore::Document::topOrigin): 23 (WebCore::Document::webkitCancelFullScreen): 24 (WebCore::Document::webkitDidExitFullScreenForElement): 25 * dom/Document.h: 26 * page/DOMWindow.cpp: 27 (WebCore::DOMWindow::incrementScrollEventListenersCount): 28 (WebCore::DOMWindow::decrementScrollEventListenersCount): 29 * rendering/RenderEmbeddedObject.cpp: 30 (WebCore::RenderEmbeddedObject::isReplacementObscured): 31 * rendering/RenderView.cpp: 32 (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator): 33 1 34 2014-01-28 Viatcheslav Ostapenko <sl.ostapenko@samsung.com> 2 35 -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r162663 r162962 610 610 Document* document = topDocument(); 611 611 if (!document) 612 return 0;612 return nullptr; 613 613 614 614 Frame* frame = document->frame(); 615 615 if (!frame) 616 return 0;616 return nullptr; 617 617 618 618 return &frame->mainFrame(); … … 622 622 { 623 623 if (!document()) 624 return 0;625 return document()->topDocument();624 return nullptr; 625 return &document()->topDocument(); 626 626 } 627 627 -
trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
r162913 r162962 1110 1110 FrameView* frameView = m_object->documentFrameView(); 1111 1111 Document* document = m_object->document(); 1112 if (document && frameView && document != document->topDocument())1112 if (document && frameView && document != &document->topDocument()) 1113 1113 return frameView->platformWidget(); 1114 1114 -
trunk/Source/WebCore/dom/Document.cpp
r162947 r162962 594 594 detachParser(); 595 595 596 if (this == topDocument())596 if (this == &topDocument()) 597 597 clearAXObjectCache(); 598 598 … … 1948 1948 ASSERT(!renderView()); 1949 1949 ASSERT(!m_inPageCache); 1950 ASSERT(!m_axObjectCache || this != topDocument());1950 ASSERT(!m_axObjectCache || this != &topDocument()); 1951 1951 1952 1952 if (m_isNonRenderedPlaceholder) … … 2033 2033 TemporaryChange<bool> change(m_renderTreeBeingDestroyed, true); 2034 2034 2035 if (this == topDocument())2035 if (this == &topDocument()) 2036 2036 clearAXObjectCache(); 2037 2037 … … 2168 2168 void Document::clearAXObjectCache() 2169 2169 { 2170 ASSERT( topDocument() == this);2170 ASSERT(&topDocument() == this); 2171 2171 // Clear the cache member variable before calling delete because attempts 2172 2172 // are made to access it during destruction. … … 2176 2176 AXObjectCache* Document::existingAXObjectCache() const 2177 2177 { 2178 if (!topDocument()->hasLivingRenderTree()) 2178 Document& topDocument = this->topDocument(); 2179 if (!topDocument.hasLivingRenderTree()) 2179 2180 return nullptr; 2180 2181 return topDocument()->m_axObjectCache.get(); 2181 return topDocument.m_axObjectCache.get(); 2182 2182 } 2183 2183 … … 2191 2191 // to any other WebCoreAXObject on the same page. Using a single cache allows 2192 2192 // lookups across nested webareas (i.e. multiple documents). 2193 Document *topDocument = this->topDocument();2193 Document& topDocument = this->topDocument(); 2194 2194 2195 2195 // If the document has already been detached, do not make a new axObjectCache. 2196 if (!topDocument ->hasLivingRenderTree())2196 if (!topDocument.hasLivingRenderTree()) 2197 2197 return nullptr; 2198 2198 2199 ASSERT( topDocument == this || !m_axObjectCache);2200 if (!topDocument ->m_axObjectCache)2201 topDocument ->m_axObjectCache = adoptPtr(new AXObjectCache(*topDocument));2202 return topDocument ->m_axObjectCache.get();2199 ASSERT(&topDocument == this || !m_axObjectCache); 2200 if (!topDocument.m_axObjectCache) 2201 topDocument.m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); 2202 return topDocument.m_axObjectCache.get(); 2203 2203 } 2204 2204 … … 2469 2469 // only safe to call when a layout is not in progress, so it can not be used in postNotification. 2470 2470 axObjectCache()->getOrCreate(renderView()); 2471 if (this == topDocument())2471 if (this == &topDocument()) 2472 2472 axObjectCache()->postNotification(renderView(), AXObjectCache::AXLoadComplete); 2473 2473 else { … … 4312 4312 } 4313 4313 4314 Document* Document::topDocument() const 4315 { 4316 return m_frame ? m_frame->mainFrame().document() : const_cast<Document*>(this); 4314 Document& Document::topDocument() const 4315 { 4316 if (!m_frame) 4317 return const_cast<Document&>(*this); 4318 // This should always be non-null. 4319 Document* mainFrameDocument = m_frame->mainFrame().document(); 4320 return mainFrameDocument ? *mainFrameDocument : const_cast<Document&>(*this); 4317 4321 } 4318 4322 … … 4876 4880 SecurityOrigin* Document::topOrigin() const 4877 4881 { 4878 return topDocument() ->securityOrigin();4882 return topDocument().securityOrigin(); 4879 4883 } 4880 4884 … … 5223 5227 // "To fully exit fullscreen act as if the exitFullscreen() method was invoked on the top-level browsing 5224 5228 // context's document and subsequently empty that document's fullscreen element stack." 5225 if (!topDocument()->webkitFullscreenElement()) 5229 Document& topDocument = this->topDocument(); 5230 if (!topDocument.webkitFullscreenElement()) 5226 5231 return; 5227 5232 … … 5229 5234 // calling webkitExitFullscreen(): 5230 5235 Vector<RefPtr<Element>> replacementFullscreenElementStack; 5231 replacementFullscreenElementStack.append(topDocument ()->webkitFullscreenElement());5232 topDocument ()->m_fullScreenElementStack.swap(replacementFullscreenElementStack);5233 5234 topDocument ()->webkitExitFullscreen();5236 replacementFullscreenElementStack.append(topDocument.webkitFullscreenElement()); 5237 topDocument.m_fullScreenElementStack.swap(replacementFullscreenElementStack); 5238 5239 topDocument.webkitExitFullscreen(); 5235 5240 } 5236 5241 … … 5405 5410 // means that the events will be queued there. So if we have no events here, start the timer on 5406 5411 // the exiting document. 5407 Document* exitingDocument = this; 5408 if (m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTargetQueue.isEmpty()) 5409 exitingDocument = topDocument(); 5410 exitingDocument->m_fullScreenChangeDelayTimer.startOneShot(0); 5412 bool eventTargetQueuesEmpty = m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTargetQueue.isEmpty(); 5413 Document& exitingDocument = eventTargetQueuesEmpty ? topDocument() : *this; 5414 exitingDocument.m_fullScreenChangeDelayTimer.startOneShot(0); 5411 5415 } 5412 5416 -
trunk/Source/WebCore/dom/Document.h
r162795 r162962 906 906 907 907 Document* parentDocument() const; 908 Document *topDocument() const;908 Document& topDocument() const; 909 909 910 910 ScriptRunner* scriptRunner() { return m_scriptRunner.get(); } -
trunk/Source/WebCore/page/DOMWindow.cpp
r162663 r162962 1696 1696 { 1697 1697 Document* document = this->document(); 1698 if (++m_scrollEventListenerCount == 1 && document == document->topDocument()) {1698 if (++m_scrollEventListenerCount == 1 && document == &document->topDocument()) { 1699 1699 Frame* frame = this->frame(); 1700 1700 if (frame && frame->page()) … … 1706 1706 { 1707 1707 Document* document = this->document(); 1708 if (!--m_scrollEventListenerCount && document == document->topDocument()) {1708 if (!--m_scrollEventListenerCount && document == &document->topDocument()) { 1709 1709 Frame* frame = this->frame(); 1710 1710 if (frame && frame->page() && !document->inPageCache()) -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r161752 r162962 425 425 return true; 426 426 427 RenderView* rootRenderView = document().topDocument() ->renderView();427 RenderView* rootRenderView = document().topDocument().renderView(); 428 428 ASSERT(rootRenderView); 429 429 if (!rootRenderView) -
trunk/Source/WebCore/rendering/RenderView.cpp
r162947 r162962 1267 1267 1268 1268 RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator(RenderView* view) 1269 : m_rootView(view ? view->document().topDocument() ->renderView() : nullptr)1269 : m_rootView(view ? view->document().topDocument().renderView() : nullptr) 1270 1270 { 1271 1271 if (!m_rootView)
Note:
See TracChangeset
for help on using the changeset viewer.