Add Frame::mainFrame and Frame::isMainFrame
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Sep 2013 17:19:04 +0000 (17:19 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Sep 2013 17:19:04 +0000 (17:19 +0000)
commit074af2d6d58b910959c0561c0608b859b4cff088
tree027a47389f5e78bd301cf30e09910f368101eb2b
parent7827f55a7c6bafa83263675d3e7106a246a55bbf
Add Frame::mainFrame and Frame::isMainFrame
https://bugs.webkit.org/show_bug.cgi?id=122064

Reviewed by Andreas Kling.

Source/WebCore:

* WebCore.exp.in: Removed exports of FrameView::isMainFrameView and
Page::frameIsMainFrame. Since the new isMainFrame function is inline, it
does not need to be exported.

* history/PageCache.cpp:
(WebCore::PageCache::markPagesForFullStyleRecalc):
(WebCore::PageCache::markPagesForDeviceScaleChanged):
These two were the only functions I found that really wanted the equivalent
of Page::frameIsMainFrame, so wrote it out here instead of using a function
call.

* inspector/InspectorAgent.cpp: Removed the unused isMainResourceLoader function.
* inspector/InspectorAgent.h: Removed declarations of a few nonexistent or
unused private member functions. Also removed the InjectedScriptForOriginMap
typedef: It's mor readable to use the type directly

* loader/FrameLoader.h: Removed isLoadingMainFrame. It's not better than
calling frame().isMainFrame() directly.

* page/Frame.cpp:
(WebCore::Frame::Frame): Initialize m_mainFrame and call selfOnlyRef, keeping
the MainFrame alive as long as any of its subframes is alive.
(WebCore::Frame::~Frame): Call selfOnlyDeref.
(WebCore::Frame::createView): Use isMainFrame.
(WebCore::Frame::setPageAndTextZoomFactors): Ditto.

* page/Frame.h: Added Frame::mainFrame, Frame::isMainFrame, and Frame::m_mainFrame.

* page/FrameView.h: Removed the isMainFrameView function. It's not better than
calling frame().isMainFrame() directly.

* page/MainFrame.cpp:
(WebCore::MainFrame::MainFrame): Initialize m_selfOnlyRefCount to 0.
(WebCore::MainFrame::selfOnlyRef): Added.
(WebCore::MainFrame::selfOnlyDeref): Added.
(WebCore::MainFrame::dropChildren): Added. Called when the self-only reference
count reaches 0 to avoid a reference cycle with subframes.

* page/MainFrame.h: Added new data members as mentioned above. Also, the
definition of the Frame::isMainFrame inline function goes here, since it can't
compile without the MainFrame class definition. This means that callers of
isMainFrame need to include MainFrame.h, which seems reasonable and is easy
to do.

* page/Page.cpp:
* page/Page.h: Added assertion to Page::mainFrame since it returns a reference.
Removed Page::frameIsMainFrame since it's not better than calling isMainFrame
on the frame.

* dom/Document.cpp:
(WebCore::Document::setVisualUpdatesAllowed):
(WebCore::Document::didBecomeCurrentDocumentInFrame):
(WebCore::Document::updateViewportArguments):
(WebCore::Document::setInPageCache):
(WebCore::Document::ensurePlugInsInjectedScript):
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
* history/CachedPage.cpp:
(WebCore::CachedPage::restore):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::shouldShrinkToFit):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::didClearWindowObjectInWorld):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
(WebCore::InspectorPageAgent::frameNavigated):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted):
(WebCore::FrameLoader::prepareForCachedPageRestore):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::didLayout):
(WebCore::FrameLoader::checkLoadComplete):
(WebCore::FrameLoader::addExtraFieldsToRequest):
(WebCore::FrameLoader::loadResourceSynchronously):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
(WebCore::FrameLoader::dispatchDidCommitLoad):
(WebCore::FrameLoader::loadProgressingStatusChanged):
* loader/HistoryController.cpp:
(WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
(WebCore::HistoryController::restoreScrollPositionAndViewState):
(WebCore::HistoryController::updateForCommit):
(WebCore::HistoryController::updateForSameDocumentNavigation):
(WebCore::HistoryController::updateBackForwardListClippedAtTarget):
(WebCore::HistoryController::pushState):
* loader/icon/IconController.cpp:
(WebCore::IconController::startLoader):
* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::stopAutoscrollTimer):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
* page/DOMWindow.cpp:
(WebCore::allowsBeforeUnloadListeners):
(WebCore::DOMWindow::focus):
(WebCore::DOMWindow::blur):
(WebCore::DOMWindow::close):
(WebCore::DOMWindow::allowedToChangeWindowGeometry):
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::keyEvent):
* page/FrameTree.cpp:
(WebCore::FrameTree::find):
(WebCore::FrameTree::traverseNextWithWrap):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::setFrameRect):
(WebCore::FrameView::createScrollbar):
(WebCore::FrameView::applyOverflowToViewport):
(WebCore::FrameView::setHeaderHeight):
(WebCore::FrameView::setFooterHeight):
(WebCore::FrameView::minimumScrollPosition):
(WebCore::FrameView::maximumScrollPosition):
(WebCore::FrameView::shouldUpdateFixedElementsAfterScrolling):
(WebCore::FrameView::beginDeferredRepaints):
(WebCore::FrameView::endDeferredRepaints):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::sendResizeEventIfNeeded):
(WebCore::FrameView::pagination):
(WebCore::FrameView::visibleContentScaleFactor):
(WebCore::FrameView::setVisibleScrollerThumbRect):
(WebCore::FrameView::scrollbarStyleChanged):
(WebCore::FrameView::paintScrollCorner):
(WebCore::FrameView::paintScrollbar):
(WebCore::FrameView::paintOverhangAreas):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
Use the new functions where possible instead of Page::frameIsMainFrame,
Page::mainFrame, FrameLoader::isLoadingMainFrame, and FrameView::isMainFrameView.

Source/WebKit/blackberry:

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
Call isMainFrame.

Source/WebKit/efl:

* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::dispatchWillSendRequest):
(WebCore::FrameLoaderClientEfl::assignIdentifierToInitialRequest):
(WebCore::FrameLoaderClientEfl::updateGlobalHistory):
Call isMainFrame.

Source/WebKit/gtk:

* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::assignIdentifierToInitialRequest):
Call isMainFrame.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::canHandleRequest):
(WebFrameLoaderClient::transitionToCommittedForNewPage):
* WebView/WebFrameView.mm:
(-[WebFrameView _install]):
Call isMainFrame.

Source/WebKit2:

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView):
Call isMainFrame.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Document.cpp
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/history/CachedPage.cpp
Source/WebCore/history/PageCache.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/HistoryController.cpp
Source/WebCore/loader/icon/IconController.cpp
Source/WebCore/page/AutoscrollController.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameTree.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/MainFrame.cpp
Source/WebCore/page/MainFrame.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebView/WebFrameView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm