Changeset 156607 in webkit


Ignore:
Timestamp:
Sep 28, 2013 10:19:04 AM (11 years ago)
Author:
Darin Adler
Message:

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.

Location:
trunk/Source
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156606 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCore.exp.in: Removed exports of FrameView::isMainFrameView and
     9        Page::frameIsMainFrame. Since the new isMainFrame function is inline, it
     10        does not need to be exported.
     11
     12        * history/PageCache.cpp:
     13        (WebCore::PageCache::markPagesForFullStyleRecalc):
     14        (WebCore::PageCache::markPagesForDeviceScaleChanged):
     15        These two were the only functions I found that really wanted the equivalent
     16        of Page::frameIsMainFrame, so wrote it out here instead of using a function
     17        call.
     18
     19        * inspector/InspectorAgent.cpp: Removed the unused isMainResourceLoader function.
     20        * inspector/InspectorAgent.h: Removed declarations of a few nonexistent or
     21        unused private member functions. Also removed the InjectedScriptForOriginMap
     22        typedef: It's mor readable to use the type directly
     23
     24        * loader/FrameLoader.h: Removed isLoadingMainFrame. It's not better than
     25        calling frame().isMainFrame() directly.
     26
     27        * page/Frame.cpp:
     28        (WebCore::Frame::Frame): Initialize m_mainFrame and call selfOnlyRef, keeping
     29        the MainFrame alive as long as any of its subframes is alive.
     30        (WebCore::Frame::~Frame): Call selfOnlyDeref.
     31        (WebCore::Frame::createView): Use isMainFrame.
     32        (WebCore::Frame::setPageAndTextZoomFactors): Ditto.
     33
     34        * page/Frame.h: Added Frame::mainFrame, Frame::isMainFrame, and Frame::m_mainFrame.
     35
     36        * page/FrameView.h: Removed the isMainFrameView function. It's not better than
     37        calling frame().isMainFrame() directly.
     38
     39        * page/MainFrame.cpp:
     40        (WebCore::MainFrame::MainFrame): Initialize m_selfOnlyRefCount to 0.
     41        (WebCore::MainFrame::selfOnlyRef): Added.
     42        (WebCore::MainFrame::selfOnlyDeref): Added.
     43        (WebCore::MainFrame::dropChildren): Added. Called when the self-only reference
     44        count reaches 0 to avoid a reference cycle with subframes.
     45
     46        * page/MainFrame.h: Added new data members as mentioned above. Also, the
     47        definition of the Frame::isMainFrame inline function goes here, since it can't
     48        compile without the MainFrame class definition. This means that callers of
     49        isMainFrame need to include MainFrame.h, which seems reasonable and is easy
     50        to do.
     51
     52        * page/Page.cpp:
     53        * page/Page.h: Added assertion to Page::mainFrame since it returns a reference.
     54        Removed Page::frameIsMainFrame since it's not better than calling isMainFrame
     55        on the frame.
     56
     57        * dom/Document.cpp:
     58        (WebCore::Document::setVisualUpdatesAllowed):
     59        (WebCore::Document::didBecomeCurrentDocumentInFrame):
     60        (WebCore::Document::updateViewportArguments):
     61        (WebCore::Document::setInPageCache):
     62        (WebCore::Document::ensurePlugInsInjectedScript):
     63        * history/CachedFrame.cpp:
     64        (WebCore::CachedFrame::CachedFrame):
     65        * history/CachedPage.cpp:
     66        (WebCore::CachedPage::restore):
     67        * html/HTMLPlugInImageElement.cpp:
     68        (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
     69        * html/ImageDocument.cpp:
     70        (WebCore::ImageDocument::shouldShrinkToFit):
     71        * inspector/InspectorController.cpp:
     72        (WebCore::InspectorController::didClearWindowObjectInWorld):
     73        * inspector/InspectorInstrumentation.cpp:
     74        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
     75        * inspector/InspectorPageAgent.cpp:
     76        (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
     77        (WebCore::InspectorPageAgent::frameNavigated):
     78        * loader/DocumentLoader.cpp:
     79        (WebCore::DocumentLoader::willSendRequest):
     80        * loader/FrameLoader.cpp:
     81        (WebCore::FrameLoader::transitionToCommitted):
     82        (WebCore::FrameLoader::prepareForCachedPageRestore):
     83        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
     84        (WebCore::FrameLoader::didLayout):
     85        (WebCore::FrameLoader::checkLoadComplete):
     86        (WebCore::FrameLoader::addExtraFieldsToRequest):
     87        (WebCore::FrameLoader::loadResourceSynchronously):
     88        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
     89        (WebCore::FrameLoader::dispatchDidCommitLoad):
     90        (WebCore::FrameLoader::loadProgressingStatusChanged):
     91        * loader/HistoryController.cpp:
     92        (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
     93        (WebCore::HistoryController::restoreScrollPositionAndViewState):
     94        (WebCore::HistoryController::updateForCommit):
     95        (WebCore::HistoryController::updateForSameDocumentNavigation):
     96        (WebCore::HistoryController::updateBackForwardListClippedAtTarget):
     97        (WebCore::HistoryController::pushState):
     98        * loader/icon/IconController.cpp:
     99        (WebCore::IconController::startLoader):
     100        * page/AutoscrollController.cpp:
     101        (WebCore::AutoscrollController::stopAutoscrollTimer):
     102        * page/ContextMenuController.cpp:
     103        (WebCore::ContextMenuController::populate):
     104        * page/DOMWindow.cpp:
     105        (WebCore::allowsBeforeUnloadListeners):
     106        (WebCore::DOMWindow::focus):
     107        (WebCore::DOMWindow::blur):
     108        (WebCore::DOMWindow::close):
     109        (WebCore::DOMWindow::allowedToChangeWindowGeometry):
     110        * page/EventHandler.cpp:
     111        (WebCore::EventHandler::hitTestResultAtPoint):
     112        (WebCore::EventHandler::selectCursor):
     113        (WebCore::EventHandler::handleMousePressEvent):
     114        (WebCore::EventHandler::keyEvent):
     115        * page/FrameTree.cpp:
     116        (WebCore::FrameTree::find):
     117        (WebCore::FrameTree::traverseNextWithWrap):
     118        * page/FrameView.cpp:
     119        (WebCore::FrameView::FrameView):
     120        (WebCore::FrameView::setFrameRect):
     121        (WebCore::FrameView::createScrollbar):
     122        (WebCore::FrameView::applyOverflowToViewport):
     123        (WebCore::FrameView::setHeaderHeight):
     124        (WebCore::FrameView::setFooterHeight):
     125        (WebCore::FrameView::minimumScrollPosition):
     126        (WebCore::FrameView::maximumScrollPosition):
     127        (WebCore::FrameView::shouldUpdateFixedElementsAfterScrolling):
     128        (WebCore::FrameView::beginDeferredRepaints):
     129        (WebCore::FrameView::endDeferredRepaints):
     130        (WebCore::FrameView::performPostLayoutTasks):
     131        (WebCore::FrameView::sendResizeEventIfNeeded):
     132        (WebCore::FrameView::pagination):
     133        (WebCore::FrameView::visibleContentScaleFactor):
     134        (WebCore::FrameView::setVisibleScrollerThumbRect):
     135        (WebCore::FrameView::scrollbarStyleChanged):
     136        (WebCore::FrameView::paintScrollCorner):
     137        (WebCore::FrameView::paintScrollbar):
     138        (WebCore::FrameView::paintOverhangAreas):
     139        * page/scrolling/ScrollingCoordinator.cpp:
     140        (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView):
     141        * rendering/RenderLayerBacking.cpp:
     142        (WebCore::RenderLayerBacking::RenderLayerBacking):
     143        Use the new functions where possible instead of Page::frameIsMainFrame,
     144        Page::mainFrame, FrameLoader::isLoadingMainFrame, and FrameView::isMainFrameView.
     145
    11462013-09-28  Gurpreet Kaur  <k.gurpreet@samsung.com>
    2147
  • trunk/Source/WebCore/WebCore.exp.in

    r156588 r156607  
    860860__ZN7WebCore4Page15didMoveOnscreenEv
    861861__ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
    862 __ZN7WebCore4Page16frameIsMainFrameEPKNS_5FrameE
    863862__ZN7WebCore4Page16setCanStartMediaEb
    864863__ZN7WebCore4Page16setDefersLoadingEb
     
    16951694__ZNK7WebCore9FrameView13paintBehaviorEv
    16961695__ZNK7WebCore9FrameView14didFirstLayoutEv
    1697 __ZNK7WebCore9FrameView15isMainFrameViewEv
    16981696__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_7IntRectE
    16991697__ZNK7WebCore9FrameView17convertToRendererEPKNS_12RenderObjectERKNS_8IntPointE
  • trunk/Source/WebCore/dom/Document.cpp

    r156558 r156607  
    12921292
    12931293    if (Page* page = this->page()) {
    1294         if (page->frameIsMainFrame(frame())) {
     1294        if (frame()->isMainFrame()) {
    12951295            frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
    12961296            if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
     
    20432043    // subframes' documents have no wheel event handlers, then the count did not change,
    20442044    // unless the documents they are replacing had wheel event handlers.
    2045     if (page() && page()->frameIsMainFrame(m_frame))
     2045    if (page() && m_frame->isMainFrame())
    20462046        pageWheelEventHandlerCountChanged(*page());
    20472047
     
    20492049    // FIXME: Doing this only for the main frame is insufficient.
    20502050    // A subframe could have touch event handlers.
    2051     if (hasTouchEventHandlers() && page() && page()->frameIsMainFrame(m_frame))
     2051    if (hasTouchEventHandlers() && page() && m_frame->isMainFrame())
    20522052        page()->chrome().client().needTouchEvents(true);
    20532053#endif
     
    29662966void Document::updateViewportArguments()
    29672967{
    2968     if (page() && page()->frameIsMainFrame(frame())) {
     2968    if (page() && frame()->isMainFrame()) {
    29692969#ifndef NDEBUG
    29702970        m_didDispatchViewportPropertiesChanged = true;
     
    40154015            // https://bugs.webkit.org/show_bug.cgi?id=98698
    40164016            v->cacheCurrentScrollPosition();
    4017             if (page && page->frameIsMainFrame(m_frame)) {
     4017            if (page && m_frame->isMainFrame()) {
    40184018                v->resetScrollbarsAndClearContentsSize();
    40194019                if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
     
    60526052        jsString = plugInsJavaScript;
    60536053
    6054     page()->mainFrame().script().evaluateInWorld(ScriptSourceCode(jsString), world);
     6054    m_frame->mainFrame().script().evaluateInWorld(ScriptSourceCode(jsString), world);
    60556055
    60566056    m_hasInjectedPlugInsScript = true;
  • trunk/Source/WebCore/history/CachedFrame.cpp

    r156550 r156607  
    158158
    159159    if (frame.page()->focusController().focusedFrame() == &frame)
    160         frame.page()->focusController().setFocusedFrame(&frame.page()->mainFrame());
     160        frame.page()->focusController().setFocusedFrame(&frame.mainFrame());
    161161
    162162    // Custom scrollbar renderers will get reattached when the document comes out of the page cache
  • trunk/Source/WebCore/history/CachedPage.cpp

    r156543 r156607  
    7878{
    7979    ASSERT(m_cachedMainFrame);
    80     ASSERT(page.frameIsMainFrame(&m_cachedMainFrame->view()->frame()));
     80    ASSERT(m_cachedMainFrame->view()->frame().isMainFrame());
    8181    ASSERT(!page.subframeCount());
    8282
  • trunk/Source/WebCore/history/PageCache.cpp

    r156550 r156607  
    401401    for (HistoryItem* current = m_head; current; current = current->m_next) {
    402402        CachedPage* cachedPage = current->m_cachedPage.get();
    403         if (page->frameIsMainFrame(&cachedPage->cachedMainFrame()->view()->frame()))
     403        if (&page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
    404404            cachedPage->markForFullStyleRecalc();
    405405    }
     
    412412    for (HistoryItem* current = m_head; current; current = current->m_next) {
    413413        CachedPage* cachedPage = current->m_cachedPage.get();
    414         if (page->frameIsMainFrame(&cachedPage->cachedMainFrame()->view()->frame()))
     414        if (&page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
    415415            cachedPage->markForDeviceScaleChanged();
    416416    }
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r156550 r156607  
    606606    }
    607607
    608     bool inMainFrame = document().page()->frameIsMainFrame(document().frame());
     608    bool inMainFrame = document().frame()->isMainFrame();
    609609
    610610    if (document().isPluginDocument() && inMainFrame) {
  • trunk/Source/WebCore/html/ImageDocument.cpp

    r156550 r156607  
    3131#include "EventNames.h"
    3232#include "ExceptionCodePlaceholder.h"
    33 #include "Frame.h"
    3433#include "FrameLoader.h"
    3534#include "FrameLoaderClient.h"
     
    3938#include "HTMLNames.h"
    4039#include "LocalizedStrings.h"
     40#include "MainFrame.h"
    4141#include "MouseEvent.h"
    4242#include "NotImplemented.h"
     
    375375bool ImageDocument::shouldShrinkToFit() const
    376376{
    377     return frame()->settings().shrinksStandaloneImagesToFit() && frame()->page()->frameIsMainFrame(frame());
     377    return frame()->settings().shrinksStandaloneImagesToFit() && frame()->isMainFrame();
    378378}
    379379
  • trunk/Source/WebCore/inspector/InspectorAgent.cpp

    r156550 r156607  
    140140}
    141141
    142 bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const URL& requestUrl)
    143 {
    144     return m_inspectedPage->frameIsMainFrame(loader->frame()) && requestUrl == loader->requestURL();
    145 }
    146 
    147142void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
    148143{
  • trunk/Source/WebCore/inspector/InspectorAgent.h

    r156550 r156607  
    9393    InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*, InspectorCompositeState*);
    9494
    95     void unbindAllResources();
    96 
    97 #if ENABLE(JAVASCRIPT_DEBUGGER)
    98     void toggleRecordButton(bool);
    99 #endif
    100 
    101     bool isMainResourceLoader(DocumentLoader*, const URL& requestUrl);
    102 
    10395    Page* m_inspectedPage;
    10496    InspectorFrontend* m_frontend;
    10597    InjectedScriptManager* m_injectedScriptManager;
    10698
    107     Vector<pair<long, String> > m_pendingEvaluateTestCommands;
    108     pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m_pendingInspectData;
    109     typedef HashMap<String, String> InjectedScriptForOriginMap;
    110     InjectedScriptForOriginMap m_injectedScriptForOrigin;
     99    Vector<pair<long, String>> m_pendingEvaluateTestCommands;
     100    pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject>> m_pendingInspectData;
     101    HashMap<String, String> m_injectedScriptForOrigin;
    111102};
    112103
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r156215 r156607  
    3636
    3737#include "DOMWrapperWorld.h"
    38 #include "Frame.h"
    3938#include "GraphicsContext.h"
    4039#include "IdentifiersFactory.h"
     
    7069#include "InspectorWorkerAgent.h"
    7170#include "InstrumentingAgents.h"
     71#include "MainFrame.h"
    7272#include "PageConsoleAgent.h"
    7373#include "PageDebuggerAgent.h"
     
    223223    // If the page is supposed to serve as InspectorFrontend notify inspector frontend
    224224    // client that it's cleared so that the client can expose inspector bindings.
    225     if (m_inspectorFrontendClient && m_page->frameIsMainFrame(frame))
     225    if (m_inspectorFrontendClient && frame->isMainFrame())
    226226        m_inspectorFrontendClient->windowObjectCleared();
    227227}
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r156550 r156607  
    904904        return;
    905905
    906     if (page->frameIsMainFrame(loader->frame())) {
     906    if (loader->frame()->isMainFrame()) {
    907907        if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
    908908            consoleAgent->reset();
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r156550 r156607  
    874874        return;
    875875
    876     if (m_page->frameIsMainFrame(frame))
     876    if (frame->isMainFrame())
    877877        m_injectedScriptManager->discardInjectedScripts();
    878878
     
    906906void InspectorPageAgent::frameNavigated(DocumentLoader* loader)
    907907{
    908     if (m_page->frameIsMainFrame(loader->frame())) {
     908    if (loader->frame()->isMainFrame()) {
    909909        m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
    910910        m_scriptPreprocessor = m_pendingScriptPreprocessor;
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r156550 r156607  
    4242#include "Event.h"
    4343#include "FormState.h"
    44 #include "Frame.h"
    4544#include "FrameLoader.h"
    4645#include "FrameLoaderClient.h"
     
    5251#include "InspectorInstrumentation.h"
    5352#include "Logging.h"
     53#include "MainFrame.h"
    5454#include "MemoryCache.h"
    5555#include "Page.h"
     
    496496    // Update cookie policy base URL as URL changes, except for subframes, which use the
    497497    // URL of the main frame which doesn't change when we redirect.
    498     if (frameLoader()->isLoadingMainFrame())
     498    if (frameLoader()->frame().isMainFrame())
    499499        newRequest.setFirstPartyForCookies(newRequest.url());
    500500
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r156550 r156607  
    18321832
    18331833#if ENABLE(TOUCH_EVENTS)
    1834     if (isLoadingMainFrame())
     1834    if (m_frame.isMainFrame())
    18351835        m_frame.page()->chrome().client().needTouchEvents(false);
    18361836#endif
     
    18471847                // without any of the items being loaded then we need to update the history in a similar manner as
    18481848                // for a standard load with the exception of updating the back/forward list (<rdar://problem/8091103>).
    1849                 if (!m_stateMachine.committedFirstRealDocumentLoad() && isLoadingMainFrame())
     1849                if (!m_stateMachine.committedFirstRealDocumentLoad() && m_frame.isMainFrame())
    18501850                    history().updateForStandardLoad(HistoryController::UpdateAllExceptBackForwardList);
    18511851
     
    19611961    ASSERT(!m_frame.tree().parent());
    19621962    ASSERT(m_frame.page());
    1963     ASSERT(m_frame.page()->frameIsMainFrame(&m_frame));
     1963    ASSERT(m_frame.isMainFrame());
    19641964
    19651965    m_frame.navigationScheduler().cancel();
     
    20262026    HTMLFrameOwnerElement* owner = m_frame.ownerElement();
    20272027    return owner && owner->hasTagName(objectTag);
    2028 }
    2029 
    2030 bool FrameLoader::isLoadingMainFrame() const
    2031 {
    2032     return m_frame.page() && m_frame.page()->frameIsMainFrame(&m_frame);
    20332028}
    20342029
     
    21802175            m_progressTracker->progressCompleted();
    21812176            if (Page* page = m_frame.page()) {
    2182                 if (page->frameIsMainFrame(&m_frame))
     2177                if (m_frame.isMainFrame())
    21832178                    page->resetRelevantPaintedObjectCounter();
    21842179            }
     
    22872282void FrameLoader::didLayout(LayoutMilestones milestones)
    22882283{
    2289 #if !ASSERT_DISABLED
    2290     if (Page* page = m_frame.page())
    2291         ASSERT(page->frameIsMainFrame(&m_frame));
    2292 #endif
     2284    ASSERT(m_frame.isMainFrame());
    22932285
    22942286    m_client.dispatchDidLayout(milestones);
     
    23542346    // is currently needed in order to null out the previous history item for all frames.
    23552347    Vector<Ref<Frame>, 16> frames;
    2356     for (Frame* frame = &m_frame.page()->mainFrame(); frame; frame = frame->tree().traverseNext())
     2348    for (Frame* frame = &m_frame.mainFrame(); frame; frame = frame->tree().traverseNext())
    23572349        frames.append(*frame);
    23582350
     
    24472439    // But make sure to set it on all requests regardless of protocol, as it has significance beyond the cookie policy (<rdar://problem/6616664>).
    24482440    if (request.firstPartyForCookies().isEmpty()) {
    2449         if (mainResource && isLoadingMainFrame())
     2441        if (mainResource && m_frame.isMainFrame())
    24502442            request.setFirstPartyForCookies(request.url());
    24512443        else if (Document* document = m_frame.document())
     
    25872579    addHTTPOriginIfNeeded(initialRequest, outgoingOrigin());
    25882580
    2589     if (Page* page = m_frame.page())
    2590         initialRequest.setFirstPartyForCookies(page->mainFrame().loader().documentLoader()->request().url());
     2581    initialRequest.setFirstPartyForCookies(m_frame.mainFrame().loader().documentLoader()->request().url());
    25912582   
    25922583    addExtraFieldsToSubresourceRequest(initialRequest);
     
    28412832        // problem that we have optimistically moved the b/f cursor already, so move it back.  For sanity,
    28422833        // we only do this when punting a navigation for the target frame or top-level frame. 
    2843         if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
     2834        if ((isTargetItem || m_frame.isMainFrame()) && isBackForwardLoadType(policyChecker().loadType())) {
    28442835            if (Page* page = m_frame.page()) {
    2845                 if (HistoryItem* resetItem = page->mainFrame().loader().history().currentItem()) {
     2836                if (HistoryItem* resetItem = m_frame.mainFrame().loader().history().currentItem()) {
    28462837                    page->backForward().setCurrentItem(resetItem);
    28472838                    m_frame.loader().client().updateGlobalHistoryItemForPage();
     
    28632854#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
    28642855    if (Page* page = m_frame.page()) {
    2865         if (page->frameIsMainFrame(&m_frame))
     2856        if (m_frame.isMainFrame())
    28662857            page->inspectorController()->resume();
    28672858    }
     
    33233314    m_client.dispatchDidCommitLoad();
    33243315
    3325     if (isLoadingMainFrame()) {
     3316    if (m_frame.isMainFrame()) {
    33263317        m_frame.page()->resetSeenPlugins();
    33273318        m_frame.page()->resetSeenMediaEngines();
     
    33303321    InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
    33313322
    3332     if (m_frame.page()->frameIsMainFrame(&m_frame))
     3323    if (m_frame.isMainFrame())
    33333324        m_frame.page()->featureObserver()->didCommitLoad();
    33343325
     
    33693360void FrameLoader::loadProgressingStatusChanged()
    33703361{
    3371     FrameView* view = m_frame.page()->mainFrame().view();
     3362    FrameView* view = m_frame.mainFrame().view();
    33723363    view->updateLayerFlushThrottlingInAllFrames();
    33733364    view->adjustTiledBackingCoverage();
  • trunk/Source/WebCore/loader/FrameLoader.h

    r156550 r156607  
    167167
    168168    bool isHostedByObjectElement() const;
    169     bool isLoadingMainFrame() const;
    170169
    171170    bool isReplacing() const;
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r156550 r156607  
    8282
    8383    Page* page = m_frame.page();
    84     if (page && page->frameIsMainFrame(&m_frame))
     84    if (page && m_frame.isMainFrame())
    8585        item->setPageScaleFactor(page->pageScaleFactor());
    8686
     
    135135    if (FrameView* view = m_frame.view()) {
    136136        Page* page = m_frame.page();
    137         if (page && page->frameIsMainFrame(&m_frame)) {
     137        if (page && m_frame.isMainFrame()) {
    138138            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    139139                scrollingCoordinator->frameViewRootLayerDidChange(view);
     
    141141
    142142        if (!view->wasScrolledByUser()) {
    143             if (page && page->frameIsMainFrame(&m_frame) && m_currentItem->pageScaleFactor())
     143            if (page && m_frame.isMainFrame() && m_currentItem->pageScaleFactor())
    144144                page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
    145145            else
     
    465465        // restore their scroll position.  We'll avoid this frame (which has already
    466466        // committed) and its children (which will be replaced).
    467         Page* page = m_frame.page();
    468         ASSERT(page);
    469         page->mainFrame().loader().history().recursiveUpdateForCommit();
     467        m_frame.mainFrame().loader().history().recursiveUpdateForCommit();
    470468    }
    471469}
     
    532530
    533531    addVisitedLink(page, m_frame.document()->url());
    534     page->mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
     532    m_frame.mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
    535533
    536534    if (m_currentItem) {
     
    797795        return;
    798796
    799     FrameLoader& frameLoader = page->mainFrame().loader();
     797    FrameLoader& frameLoader = m_frame.mainFrame().loader();
    800798
    801799    frameLoader.checkDidPerformFirstNavigation();
     
    840838
    841839    // Get a HistoryItem tree for the current frame tree.
    842     RefPtr<HistoryItem> topItem = page->mainFrame().loader().history().createItemTree(m_frame, false);
     840    RefPtr<HistoryItem> topItem = m_frame.mainFrame().loader().history().createItemTree(m_frame, false);
    843841   
    844842    // Override data in the current item (created by createItemTree) to reflect
  • trunk/Source/WebCore/loader/icon/IconController.cpp

    r156550 r156607  
    3838#include "Document.h"
    3939#include "DocumentLoader.h"
    40 #include "Frame.h"
    4140#include "FrameLoader.h"
    4241#include "FrameLoaderClient.h"
     
    4645#include "IconURL.h"
    4746#include "Logging.h"
     47#include "MainFrame.h"
    4848#include "Page.h"
    4949#include "Settings.h"
     
    131131    // FIXME: We kick off the icon loader when the frame is done receiving its main resource.
    132132    // But we should instead do it when we're done parsing the head element.
    133     if (!m_frame->loader().isLoadingMainFrame())
     133
     134    if (!m_frame->isMainFrame())
    134135        return;
    135136
  • trunk/Source/WebCore/page/AutoscrollController.cpp

    r156543 r156607  
    117117#if ENABLE(PAN_SCROLLING)
    118118    // If we're not in the top frame we notify it that we are not doing a panScroll any more.
    119     if (Frame* mainFrame = getMainFrame(&frame)) {
    120         if (&frame != mainFrame)
    121             mainFrame->eventHandler().didPanScrollStop();
    122     }
     119    if (!frame.isMainFrame())
     120        frame.mainFrame().eventHandler().didPanScrollStop();
    123121#endif
    124122}
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r156550 r156607  
    923923#endif
    924924
    925                 if (frame->page() && frame != &frame->page()->mainFrame())
     925                if (frame->page() && !frame->isMainFrame())
    926926                    appendItem(OpenFrameItem, m_contextMenu.get());
    927927            }
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r156550 r156607  
    216216    if (!frame)
    217217        return false;
    218     Page* page = frame->page();
    219     if (!page)
     218    if (!frame->page())
    220219        return false;
    221     return page->frameIsMainFrame(frame);
     220    return frame->isMainFrame();
    222221}
    223222
     
    907906
    908907    // If we're a top level window, bring the window to the front.
    909     if (page->frameIsMainFrame(m_frame) && allowFocus)
     908    if (m_frame->isMainFrame() && allowFocus)
    910909        page->chrome().focus();
    911910
     
    933932        return;
    934933
    935     if (m_frame != &page->mainFrame())
     934    if (!m_frame->isMainFrame())
    936935        return;
    937936
     
    948947        return;
    949948
    950     if (m_frame != &page->mainFrame())
     949    if (!m_frame->isMainFrame())
    951950        return;
    952951
     
    14531452    if (!m_frame)
    14541453        return false;
    1455     const Page* page = m_frame->page();
    1456     if (!page)
     1454    if (!m_frame->page())
    14571455        return false;
    1458     if (m_frame != &page->mainFrame())
     1456    if (!m_frame->isMainFrame())
    14591457        return false;
    14601458    // Prevent web content from tricking the user into initiating a drag.
  • trunk/Source/WebCore/page/EventHandler.cpp

    r156543 r156607  
    10301030    // We always send hitTestResultAtPoint to the main frame if we have one,
    10311031    // otherwise we might hit areas that are obscured by higher frames.
    1032     if (Page* page = m_frame.page()) {
    1033         Frame& mainFrame = page->mainFrame();
    1034         if (&m_frame != &mainFrame) {
    1035             FrameView* frameView = m_frame.view();
    1036             FrameView* mainView = mainFrame.view();
    1037             if (frameView && mainView) {
    1038                 IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
    1039                 return mainFrame.eventHandler().hitTestResultAtPoint(mainFramePoint, hitType, padding);
    1040             }
     1032    if (!m_frame.isMainFrame()) {
     1033        Frame& mainFrame = m_frame.mainFrame();
     1034        FrameView* frameView = m_frame.view();
     1035        FrameView* mainView = mainFrame.view();
     1036        if (frameView && mainView) {
     1037            IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
     1038            return mainFrame.eventHandler().hitTestResultAtPoint(mainFramePoint, hitType, padding);
    10411039        }
    10421040    }
     
    12811279        return NoCursorChange;
    12821280
    1283     Page* page = m_frame.page();
    1284     if (!page)
     1281    if (!m_frame.page())
    12851282        return NoCursorChange;
     1283
    12861284#if ENABLE(PAN_SCROLLING)
    1287     if (page->mainFrame().eventHandler().panScrollInProgress())
     1285    if (m_frame.mainFrame().eventHandler().panScrollInProgress())
    12881286        return NoCursorChange;
    12891287#endif
     
    15601558    // We store whether pan scrolling is in progress before calling stopAutoscrollTimer()
    15611559    // because it will set m_autoscrollType to NoAutoscroll on return.
    1562     bool isPanScrollInProgress = m_frame.page() && m_frame.page()->mainFrame().eventHandler().panScrollInProgress();
     1560    bool isPanScrollInProgress = m_frame.mainFrame().eventHandler().panScrollInProgress();
    15631561    stopAutoscrollTimer();
    15641562    if (isPanScrollInProgress) {
     
    32613259
    32623260#if ENABLE(PAN_SCROLLING)
    3263     if (Page* page = m_frame.page()) {
    3264         if (page->mainFrame().eventHandler().panScrollInProgress()) {
    3265             // If a key is pressed while the panScroll is in progress then we want to stop
    3266             if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown)
    3267                 stopAutoscrollTimer();
    3268 
    3269             // If we were in panscroll mode, we swallow the key event
    3270             return true;
    3271         }
     3261    if (m_frame.mainFrame().eventHandler().panScrollInProgress()) {
     3262        // If a key is pressed while the panScroll is in progress then we want to stop
     3263        if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown)
     3264            stopAutoscrollTimer();
     3265
     3266        // If we were in panscroll mode, we swallow the key event
     3267        return true;
    32723268    }
    32733269#endif
  • trunk/Source/WebCore/page/Frame.cpp

    r156550 r156607  
    153153
    154154Frame::Frame(Page& page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient& frameLoaderClient)
    155     : m_page(&page)
     155    : m_mainFrame(ownerElement ? page.mainFrame() : static_cast<MainFrame&>(*this))
     156    , m_page(&page)
    156157    , m_settings(&page.settings())
    157158    , m_treeNode(this, parentFromOwnerElement(ownerElement))
     
    189190#endif
    190191    } else {
     192        m_mainFrame.selfOnlyRef();
    191193        page.incrementSubframeCount();
    192194        ownerElement->setContentFrame(this);
     
    226228    for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
    227229        (*it)->frameDestroyed();
     230
     231    if (!isMainFrame())
     232        m_mainFrame.selfOnlyDeref();
    228233}
    229234
     
    646651            m_page->decrementSubframeCount();
    647652    }
    648     m_ownerElement = 0;
     653    m_ownerElement = nullptr;
    649654}
    650655
     
    714719    ASSERT(m_page);
    715720
    716     bool isMainFrame = m_page->frameIsMainFrame(this);
     721    bool isMainFrame = this->isMainFrame();
    717722
    718723    if (isMainFrame && view())
     
    887892    }
    888893
    889     if (page->frameIsMainFrame(this))
     894    if (isMainFrame())
    890895        pageCache()->markPagesForFullStyleRecalc(page);
    891896}
  • trunk/Source/WebCore/page/Frame.h

    r156550 r156607  
    6565    class HTMLTableCellElement;
    6666    class IntRect;
     67    class MainFrame;
    6768    class Node;
    6869    class Range;
     
    109110        void detachFromPage();
    110111        void disconnectOwnerElement();
     112
     113        MainFrame& mainFrame() const;
     114        bool isMainFrame() const;
    111115
    112116        Page* page() const;
     
    206210        HashSet<FrameDestructionObserver*> m_destructionObservers;
    207211
     212        MainFrame& m_mainFrame;
    208213        Page* m_page;
    209214        const RefPtr<Settings> m_settings;
     
    337342    }
    338343
     344    inline MainFrame& Frame::mainFrame() const
     345    {
     346        return m_mainFrame;
     347    }
     348
    339349} // namespace WebCore
    340350
  • trunk/Source/WebCore/page/FrameTree.cpp

    r156543 r156607  
    278278        return parent() ? parent() : m_thisFrame;
    279279
    280     // Since "_blank" should never be any frame's name, the following just amounts to an optimization.
     280    // Since "_blank" should never be any frame's name, the following is only an optimization.
    281281    if (name == "_blank")
    282282        return 0;
    283283
    284284    // Search subtree starting with this frame first.
    285     for (Frame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m_thisFrame))
     285    for (Frame* frame = m_thisFrame; frame; frame = frame->tree().traverseNext(m_thisFrame)) {
    286286        if (frame->tree().uniqueName() == name)
    287287            return frame;
    288 
    289     // Search the entire tree for this page next.
    290     Page* page = m_thisFrame->page();
    291 
    292     // The frame could have been detached from the page, so check it.
    293     if (!page)
    294         return 0;
    295 
    296     for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
     288    }
     289
     290    // Then the rest of the tree.
     291    for (Frame* frame = &m_thisFrame->mainFrame(); frame; frame = frame->tree().traverseNext()) {
    297292        if (frame->tree().uniqueName() == name)
    298293            return frame;
     294    }
    299295
    300296    // Search the entire tree of each of the other pages in this namespace.
    301297    // FIXME: Is random order OK?
     298    Page* page = m_thisFrame->page();
     299    if (!page)
     300        return 0;
    302301    const HashSet<Page*>& pages = page->group().pages();
    303     HashSet<Page*>::const_iterator end = pages.end();
    304     for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
     302    for (auto it = pages.begin(), end = pages.end(); it != end; ++it) {
    305303        Page* otherPage = *it;
    306         if (otherPage != page) {
    307             for (Frame* frame = &otherPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
    308                 if (frame->tree().uniqueName() == name)
    309                     return frame;
    310             }
     304        if (otherPage == page)
     305            continue;
     306        for (Frame* frame = &otherPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
     307            if (frame->tree().uniqueName() == name)
     308                return frame;
    311309        }
    312310    }
     
    368366
    369367    if (wrap)
    370         return &m_thisFrame->page()->mainFrame();
     368        return &m_thisFrame->mainFrame();
    371369
    372370    return 0;
  • trunk/Source/WebCore/page/FrameView.cpp

    r156558 r156607  
    205205    init();
    206206
    207     if (isMainFrameView()) {
     207    if (frame.isMainFrame()) {
    208208        ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
    209209        ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
     
    411411}
    412412
    413 bool FrameView::isMainFrameView() const
    414 {
    415     return frame().page() && frame().page()->frameIsMainFrame(&frame());
    416 }
    417 
    418413bool FrameView::didFirstLayout() const
    419414{
     
    449444    if (newRect.width() != oldRect.width()) {
    450445        Page* page = frame().page();
    451         if (isMainFrameView() && page->settings().textAutosizingEnabled()) {
     446        if (frame().isMainFrame() && page->settings().textAutosizingEnabled()) {
    452447            for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
    453448                frame().document()->textAutosizer()->recalculateMultipliers();
     
    539534PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
    540535{
    541     if (!frame().settings().allowCustomScrollbarInMainFrame() && isMainFrameView())
     536    if (!frame().settings().allowCustomScrollbarInMainFrame() && frame().isMainFrame())
    542537        return ScrollView::createScrollbar(orientation);
    543538
     
    615610    // header or footer.
    616611
    617     bool overrideHidden = isMainFrameView() && ((frame().frameScaleFactor() > 1) || headerHeight() || footerHeight());
     612    bool overrideHidden = frame().isMainFrame() && ((frame().frameScaleFactor() > 1) || headerHeight() || footerHeight());
    618613
    619614    EOverflow overflowX = o->style()->overflowX();
     
    921916{
    922917    if (frame().page())
    923         ASSERT(isMainFrameView());
     918        ASSERT(frame().isMainFrame());
    924919    m_headerHeight = headerHeight;
    925920
     
    931926{
    932927    if (frame().page())
    933         ASSERT(isMainFrameView());
     928        ASSERT(frame().isMainFrame());
    934929    m_footerHeight = footerHeight;
    935930
     
    15971592    IntPoint minimumPosition(ScrollView::minimumScrollPosition());
    15981593
    1599     if (isMainFrameView() && m_scrollPinningBehavior == PinToBottom)
     1594    if (frame().isMainFrame() && m_scrollPinningBehavior == PinToBottom)
    16001595        minimumPosition.setY(maximumScrollPosition().y());
    16011596   
     
    16091604    maximumOffset.clampNegativeToZero();
    16101605
    1611     if (isMainFrameView() && m_scrollPinningBehavior == PinToTop)
     1606    if (frame().isMainFrame() && m_scrollPinningBehavior == PinToTop)
    16121607        maximumOffset.setY(minimumScrollPosition().y());
    16131608   
     
    19951990{
    19961991#if ENABLE(THREADED_SCROLLING)
     1992    // If the scrolling thread is updating the fixed elements, then the FrameView should not update them as well.
     1993
    19971994    Page* page = frame().page();
    19981995    if (!page)
    19991996        return true;
    20001997
    2001     // If the scrolling thread is updating the fixed elements, then the FrameView should not update them as well.
    20021998    if (&page->mainFrame() != &frame())
    20031999        return true;
     
    21872183void FrameView::beginDeferredRepaints()
    21882184{
    2189     Page* page = frame().page();
    2190     if (&page->mainFrame() != &frame()) {
    2191         page->mainFrame().view()->beginDeferredRepaints();
     2185    if (!frame().isMainFrame()) {
     2186        frame().mainFrame().view()->beginDeferredRepaints();
    21922187        return;
    21932188    }
     
    21982193void FrameView::endDeferredRepaints()
    21992194{
    2200     Page* page = frame().page();
    2201     if (&page->mainFrame() != &frame()) {
    2202         page->mainFrame().view()->endDeferredRepaints();
     2195    if (!frame().isMainFrame()) {
     2196        frame().mainFrame().view()->endDeferredRepaints();
    22032197        return;
    22042198    }
     
    27432737            if (requestedMilestones & DidFirstLayout)
    27442738                milestonesAchieved |= DidFirstLayout;
    2745             if (isMainFrameView())
     2739            if (frame().isMainFrame())
    27462740                page->startCountingRelevantRepaintedObjects();
    27472741        }
     
    27562750    }
    27572751
    2758     if (milestonesAchieved && page && page->frameIsMainFrame(&frame()))
     2752    if (milestonesAchieved && frame().isMainFrame())
    27592753        frame().loader().didLayout(milestonesAchieved);
    27602754
     
    28192813        return;
    28202814
    2821     bool isMainFrame = isMainFrameView();
     2815    bool isMainFrame = frame().isMainFrame();
    28222816    bool canSendResizeEventSynchronously = isMainFrame && !isInLayout();
    28232817
     
    29952989        return m_pagination;
    29962990
    2997     if (isMainFrameView())
     2991    if (frame().isMainFrame())
    29982992        return frame().page()->pagination();
    29992993
     
    30843078float FrameView::visibleContentScaleFactor() const
    30853079{
    3086     if (!isMainFrameView() || !frame().settings().applyPageScaleFactorInCompositor())
     3080    if (!frame().isMainFrame() || !frame().settings().applyPageScaleFactorInCompositor())
    30873081        return 1;
    30883082
     
    30923086void FrameView::setVisibleScrollerThumbRect(const IntRect& scrollerThumb)
    30933087{
    3094     if (!isMainFrameView())
     3088    if (!frame().isMainFrame())
    30953089        return;
    30963090
     
    31643158void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
    31653159{
    3166     if (!isMainFrameView())
     3160    if (!frame().isMainFrame())
    31673161        return;
    31683162
     
    32703264
    32713265    if (m_scrollCorner) {
    3272         if (isMainFrameView())
     3266        if (frame().isMainFrame())
    32733267            context->fillRect(cornerRect, baseBackgroundColor(), ColorSpaceDeviceRGB);
    32743268        m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
     
    32813275void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
    32823276{
    3283     if (bar->isCustomScrollbar() && isMainFrameView()) {
     3277    if (bar->isCustomScrollbar() && frame().isMainFrame()) {
    32843278        IntRect toFill = bar->frameRect();
    32853279        toFill.intersect(rect);
     
    36223616        return;
    36233617
    3624     if (isMainFrameView() && frame().page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
     3618    if (frame().isMainFrame() && frame().page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
    36253619        return;
    36263620
  • trunk/Source/WebCore/page/FrameView.h

    r156558 r156607  
    435435    void willRemoveWidgetFromRenderTree(Widget&);
    436436
    437     bool isMainFrameView() const;
    438 
    439437protected:
    440438    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) OVERRIDE;
  • trunk/Source/WebCore/page/MainFrame.cpp

    r156543 r156607  
    3232inline MainFrame::MainFrame(Page& page, FrameLoaderClient& client)
    3333    : Frame(page, nullptr, client)
     34    , m_selfOnlyRefCount(0)
    3435{
    3536}
     
    4041}
    4142
     43void MainFrame::selfOnlyRef()
     44{
     45    if (m_selfOnlyRefCount++)
     46        return;
     47
     48    ref();
    4249}
     50
     51void MainFrame::selfOnlyDeref()
     52{
     53    ASSERT(m_selfOnlyRefCount);
     54    if (--m_selfOnlyRefCount)
     55        return;
     56
     57    if (hasOneRef())
     58        dropChildren();
     59
     60    deref();
     61}
     62
     63void MainFrame::dropChildren()
     64{
     65    while (Frame* child = tree().firstChild())
     66        tree().removeChild(child);
     67}
     68
     69}
  • trunk/Source/WebCore/page/MainFrame.h

    r156543 r156607  
    3636    static RefPtr<MainFrame> create(Page&, FrameLoaderClient&);
    3737
     38    void selfOnlyRef();
     39    void selfOnlyDeref();
     40
    3841private:
    3942    MainFrame(Page&, FrameLoaderClient&);
     43
     44    void dropChildren();
     45
     46    unsigned m_selfOnlyRefCount;
    4047};
     48
     49inline bool Frame::isMainFrame() const
     50{
     51    return this == &m_mainFrame;
     52}
    4153
    4254}
  • trunk/Source/WebCore/page/Page.cpp

    r156558 r156607  
    240240}
    241241
    242 bool Page::frameIsMainFrame(const Frame* frame)
    243 {
    244     return frame == m_mainFrame.get();
    245 }
    246 
    247242ArenaSize Page::renderTreeSize() const
    248243{
  • trunk/Source/WebCore/page/Page.h

    r156558 r156607  
    163163    PlugInClient* plugInClient() const { return m_plugInClient; }
    164164
    165     MainFrame& mainFrame() { return *m_mainFrame; }
    166     const MainFrame& mainFrame() const { return *m_mainFrame; }
    167     bool frameIsMainFrame(const Frame*);
     165    MainFrame& mainFrame() { ASSERT(m_mainFrame); return *m_mainFrame; }
     166    const MainFrame& mainFrame() const { ASSERT(m_mainFrame); return *m_mainFrame; }
    168167
    169168    bool openedByDOM() const;
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r156543 r156607  
    103103
    104104    // We currently only handle the main frame.
    105     if (&frameView->frame() != &m_page->mainFrame())
     105    if (!frameView->frame().isMainFrame())
    106106        return false;
    107107
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r156560 r156607  
    4646#include "InspectorInstrumentation.h"
    4747#include "KeyframeList.h"
     48#include "MainFrame.h"
    4849#include "PluginViewBase.h"
    4950#include "ProgressTracker.h"
     
    122123
    123124    if (layer->isRootLayer() && page) {
    124         if (page->frameIsMainFrame(&renderer().frame()))
     125        if (renderer().frame().isMainFrame())
    125126            m_isMainFrameRenderViewLayer = true;
    126127
  • trunk/Source/WebKit/blackberry/ChangeLog

    r156550 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     9        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
     10        Call isMainFrame.
     11
    1122013-09-26  Darin Adler  <darin@apple.com>
    213
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r156550 r156607  
    4545#include "InputHandler.h"
    4646#include "MIMETypeRegistry.h"
     47#include "MainFrame.h"
    4748#include "NetworkManager.h"
    4849#include "NodeList.h"
     
    5556#include "ScopePointer.h"
    5657#include "SelectionHandler.h"
    57 #if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
    5858#include "Settings.h"
    59 #endif
    6059#include "SharedBuffer.h"
    6160#include "TextEncoding.h"
     
    972971    // TargetType for subresource loads should have been set in CachedResource::load().
    973972    if (isMainResourceLoad)
    974         request.setTargetType(docLoader->frameLoader()->isLoadingMainFrame() ? ResourceRequest::TargetIsMainFrame : ResourceRequest::TargetIsSubframe);
     973        request.setTargetType(docLoader->frameLoader()->frame().isMainFrame() ? ResourceRequest::TargetIsMainFrame : ResourceRequest::TargetIsSubframe);
    975974
    976975    // Any processing which is done for all loads (both main and subresource) should go here.
  • trunk/Source/WebKit/efl/ChangeLog

    r156550 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/FrameLoaderClientEfl.cpp:
     9        (WebCore::FrameLoaderClientEfl::dispatchWillSendRequest):
     10        (WebCore::FrameLoaderClientEfl::assignIdentifierToInitialRequest):
     11        (WebCore::FrameLoaderClientEfl::updateGlobalHistory):
     12        Call isMainFrame.
     13
    1142013-09-26  Darin Adler  <darin@apple.com>
    215
  • trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r156550 r156607  
    4848#include "HTTPStatusCodes.h"
    4949#include "MIMETypeRegistry.h"
     50#include "MainFrame.h"
    5051#include "NotImplemented.h"
    5152#include "Page.h"
     
    184185    if (loader) {
    185186            const FrameLoader* frameLoader = loader->frameLoader();
    186             isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->isLoadingMainFrame());
     187            isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->frame().isMainFrame());
    187188    }
    188189
     
    237238    if (loader) {
    238239            const FrameLoader* frameLoader = loader->frameLoader();
    239             isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->isLoadingMainFrame());
     240            isMainFrameRequest = (loader == frameLoader->provisionalDocumentLoader() && frameLoader->frame().isMainFrame());
    240241    }
    241242
     
    993994
    994995    const FrameLoader* frameLoader = loader->frameLoader();
    995     const bool isMainFrameRequest = frameLoader && (loader == frameLoader->provisionalDocumentLoader()) && frameLoader->isLoadingMainFrame();
     996    const bool isMainFrameRequest = frameLoader && (loader == frameLoader->provisionalDocumentLoader()) && frameLoader->frame().isMainFrame();
    996997    const CString& urlForHistory = loader->urlForHistory().string().utf8();
    997998    const CString& title = loader->title().string().utf8();
  • trunk/Source/WebKit/gtk/ChangeLog

    r156603 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     9        (WebKit::FrameLoaderClient::assignIdentifierToInitialRequest):
     10        Call isMainFrame.
     11
    1122013-09-28  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r156550 r156607  
    277277
    278278    if (loader == loader->frameLoader()->provisionalDocumentLoader()
    279         && loader->frameLoader()->isLoadingMainFrame()) {
     279        && loader->frameLoader()->frame().isMainFrame()) {
    280280        webkit_web_view_add_main_resource(getViewFromFrame(m_frame), identifierString.get(), webResource);
    281281        return;
  • trunk/Source/WebKit/mac/ChangeLog

    r156599 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/WebFrameLoaderClient.mm:
     9        (WebFrameLoaderClient::canHandleRequest):
     10        (WebFrameLoaderClient::transitionToCommittedForNewPage):
     11        * WebView/WebFrameView.mm:
     12        (-[WebFrameView _install]):
     13        Call isMainFrame.
     14
    1152013-09-28  Mark Rowe  <mrowe@apple.com>
    216
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r156550 r156607  
    8888#import <WebCore/FocusController.h>
    8989#import <WebCore/FormState.h>
    90 #import <WebCore/Frame.h>
    9190#import <WebCore/FrameLoader.h>
    9291#import <WebCore/FrameLoaderStateMachine.h>
     
    108107#import <WebCore/LoaderNSURLExtras.h>
    109108#import <WebCore/MIMETypeRegistry.h>
     109#import <WebCore/MainFrame.h>
    110110#import <WebCore/MouseEvent.h>
    111111#import <WebCore/Page.h>
     
    10641064bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest& request) const
    10651065{
    1066     Frame* frame = core(m_webFrame.get());
    1067     Page* page = frame->page();
    1068     BOOL forMainFrame = page && page->frameIsMainFrame(frame);
    1069     return [WebView _canHandleRequest:request.nsURLRequest(UpdateHTTPBody) forMainFrame:forMainFrame];
     1066    return [WebView _canHandleRequest:request.nsURLRequest(UpdateHTTPBody) forMainFrame:core(m_webFrame.get())->isMainFrame()];
    10701067}
    10711068
     
    12661263    Frame* coreFrame = core(m_webFrame.get());
    12671264    Page* page = coreFrame->page();
    1268     bool isMainFrame = page->frameIsMainFrame(coreFrame);
     1265    bool isMainFrame = coreFrame->isMainFrame();
    12691266    if (isMainFrame && coreFrame->view())
    12701267        coreFrame->view()->setParentVisible(false);
  • trunk/Source/WebKit/mac/WebView/WebFrameView.mm

    r155591 r156607  
    283283    // If this isn't the main frame, it must have an owner element set, or it
    284284    // won't ever get installed in the view hierarchy.
    285     ASSERT(frame->page()->frameIsMainFrame(frame) || frame->ownerElement());
     285    ASSERT(frame->isMainFrame() || frame->ownerElement());
    286286
    287287    FrameView* view = frame->view();
  • trunk/Source/WebKit2/ChangeLog

    r156604 r156607  
     12013-09-28  Darin Adler  <darin@apple.com>
     2
     3        Add Frame::mainFrame and Frame::isMainFrame
     4        https://bugs.webkit.org/show_bug.cgi?id=122064
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     9        (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView):
     10        Call isMainFrame.
     11
    1122013-09-27  Anders Carlsson  <andersca@apple.com>
    213
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r156560 r156607  
    707707bool TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView(const FrameView* frameView)
    708708{
    709     return frameView && frameView->isMainFrameView();
     709    return frameView && frameView->frame().isMainFrame();
    710710}
    711711
Note: See TracChangeset for help on using the changeset viewer.