Commit 0e83ab12 authored by darin@apple.com's avatar darin@apple.com

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: http://svn.webkit.org/repository/webkit/trunk@156607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 786d0398
2013-09-28 Darin Adler <darin@apple.com>
Add Frame::mainFrame and Frame::isMainFrame
https://bugs.webkit.org/show_bug.cgi?id=122064
Reviewed by Andreas Kling.
* 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.
2013-09-28 Gurpreet Kaur <k.gurpreet@samsung.com>
filter: drop-shadow doesnot support viewport units
......@@ -859,7 +859,6 @@ __ZN7WebCore4Page14setMediaVolumeEf
__ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
__ZN7WebCore4Page15didMoveOnscreenEv
__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
__ZN7WebCore4Page16frameIsMainFrameEPKNS_5FrameE
__ZN7WebCore4Page16setCanStartMediaEb
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17willMoveOffscreenEv
......@@ -1694,7 +1693,6 @@ __ZNK7WebCore9FrameView11needsLayoutEv
__ZNK7WebCore9FrameView13isTransparentEv
__ZNK7WebCore9FrameView13paintBehaviorEv
__ZNK7WebCore9FrameView14didFirstLayoutEv
__ZNK7WebCore9FrameView15isMainFrameViewEv
__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_7IntRectE
__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_8IntPointE
__ZNK7WebCore9FrameView19baseBackgroundColorEv
......
......@@ -1291,7 +1291,7 @@ void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed)
updateLayout();
if (Page* page = this->page()) {
if (page->frameIsMainFrame(frame())) {
if (frame()->isMainFrame()) {
frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
frame()->loader().didLayout(DidFirstLayoutAfterSuppressedIncrementalRendering);
......@@ -2042,13 +2042,13 @@ void Document::didBecomeCurrentDocumentInFrame()
// FIXME: Doing this every time is a waste. If the current document and its
// subframes' documents have no wheel event handlers, then the count did not change,
// unless the documents they are replacing had wheel event handlers.
if (page() && page()->frameIsMainFrame(m_frame))
if (page() && m_frame->isMainFrame())
pageWheelEventHandlerCountChanged(*page());
#if ENABLE(TOUCH_EVENTS)
// FIXME: Doing this only for the main frame is insufficient.
// A subframe could have touch event handlers.
if (hasTouchEventHandlers() && page() && page()->frameIsMainFrame(m_frame))
if (hasTouchEventHandlers() && page() && m_frame->isMainFrame())
page()->chrome().client().needTouchEvents(true);
#endif
......@@ -2965,7 +2965,7 @@ void Document::processViewport(const String& features, ViewportArguments::Type o
void Document::updateViewportArguments()
{
if (page() && page()->frameIsMainFrame(frame())) {
if (page() && frame()->isMainFrame()) {
#ifndef NDEBUG
m_didDispatchViewportPropertiesChanged = true;
#endif
......@@ -4014,7 +4014,7 @@ void Document::setInPageCache(bool flag)
// function. It would be nice if there was more symmetry here.
// https://bugs.webkit.org/show_bug.cgi?id=98698
v->cacheCurrentScrollPosition();
if (page && page->frameIsMainFrame(m_frame)) {
if (page && m_frame->isMainFrame()) {
v->resetScrollbarsAndClearContentsSize();
if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
scrollingCoordinator->clearStateTree();
......@@ -6051,7 +6051,7 @@ void Document::ensurePlugInsInjectedScript(DOMWrapperWorld* world)
if (!jsString)
jsString = plugInsJavaScript;
page()->mainFrame().script().evaluateInWorld(ScriptSourceCode(jsString), world);
m_frame->mainFrame().script().evaluateInWorld(ScriptSourceCode(jsString), world);
m_hasInjectedPlugInsScript = true;
}
......
......@@ -157,7 +157,7 @@ CachedFrame::CachedFrame(Frame& frame)
ASSERT(m_view);
if (frame.page()->focusController().focusedFrame() == &frame)
frame.page()->focusController().setFocusedFrame(&frame.page()->mainFrame());
frame.page()->focusController().setFocusedFrame(&frame.mainFrame());
// Custom scrollbar renderers will get reattached when the document comes out of the page cache
m_view->detachCustomScrollbars();
......
......@@ -77,7 +77,7 @@ CachedPage::~CachedPage()
void CachedPage::restore(Page& page)
{
ASSERT(m_cachedMainFrame);
ASSERT(page.frameIsMainFrame(&m_cachedMainFrame->view()->frame()));
ASSERT(m_cachedMainFrame->view()->frame().isMainFrame());
ASSERT(!page.subframeCount());
m_cachedMainFrame->open();
......
......@@ -400,7 +400,7 @@ void PageCache::markPagesForFullStyleRecalc(Page* page)
{
for (HistoryItem* current = m_head; current; current = current->m_next) {
CachedPage* cachedPage = current->m_cachedPage.get();
if (page->frameIsMainFrame(&cachedPage->cachedMainFrame()->view()->frame()))
if (&page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
cachedPage->markForFullStyleRecalc();
}
}
......@@ -411,7 +411,7 @@ void PageCache::markPagesForDeviceScaleChanged(Page* page)
{
for (HistoryItem* current = m_head; current; current = current->m_next) {
CachedPage* cachedPage = current->m_cachedPage.get();
if (page->frameIsMainFrame(&cachedPage->cachedMainFrame()->view()->frame()))
if (&page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
cachedPage->markForDeviceScaleChanged();
}
}
......
......@@ -605,7 +605,7 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const URL& url)
return;
}
bool inMainFrame = document().page()->frameIsMainFrame(document().frame());
bool inMainFrame = document().frame()->isMainFrame();
if (document().isPluginDocument() && inMainFrame) {
LOG(Plugins, "%p Plug-in document in main frame", this);
......
......@@ -30,7 +30,6 @@
#include "EventListener.h"
#include "EventNames.h"
#include "ExceptionCodePlaceholder.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameView.h"
......@@ -38,6 +37,7 @@
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "LocalizedStrings.h"
#include "MainFrame.h"
#include "MouseEvent.h"
#include "NotImplemented.h"
#include "Page.h"
......@@ -374,7 +374,7 @@ CachedImage* ImageDocument::cachedImage()
bool ImageDocument::shouldShrinkToFit() const
{
return frame()->settings().shrinksStandaloneImagesToFit() && frame()->page()->frameIsMainFrame(frame());
return frame()->settings().shrinksStandaloneImagesToFit() && frame()->isMainFrame();
}
void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
......
......@@ -139,11 +139,6 @@ void InspectorAgent::domContentLoadedEventFired()
m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
}
bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const URL& requestUrl)
{
return m_inspectedPage->frameIsMainFrame(loader->frame()) && requestUrl == loader->requestURL();
}
void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
{
if (m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled))
......
......@@ -92,22 +92,13 @@ public:
private:
InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*, InspectorCompositeState*);
void unbindAllResources();
#if ENABLE(JAVASCRIPT_DEBUGGER)
void toggleRecordButton(bool);
#endif
bool isMainResourceLoader(DocumentLoader*, const URL& requestUrl);
Page* m_inspectedPage;
InspectorFrontend* m_frontend;
InjectedScriptManager* m_injectedScriptManager;
Vector<pair<long, String> > m_pendingEvaluateTestCommands;
pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m_pendingInspectData;
typedef HashMap<String, String> InjectedScriptForOriginMap;
InjectedScriptForOriginMap m_injectedScriptForOrigin;
Vector<pair<long, String>> m_pendingEvaluateTestCommands;
pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject>> m_pendingInspectData;
HashMap<String, String> m_injectedScriptForOrigin;
};
} // namespace WebCore
......
......@@ -35,7 +35,6 @@
#include "InspectorController.h"
#include "DOMWrapperWorld.h"
#include "Frame.h"
#include "GraphicsContext.h"
#include "IdentifiersFactory.h"
#include "InjectedScriptHost.h"
......@@ -69,6 +68,7 @@
#include "InspectorTimelineAgent.h"
#include "InspectorWorkerAgent.h"
#include "InstrumentingAgents.h"
#include "MainFrame.h"
#include "PageConsoleAgent.h"
#include "PageDebuggerAgent.h"
#include "PageRuntimeAgent.h"
......@@ -222,7 +222,7 @@ void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWo
// If the page is supposed to serve as InspectorFrontend notify inspector frontend
// client that it's cleared so that the client can expose inspector bindings.
if (m_inspectorFrontendClient && m_page->frameIsMainFrame(frame))
if (m_inspectorFrontendClient && frame->isMainFrame())
m_inspectorFrontendClient->windowObjectCleared();
}
......
......@@ -903,7 +903,7 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
return;
if (page->frameIsMainFrame(loader->frame())) {
if (loader->frame()->isMainFrame()) {
if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
consoleAgent->reset();
......
......@@ -873,7 +873,7 @@ void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWor
if (world != mainThreadNormalWorld())
return;
if (m_page->frameIsMainFrame(frame))
if (frame->isMainFrame())
m_injectedScriptManager->discardInjectedScripts();
if (!m_frontend)
......@@ -905,7 +905,7 @@ void InspectorPageAgent::loadEventFired()
void InspectorPageAgent::frameNavigated(DocumentLoader* loader)
{
if (m_page->frameIsMainFrame(loader->frame())) {
if (loader->frame()->isMainFrame()) {
m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
m_scriptPreprocessor = m_pendingScriptPreprocessor;
m_pendingScriptToEvaluateOnLoadOnce = String();
......
......@@ -41,7 +41,6 @@
#include "DocumentWriter.h"
#include "Event.h"
#include "FormState.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameTree.h"
......@@ -51,6 +50,7 @@
#include "IconController.h"
#include "InspectorInstrumentation.h"
#include "Logging.h"
#include "MainFrame.h"
#include "MemoryCache.h"
#include "Page.h"
#include "PolicyChecker.h"
......@@ -495,7 +495,7 @@ void DocumentLoader::willSendRequest(ResourceRequest& newRequest, const Resource
// Update cookie policy base URL as URL changes, except for subframes, which use the
// URL of the main frame which doesn't change when we redirect.
if (frameLoader()->isLoadingMainFrame())
if (frameLoader()->frame().isMainFrame())
newRequest.setFirstPartyForCookies(newRequest.url());
// If we're fielding a redirect in response to a POST, force a load from origin, since
......
......@@ -1831,7 +1831,7 @@ void FrameLoader::transitionToCommitted(CachedPage* cachedPage)
setState(FrameStateCommittedPage);
#if ENABLE(TOUCH_EVENTS)
if (isLoadingMainFrame())
if (m_frame.isMainFrame())
m_frame.page()->chrome().client().needTouchEvents(false);
#endif
......@@ -1846,7 +1846,7 @@ void FrameLoader::transitionToCommitted(CachedPage* cachedPage)
// If the first load within a frame is a navigation within a back/forward list that was attached
// without any of the items being loaded then we need to update the history in a similar manner as
// for a standard load with the exception of updating the back/forward list (<rdar://problem/8091103>).
if (!m_stateMachine.committedFirstRealDocumentLoad() && isLoadingMainFrame())
if (!m_stateMachine.committedFirstRealDocumentLoad() && m_frame.isMainFrame())
history().updateForStandardLoad(HistoryController::UpdateAllExceptBackForwardList);
history().updateForBackForwardNavigation();
......@@ -1960,7 +1960,7 @@ void FrameLoader::prepareForCachedPageRestore()
{
ASSERT(!m_frame.tree().parent());
ASSERT(m_frame.page());
ASSERT(m_frame.page()->frameIsMainFrame(&m_frame));
ASSERT(m_frame.isMainFrame());
m_frame.navigationScheduler().cancel();
......@@ -2027,11 +2027,6 @@ bool FrameLoader::isHostedByObjectElement() const
return owner && owner->hasTagName(objectTag);
}
bool FrameLoader::isLoadingMainFrame() const
{
return m_frame.page() && m_frame.page()->frameIsMainFrame(&m_frame);
}
bool FrameLoader::isReplacing() const
{
return m_loadType == FrameLoadTypeReplace;
......@@ -2179,7 +2174,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
m_progressTracker->progressCompleted();
if (Page* page = m_frame.page()) {
if (page->frameIsMainFrame(&m_frame))
if (m_frame.isMainFrame())
page->resetRelevantPaintedObjectCounter();
}
......@@ -2286,10 +2281,7 @@ void FrameLoader::setOriginalURLForDownloadRequest(ResourceRequest& request)
void FrameLoader::didLayout(LayoutMilestones milestones)
{
#if !ASSERT_DISABLED
if (Page* page = m_frame.page())
ASSERT(page->frameIsMainFrame(&m_frame));
#endif
ASSERT(m_frame.isMainFrame());
m_client.dispatchDidLayout(milestones);
}
......@@ -2353,7 +2345,7 @@ void FrameLoader::checkLoadComplete()
// FIXME: Always traversing the entire frame tree is a bit inefficient, but
// is currently needed in order to null out the previous history item for all frames.
Vector<Ref<Frame>, 16> frames;
for (Frame* frame = &m_frame.page()->mainFrame(); frame; frame = frame->tree().traverseNext())
for (Frame* frame = &m_frame.mainFrame(); frame; frame = frame->tree().traverseNext())
frames.append(*frame);
// To process children before their parents, iterate the vector backwards.
......@@ -2446,7 +2438,7 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp
// Don't set the cookie policy URL if it's already been set.
// But make sure to set it on all requests regardless of protocol, as it has significance beyond the cookie policy (<rdar://problem/6616664>).
if (request.firstPartyForCookies().isEmpty()) {
if (mainResource && isLoadingMainFrame())
if (mainResource && m_frame.isMainFrame())
request.setFirstPartyForCookies(request.url());
else if (Document* document = m_frame.document())
request.setFirstPartyForCookies(document->firstPartyForCookies());
......@@ -2586,8 +2578,7 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
initialRequest.setHTTPReferrer(referrer);
addHTTPOriginIfNeeded(initialRequest, outgoingOrigin());
if (Page* page = m_frame.page())
initialRequest.setFirstPartyForCookies(page->mainFrame().loader().documentLoader()->request().url());
initialRequest.setFirstPartyForCookies(m_frame.mainFrame().loader().documentLoader()->request().url());
addExtraFieldsToSubresourceRequest(initialRequest);
......@@ -2840,9 +2831,9 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
// If the navigation request came from the back/forward menu, and we punt on it, we have the
// problem that we have optimistically moved the b/f cursor already, so move it back. For sanity,
// we only do this when punting a navigation for the target frame or top-level frame.
if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
if (Page* page = m_frame.page()) {
if (HistoryItem* resetItem = page->mainFrame().loader().history().currentItem()) {
if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem()) {
page->backForward().setCurrentItem(resetItem);
m_frame.loader().client().updateGlobalHistoryItemForPage();
}
......@@ -2862,7 +2853,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
if (Page* page = m_frame.page()) {
if (page->frameIsMainFrame(&m_frame))
if (m_frame.isMainFrame())
page->inspectorController()->resume();
}
#endif
......@@ -3322,14 +3313,14 @@ void FrameLoader::dispatchDidCommitLoad()
m_client.dispatchDidCommitLoad();
if (isLoadingMainFrame()) {
if (m_frame.isMainFrame()) {
m_frame.page()->resetSeenPlugins();
m_frame.page()->resetSeenMediaEngines();
}
InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
if (m_frame.page()->frameIsMainFrame(&m_frame))
if (m_frame.isMainFrame())
m_frame.page()->featureObserver()->didCommitLoad();
}
......@@ -3368,7 +3359,7 @@ NetworkingContext* FrameLoader::networkingContext() const
void FrameLoader::loadProgressingStatusChanged()
{
FrameView* view = m_frame.page()->mainFrame().view();
FrameView* view = m_frame.mainFrame().view();
view->updateLayerFlushThrottlingInAllFrames();
view->adjustTiledBackingCoverage();
}
......
......@@ -166,7 +166,6 @@ public:
ResourceError cancelledError(const ResourceRequest&) const;
bool isHostedByObjectElement() const;
bool isLoadingMainFrame() const;
bool isReplacing() const;
void setReplacing();
......
......@@ -81,7 +81,7 @@ void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item)
item->setScrollPoint(m_frame.view()->scrollPosition());
Page* page = m_frame.page();
if (page && page->frameIsMainFrame(&m_frame))
if (page && m_frame.isMainFrame())
item->setPageScaleFactor(page->pageScaleFactor());
// FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client.
......@@ -134,13 +134,13 @@ void HistoryController::restoreScrollPositionAndViewState()
// https://bugs.webkit.org/show_bug.cgi?id=98698
if (FrameView* view = m_frame.view()) {
Page* page = m_frame.page();
if (page && page->frameIsMainFrame(&m_frame)) {
if (page && m_frame.isMainFrame()) {
if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
scrollingCoordinator->frameViewRootLayerDidChange(view);
}
if (!view->wasScrolledByUser()) {
if (page && page->frameIsMainFrame(&m_frame) && m_currentItem->pageScaleFactor())
if (page && m_frame.isMainFrame() && m_currentItem->pageScaleFactor())
page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
else
view->setScrollPosition(m_currentItem->scrollPoint());
......@@ -464,9 +464,7 @@ void HistoryController::updateForCommit()
// Tell all other frames in the tree to commit their provisional items and
// restore their scroll position. We'll avoid this frame (which has already
// committed) and its children (which will be replaced).
Page* page = m_frame.page();
ASSERT(page);
page->mainFrame().loader().history().recursiveUpdateForCommit();
m_frame.mainFrame().loader().history().recursiveUpdateForCommit();
}
}
......@@ -531,7 +529,7 @@ void HistoryController::updateForSameDocumentNavigation()
return;
addVisitedLink(page, m_frame.document()->url());
page->mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
m_frame.mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
if (m_currentItem) {
m_currentItem->setURL(m_frame.document()->url());
......@@ -796,7 +794,7 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip)
if (m_frame.loader().documentLoader()->urlForHistory().isEmpty())
return;
FrameLoader& frameLoader = page->mainFrame().loader();
FrameLoader& frameLoader = m_frame.mainFrame().loader();
frameLoader.checkDidPerformFirstNavigation();
......@@ -839,7 +837,7 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject,
ASSERT(page);
// Get a HistoryItem tree for the current frame tree.
RefPtr<HistoryItem> topItem = page->mainFrame().loader().history().createItemTree(m_frame, false);
RefPtr<HistoryItem> topItem = m_frame.mainFrame().loader().history().createItemTree(m_frame, false);
// Override data in the current item (created by createItemTree) to reflect
// the pushState() arguments.
......
......@@ -37,7 +37,6 @@
#include "Document.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "IconDatabase.h"
......@@ -45,6 +44,7 @@
#include "IconLoader.h"
#include "IconURL.h"
#include "Logging.h"
#include "MainFrame.h"
#include "Page.h"
#include "Settings.h"
......@@ -130,7 +130,8 @@ void IconController::startLoader()
{
// FIXME: We kick off the icon loader when the frame is done receiving its main resource.
// But we should instead do it when we're done parsing the head element.
if (!m_frame->loader().isLoadingMainFrame())
if (!m_frame->isMainFrame())
return;
if (!iconDatabase().isEnabled())
......
......@@ -116,10 +116,8 @@ void AutoscrollController::stopAutoscrollTimer(bool rendererIsBeingDestroyed)
#if ENABLE(PAN_SCROLLING)
// If we're not in the top frame we notify it that we are not doing a panScroll any more.
if (Frame* mainFrame = getMainFrame(&frame)) {
if (&frame != mainFrame)
mainFrame->eventHandler().didPanScrollStop();
}
if (!frame.isMainFrame())
frame.mainFrame().eventHandler().didPanScrollStop();
#endif
}
......
......@@ -922,7 +922,7 @@ void ContextMenuController::populate()
}
#endif
if (frame->page() && frame != &frame->page()->mainFrame())
if (frame->page() && !frame->isMainFrame())
appendItem(OpenFrameItem, m_contextMenu.get());
}
}
......
......@@ -215,10 +215,9 @@ static bool allowsBeforeUnloadListeners(DOMWindow* window)
Frame* frame = window->frame();
if (!frame)