Page::mainFrame() should return a reference.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Aug 2013 02:47:37 +0000 (02:47 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Aug 2013 02:47:37 +0000 (02:47 +0000)
<http://webkit.org/b/119677>

Reviewed by Antti Koivisto.

Page always creates the main Frame by itself now, so it will never be null during the Page's lifetime.

Let Page::mainFrame() return Frame& and remove a sea of null checks.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154658 268f45cc-cd09-0410-ab3c-d52691b4dbfc

109 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/bindings/js/PageScriptDebugServer.cpp
Source/WebCore/bindings/js/ScriptProfiler.cpp
Source/WebCore/bindings/js/ScriptState.cpp
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/history/CachedPage.cpp
Source/WebCore/history/PageCache.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorCanvasAgent.cpp
Source/WebCore/inspector/InspectorClient.cpp
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorInputAgent.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/PageRuntimeAgent.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/HistoryController.cpp
Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/FocusController.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/FrameTree.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/GestureTapHighlighter.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/PageGroupLoadDeferrer.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/PageThrottler.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/page/mac/DragControllerMac.mm
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
Source/WebCore/plugins/DOMMimeType.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebCore/storage/StorageEventDispatcher.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp
Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp
Source/WebKit/gtk/webkit/webkitviewportattributes.cpp
Source/WebKit/gtk/webkit/webkitwebframe.cpp
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/mac/WebCoreSupport/WebDragClient.mm
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKit/mac/WebView/WebFrame.mm
Source/WebKit/mac/WebView/WebFrameView.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
Source/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
Source/WebKit/win/WebCoreSupport/WebDragClient.cpp
Source/WebKit/win/WebDropSource.cpp
Source/WebKit/win/WebFrame.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit/wince/WebView.cpp
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
Source/WebKit2/WebProcess/WebPage/FindController.cpp
Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index c99a5fed416959660c7e9fe06218a8c9da698dd0..2133d68d3629b165eedb75f866ea4d5b018123b9 100644 (file)
@@ -1,3 +1,14 @@
+2013-08-26  Andreas Kling  <akling@apple.com>
+
+        Page::mainFrame() should return a reference.
+        <http://webkit.org/b/119677>
+
+        Reviewed by Antti Koivisto.
+
+        Page always creates the main Frame by itself now, so it will never be null during the Page's lifetime.
+
+        Let Page::mainFrame() return Frame& and remove a sea of null checks.
+
 2013-08-26  Sam Weinig  <sam@webkit.org>
 
         Remove two unnecessary .get()s.
 2013-08-26  Sam Weinig  <sam@webkit.org>
 
         Remove two unnecessary .get()s.
index 5959f1538e8276fc7f7773bdc6a87e15480ff09b..9be50c8d554686804c4f1327e9ea38d31115cec7 100644 (file)
@@ -3009,7 +3009,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         }
     }
     
         }
     }
     
-    page->contextMenuController().showContextMenuAt(page->mainFrame(), rect.center());
+    page->contextMenuController().showContextMenuAt(&page->mainFrame(), rect.center());
 }
 
 - (void)accessibilityScrollToVisible
 }
 
 - (void)accessibilityScrollToVisible
index 3189a76ac823deaf7b2a2ce803b7412436560f34..ab3cfc3a79bba77664628272c71c230fb44e6da7 100644 (file)
@@ -189,7 +189,7 @@ void PageScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
 
     page->setDefersLoading(paused);
 
 
     page->setDefersLoading(paused);
 
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
         setJavaScriptPaused(frame, paused);
 }
 
         setJavaScriptPaused(frame, paused);
 }
 
index a61d53d87b34547cfcee4ff36daa12054fde89cd..896ca577c256790353ee807c53599303c8e5715a 100644 (file)
@@ -64,7 +64,7 @@ void ScriptProfiler::start(ScriptState* state, const String& title)
 
 void ScriptProfiler::startForPage(Page* inspectedPage, const String& title)
 {
 
 void ScriptProfiler::startForPage(Page* inspectedPage, const String& title)
 {
-    JSC::ExecState* scriptState = toJSDOMWindow(inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+    JSC::ExecState* scriptState = toJSDOMWindow(&inspectedPage->mainFrame(), debuggerWorld())->globalExec();
     start(scriptState, title);
 }
 
     start(scriptState, title);
 }
 
@@ -83,7 +83,7 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String&
 
 PassRefPtr<ScriptProfile> ScriptProfiler::stopForPage(Page* inspectedPage, const String& title)
 {
 
 PassRefPtr<ScriptProfile> ScriptProfiler::stopForPage(Page* inspectedPage, const String& title)
 {
-    JSC::ExecState* scriptState = toJSDOMWindow(inspectedPage->mainFrame(), debuggerWorld())->globalExec();
+    JSC::ExecState* scriptState = toJSDOMWindow(&inspectedPage->mainFrame(), debuggerWorld())->globalExec();
     return stop(scriptState, title);
 }
 
     return stop(scriptState, title);
 }
 
index e6a530cfd12bccc7eff52d91892b06491692e233..0717da4a81794ef8cc7192de2e669a25e8e53702 100644 (file)
@@ -89,7 +89,7 @@ ScriptState* scriptStateFromNode(DOMWrapperWorld* world, Node* node)
 
 ScriptState* scriptStateFromPage(DOMWrapperWorld* world, Page* page)
 {
 
 ScriptState* scriptStateFromPage(DOMWrapperWorld* world, Page* page)
 {
-    return page->mainFrame()->script().globalObject(world)->globalExec();
+    return page->mainFrame().script().globalObject(world)->globalExec();
 }
 
 #if ENABLE(WORKERS)
 }
 
 #if ENABLE(WORKERS)
index e319a408c7e3d1322690f88704cf63c86f6847da..c923ffbb71e25bcc422601c848d6355ab94e4923 100644 (file)
@@ -200,7 +200,7 @@ static bool numberValue(CSSValue* value, float& result)
 
 static bool colorMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
 
 static bool colorMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
-    int bitsPerComponent = screenDepthPerComponent(frame->page()->mainFrame()->view());
+    int bitsPerComponent = screenDepthPerComponent(frame->page()->mainFrame().view());
     float number;
     if (value)
         return numberValue(value, number) && compareValue(bitsPerComponent, static_cast<int>(number), op);
     float number;
     if (value)
         return numberValue(value, number) && compareValue(bitsPerComponent, static_cast<int>(number), op);
@@ -221,7 +221,7 @@ static bool color_indexMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, M
 
 static bool monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
 
 static bool monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
-    if (!screenIsMonochrome(frame->page()->mainFrame()->view())) {
+    if (!screenIsMonochrome(frame->page()->mainFrame().view())) {
         if (value) {
             float number;
             return numberValue(value, number) && compareValue(0, static_cast<int>(number), op);
         if (value) {
             float number;
             return numberValue(value, number) && compareValue(0, static_cast<int>(number), op);
@@ -268,7 +268,7 @@ static bool aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f
 static bool device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
 static bool device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
-        FloatRect sg = screenRect(frame->page()->mainFrame()->view());
+        FloatRect sg = screenRect(frame->page()->mainFrame().view());
         return compareAspectRatioValue(value, static_cast<int>(sg.width()), static_cast<int>(sg.height()), op);
     }
 
         return compareAspectRatioValue(value, static_cast<int>(sg.width()), static_cast<int>(sg.height()), op);
     }
 
@@ -359,7 +359,7 @@ static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, Rend
 static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
 static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
-        FloatRect sg = screenRect(frame->page()->mainFrame()->view());
+        FloatRect sg = screenRect(frame->page()->mainFrame().view());
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
         int length;
         long height = sg.height();
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
         int length;
         long height = sg.height();
@@ -374,7 +374,7 @@ static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, F
 static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
 static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
-        FloatRect sg = screenRect(frame->page()->mainFrame()->view());
+        FloatRect sg = screenRect(frame->page()->mainFrame().view());
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
         int length;
         long width = sg.width();
         RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
         int length;
         long width = sg.width();
index d7e7bdf4d93ddebe3ebb11fdb1b40d4282f824db..694f6a4da867b2df228a29958040e493bfefd44c 100644 (file)
@@ -1270,7 +1270,7 @@ void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed)
         updateLayout();
 
     if (Page* page = this->page()) {
         updateLayout();
 
     if (Page* page = this->page()) {
-        if (frame() == page->mainFrame()) {
+        if (frame() == &page->mainFrame()) {
             frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
             if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
                 frame()->loader().didLayout(DidFirstLayoutAfterSuppressedIncrementalRendering);
             frameView->addPaintPendingMilestones(DidFirstPaintAfterSuppressedIncrementalRendering);
             if (page->requestedLayoutMilestones() & DidFirstLayoutAfterSuppressedIncrementalRendering)
                 frame()->loader().didLayout(DidFirstLayoutAfterSuppressedIncrementalRendering);
@@ -1988,7 +1988,7 @@ void Document::createRenderTree()
 static void pageWheelEventHandlerCountChanged(Page& page)
 {
     unsigned count = 0;
 static void pageWheelEventHandlerCountChanged(Page& page)
 {
     unsigned count = 0;
-    for (const Frame* frame = page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (const Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (Document* document = frame->document())
             count += document->wheelEventHandlerCount();
     }
         if (Document* document = frame->document())
             count += document->wheelEventHandlerCount();
     }
@@ -2014,13 +2014,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.
     // 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()->mainFrame() == m_frame)
+    if (page() && &page()->mainFrame() == m_frame)
         pageWheelEventHandlerCountChanged(*page());
 
 #if ENABLE(TOUCH_EVENTS)
     // FIXME: Doing this only for the main frame is insufficient.
     // A subframe could have touch event handlers.
         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()->mainFrame() == m_frame)
+    if (hasTouchEventHandlers() && page() && &page()->mainFrame() == m_frame)
         page()->chrome().client().needTouchEvents(true);
 #endif
 
         page()->chrome().client().needTouchEvents(true);
 #endif
 
@@ -2942,7 +2942,7 @@ void Document::processViewport(const String& features, ViewportArguments::Type o
 
 void Document::updateViewportArguments()
 {
 
 void Document::updateViewportArguments()
 {
-    if (page() && page()->mainFrame() == frame()) {
+    if (page() && &page()->mainFrame() == frame()) {
 #ifndef NDEBUG
         m_didDispatchViewportPropertiesChanged = true;
 #endif
 #ifndef NDEBUG
         m_didDispatchViewportPropertiesChanged = true;
 #endif
@@ -3996,7 +3996,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();
             // 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->mainFrame() == m_frame) {
+            if (page && &page->mainFrame() == m_frame) {
                 v->resetScrollbarsAndClearContentsSize();
                 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
                     scrollingCoordinator->clearStateTree();
                 v->resetScrollbarsAndClearContentsSize();
                 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
                     scrollingCoordinator->clearStateTree();
@@ -5613,7 +5613,7 @@ void Document::didRemoveTouchEventHandler(Node* handler)
 #endif
     if (m_touchEventTargets->size())
         return;
 #endif
     if (m_touchEventTargets->size())
         return;
-    for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (const Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document() && frame->document()->hasTouchEventHandlers())
             return;
     }
         if (frame->document() && frame->document()->hasTouchEventHandlers())
             return;
     }
@@ -5997,7 +5997,7 @@ void Document::ensurePlugInsInjectedScript(DOMWrapperWorld* world)
     if (!jsString)
         jsString = plugInsJavaScript;
 
     if (!jsString)
         jsString = plugInsJavaScript;
 
-    page()->mainFrame()->script().evaluateInWorld(ScriptSourceCode(jsString), world);
+    page()->mainFrame().script().evaluateInWorld(ScriptSourceCode(jsString), world);
 
     m_hasInjectedPlugInsScript = true;
 }
 
     m_hasInjectedPlugInsScript = true;
 }
index 3a3eb8d3d180efc14ec50f706157341a49270f3b..0f8d0758a13e38d193ac599357b6b37ff63de96b 100644 (file)
@@ -160,7 +160,7 @@ CachedFrame::CachedFrame(Frame* frame)
     ASSERT(m_view);
 
     if (frame->page()->focusController().focusedFrame() == frame)
     ASSERT(m_view);
 
     if (frame->page()->focusController().focusedFrame() == frame)
-        frame->page()->focusController().setFocusedFrame(frame->page()->mainFrame());
+        frame->page()->focusController().setFocusedFrame(&frame->page()->mainFrame());
 
     // Custom scrollbar renderers will get reattached when the document comes out of the page cache
     m_view->detachCustomScrollbars();
 
     // Custom scrollbar renderers will get reattached when the document comes out of the page cache
     m_view->detachCustomScrollbars();
index 37cf9fa2731835a4c61d71c034bc8e4481ec7a54..b3e9407c9c481a475a35918938a0ea145c282462 100644 (file)
@@ -53,7 +53,7 @@ PassRefPtr<CachedPage> CachedPage::create(Page* page)
 CachedPage::CachedPage(Page* page)
     : m_timeStamp(currentTime())
     , m_expirationTime(m_timeStamp + page->settings().backForwardCacheExpirationInterval())
 CachedPage::CachedPage(Page* page)
     : m_timeStamp(currentTime())
     , m_expirationTime(m_timeStamp + page->settings().backForwardCacheExpirationInterval())
-    , m_cachedMainFrame(CachedFrame::create(page->mainFrame()))
+    , m_cachedMainFrame(CachedFrame::create(&page->mainFrame()))
     , m_needStyleRecalcForVisitedLinks(false)
     , m_needsFullStyleRecalc(false)
     , m_needsCaptionPreferencesChanged(false)
     , m_needStyleRecalcForVisitedLinks(false)
     , m_needsFullStyleRecalc(false)
     , m_needsCaptionPreferencesChanged(false)
@@ -77,7 +77,7 @@ CachedPage::~CachedPage()
 void CachedPage::restore(Page* page)
 {
     ASSERT(m_cachedMainFrame);
 void CachedPage::restore(Page* page)
 {
     ASSERT(m_cachedMainFrame);
-    ASSERT(page && page->mainFrame() && page->mainFrame() == &m_cachedMainFrame->view()->frame());
+    ASSERT(page && &page->mainFrame() == &m_cachedMainFrame->view()->frame());
     ASSERT(!page->subframeCount());
 
     m_cachedMainFrame->open();
     ASSERT(!page->subframeCount());
 
     m_cachedMainFrame->open();
@@ -89,14 +89,13 @@ void CachedPage::restore(Page* page)
         element->updateFocusAppearance(true);
 
     if (m_needStyleRecalcForVisitedLinks) {
         element->updateFocusAppearance(true);
 
     if (m_needStyleRecalcForVisitedLinks) {
-        for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+        for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
             frame->document()->visitedLinkState().invalidateStyleForAllLinks();
     }
 
 #if USE(ACCELERATED_COMPOSITING)
     if (m_needsDeviceScaleChanged) {
             frame->document()->visitedLinkState().invalidateStyleForAllLinks();
     }
 
 #if USE(ACCELERATED_COMPOSITING)
     if (m_needsDeviceScaleChanged) {
-        if (Frame* frame = page->mainFrame())
-            frame->deviceOrPageScaleFactorChanged();
+        page->mainFrame().deviceOrPageScaleFactorChanged();
     }
 #endif
 
     }
 #endif
 
index 9c512c9cd1c0ea005c1676efc760b37f13a80010..8f7fcc4602a8f42fd9f88fa74c385fe66c7a18a2 100644 (file)
@@ -202,9 +202,9 @@ COMPILE_ASSERT(NumberOfReasonsPagesCannotBeInPageCache <= sizeof(unsigned)*8, Re
 static void logCanCachePageDecision(Page* page)
 {
     // Only bother logging for main frames that have actually loaded and have content.
 static void logCanCachePageDecision(Page* page)
 {
     // Only bother logging for main frames that have actually loaded and have content.
-    if (page->mainFrame()->loader().stateMachine()->creatingInitialEmptyDocument())
+    if (page->mainFrame().loader().stateMachine()->creatingInitialEmptyDocument())
         return;
         return;
-    KURL currentURL = page->mainFrame()->loader().documentLoader() ? page->mainFrame()->loader().documentLoader()->url() : KURL();
+    KURL currentURL = page->mainFrame().loader().documentLoader() ? page->mainFrame().loader().documentLoader()->url() : KURL();
     if (currentURL.isEmpty())
         return;
     
     if (currentURL.isEmpty())
         return;
     
@@ -212,7 +212,7 @@ static void logCanCachePageDecision(Page* page)
     PCLOG("--------\n Determining if page can be cached:");
     
     unsigned rejectReasons = 0;
     PCLOG("--------\n Determining if page can be cached:");
     
     unsigned rejectReasons = 0;
-    unsigned frameRejectReasons = logCanCacheFrameDecision(page->mainFrame(), indentLevel+1);
+    unsigned frameRejectReasons = logCanCacheFrameDecision(&page->mainFrame(), indentLevel+1);
     if (frameRejectReasons)
         rejectReasons |= 1 << FrameCannotBeInPageCache;
     
     if (frameRejectReasons)
         rejectReasons |= 1 << FrameCannotBeInPageCache;
     
@@ -240,7 +240,7 @@ static void logCanCachePageDecision(Page* page)
         rejectReasons |= 1 << UsesDeviceMotion;
     }
 #endif
         rejectReasons |= 1 << UsesDeviceMotion;
     }
 #endif
-    FrameLoadType loadType = page->mainFrame()->loader().loadType();
+    FrameLoadType loadType = page->mainFrame().loader().loadType();
     if (loadType == FrameLoadTypeReload) {
         PCLOG("   -Load type is: Reload");
         rejectReasons |= 1 << IsReload;
     if (loadType == FrameLoadTypeReload) {
         PCLOG("   -Load type is: Reload");
         rejectReasons |= 1 << IsReload;
@@ -350,10 +350,10 @@ bool PageCache::canCache(Page* page) const
     // store the final page we end up on.
     // No point writing to the cache on a reload or loadSame, since we will just write
     // over it again when we leave that page.
     // store the final page we end up on.
     // No point writing to the cache on a reload or loadSame, since we will just write
     // over it again when we leave that page.
-    FrameLoadType loadType = page->mainFrame()->loader().loadType();
+    FrameLoadType loadType = page->mainFrame().loader().loadType();
     
     return m_capacity > 0
     
     return m_capacity > 0
-        && canCachePageContainingThisFrame(page->mainFrame())
+        && canCachePageContainingThisFrame(&page->mainFrame())
         && page->backForward()->isActive()
         && page->settings().usesPageCache()
 #if ENABLE(DEVICE_ORIENTATION)
         && page->backForward()->isActive()
         && page->settings().usesPageCache()
 #if ENABLE(DEVICE_ORIENTATION)
@@ -397,11 +397,9 @@ void PageCache::markPagesForVistedLinkStyleRecalc()
 
 void PageCache::markPagesForFullStyleRecalc(Page* page)
 {
 
 void PageCache::markPagesForFullStyleRecalc(Page* page)
 {
-    Frame* mainFrame = page->mainFrame();
-
     for (HistoryItem* current = m_head; current; current = current->m_next) {
         CachedPage* cachedPage = current->m_cachedPage.get();
     for (HistoryItem* current = m_head; current; current = current->m_next) {
         CachedPage* cachedPage = current->m_cachedPage.get();
-        if (&cachedPage->cachedMainFrame()->view()->frame() == mainFrame)
+        if (&cachedPage->cachedMainFrame()->view()->frame() == &page->mainFrame())
             cachedPage->markForFullStyleRecalc();
     }
 }
             cachedPage->markForFullStyleRecalc();
     }
 }
@@ -410,11 +408,9 @@ void PageCache::markPagesForFullStyleRecalc(Page* page)
 #if USE(ACCELERATED_COMPOSITING)
 void PageCache::markPagesForDeviceScaleChanged(Page* page)
 {
 #if USE(ACCELERATED_COMPOSITING)
 void PageCache::markPagesForDeviceScaleChanged(Page* page)
 {
-    Frame* mainFrame = page->mainFrame();
-
     for (HistoryItem* current = m_head; current; current = current->m_next) {
         CachedPage* cachedPage = current->m_cachedPage.get();
     for (HistoryItem* current = m_head; current; current = current->m_next) {
         CachedPage* cachedPage = current->m_cachedPage.get();
-        if (&cachedPage->cachedMainFrame()->view()->frame() == mainFrame)
+        if (&cachedPage->cachedMainFrame()->view()->frame() == &page->mainFrame())
             cachedPage->markForDeviceScaleChanged();
     }
 }
             cachedPage->markForDeviceScaleChanged();
     }
 }
index d70ee6f8871be75205edd98379318ddf488ea15e..743a6df84769e637fc6ecd017325a5c3c190af3c 100644 (file)
@@ -370,7 +370,7 @@ void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     static DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::create(JSDOMWindow::commonVM()).leakRef();
     document()->ensurePlugInsInjectedScript(isolatedWorld);
 
     static DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::create(JSDOMWindow::commonVM()).leakRef();
     document()->ensurePlugInsInjectedScript(isolatedWorld);
 
-    ScriptController& scriptController = page->mainFrame()->script();
+    ScriptController& scriptController = page->mainFrame().script();
     JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(isolatedWorld));
     JSC::ExecState* exec = globalObject->globalExec();
 
     JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(isolatedWorld));
     JSC::ExecState* exec = globalObject->globalExec();
 
@@ -451,7 +451,7 @@ void HTMLPlugInImageElement::restartSimilarPlugIns()
     if (!document()->page())
         return;
 
     if (!document()->page())
         return;
 
-    for (Frame* frame = document()->page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &document()->page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->loader().subframeLoader()->containsPlugins())
             continue;
         
         if (!frame->loader().subframeLoader()->containsPlugins())
             continue;
         
@@ -483,8 +483,8 @@ void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event,
         m_pendingClickEventFromSnapshot = event;
 
     String plugInOrigin = m_loadedUrl.host();
         m_pendingClickEventFromSnapshot = event;
 
     String plugInOrigin = m_loadedUrl.host();
-    if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()) && document()->page()->settings().autostartOriginPlugInSnapshottingEnabled())
-        document()->page()->plugInClient()->didStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), plugInOrigin, loadedMimeType());
+    if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame().document()->baseURL().protocol()) && document()->page()->settings().autostartOriginPlugInSnapshottingEnabled())
+        document()->page()->plugInClient()->didStartFromOrigin(document()->page()->mainFrame().document()->baseURL().host(), plugInOrigin, loadedMimeType());
 
     LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
     restartSnapshottedPlugIn();
 
     LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
     restartSnapshottedPlugIn();
@@ -540,8 +540,8 @@ static bool documentHadRecentUserGesture(Document* document)
 {
     double lastKnownUserGestureTimestamp = document->lastHandledUserGestureTimestamp();
 
 {
     double lastKnownUserGestureTimestamp = document->lastHandledUserGestureTimestamp();
 
-    if (document->frame() != document->page()->mainFrame() && document->page()->mainFrame() && document->page()->mainFrame()->document())
-        lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document->page()->mainFrame()->document()->lastHandledUserGestureTimestamp());
+    if (document->frame() != &document->page()->mainFrame() && document->page()->mainFrame().document())
+        lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document->page()->mainFrame().document()->lastHandledUserGestureTimestamp());
 
     if (monotonicallyIncreasingTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold)
         return true;
 
     if (monotonicallyIncreasingTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold)
         return true;
@@ -603,7 +603,7 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
         return;
     }
 
         return;
     }
 
-    bool inMainFrame = document()->frame() == document()->page()->mainFrame();
+    bool inMainFrame = document()->frame() == &document()->page()->mainFrame();
 
     if (document()->isPluginDocument() && inMainFrame) {
         LOG(Plugins, "%p Plug-in document in main frame", this);
 
     if (document()->isPluginDocument() && inMainFrame) {
         LOG(Plugins, "%p Plug-in document in main frame", this);
@@ -636,8 +636,8 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
         return;
     }
 
         return;
     }
 
-    if (document()->page()->settings().autostartOriginPlugInSnapshottingEnabled() && document()->page()->plugInClient() && document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), url.host(), loadedMimeType())) {
-        LOG(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set to play", this, document()->page()->mainFrame()->document()->baseURL().host().utf8().data(), url.host().utf8().data());
+    if (document()->page()->settings().autostartOriginPlugInSnapshottingEnabled() && document()->page()->plugInClient() && document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()->page()->mainFrame().document()->baseURL().host(), url.host(), loadedMimeType())) {
+        LOG(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set to play", this, document()->page()->mainFrame().document()->baseURL().host().utf8().data(), url.host().utf8().data());
         m_snapshotDecision = NeverSnapshot;
         return;
     }
         m_snapshotDecision = NeverSnapshot;
         return;
     }
@@ -648,7 +648,7 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
         return;
     }
 
         return;
     }
 
-    if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(m_loadedUrl.protocol()) && !m_loadedUrl.host().isEmpty() && m_loadedUrl.host() == document()->page()->mainFrame()->document()->baseURL().host()) {
+    if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(m_loadedUrl.protocol()) && !m_loadedUrl.host().isEmpty() && m_loadedUrl.host() == document()->page()->mainFrame().document()->baseURL().host()) {
         LOG(Plugins, "%p Plug-in is served from page's domain, set to play", this);
         m_snapshotDecision = NeverSnapshot;
         return;
         LOG(Plugins, "%p Plug-in is served from page's domain, set to play", this);
         m_snapshotDecision = NeverSnapshot;
         return;
@@ -686,7 +686,7 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
         return;
     }
 
         return;
     }
 
-    LOG(Plugins, "%p Plug-in from (%s, %s) is not auto-start, sized at %dx%d, set to wait for snapshot", this, document()->page()->mainFrame()->document()->baseURL().host().utf8().data(), url.host().utf8().data(), contentWidth, contentHeight);
+    LOG(Plugins, "%p Plug-in from (%s, %s) is not auto-start, sized at %dx%d, set to wait for snapshot", this, document()->page()->mainFrame().document()->baseURL().host().utf8().data(), url.host().utf8().data(), contentWidth, contentHeight);
     m_snapshotDecision = Snapshotted;
     setDisplayState(WaitingForSnapshot);
 }
     m_snapshotDecision = Snapshotted;
     setDisplayState(WaitingForSnapshot);
 }
index 0adf8823583b153cda761156b29fe653d698f068..d310938986705eb3c87308634d894a29e29376cd 100644 (file)
@@ -373,7 +373,7 @@ CachedImage* ImageDocument::cachedImage()
 
 bool ImageDocument::shouldShrinkToFit() const
 {
 
 bool ImageDocument::shouldShrinkToFit() const
 {
-    return frame()->page()->settings().shrinksStandaloneImagesToFit() && frame()->page()->mainFrame() == frame();
+    return frame()->page()->settings().shrinksStandaloneImagesToFit() && &frame()->page()->mainFrame() == frame();
 }
 
 void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
 }
 
 void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
index 172dc912a4fe43301fe0404db6ba941847e85e0d..a40dca6144f7db27108390644c76bd5c194d90fe 100644 (file)
@@ -141,7 +141,7 @@ void InspectorAgent::domContentLoadedEventFired()
 
 bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
 {
 
 bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
 {
-    return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
+    return loader->frame() == &m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
 }
 
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
 }
 
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
@@ -171,7 +171,7 @@ void InspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> obje
 
 KURL InspectorAgent::inspectedURL() const
 {
 
 KURL InspectorAgent::inspectedURL() const
 {
-    return m_inspectedPage->mainFrame()->document()->url();
+    return m_inspectedPage->mainFrame().document()->url();
 }
 
 KURL InspectorAgent::inspectedURLWithoutFragment() const
 }
 
 KURL InspectorAgent::inspectedURLWithoutFragment() const
index 6affe693ed3f80f84c89cc13d31cf9b77e72c37f..42aeea16514520dc62318322b968d54d863a8457 100644 (file)
@@ -266,7 +266,7 @@ void InspectorCanvasAgent::findFramesWithUninstrumentedCanvases()
 {
     m_framesWithUninstrumentedCanvases.clear();
 
 {
     m_framesWithUninstrumentedCanvases.clear();
 
-    for (Frame* frame = m_pageAgent->page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_pageAgent->page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->document())
             continue;
 
         if (!frame->document())
             continue;
 
index 405c0c0a18d5e3f666dfcf066bbd0d3006c9afad..0702fa86e367f29657bd68580adac8c8c7cf851c 100644 (file)
@@ -47,14 +47,10 @@ bool InspectorClient::doDispatchMessageOnFrontendPage(Page* frontendPage, const
     if (!frontendPage)
         return false;
 
     if (!frontendPage)
         return false;
 
-    Frame* frame = frontendPage->mainFrame();
-    if (!frame)
-        return false;
-
     String dispatchToFrontend = "InspectorFrontendAPI.dispatchMessageAsync(" + message + ");";
 
     // FIXME: This should execute the script in the appropriate world.
     String dispatchToFrontend = "InspectorFrontendAPI.dispatchMessageAsync(" + message + ");";
 
     // FIXME: This should execute the script in the appropriate world.
-    frame->script().evaluate(ScriptSourceCode(dispatchToFrontend));
+    frontendPage->mainFrame().script().evaluate(ScriptSourceCode(dispatchToFrontend));
     return true;
 }
 
     return true;
 }
 
index e3590125b19dde98f27f81d158ece8446c3f0c52..d57cb3dd7dbfd9d81ce220080d9b6d86e4a26b41 100644 (file)
@@ -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 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 && frame == m_page->mainFrame())
+    if (m_inspectorFrontendClient && frame == &m_page->mainFrame())
         m_inspectorFrontendClient->windowObjectCleared();
 }
 
         m_inspectorFrontendClient->windowObjectCleared();
 }
 
index bd3cb1aed721524893373c3f7252501c93607e12..a84da816412ff79b9b54bbdceac4a445fd505551 100644 (file)
@@ -1750,7 +1750,7 @@ void InspectorDOMAgent::frameDocumentUpdated(Frame* frame)
 
     Page* page = frame->page();
     ASSERT(page);
 
     Page* page = frame->page();
     ASSERT(page);
-    if (frame != page->mainFrame())
+    if (frame != &page->mainFrame())
         return;
 
     // Only update the main frame document, nested frame document updates are not required
         return;
 
     // Only update the main frame document, nested frame document updates are not required
index c821bbe353eca4cd4774a84881a209468eabeabb..982a236458b3c0ba9c9f3fd553e147676ea26f8c 100644 (file)
@@ -180,8 +180,8 @@ bool InspectorFrontendClientLocal::canAttachWindow()
         return true;
 
     // Don't allow the attach if the window would be too small to accommodate the minimum inspector size.
         return true;
 
     // Don't allow the attach if the window would be too small to accommodate the minimum inspector size.
-    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
-    unsigned inspectedPageWidth = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleWidth();
+    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
+    unsigned inspectedPageWidth = m_inspectorController->inspectedPage()->mainFrame().view()->visibleWidth();
     unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
     return minimumAttachedHeight <= maximumAttachedHeight && minimumAttachedWidth <= inspectedPageWidth;
 }
     unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
     return minimumAttachedHeight <= maximumAttachedHeight && minimumAttachedWidth <= inspectedPageWidth;
 }
@@ -193,7 +193,7 @@ void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable)
 
 void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 {
 
 void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 {
-    unsigned totalHeight = m_frontendPage->mainFrame()->view()->visibleHeight() + m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
+    unsigned totalHeight = m_frontendPage->mainFrame().view()->visibleHeight() + m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
     unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight);
     m_settings->setProperty(inspectorAttachedHeightSetting, String::number(attachedHeight));
     setAttachedWindowHeight(attachedHeight);
     unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight);
     m_settings->setProperty(inspectorAttachedHeightSetting, String::number(attachedHeight));
     setAttachedWindowHeight(attachedHeight);
@@ -201,7 +201,7 @@ void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 
 void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
 {
 
 void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
 {
-    unsigned totalWidth = m_frontendPage->mainFrame()->view()->visibleWidth() + m_inspectorController->inspectedPage()->mainFrame()->view()->visibleWidth();
+    unsigned totalWidth = m_frontendPage->mainFrame().view()->visibleWidth() + m_inspectorController->inspectedPage()->mainFrame().view()->visibleWidth();
     unsigned attachedWidth = constrainedAttachedWindowWidth(width, totalWidth);
     setAttachedWindowWidth(attachedWidth);
 }
     unsigned attachedWidth = constrainedAttachedWindowWidth(width, totalWidth);
     setAttachedWindowWidth(attachedWidth);
 }
@@ -210,20 +210,20 @@ void InspectorFrontendClientLocal::openInNewTab(const String& url)
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
     Page* page = m_inspectorController->inspectedPage();
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
     Page* page = m_inspectorController->inspectedPage();
-    Frame* mainFrame = page->mainFrame();
-    FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
+    Frame& mainFrame = page->mainFrame();
+    FrameLoadRequest request(mainFrame.document()->securityOrigin(), ResourceRequest(), "_blank");
 
     bool created;
     WindowFeatures windowFeatures;
 
     bool created;
     WindowFeatures windowFeatures;
-    RefPtr<Frame> frame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+    RefPtr<Frame> frame = WebCore::createWindow(&mainFrame, &mainFrame, request, windowFeatures, created);
     if (!frame)
         return;
 
     if (!frame)
         return;
 
-    frame->loader().setOpener(mainFrame);
+    frame->loader().setOpener(&mainFrame);
     frame->page()->setOpenedByDOM();
 
     // FIXME: Why does one use mainFrame and the other frame?
     frame->page()->setOpenedByDOM();
 
     // FIXME: Why does one use mainFrame and the other frame?
-    frame->loader().changeLocation(mainFrame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
+    frame->loader().changeLocation(mainFrame.document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
 }
 
 void InspectorFrontendClientLocal::moveWindowBy(float x, float y)
 }
 
 void InspectorFrontendClientLocal::moveWindowBy(float x, float y)
@@ -255,7 +255,7 @@ void InspectorFrontendClientLocal::setAttachedWindow(DockSide dockSide)
 
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
 {
 
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
 {
-    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
+    unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame().view()->visibleHeight();
     String value = m_settings->getProperty(inspectorAttachedHeightSetting);
     unsigned preferredHeight = value.isEmpty() ? defaultAttachedHeight : value.toUInt();
     
     String value = m_settings->getProperty(inspectorAttachedHeightSetting);
     unsigned preferredHeight = value.isEmpty() ? defaultAttachedHeight : value.toUInt();
     
@@ -344,16 +344,14 @@ bool InspectorFrontendClientLocal::isUnderTest()
 
 bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& expression)
 {
 
 bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& expression)
 {
-    if (!m_frontendPage->mainFrame())
-        return false;
-    ScriptValue value = m_frontendPage->mainFrame()->script().executeScript(expression);
-    return value.toString(mainWorldScriptState(m_frontendPage->mainFrame())) == "true";
+    ScriptValue value = m_frontendPage->mainFrame().script().executeScript(expression);
+    return value.toString(mainWorldScriptState(&m_frontendPage->mainFrame())) == "true";
 }
 
 void InspectorFrontendClientLocal::evaluateOnLoad(const String& expression)
 {
     if (m_frontendLoaded)
 }
 
 void InspectorFrontendClientLocal::evaluateOnLoad(const String& expression)
 {
     if (m_frontendLoaded)
-        m_frontendPage->mainFrame()->script().executeScript("InspectorFrontendAPI.dispatch(" + expression + ")");
+        m_frontendPage->mainFrame().script().executeScript("InspectorFrontendAPI.dispatch(" + expression + ")");
     else
         m_evaluateOnLoad.append(expression);
 }
     else
         m_evaluateOnLoad.append(expression);
 }
index 52463d08ff76bcc57afce34a0887d23222232a83..124b9b9e42cb875708e275b8b565c39321f61468 100644 (file)
@@ -178,7 +178,7 @@ void InspectorFrontendHost::bringToFront()
 
 void InspectorFrontendHost::setZoomFactor(float zoom)
 {
 
 void InspectorFrontendHost::setZoomFactor(float zoom)
 {
-    m_frontendPage->mainFrame()->setPageAndTextZoomFactors(zoom, 1);
+    m_frontendPage->mainFrame().setPageAndTextZoomFactors(zoom, 1);
 }
 
 void InspectorFrontendHost::inspectedURLChanged(const String& newURL)
 }
 
 void InspectorFrontendHost::inspectedURLChanged(const String& newURL)
@@ -289,7 +289,7 @@ String InspectorFrontendHost::loadResourceSynchronously(const String& url)
     Vector<char> data;
     ResourceError error;
     ResourceResponse response;
     Vector<char> data;
     ResourceError error;
     ResourceResponse response;
-    m_frontendPage->mainFrame()->loader().loadResourceSynchronously(request, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, error, response, data);
+    m_frontendPage->mainFrame().loader().loadResourceSynchronously(request, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, error, response, data);
     return String::fromUTF8(data.data(), data.size());
 }
 
     return String::fromUTF8(data.data(), data.size());
 }
 
@@ -321,7 +321,7 @@ void InspectorFrontendHost::removeFileSystem(const String& fileSystemPath)
 #if ENABLE(FILE_SYSTEM)
 PassRefPtr<DOMFileSystem> InspectorFrontendHost::isolatedFileSystem(const String& fileSystemName, const String& rootURL)
 {
 #if ENABLE(FILE_SYSTEM)
 PassRefPtr<DOMFileSystem> InspectorFrontendHost::isolatedFileSystem(const String& fileSystemName, const String& rootURL)
 {
-    ScriptExecutionContext* context = m_frontendPage->mainFrame()->document();
+    ScriptExecutionContext* context = m_frontendPage->mainFrame().document();
     return DOMFileSystem::create(context, fileSystemName, FileSystemTypeIsolated, KURL(ParsedURLString, rootURL), AsyncFileSystem::create());
 }
 #endif
     return DOMFileSystem::create(context, fileSystemName, FileSystemTypeIsolated, KURL(ParsedURLString, rootURL), AsyncFileSystem::create());
 }
 #endif
index ffc70ce891c1aa7d15da878517c1024cc47ad4d1..4690af1408bbe5eb2d6d8eb9261d856fbfb5b45c 100644 (file)
@@ -90,7 +90,7 @@ void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
         isSystemKey ? *isSystemKey : false,
         static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0),
         timestamp ? *timestamp : currentTime());
         isSystemKey ? *isSystemKey : false,
         static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0),
         timestamp ? *timestamp : currentTime());
-    m_page->mainFrame()->eventHandler().keyEvent(event);
+    m_page->mainFrame().eventHandler().keyEvent(event);
 }
 
 void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount)
 }
 
 void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& type, int x, int y, const int* modifiers, const double* timestamp, const String* button, const int* clickCount)
@@ -125,7 +125,7 @@ void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& t
 
     // Some platforms may have flipped coordinate systems, but the given coordinates
     // assume the origin is in the top-left of the window. Convert.
 
     // Some platforms may have flipped coordinate systems, but the given coordinates
     // assume the origin is in the top-left of the window. Convert.
-    IntPoint convertedPoint = m_page->mainFrame()->view()->convertToContainingWindow(IntPoint(x, y));
+    IntPoint convertedPoint = m_page->mainFrame().view()->convertToContainingWindow(IntPoint(x, y));
     IntPoint globalPoint = m_page->chrome().rootViewToScreen(IntRect(IntPoint(x, y), IntSize(0, 0))).location();
 
     PlatformMouseEvent event(
     IntPoint globalPoint = m_page->chrome().rootViewToScreen(IntRect(IntPoint(x, y), IntSize(0, 0))).location();
 
     PlatformMouseEvent event(
@@ -140,7 +140,7 @@ void InspectorInputAgent::dispatchMouseEvent(ErrorString* error, const String& t
         convertedModifiers & PlatformEvent::MetaKey,
         timestamp ? *timestamp : currentTime());
 
         convertedModifiers & PlatformEvent::MetaKey,
         timestamp ? *timestamp : currentTime());
 
-    EventHandler& eventHandler = m_page->mainFrame()->eventHandler();
+    EventHandler& eventHandler = m_page->mainFrame().eventHandler();
     switch (convertedType) {
     case PlatformEvent::MousePressed:
         eventHandler.handleMousePressEvent(event);
     switch (convertedType) {
     case PlatformEvent::MousePressed:
         eventHandler.handleMousePressEvent(event);
index 5b6189a628d475cd0a19193d3e60e8ace8714d58..7666d9c63d66244632aed27d6093e2180122940e 100644 (file)
@@ -860,7 +860,7 @@ void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgent
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
         timelineAgent->didMarkDOMContentEvent(frame);
 
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
         timelineAgent->didMarkDOMContentEvent(frame);
 
-    if (frame->page()->mainFrame() != frame)
+    if (&frame->page()->mainFrame() != frame)
         return;
 
     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
         return;
 
     if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
@@ -881,7 +881,7 @@ void InspectorInstrumentation::loadEventFiredImpl(InstrumentingAgents* instrumen
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
         timelineAgent->didMarkLoadEvent(frame);
 
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
         timelineAgent->didMarkLoadEvent(frame);
 
-    if (frame->page()->mainFrame() != frame)
+    if (&frame->page()->mainFrame() != frame)
         return;
 
     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
         return;
 
     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
@@ -902,8 +902,7 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
     if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
         return;
 
     if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
         return;
 
-    Frame* mainFrame = page->mainFrame();
-    if (loader->frame() == mainFrame) {
+    if (loader->frame() == &page->mainFrame()) {
         if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
             consoleAgent->reset();
 
         if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
             consoleAgent->reset();
 
@@ -922,7 +921,7 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
             databaseAgent->clearResources();
 #endif
         if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
             databaseAgent->clearResources();
 #endif
         if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
-            domAgent->setDocument(mainFrame->document());
+            domAgent->setDocument(page->mainFrame().document());
 #if USE(ACCELERATED_COMPOSITING)
         if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
             layerTreeAgent->reset();
 #if USE(ACCELERATED_COMPOSITING)
         if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
             layerTreeAgent->reset();
index e870c757b9f78b63b14755c3277670796df340f6..5418ba4a399225d22909a853b17ab5238adac3d2 100644 (file)
@@ -111,7 +111,7 @@ static void buildNodeHighlight(Node* node, const HighlightConfig& highlightConfi
 
     highlight->setDataFromConfig(highlightConfig);
     FrameView* containingView = containingFrame->view();
 
     highlight->setDataFromConfig(highlightConfig);
     FrameView* containingView = containingFrame->view();
-    FrameView* mainView = containingFrame->page()->mainFrame()->view();
+    FrameView* mainView = containingFrame->page()->mainFrame().view();
     IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView(renderer->absoluteBoundingBoxRect()));
     boundingBox.move(mainView->scrollOffset());
     IntRect titleAnchorBox = boundingBox;
     IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView(renderer->absoluteBoundingBoxRect()));
     boundingBox.move(mainView->scrollOffset());
     IntRect titleAnchorBox = boundingBox;
@@ -208,7 +208,7 @@ void InspectorOverlay::paint(GraphicsContext& context)
     if (m_pausedInDebuggerMessage.isNull() && !m_highlightNode && !m_highlightQuad && m_size.isEmpty())
         return;
     GraphicsContextStateSaver stateSaver(context);
     if (m_pausedInDebuggerMessage.isNull() && !m_highlightNode && !m_highlightQuad && m_size.isEmpty())
         return;
     GraphicsContextStateSaver stateSaver(context);
-    FrameView* view = overlayPage()->mainFrame()->view();
+    FrameView* view = overlayPage()->mainFrame().view();
     view->updateLayoutAndStyleIfNeededRecursive();
     view->paint(&context, IntRect(0, 0, view->width(), view->height()));
 }
     view->updateLayoutAndStyleIfNeededRecursive();
     view->paint(&context, IntRect(0, 0, view->width(), view->height()));
 }
@@ -260,7 +260,7 @@ void InspectorOverlay::highlightNode(Node* node, const HighlightConfig& highligh
 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const HighlightConfig& highlightConfig)
 {
     if (m_quadHighlightConfig.usePageCoordinates)
 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const HighlightConfig& highlightConfig)
 {
     if (m_quadHighlightConfig.usePageCoordinates)
-        *quad -= m_page->mainFrame()->view()->scrollOffset();
+        *quad -= m_page->mainFrame().view()->scrollOffset();
 
     m_quadHighlightConfig = highlightConfig;
     m_highlightQuad = quad;
 
     m_quadHighlightConfig = highlightConfig;
     m_highlightQuad = quad;
@@ -279,11 +279,11 @@ void InspectorOverlay::update()
         return;
     }
 
         return;
     }
 
-    FrameView* view = m_page->mainFrame()->view();
+    FrameView* view = m_page->mainFrame().view();
     if (!view)
         return;
 
     if (!view)
         return;
 
-    FrameView* overlayView = overlayPage()->mainFrame()->view();
+    FrameView* overlayView = overlayPage()->mainFrame().view();
     IntSize viewportSize = view->visibleContentRect().size();
     IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
     IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size;
     IntSize viewportSize = view->visibleContentRect().size();
     IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
     IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size;
@@ -301,7 +301,7 @@ void InspectorOverlay::update()
     drawPausedInDebuggerMessage();
 
     // Position DOM elements.
     drawPausedInDebuggerMessage();
 
     // Position DOM elements.
-    overlayPage()->mainFrame()->document()->recalcStyle(Style::Force);
+    overlayPage()->mainFrame().document()->recalcStyle(Style::Force);
     if (overlayView->needsLayout())
         overlayView->layout();
 
     if (overlayView->needsLayout())
         overlayView->layout();
 
@@ -373,7 +373,7 @@ void InspectorOverlay::drawNodeHighlight()
 
     Highlight highlight;
     buildNodeHighlight(m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
 
     Highlight highlight;
     buildNodeHighlight(m_highlightNode.get(), m_nodeHighlightConfig, &highlight);
-    RefPtr<InspectorObject> highlightObject = buildObjectForHighlight(m_page->mainFrame()->view(), highlight);
+    RefPtr<InspectorObject> highlightObject = buildObjectForHighlight(m_page->mainFrame().view(), highlight);
 
     Node* node = m_highlightNode.get();
     if (node->isElementNode() && m_nodeHighlightConfig.showInfo && node->renderer() && node->document()->frame()) {
 
     Node* node = m_highlightNode.get();
     if (node->isElementNode() && m_nodeHighlightConfig.showInfo && node->renderer() && node->document()->frame()) {
@@ -417,7 +417,7 @@ void InspectorOverlay::drawQuadHighlight()
 
     Highlight highlight;
     buildQuadHighlight(m_page, *m_highlightQuad, m_quadHighlightConfig, &highlight);
 
     Highlight highlight;
     buildQuadHighlight(m_page, *m_highlightQuad, m_quadHighlightConfig, &highlight);
-    evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(m_page->mainFrame()->view(), highlight));
+    evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(m_page->mainFrame().view(), highlight));
 }
 
 void InspectorOverlay::drawPausedInDebuggerMessage()
 }
 
 void InspectorOverlay::drawPausedInDebuggerMessage()
@@ -450,12 +450,12 @@ Page* InspectorOverlay::overlayPage()
     overlaySettings.setScriptEnabled(true);
     overlaySettings.setPluginsEnabled(false);
 
     overlaySettings.setScriptEnabled(true);
     overlaySettings.setPluginsEnabled(false);
 
-    RefPtr<Frame> frame = m_overlayPage->mainFrame();
-    frame->setView(FrameView::create(frame.get()));
-    frame->init();
-    FrameLoader& loader = frame->loader();
-    frame->view()->setCanHaveScrollbars(false);
-    frame->view()->setTransparent(true);
+    Frame& frame = m_overlayPage->mainFrame();
+    frame.setView(FrameView::create(&frame));
+    frame.init();
+    FrameLoader& loader = frame.loader();
+    frame.view()->setCanHaveScrollbars(false);
+    frame.view()->setTransparent(true);
     ASSERT(loader.activeDocumentLoader());
     loader.activeDocumentLoader()->writer()->setMIMEType("text/html");
     loader.activeDocumentLoader()->writer()->begin();
     ASSERT(loader.activeDocumentLoader());
     loader.activeDocumentLoader()->writer()->setMIMEType("text/html");
     loader.activeDocumentLoader()->writer()->begin();
@@ -487,7 +487,7 @@ void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushString(argument);
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushString(argument);
-    overlayPage()->mainFrame()->script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<InspectorValue> argument)
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<InspectorValue> argument)
@@ -495,7 +495,7 @@ void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<Inspec
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushValue(argument);
     RefPtr<InspectorArray> command = InspectorArray::create();
     command->pushString(method);
     command->pushValue(argument);
-    overlayPage()->mainFrame()->script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
+    overlayPage()->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ")")));
 }
 
 void InspectorOverlay::freePage()
 }
 
 void InspectorOverlay::freePage()
index a98f9a6bbdfe230f30b555113d69649c5ef6c8e0..807e4d0643cb1cd9c938556b093cb464502b3604 100644 (file)
@@ -492,14 +492,14 @@ void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa
 {
     m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *optionalScriptToEvaluateOnLoad : "";
     m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPreprocessor : "";
 {
     m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *optionalScriptToEvaluateOnLoad : "";
     m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPreprocessor : "";
-    m_page->mainFrame()->loader().reload(optionalIgnoreCache ? *optionalIgnoreCache : false);
+    m_page->mainFrame().loader().reload(optionalIgnoreCache ? *optionalIgnoreCache : false);
 }
 
 void InspectorPageAgent::navigate(ErrorString*, const String& url)
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
 }
 
 void InspectorPageAgent::navigate(ErrorString*, const String& url)
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-    Frame* frame = m_page->mainFrame();
-    frame->loader().changeLocation(frame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
+    Frame& frame = m_page->mainFrame();
+    frame.loader().changeLocation(frame.document()->securityOrigin(), frame.document()->completeURL(url), "", false, false);
 }
 
 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
 }
 
 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
@@ -618,13 +618,13 @@ void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type
 void InspectorPageAgent::deleteCookie(ErrorString*, const String& cookieName, const String& url)
 {
     KURL parsedURL(ParsedURLString, url);
 void InspectorPageAgent::deleteCookie(ErrorString*, const String& cookieName, const String& url)
 {
     KURL parsedURL(ParsedURLString, url);
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext(m_page->mainFrame()))
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext(&m_page->mainFrame()))
         WebCore::deleteCookie(frame->document(), parsedURL, cookieName);
 }
 
 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object)
 {
         WebCore::deleteCookie(frame->document(), parsedURL, cookieName);
 }
 
 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object)
 {
-    object = buildObjectForFrameTree(m_page->mainFrame());
+    object = buildObjectForFrameTree(&m_page->mainFrame());
 }
 
 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, String* content, bool* base64Encoded)
 }
 
 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, String* content, bool* base64Encoded)
@@ -700,7 +700,7 @@ void InspectorPageAgent::searchInResources(ErrorString*, const String& text, con
     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
     RegularExpression regex = ContentSearchUtils::createSearchRegex(text, caseSensitive, isRegex);
 
     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
     RegularExpression regex = ContentSearchUtils::createSearchRegex(text, caseSensitive, isRegex);
 
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext(m_page->mainFrame())) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext(&m_page->mainFrame())) {
         String content;
         Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
         for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it) {
         String content;
         Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
         for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it) {
@@ -868,7 +868,7 @@ void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWor
     if (world != mainThreadNormalWorld())
         return;
 
     if (world != mainThreadNormalWorld())
         return;
 
-    if (frame == m_page->mainFrame())
+    if (frame == &m_page->mainFrame())
         m_injectedScriptManager->discardInjectedScripts();
 
     if (!m_frontend)
         m_injectedScriptManager->discardInjectedScripts();
 
     if (!m_frontend)
@@ -900,7 +900,7 @@ void InspectorPageAgent::loadEventFired()
 
 void InspectorPageAgent::frameNavigated(DocumentLoader* loader)
 {
 
 void InspectorPageAgent::frameNavigated(DocumentLoader* loader)
 {
-    if (loader->frame() == m_page->mainFrame()) {
+    if (loader->frame() == &m_page->mainFrame()) {
         m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
         m_scriptPreprocessor = m_pendingScriptPreprocessor;
         m_pendingScriptToEvaluateOnLoadOnce = String();
         m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
         m_scriptPreprocessor = m_pendingScriptPreprocessor;
         m_pendingScriptToEvaluateOnLoadOnce = String();
@@ -921,7 +921,8 @@ void InspectorPageAgent::frameDetached(Frame* frame)
 
 Frame* InspectorPageAgent::mainFrame()
 {
 
 Frame* InspectorPageAgent::mainFrame()
 {
-    return m_page->mainFrame();
+    // FIXME: This should return a Frame&
+    return &m_page->mainFrame();
 }
 
 Frame* InspectorPageAgent::frameForId(const String& frameId)
 }
 
 Frame* InspectorPageAgent::frameForId(const String& frameId)
@@ -961,7 +962,7 @@ String InspectorPageAgent::loaderId(DocumentLoader* loader)
 
 Frame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
 {
 
 Frame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
 {
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         RefPtr<SecurityOrigin> documentOrigin = frame->document()->securityOrigin();
         if (documentOrigin->toRawString() == originRawString)
             return frame;
         RefPtr<SecurityOrigin> documentOrigin = frame->document()->securityOrigin();
         if (documentOrigin->toRawString() == originRawString)
             return frame;
@@ -1290,9 +1291,7 @@ void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
         return;
 
     m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
         return;
 
     m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
-    Document* document = 0;
-    if (m_page->mainFrame())
-        document = m_page->mainFrame()->document();
+    Document* document = m_page->mainFrame().document();
     if (document) {
         document->styleResolverChanged(RecalcStyleImmediately);
         document->updateLayout();
     if (document) {
         document->styleResolverChanged(RecalcStyleImmediately);
         document->updateLayout();
index c7db2940c937fc9b738f8f87ae0c9fd73e58d8ab..c33f36c234f9246d996c0d92e73fe8b0f11ba959 100644 (file)
@@ -135,7 +135,7 @@ void PageRuntimeAgent::didCreateIsolatedContext(Frame* frame, ScriptState* scrip
 InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString* errorString, const int* executionContextId)
 {
     if (!executionContextId) {
 InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString* errorString, const int* executionContextId)
 {
     if (!executionContextId) {
-        ScriptState* scriptState = mainWorldScriptState(m_inspectedPage->mainFrame());
+        ScriptState* scriptState = mainWorldScriptState(&m_inspectedPage->mainFrame());
         InjectedScript result = injectedScriptManager()->injectedScriptFor(scriptState);
         if (result.hasNoValue())
             *errorString = "Internal error: main world execution context not found.";
         InjectedScript result = injectedScriptManager()->injectedScriptFor(scriptState);
         if (result.hasNoValue())
             *errorString = "Internal error: main world execution context not found.";
@@ -160,7 +160,7 @@ void PageRuntimeAgent::unmuteConsole()
 void PageRuntimeAgent::reportExecutionContextCreation()
 {
     Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
 void PageRuntimeAgent::reportExecutionContextCreation()
 {
     Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
-    for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_inspectedPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
             continue;
         String frameId = m_pageAgent->frameId(frame);
         if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
             continue;
         String frameId = m_pageAgent->frameId(frame);
index 28d0b62ee9999e1dc59ef99519e0e9c3ca5b2eb4..68e64b666b6eebdf6a528eef2daef985ed4860dc 100644 (file)
@@ -1959,7 +1959,7 @@ void FrameLoader::prepareForCachedPageRestore()
 {
     ASSERT(!m_frame.tree().parent());
     ASSERT(m_frame.page());
 {
     ASSERT(!m_frame.tree().parent());
     ASSERT(m_frame.page());
-    ASSERT(m_frame.page()->mainFrame() == &m_frame);
+    ASSERT(&m_frame.page()->mainFrame() == &m_frame);
 
     m_frame.navigationScheduler().cancel();
 
 
     m_frame.navigationScheduler().cancel();
 
@@ -2028,7 +2028,7 @@ bool FrameLoader::isHostedByObjectElement() const
 
 bool FrameLoader::isLoadingMainFrame() const
 {
 
 bool FrameLoader::isLoadingMainFrame() const
 {
-    return m_frame.page() && m_frame.page()->mainFrame() == &m_frame;
+    return m_frame.page() && &m_frame.page()->mainFrame() == &m_frame;
 }
 
 bool FrameLoader::isReplacing() const
 }
 
 bool FrameLoader::isReplacing() const
@@ -2121,7 +2121,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
             if (Page* page = m_frame.page())
                 if (isBackForwardLoadType(loadType()))
                     // Reset the back forward list to the last committed history item at the top level.
             if (Page* page = m_frame.page())
                 if (isBackForwardLoadType(loadType()))
                     // Reset the back forward list to the last committed history item at the top level.
-                    item = page->mainFrame()->loader().history().currentItem();
+                    item = page->mainFrame().loader().history().currentItem();
                 
             // Only reset if we aren't already going to a new provisional item.
             bool shouldReset = !history().provisionalItem();
                 
             // Only reset if we aren't already going to a new provisional item.
             bool shouldReset = !history().provisionalItem();
@@ -2178,7 +2178,7 @@ void FrameLoader::checkLoadCompleteForThisFrame()
 
             m_progressTracker->progressCompleted();
             if (Page* page = m_frame.page()) {
 
             m_progressTracker->progressCompleted();
             if (Page* page = m_frame.page()) {
-                if (&m_frame == page->mainFrame())
+                if (&m_frame == &page->mainFrame())
                     page->resetRelevantPaintedObjectCounter();
             }
 
                     page->resetRelevantPaintedObjectCounter();
             }
 
@@ -2287,7 +2287,7 @@ void FrameLoader::didLayout(LayoutMilestones milestones)
 {
 #if !ASSERT_DISABLED
     if (Page* page = m_frame.page())
 {
 #if !ASSERT_DISABLED
     if (Page* page = m_frame.page())
-        ASSERT(page->mainFrame() == &m_frame);
+        ASSERT(&page->mainFrame() == &m_frame);
 #endif
 
     m_client.dispatchDidLayout(milestones);
 #endif
 
     m_client.dispatchDidLayout(milestones);
@@ -2352,7 +2352,7 @@ void FrameLoader::checkLoadComplete()
     // is currently needed in order to null out the previous history item for all frames.
     if (Page* page = m_frame.page()) {
         Vector<RefPtr<Frame>, 10> frames;
     // is currently needed in order to null out the previous history item for all frames.
     if (Page* page = m_frame.page()) {
         Vector<RefPtr<Frame>, 10> frames;
-        for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+        for (RefPtr<Frame> frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
             frames.append(frame);
         // To process children before their parents, iterate the vector backwards.
         for (size_t i = frames.size(); i; --i)
             frames.append(frame);
         // To process children before their parents, iterate the vector backwards.
         for (size_t i = frames.size(); i; --i)
@@ -2586,7 +2586,7 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
     addHTTPOriginIfNeeded(initialRequest, outgoingOrigin());
 
     if (Page* page = m_frame.page())
     addHTTPOriginIfNeeded(initialRequest, outgoingOrigin());
 
     if (Page* page = m_frame.page())
-        initialRequest.setFirstPartyForCookies(page->mainFrame()->loader().documentLoader()->request().url());
+        initialRequest.setFirstPartyForCookies(page->mainFrame().loader().documentLoader()->request().url());
     
     addExtraFieldsToSubresourceRequest(initialRequest);
 
     
     addExtraFieldsToSubresourceRequest(initialRequest);
 
@@ -2841,8 +2841,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
         // we only do this when punting a navigation for the target frame or top-level frame.  
         if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker()->loadType())) {
             if (Page* page = m_frame.page()) {
         // we only do this when punting a navigation for the target frame or top-level frame.  
         if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(policyChecker()->loadType())) {
             if (Page* page = m_frame.page()) {
-                Frame* mainFrame = page->mainFrame();
-                if (HistoryItem* resetItem = mainFrame->loader().history().currentItem()) {
+                if (HistoryItem* resetItem = page->mainFrame().loader().history().currentItem()) {
                     page->backForward()->setCurrentItem(resetItem);
                     m_frame.loader().client().updateGlobalHistoryItemForPage();
                 }
                     page->backForward()->setCurrentItem(resetItem);
                     m_frame.loader().client().updateGlobalHistoryItemForPage();
                 }
@@ -2862,7 +2861,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
     if (Page* page = m_frame.page()) {
 
 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
     if (Page* page = m_frame.page()) {
-        if (page->mainFrame() == &m_frame)
+        if (&page->mainFrame() == &m_frame)
             page->inspectorController()->resume();
     }
 #endif
             page->inspectorController()->resume();
     }
 #endif
@@ -3329,7 +3328,7 @@ void FrameLoader::dispatchDidCommitLoad()
 
     InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
 
 
     InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
 
-    if (m_frame.page()->mainFrame() == &m_frame)
+    if (&m_frame.page()->mainFrame() == &m_frame)
         m_frame.page()->featureObserver()->didCommitLoad();
 
 }
         m_frame.page()->featureObserver()->didCommitLoad();
 
 }
@@ -3368,7 +3367,7 @@ NetworkingContext* FrameLoader::networkingContext() const
 
 void FrameLoader::loadProgressingStatusChanged()
 {
 
 void FrameLoader::loadProgressingStatusChanged()
 {
-    FrameView* view = m_frame.page()->mainFrame()->view();
+    FrameView* view = m_frame.page()->mainFrame().view();
     view->updateLayerFlushThrottlingInAllFrames();
     view->adjustTiledBackingCoverage();
 }
     view->updateLayerFlushThrottlingInAllFrames();
     view->adjustTiledBackingCoverage();
 }
@@ -3426,12 +3425,10 @@ PassRefPtr<Frame> createWindow(Frame* openerFrame, Frame* lookupFrame, const Fra
     if (!page)
         return 0;
 
     if (!page)
         return 0;
 
-    Frame* frame = page->mainFrame();
-
-    frame->loader().forceSandboxFlags(openerFrame->document()->sandboxFlags());
+    page->mainFrame().loader().forceSandboxFlags(openerFrame->document()->sandboxFlags());
 
     if (request.frameName() != "_blank")
 
     if (request.frameName() != "_blank")
-        frame->tree().setName(request.frameName());
+        page->mainFrame().tree().setName(request.frameName());
 
     page->chrome().setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);
     page->chrome().setStatusbarVisible(features.statusBarVisible);
 
     page->chrome().setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);
     page->chrome().setStatusbarVisible(features.statusBarVisible);
@@ -3463,7 +3460,7 @@ PassRefPtr<Frame> createWindow(Frame* openerFrame, Frame* lookupFrame, const Fra
     page->chrome().show();
 
     created = true;
     page->chrome().show();
 
     created = true;
-    return frame;
+    return &page->mainFrame();
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
index f7513dbd294a55797e5755ca5199241a4ca0f582..24054595b512f43a5a38c6907914526dc9ccdc63 100644 (file)
@@ -81,7 +81,7 @@ void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item)
         item->setScrollPoint(m_frame.view()->scrollPosition());
 
     Page* page = m_frame.page();
         item->setScrollPoint(m_frame.view()->scrollPosition());
 
     Page* page = m_frame.page();
-    if (page && page->mainFrame() == &m_frame)
+    if (page && &page->mainFrame() == &m_frame)
         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.
         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();
     // https://bugs.webkit.org/show_bug.cgi?id=98698
     if (FrameView* view = m_frame.view()) {
         Page* page = m_frame.page();
-        if (page && page->mainFrame() == &m_frame) {
+        if (page && &page->mainFrame() == &m_frame) {
             if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
                 scrollingCoordinator->frameViewRootLayerDidChange(view);
         }
 
         if (!view->wasScrolledByUser()) {
             if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
                 scrollingCoordinator->frameViewRootLayerDidChange(view);
         }
 
         if (!view->wasScrolledByUser()) {
-            if (page && page->mainFrame() == &m_frame && m_currentItem->pageScaleFactor())
+            if (page && &page->mainFrame() == &m_frame && m_currentItem->pageScaleFactor())
                 page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
             else
                 view->setScrollPosition(m_currentItem->scrollPoint());
                 page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
             else
                 view->setScrollPosition(m_currentItem->scrollPoint());
@@ -466,7 +466,7 @@ void HistoryController::updateForCommit()
         // committed) and its children (which will be replaced).
         Page* page = m_frame.page();
         ASSERT(page);
         // committed) and its children (which will be replaced).
         Page* page = m_frame.page();
         ASSERT(page);
-        page->mainFrame()->loader().history().recursiveUpdateForCommit();
+        page->mainFrame().loader().history().recursiveUpdateForCommit();
     }
 }
 
     }
 }
 
@@ -531,7 +531,7 @@ void HistoryController::updateForSameDocumentNavigation()
         return;
 
     addVisitedLink(page, m_frame.document()->url());
         return;
 
     addVisitedLink(page, m_frame.document()->url());
-    page->mainFrame()->loader().history().recursiveUpdateForSameDocumentNavigation();
+    page->mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
 
     if (m_currentItem) {
         m_currentItem->setURL(m_frame.document()->url());
 
     if (m_currentItem) {
         m_currentItem->setURL(m_frame.document()->url());
@@ -796,9 +796,7 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip)
     if (m_frame.loader().documentLoader()->urlForHistory().isEmpty())
         return;
 
     if (m_frame.loader().documentLoader()->urlForHistory().isEmpty())
         return;
 
-    Frame* mainFrame = page->mainFrame();
-    ASSERT(mainFrame);
-    FrameLoader& frameLoader = mainFrame->loader();
+    FrameLoader& frameLoader = page->mainFrame().loader();
 
     frameLoader.checkDidPerformFirstNavigation();
 
 
     frameLoader.checkDidPerformFirstNavigation();
 
@@ -841,7 +839,7 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject,
     ASSERT(page);
 
     // Get a HistoryItem tree for the current frame tree.
     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 = page->mainFrame().loader().history().createItemTree(m_frame, false);
     
     // Override data in the current item (created by createItemTree) to reflect
     // the pushState() arguments.
     
     // Override data in the current item (created by createItemTree) to reflect
     // the pushState() arguments.
index 5567746c35b001885cf5abecd1895d2a123e1e02..f8315c9a0743f7390b5aeb79894a47cb11616168 100644 (file)
@@ -159,13 +159,13 @@ PassRefPtr<SharedBuffer> MHTMLArchive::generateMHTMLData(Page* page, bool useBin
     stringBuilder.append("From: <Saved by WebKit>\r\n");
     stringBuilder.append("Subject: ");
     // We replace non ASCII characters with '?' characters to match IE's behavior.
     stringBuilder.append("From: <Saved by WebKit>\r\n");
     stringBuilder.append("Subject: ");
     // We replace non ASCII characters with '?' characters to match IE's behavior.
-    stringBuilder.append(replaceNonPrintableCharacters(page->mainFrame()->document()->title()));
+    stringBuilder.append(replaceNonPrintableCharacters(page->mainFrame().document()->title()));
     stringBuilder.append("\r\nDate: ");
     stringBuilder.append(dateString);
     stringBuilder.append("\r\nMIME-Version: 1.0\r\n");
     stringBuilder.append("Content-Type: multipart/related;\r\n");
     stringBuilder.append("\ttype=\"");
     stringBuilder.append("\r\nDate: ");
     stringBuilder.append(dateString);
     stringBuilder.append("\r\nMIME-Version: 1.0\r\n");
     stringBuilder.append("Content-Type: multipart/related;\r\n");
     stringBuilder.append("\ttype=\"");
-    stringBuilder.append(page->mainFrame()->document()->suggestedMIMEType());
+    stringBuilder.append(page->mainFrame().document()->suggestedMIMEType());
     stringBuilder.append("\";\r\n");
     stringBuilder.append("\tboundary=\"");
     stringBuilder.append(boundary);
     stringBuilder.append("\";\r\n");
     stringBuilder.append("\tboundary=\"");
     stringBuilder.append(boundary);
index 14899ead1fd540e520f502b0cfc40f8013ebe74e..94f82455f04a877ff048b824c92a8dc3a481a1c1 100644 (file)
@@ -212,7 +212,7 @@ bool Chrome::canRunModal() const
 
 static bool canRunModalIfDuringPageDismissal(Page* page, ChromeClient::DialogType dialog, const String& message)
 {
 
 static bool canRunModalIfDuringPageDismissal(Page* page, ChromeClient::DialogType dialog, const String& message)
 {
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameLoader::PageDismissalType dismissal = frame->loader().pageDismissalEventBeingDispatched();
         if (dismissal != FrameLoader::NoDismissal)
             return page->chrome().client().shouldRunModalDialogDuringPageDismissal(dialog, message, dismissal);
         FrameLoader::PageDismissalType dismissal = frame->loader().pageDismissalEventBeingDispatched();
         if (dismissal != FrameLoader::NoDismissal)
             return page->chrome().client().shouldRunModalDialogDuringPageDismissal(dialog, message, dismissal);
@@ -542,7 +542,7 @@ void Chrome::windowScreenDidChange(PlatformDisplayID displayID)
 
     m_displayID = displayID;
 
 
     m_displayID = displayID;
 
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->windowScreenDidChange(displayID);
     }
         if (frame->document())
             frame->document()->windowScreenDidChange(displayID);
     }
index 602665ee17c33c016effa690c473cfc8abc8e5cb..27ad8e06cf0b0c8b2096e63a95d2859ba0bca72c 100644 (file)
@@ -189,7 +189,7 @@ static void openNewWindow(const KURL& urlToLoad, Frame* frame)
                 return;
             newPage->chrome().show();
         }
                 return;
             newPage->chrome().show();
         }
-        newPage->mainFrame()->loader().loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer);
+        newPage->mainFrame().loader().loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer);
     }
 }
 
     }
 }
 
@@ -928,7 +928,7 @@ void ContextMenuController::populate()
                 }
 #endif
 
                 }
 #endif
 
-                if (frame->page() && frame != frame->page()->mainFrame())
+                if (frame->page() && frame != &frame->page()->mainFrame())
                     appendItem(OpenFrameItem, m_contextMenu.get());
             }
         }
                     appendItem(OpenFrameItem, m_contextMenu.get());
             }
         }
index 113a06fd405c5a4db975cf22adc12505ee723f2d..055e1f9150cad2b62a1998d3a126e50ff7f71a5b 100644 (file)
@@ -231,7 +231,7 @@ static bool allowsBeforeUnloadListeners(DOMWindow* window)
     Page* page = frame->page();
     if (!page)
         return false;
     Page* page = frame->page();
     if (!page)
         return false;
-    return frame == page->mainFrame();
+    return frame == &page->mainFrame();
 }
 
 bool DOMWindow::dispatchAllPendingBeforeUnloadEvents()
 }
 
 bool DOMWindow::dispatchAllPendingBeforeUnloadEvents()
@@ -316,7 +316,7 @@ FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChange
 {
     ASSERT(page);
 
 {
     ASSERT(page);
 
-    FloatRect screen = screenAvailableRect(page->mainFrame()->view());
+    FloatRect screen = screenAvailableRect(page->mainFrame().view());
     FloatRect window = page->chrome().windowRect();
 
     // Make sure we're in a valid state before adjusting dimensions.
     FloatRect window = page->chrome().windowRect();
 
     // Make sure we're in a valid state before adjusting dimensions.
@@ -931,7 +931,7 @@ void DOMWindow::focus(ScriptExecutionContext* context)
     }
 
     // If we're a top level window, bring the window to the front.
     }
 
     // If we're a top level window, bring the window to the front.
-    if (m_frame == page->mainFrame() && allowFocus)
+    if (m_frame == &page->mainFrame() && allowFocus)
         page->chrome().focus();
 
     if (!m_frame)
         page->chrome().focus();
 
     if (!m_frame)
@@ -957,7 +957,7 @@ void DOMWindow::blur()
     if (m_frame->settings().windowFocusRestricted())
         return;
 
     if (m_frame->settings().windowFocusRestricted())
         return;
 
-    if (m_frame != page->mainFrame())
+    if (m_frame != &page->mainFrame())
         return;
 
     page->chrome().unfocus();
         return;
 
     page->chrome().unfocus();
@@ -972,7 +972,7 @@ void DOMWindow::close(ScriptExecutionContext* context)
     if (!page)
         return;
 
     if (!page)
         return;
 
-    if (m_frame != page->mainFrame())
+    if (m_frame != &page->mainFrame())
         return;
 
     if (context) {
         return;
 
     if (context) {
@@ -1478,7 +1478,7 @@ bool DOMWindow::allowedToChangeWindowGeometry() const
     const Page* page = m_frame->page();
     if (!page)
         return false;
     const Page* page = m_frame->page();
     if (!page)
         return false;
-    if (m_frame != page->mainFrame())
+    if (m_frame != &page->mainFrame())
         return false;
     // Prevent web content from tricking the user into initiating a drag.
     if (m_frame->eventHandler().mousePressed())
         return false;
     // Prevent web content from tricking the user into initiating a drag.
     if (m_frame->eventHandler().mousePressed())
@@ -1506,7 +1506,7 @@ void DOMWindow::moveTo(float x, float y) const
 
     Page* page = m_frame->page();
     FloatRect fr = page->chrome().windowRect();
 
     Page* page = m_frame->page();
     FloatRect fr = page->chrome().windowRect();
-    FloatRect sr = screenAvailableRect(page->mainFrame()->view());
+    FloatRect sr = screenAvailableRect(page->mainFrame().view());
     fr.setLocation(sr.location());
     FloatRect update = fr;
     update.move(x, y);
     fr.setLocation(sr.location());
     FloatRect update = fr;
     update.move(x, y);
index c8d5fc97eac57a231d32ed77d5b5fedf14dc452a..bf0742aeb56d64408fd159f67d5e19b3798a8935 100644 (file)
@@ -192,13 +192,12 @@ DragSession DragController::dragEntered(DragData* dragData)
 void DragController::dragExited(DragData* dragData)
 {
     ASSERT(dragData);
 void DragController::dragExited(DragData* dragData)
 {
     ASSERT(dragData);
-    Frame* mainFrame = m_page->mainFrame();
 
 
-    if (RefPtr<FrameView> v = mainFrame->view()) {
+    if (RefPtr<FrameView> v = m_page->mainFrame().view()) {
         ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable;
         RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, *dragData);
         clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
         ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable;
         RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, *dragData);
         clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
-        mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
+        m_page->mainFrame().eventHandler().cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
         clipboard->setAccessPolicy(ClipboardNumb);    // invalidate clipboard here for security
     }
     mouseMovedIntoDocument(0);
         clipboard->setAccessPolicy(ClipboardNumb);    // invalidate clipboard here for security
     }
     mouseMovedIntoDocument(0);
@@ -215,10 +214,10 @@ DragSession DragController::dragUpdated(DragData* dragData)
 bool DragController::performDrag(DragData* dragData)
 {
     ASSERT(dragData);
 bool DragController::performDrag(DragData* dragData)
 {
     ASSERT(dragData);
-    m_documentUnderMouse = m_page->mainFrame()->documentAtPoint(dragData->clientPosition());
+    m_documentUnderMouse = m_page->mainFrame().documentAtPoint(dragData->clientPosition());
     if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHandlingDrag) {
         m_client->willPerformDragDestinationAction(DragDestinationActionDHTML, dragData);
     if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHandlingDrag) {
         m_client->willPerformDragDestinationAction(DragDestinationActionDHTML, dragData);
-        RefPtr<Frame> mainFrame = m_page->mainFrame();
+        RefPtr<Frame> mainFrame = &m_page->mainFrame();
         bool preventedDefault = false;
         if (mainFrame->view()) {
             // Sending an event can result in the destruction of the view and part.
         bool preventedDefault = false;
         if (mainFrame->view()) {
             // Sending an event can result in the destruction of the view and part.
@@ -244,7 +243,7 @@ bool DragController::performDrag(DragData* dragData)
         return false;
 
     m_client->willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
         return false;
 
     m_client->willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
-    m_page->mainFrame()->loader().load(FrameLoadRequest(m_page->mainFrame(), ResourceRequest(dragData->asURL(m_page->mainFrame()))));
+    m_page->mainFrame().loader().load(FrameLoadRequest(&m_page->mainFrame(), ResourceRequest(dragData->asURL(&m_page->mainFrame()))));
     return true;
 }
 
     return true;
 }
 
@@ -262,8 +261,7 @@ void DragController::mouseMovedIntoDocument(Document* newDocument)
 DragSession DragController::dragEnteredOrUpdated(DragData* dragData)
 {
     ASSERT(dragData);
 DragSession DragController::dragEnteredOrUpdated(DragData* dragData)
 {
     ASSERT(dragData);
-    ASSERT(m_page->mainFrame());
-    mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(dragData->clientPosition()));
+    mouseMovedIntoDocument(m_page->mainFrame().documentAtPoint(dragData->clientPosition()));
 
     m_dragDestinationAction = m_client->actionMaskForDrag(dragData);
     if (m_dragDestinationAction == DragDestinationActionNone) {
 
     m_dragDestinationAction = m_client->actionMaskForDrag(dragData);
     if (m_dragDestinationAction == DragDestinationActionNone) {
@@ -410,7 +408,7 @@ DragSourceAction DragController::delegateDragSourceAction(const IntPoint& rootVi
 DragOperation DragController::operationForLoad(DragData* dragData)
 {
     ASSERT(dragData);
 DragOperation DragController::operationForLoad(DragData* dragData)
 {
     ASSERT(dragData);
-    Document* doc = m_page->mainFrame()->documentAtPoint(dragData->clientPosition());
+    Document* doc = m_page->mainFrame().documentAtPoint(dragData->clientPosition());
 
     bool pluginDocumentAcceptsDrags = false;
 
 
     bool pluginDocumentAcceptsDrags = false;
 
@@ -559,12 +557,12 @@ bool DragController::canProcessDrag(DragData* dragData)
     if (!dragData->containsCompatibleContent())
         return false;
 
     if (!dragData->containsCompatibleContent())
         return false;
 
-    IntPoint point = m_page->mainFrame()->view()->windowToContents(dragData->clientPosition());
+    IntPoint point = m_page->mainFrame().view()->windowToContents(dragData->clientPosition());
     HitTestResult result = HitTestResult(point);
     HitTestResult result = HitTestResult(point);
-    if (!m_page->mainFrame()->contentRenderer())
+    if (!m_page->mainFrame().contentRenderer())
         return false;
 
         return false;
 
-    result = m_page->mainFrame()->eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
+    result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active);
 
     if (!result.innerNonSharedNode())
         return false;
 
     if (!result.innerNonSharedNode())
         return false;
@@ -608,7 +606,7 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
 {
     ASSERT(dragData);
     ASSERT(m_documentUnderMouse);
 {
     ASSERT(dragData);
     ASSERT(m_documentUnderMouse);
-    RefPtr<Frame> mainFrame = m_page->mainFrame();
+    RefPtr<Frame> mainFrame = &m_page->mainFrame();
     RefPtr<FrameView> viewProtector = mainFrame->view();
     if (!viewProtector)
         return false;
     RefPtr<FrameView> viewProtector = mainFrame->view();
     if (!viewProtector)
         return false;
@@ -823,7 +821,7 @@ bool DragController::startDrag(Frame* src, const DragState& state, DragOperation
 
         if (!dragImage) {
             IntRect imageRect = hitTestResult.imageRect();
 
         if (!dragImage) {
             IntRect imageRect = hitTestResult.imageRect();
-            imageRect.setLocation(m_page->mainFrame()->view()->rootViewToContents(src->view()->contentsToRootView(imageRect.location())));
+            imageRect.setLocation(m_page->mainFrame().view()->rootViewToContents(src->view()->contentsToRootView(imageRect.location())));
             doImageDrag(element, dragOrigin, hitTestResult.imageRect(), clipboard, src, m_dragOffset);
         } else
             // DHTML defined drag image
             doImageDrag(element, dragOrigin, hitTestResult.imageRect(), clipboard, src, m_dragOffset);
         } else
             // DHTML defined drag image
@@ -918,7 +916,7 @@ void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, c
     m_didInitiateDrag = true;
     m_dragInitiator = frame->document();
     // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame
     m_didInitiateDrag = true;
     m_dragInitiator = frame->document();
     // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame
-    RefPtr<Frame> frameProtector = m_page->mainFrame();
+    RefPtr<Frame> frameProtector = &m_page->mainFrame();
     RefPtr<FrameView> viewProtector = frameProtector->view();
     m_client->startDrag(image, viewProtector->rootViewToContents(frame->view()->contentsToRootView(dragLoc)),
         viewProtector->rootViewToContents(frame->view()->contentsToRootView(eventPos)), clipboard, frameProtector.get(), forLink);
     RefPtr<FrameView> viewProtector = frameProtector->view();
     m_client->startDrag(image, viewProtector->rootViewToContents(frame->view()->contentsToRootView(dragLoc)),
         viewProtector->rootViewToContents(frame->view()->contentsToRootView(eventPos)), clipboard, frameProtector.get(), forLink);
@@ -932,7 +930,7 @@ void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, c
 // Manual drag caret manipulation
 void DragController::placeDragCaret(const IntPoint& windowPoint)
 {
 // Manual drag caret manipulation
 void DragController::placeDragCaret(const IntPoint& windowPoint)
 {
-    mouseMovedIntoDocument(m_page->mainFrame()->documentAtPoint(windowPoint));
+    mouseMovedIntoDocument(m_page->mainFrame().documentAtPoint(windowPoint));
     if (!m_documentUnderMouse)
         return;
     Frame* frame = m_documentUnderMouse->frame();
     if (!m_documentUnderMouse)
         return;
     Frame* frame = m_documentUnderMouse->frame();
index 9b2cf6c77031324dea51d6ef554daf5ce70b87aa..358f7abdaf85a57febc1af0000ac00c842fe8536 100644 (file)
@@ -1036,13 +1036,13 @@ HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe
     // We always send hitTestResultAtPoint to the main frame if we have one,
     // otherwise we might hit areas that are obscured by higher frames.
     if (Page* page = m_frame->page()) {
     // We always send hitTestResultAtPoint to the main frame if we have one,
     // otherwise we might hit areas that are obscured by higher frames.
     if (Page* page = m_frame->page()) {
-        Frame* mainFrame = page->mainFrame();
-        if (m_frame != mainFrame) {
+        Frame& mainFrame = page->mainFrame();
+        if (m_frame != &mainFrame) {
             FrameView* frameView = m_frame->view();
             FrameView* frameView = m_frame->view();
-            FrameView* mainView = mainFrame->view();
+            FrameView* mainView = mainFrame.view();
             if (frameView && mainView) {
                 IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
             if (frameView && mainView) {
                 IntPoint mainFramePoint = mainView->rootViewToContents(frameView->contentsToRootView(roundedIntPoint(point)));
-                return mainFrame->eventHandler().hitTestResultAtPoint(mainFramePoint, hitType, padding);
+                return mainFrame.eventHandler().hitTestResultAtPoint(mainFramePoint, hitType, padding);
             }
         }
     }
             }
         }
     }
@@ -1292,7 +1292,7 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
     if (!page)
         return NoCursorChange;
 #if ENABLE(PAN_SCROLLING)
     if (!page)
         return NoCursorChange;
 #if ENABLE(PAN_SCROLLING)
-    if (page->mainFrame()->eventHandler().panScrollInProgress())
+    if (page->mainFrame().eventHandler().panScrollInProgress())
         return NoCursorChange;
 #endif
 
         return NoCursorChange;
 #endif
 
@@ -1567,7 +1567,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
 #if ENABLE(PAN_SCROLLING)
     // We store whether pan scrolling is in progress before calling stopAutoscrollTimer()
     // because it will set m_autoscrollType to NoAutoscroll on return.
 #if ENABLE(PAN_SCROLLING)
     // We store whether pan scrolling is in progress before calling stopAutoscrollTimer()
     // because it will set m_autoscrollType to NoAutoscroll on return.
-    bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame()->eventHandler().panScrollInProgress();
+    bool isPanScrollInProgress = m_frame->page() && m_frame->page()->mainFrame().eventHandler().panScrollInProgress();
     stopAutoscrollTimer();
     if (isPanScrollInProgress) {
         // We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate
     stopAutoscrollTimer();
     if (isPanScrollInProgress) {
         // We invalidate the click when exiting pan scrolling so that we don't inadvertently navigate
@@ -3284,7 +3284,7 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent)
 
 #if ENABLE(PAN_SCROLLING)
     if (Page* page = m_frame->page()) {
 
 #if ENABLE(PAN_SCROLLING)
     if (Page* page = m_frame->page()) {
-        if (page->mainFrame()->eventHandler().panScrollInProgress()) {
+        if (page->mainFrame().eventHandler().panScrollInProgress()) {
             // If a key is pressed while the panScroll is in progress then we want to stop
             if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown) 
                 stopAutoscrollTimer();
             // If a key is pressed while the panScroll is in progress then we want to stop
             if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown) 
                 stopAutoscrollTimer();
index 1886dbd19dc88a04e84507b365ddd212b8231d4e..01b33bcb3cb60ac29d2bb6c58e471790e6c0479d 100644 (file)
@@ -208,7 +208,7 @@ Frame* FocusController::focusedOrMainFrame() const
 {
     if (Frame* frame = focusedFrame())
         return frame;
 {
     if (Frame* frame = focusedFrame())
         return frame;
-    return m_page->mainFrame();
+    return &m_page->mainFrame();
 }
 
 void FocusController::setFocused(bool focused)
 }
 
 void FocusController::setFocused(bool focused)
@@ -222,7 +222,7 @@ void FocusController::setFocused(bool focused)
         focusedOrMainFrame()->eventHandler().stopAutoscrollTimer();
 
     if (!m_focusedFrame)
         focusedOrMainFrame()->eventHandler().stopAutoscrollTimer();
 
     if (!m_focusedFrame)
-        setFocusedFrame(m_page->mainFrame());
+        setFocusedFrame(&m_page->mainFrame());
 
     if (m_focusedFrame->view()) {
         m_focusedFrame->selection().setFocused(focused);
 
     if (m_focusedFrame->view()) {
         m_focusedFrame->selection().setFocused(focused);
@@ -306,7 +306,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb
         }
 
         // Chrome doesn't want focus, so we should wrap focus.
         }
 
         // Chrome doesn't want focus, so we should wrap focus.
-        element = findFocusableElementRecursively(direction, FocusNavigationScope::focusNavigationScopeOf(m_page->mainFrame()->document()), 0, event);
+        element = findFocusableElementRecursively(direction, FocusNavigationScope::focusNavigationScopeOf(m_page->mainFrame().document()), 0, event);
         element = findFocusableElementDescendingDownIntoFrameDocument(direction, element.get(), event);
 
         if (!element)
         element = findFocusableElementDescendingDownIntoFrameDocument(direction, element.get(), event);
 
         if (!element)
@@ -653,7 +653,7 @@ void FocusController::setActive(bool active)
 
     m_isActive = active;
 
 
     m_isActive = active;
 
-    if (FrameView* view = m_page->mainFrame()->view()) {
+    if (FrameView* view = m_page->mainFrame().view()) {
         if (!view->platformWidget()) {
             view->updateLayoutAndStyleIfNeededRecursive();
             view->updateControlTints();
         if (!view->platformWidget()) {
             view->updateLayoutAndStyleIfNeededRecursive();
             view->updateControlTints();
@@ -681,13 +681,13 @@ void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisibl
 
     m_containingWindowIsVisible = containingWindowIsVisible;
 
 
     m_containingWindowIsVisible = containingWindowIsVisible;
 
-    FrameView* view = m_page->mainFrame()->view();
+    FrameView* view = m_page->mainFrame().view();
     if (!view)
         return;
 
     contentAreaDidShowOrHide(view, containingWindowIsVisible);
 
     if (!view)
         return;
 
     contentAreaDidShowOrHide(view, containingWindowIsVisible);
 
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameView* frameView = frame->view();
         if (!frameView)
             continue;
         FrameView* frameView = frame->view();
         if (!frameView)
             continue;
@@ -735,7 +735,7 @@ static void updateFocusCandidateIfNeeded(FocusDirection direction, const FocusCa
         // If 2 nodes are intersecting, do hit test to find which node in on top.
         LayoutUnit x = intersectionRect.x() + intersectionRect.width() / 2;
         LayoutUnit y = intersectionRect.y() + intersectionRect.height() / 2;
         // If 2 nodes are intersecting, do hit test to find which node in on top.
         LayoutUnit x = intersectionRect.x() + intersectionRect.width() / 2;
         LayoutUnit y = intersectionRect.y() + intersectionRect.height() / 2;
-        HitTestResult result = candidate.visibleNode->document()->page()->mainFrame()->eventHandler().hitTestResultAtPoint(IntPoint(x, y), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
+        HitTestResult result = candidate.visibleNode->document()->page()->mainFrame().eventHandler().hitTestResultAtPoint(IntPoint(x, y), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
         if (candidate.visibleNode->contains(result.innerNode())) {
             closest = candidate;
             return;
         if (candidate.visibleNode->contains(result.innerNode())) {
             closest = candidate;
             return;
index dea3dea05227735639f73b59e47c5d282ee838de..3bfdc425eff549d44f3a793005f1439baf57e659 100644 (file)
@@ -706,7 +706,7 @@ void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor
     ASSERT(this);
     ASSERT(m_page);
 
     ASSERT(this);
     ASSERT(m_page);
 
-    bool isMainFrame = this == m_page->mainFrame();
+    bool isMainFrame = this == &m_page->mainFrame();
 
     if (isMainFrame && view())
         view()->setParentVisible(false);
 
     if (isMainFrame && view())
         view()->setParentVisible(false);
@@ -879,7 +879,7 @@ void Frame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor
             view->layout();
     }
 
             view->layout();
     }
 
-    if (page->mainFrame() == this)
+    if (&page->mainFrame() == this)
         pageCache()->markPagesForFullStyleRecalc(page);
 }
 
         pageCache()->markPagesForFullStyleRecalc(page);
 }
 
@@ -888,7 +888,7 @@ float Frame::frameScaleFactor() const
     Page* page = this->page();
 
     // Main frame is scaled with respect to he container but inner frames are not scaled with respect to the main frame.
     Page* page = this->page();
 
     // Main frame is scaled with respect to he container but inner frames are not scaled with respect to the main frame.
-    if (!page || page->mainFrame() != this || settings().applyPageScaleFactorInCompositor())
+    if (!page || &page->mainFrame() != this || settings().applyPageScaleFactorInCompositor())
         return 1;
 
     return page->pageScaleFactor();
         return 1;
 
     return page->pageScaleFactor();
index 5a83d02efdeadd3b3189d23f1773ab481a19420a..82dfe1fc1acbb559df0caee036645c4c19e64317 100644 (file)
@@ -293,7 +293,7 @@ Frame* FrameTree::find(const AtomicString& name) const
     if (!page)
         return 0;
 
     if (!page)
         return 0;
 
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
         if (frame->tree().uniqueName() == name)
             return frame;
 
         if (frame->tree().uniqueName() == name)
             return frame;
 
@@ -304,7 +304,7 @@ Frame* FrameTree::find(const AtomicString& name) const
     for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
         Page* otherPage = *it;
         if (otherPage != page) {
     for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
         Page* otherPage = *it;
         if (otherPage != page) {
-            for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+            for (Frame* frame = &otherPage->mainFrame(); frame; frame = frame->tree().traverseNext()) {
                 if (frame->tree().uniqueName() == name)
                     return frame;
             }
                 if (frame->tree().uniqueName() == name)
                     return frame;
             }
@@ -367,7 +367,7 @@ Frame* FrameTree::traverseNextWithWrap(bool wrap) const
         return result;
 
     if (wrap)
         return result;
 
     if (wrap)
-        return m_thisFrame->page()->mainFrame();
+        return &m_thisFrame->page()->mainFrame();
 
     return 0;
 }
 
     return 0;
 }
index e2db5ffceb8f818a890db4c25df6a03f5a4b4380..79334179e5f8a2c512db7597552a4d5d5ffe546e 100644 (file)
@@ -412,7 +412,7 @@ void FrameView::clear()
 
 bool FrameView::isMainFrameView() const
 {
 
 bool FrameView::isMainFrameView() const
 {
-    return frame().page() && frame().page()->mainFrame() == &frame();
+    return frame().page() && &frame().page()->mainFrame() == &frame();
 }
 
 bool FrameView::didFirstLayout() const
 }
 
 bool FrameView::didFirstLayout() const
@@ -449,7 +449,7 @@ void FrameView::setFrameRect(const IntRect& newRect)
     if (newRect.width() != oldRect.width()) {
         Page* page = frame().page();
         if (isMainFrameView() && page->settings().textAutosizingEnabled()) {
     if (newRect.width() != oldRect.width()) {
         Page* page = frame().page();
         if (isMainFrameView() && page->settings().textAutosizingEnabled()) {
-            for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+            for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
                 frame().document()->textAutosizer()->recalculateMultipliers();
         }
     }
                 frame().document()->textAutosizer()->recalculateMultipliers();
         }
     }
@@ -2010,7 +2010,7 @@ bool FrameView::shouldUpdateFixedElementsAfterScrolling()
         return true;
 
     // If the scrolling thread is updating the fixed elements, then the FrameView should not update them as well.
         return true;
 
     // If the scrolling thread is updating the fixed elements, then the FrameView should not update them as well.
-    if (page->mainFrame() != &frame())
+    if (&page->mainFrame() != &frame())
         return true;
 
     ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator();
         return true;
 
     ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator();
@@ -2188,8 +2188,8 @@ void FrameView::visibleContentsResized()
 void FrameView::beginDeferredRepaints()
 {
     Page* page = frame().page();
 void FrameView::beginDeferredRepaints()
 {
     Page* page = frame().page();
-    if (page->mainFrame() != &frame()) {
-        page->mainFrame()->view()->beginDeferredRepaints();
+    if (&page->mainFrame() != &frame()) {
+        page->mainFrame().view()->beginDeferredRepaints();
         return;
     }
 
         return;
     }
 
@@ -2199,8 +2199,8 @@ void FrameView::beginDeferredRepaints()
 void FrameView::endDeferredRepaints()
 {
     Page* page = frame().page();
 void FrameView::endDeferredRepaints()
 {
     Page* page = frame().page();
-    if (page->mainFrame() != &frame()) {
-        page->mainFrame()->view()->endDeferredRepaints();
+    if (&page->mainFrame() != &frame()) {
+        page->mainFrame().view()->endDeferredRepaints();
         return;
     }
 
         return;
     }
 
@@ -2742,7 +2742,7 @@ void FrameView::performPostLayoutTasks()
         }
     }
 
         }
     }
 
-    if (milestonesAchieved && page && page->mainFrame() == &frame())
+    if (milestonesAchieved && page && &page->mainFrame() == &frame())
         frame().loader().didLayout(milestonesAchieved);
 #if ENABLE(FONT_LOAD_EVENTS)
     if (RuntimeEnabledFeatures::fontLoadEventsEnabled())
         frame().loader().didLayout(milestonesAchieved);
 #if ENABLE(FONT_LOAD_EVENTS)
     if (RuntimeEnabledFeatures::fontLoadEventsEnabled())
@@ -4210,10 +4210,8 @@ void FrameView::firePaintRelatedMilestones()
 
     m_milestonesPendingPaint = 0;
 
 
     m_milestonesPendingPaint = 0;
 
-    if (milestonesAchieved) {
-        if (Frame* frame = page->mainFrame())
-            frame->loader().didLayout(milestonesAchieved);
-    }
+    if (milestonesAchieved)
+        page->mainFrame().loader().didLayout(milestonesAchieved);
 }
 
 void FrameView::setVisualUpdatesAllowedByClient(bool visualUpdatesAllowed)
 }
 
 void FrameView::setVisualUpdatesAllowedByClient(bool visualUpdatesAllowed)
index 00eae65f092218526a0f0aa7dd2b7dae88f41f67..c327c1bf3e72912dfb4616c9c82835e2c50d6768 100644 (file)
@@ -52,9 +52,9 @@ inline LayoutPoint ownerFrameToMainFrameOffset(const RenderObject* o)
     ASSERT(o->node());
     Frame& containingFrame = o->frame();
 
     ASSERT(o->node());
     Frame& containingFrame = o->frame();
 
-    Frame* mainFrame = containingFrame.page()->mainFrame();
+    Frame& mainFrame = containingFrame.page()->mainFrame();
 
 
-    LayoutPoint mainFramePoint = mainFrame->view()->windowToContents(containingFrame.view()->contentsToWindow(IntPoint()));
+    LayoutPoint mainFramePoint = mainFrame.view()->windowToContents(containingFrame.view()->contentsToWindow(IntPoint()));
     return mainFramePoint;
 }
 
     return mainFramePoint;
 }
 
index dba6ec9c254b3554f674585ed4d5f0601cd612b7..a5979bcef434b1c4c794647addb618c1e42d922c 100644 (file)
@@ -103,7 +103,7 @@ static void networkStateChanged(bool isOnLine)
     // Get all the frames of all the pages in all the page groups
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) {
     // Get all the frames of all the pages in all the page groups
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) {
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext())
+        for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext())
             frames.append(frame);
         InspectorInstrumentation::networkStateChanged(*it);
     }
             frames.append(frame);
         InspectorInstrumentation::networkStateChanged(*it);
     }
@@ -213,7 +213,7 @@ Page::~Page()
     setGroupName(String());
     allPages->remove(this);
     
     setGroupName(String());
     allPages->remove(this);
     
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         frame->willDetachPage();
         frame->detachFromPage();
     }
         frame->willDetachPage();
         frame->detachFromPage();
     }
@@ -243,7 +243,7 @@ Page::~Page()
 ArenaSize Page::renderTreeSize() const
 {
     ArenaSize total(0, 0);
 ArenaSize Page::renderTreeSize() const
 {
     ArenaSize total(0, 0);
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->document())
             continue;
         if (RenderArena* arena = frame->document()->renderArena()) {
         if (!frame->document())
             continue;
         if (RenderArena* arena = frame->document()->renderArena()) {
@@ -256,7 +256,7 @@ ArenaSize Page::renderTreeSize() const
 
 ViewportArguments Page::viewportArguments() const
 {
 
 ViewportArguments Page::viewportArguments() const
 {
-    return mainFrame() && mainFrame()->document() ? mainFrame()->document()->viewportArguments() : ViewportArguments();
+    return mainFrame().document() ? mainFrame().document()->viewportArguments() : ViewportArguments();
 }
 
 ScrollingCoordinator* Page::scrollingCoordinator()
 }
 
 ScrollingCoordinator* Page::scrollingCoordinator()
@@ -468,7 +468,7 @@ void Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment()
         return;
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
         return;
     HashSet<Page*>::iterator end = allPages->end();
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it)
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
             // If a change in the global environment has occurred, we need to
             // make sure all the properties a recomputed, therefore we invalidate
             // the properties cache.
             // If a change in the global environment has occurred, we need to
             // make sure all the properties a recomputed, therefore we invalidate
             // the properties cache.
@@ -480,7 +480,7 @@ void Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment()
 
 void Page::setNeedsRecalcStyleInAllFrames()
 {
 
 void Page::setNeedsRecalcStyleInAllFrames()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (Document* document = frame->document())
             document->styleResolverChanged(DeferRecalcStyle);
     }
         if (Document* document = frame->document())
             document->styleResolverChanged(DeferRecalcStyle);
     }
@@ -506,7 +506,7 @@ void Page::refreshPlugins(bool reload)
         if (!reload)
             continue;
         
         if (!reload)
             continue;
         
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
             if (frame->loader().subframeLoader()->containsPlugins())
                 framesNeedingReload.append(frame);
         }
             if (frame->loader().subframeLoader()->containsPlugins())
                 framesNeedingReload.append(frame);
         }
@@ -525,7 +525,7 @@ PluginData* Page::pluginData() const
 
 inline MediaCanStartListener* Page::takeAnyMediaCanStartListener()
 {
 
 inline MediaCanStartListener* Page::takeAnyMediaCanStartListener()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (MediaCanStartListener* listener = frame->document()->takeAnyMediaCanStartListener())
             return listener;
     }
         if (MediaCanStartListener* listener = frame->document()->takeAnyMediaCanStartListener())
             return listener;
     }
@@ -561,7 +561,7 @@ bool Page::findString(const String& target, TextCaseSensitivity caseSensitivity,
 
 bool Page::findString(const String& target, FindOptions options)
 {
 
 bool Page::findString(const String& target, FindOptions options)
 {
-    if (target.isEmpty() || !mainFrame())
+    if (target.isEmpty())
         return false;
 
     bool shouldWrap = options & WrapAround;
         return false;
 
     bool shouldWrap = options & WrapAround;
@@ -591,10 +591,8 @@ bool Page::findString(const String& target, FindOptions options)
 void Page::findStringMatchingRanges(const String& target, FindOptions options, int limit, Vector<RefPtr<Range> >* matchRanges, int& indexForSelection)
 {
     indexForSelection = 0;
 void Page::findStringMatchingRanges(const String& target, FindOptions options, int limit, Vector<RefPtr<Range> >* matchRanges, int& indexForSelection)
 {
     indexForSelection = 0;
-    if (!mainFrame())
-        return;
 
 
-    Frame* frame = mainFrame();
+    Frame* frame = &mainFrame();
     Frame* frameWithSelection = 0;
     do {
         frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matchRanges->size()) : 0, true, matchRanges);
     Frame* frameWithSelection = 0;
     do {
         frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matchRanges->size()) : 0, true, matchRanges);
@@ -634,14 +632,14 @@ void Page::findStringMatchingRanges(const String& target, FindOptions options, i
 
 PassRefPtr<Range> Page::rangeOfString(const String& target, Range* referenceRange, FindOptions options)
 {
 
 PassRefPtr<Range> Page::rangeOfString(const String& target, Range* referenceRange, FindOptions options)
 {
-    if (target.isEmpty() || !mainFrame())
+    if (target.isEmpty())
         return 0;
 
     if (referenceRange && referenceRange->ownerDocument()->page() != this)
         return 0;
 
     bool shouldWrap = options & WrapAround;
         return 0;
 
     if (referenceRange && referenceRange->ownerDocument()->page() != this)
         return 0;
 
     bool shouldWrap = options & WrapAround;
-    Frame* frame = referenceRange ? referenceRange->ownerDocument()->frame() : mainFrame();
+    Frame* frame = referenceRange ? referenceRange->ownerDocument()->frame() : &mainFrame();
     Frame* startFrame = frame;
     do {
         if (RefPtr<Range> resultRange = frame->editor().rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
     Frame* startFrame = frame;
     do {
         if (RefPtr<Range> resultRange = frame->editor().rangeOfString(target, frame == startFrame ? referenceRange : 0, options & ~WrapAround))
@@ -662,12 +660,12 @@ PassRefPtr<Range> Page::rangeOfString(const String& target, Range* referenceRang
 
 unsigned Page::findMatchesForText(const String& target, FindOptions options, unsigned maxMatchCount, ShouldHighlightMatches shouldHighlightMatches, ShouldMarkMatches shouldMarkMatches)
 {
 
 unsigned Page::findMatchesForText(const String& target, FindOptions options, unsigned maxMatchCount, ShouldHighlightMatches shouldHighlightMatches, ShouldMarkMatches shouldMarkMatches)
 {
-    if (target.isEmpty() || !mainFrame())
+    if (target.isEmpty())
         return 0;
 
     unsigned matchCount = 0;
 
         return 0;
 
     unsigned matchCount = 0;
 
-    Frame* frame = mainFrame();
+    Frame* frame = &mainFrame();
     do {
         if (shouldMarkMatches == MarkMatches)
             frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlightMatches == HighlightMatches);
     do {
         if (shouldMarkMatches == MarkMatches)
             frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlightMatches == HighlightMatches);
@@ -690,10 +688,7 @@ unsigned Page::countFindMatches(const String& target, FindOptions options, unsig
 
 void Page::unmarkAllTextMatches()
 {
 
 void Page::unmarkAllTextMatches()
 {
-    if (!mainFrame())
-        return;
-
-    Frame* frame = mainFrame();
+    Frame* frame = &mainFrame();
     do {
         frame->document()->markers().removeMarkers(DocumentMarker::TextMatch);
         frame = incrementFrame(frame, true, false);
     do {
         frame->document()->markers().removeMarkers(DocumentMarker::TextMatch);
         frame = incrementFrame(frame, true, false);
@@ -723,7 +718,7 @@ void Page::setDefersLoading(bool defers)
     }
 
     m_defersLoading = defers;
     }
 
     m_defersLoading = defers;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->loader().setDefersLoading(defers);
 }
 
         frame->loader().setDefersLoading(defers);
 }
 
@@ -751,14 +746,14 @@ void Page::setMediaVolume(float volume)
         return;
 
     m_mediaVolume = volume;
         return;
 
     m_mediaVolume = volume;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         frame->document()->mediaVolumeDidChange();
     }
 }
 
 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
 {
         frame->document()->mediaVolumeDidChange();
     }
 }
 
 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
 {
-    Document* document = mainFrame()->document();
+    Document* document = mainFrame().document();
     FrameView* view = document->view();
 
     if (scale == m_pageScaleFactor) {
     FrameView* view = document->view();
 
     if (scale == m_pageScaleFactor) {
@@ -779,11 +774,11 @@ void Page::setPageScaleFactor(float scale, const IntPoint& origin)
         document->recalcStyle(Style::Force);
 
         // Transform change on RenderView doesn't trigger repaint on non-composited contents.
         document->recalcStyle(Style::Force);
 
         // Transform change on RenderView doesn't trigger repaint on non-composited contents.
-        mainFrame()->view()->invalidateRect(IntRect(LayoutRect::infiniteRect()));
+        mainFrame().view()->invalidateRect(IntRect(LayoutRect::infiniteRect()));
     }
 
 #if USE(ACCELERATED_COMPOSITING)
     }
 
 #if USE(ACCELERATED_COMPOSITING)
-    mainFrame()->deviceOrPageScaleFactorChanged();
+    mainFrame().deviceOrPageScaleFactorChanged();
 #endif
 
     if (view && view->fixedElementsLayoutRelativeToFrame())
 #endif
 
     if (view && view->fixedElementsLayoutRelativeToFrame())
@@ -806,13 +801,11 @@ void Page::setDeviceScaleFactor(float scaleFactor)
     setNeedsRecalcStyleInAllFrames();
 
 #if USE(ACCELERATED_COMPOSITING)
     setNeedsRecalcStyleInAllFrames();
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (mainFrame())
-        mainFrame()->deviceOrPageScaleFactorChanged();
-
+    mainFrame().deviceOrPageScaleFactorChanged();
     pageCache()->markPagesForDeviceScaleChanged(this);
 #endif
 
     pageCache()->markPagesForDeviceScaleChanged(this);
 #endif
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->editor().deviceScaleFactorChanged();
 
     pageCache()->markPagesForFullStyleRecalc(this);
         frame->editor().deviceScaleFactorChanged();
 
     pageCache()->markPagesForFullStyleRecalc(this);
@@ -832,13 +825,13 @@ void Page::setShouldSuppressScrollbarAnimations(bool suppressAnimations)
 
     // On the other hand, if we are going to start suppressing animations, then we need to make sure we
     // finish any current scroll animations first.
 
     // On the other hand, if we are going to start suppressing animations, then we need to make sure we
     // finish any current scroll animations first.
-    FrameView* view = mainFrame()->view();
+    FrameView* view = mainFrame().view();
     if (!view)
         return;
 
     view->finishCurrentScrollAnimations();
     
     if (!view)
         return;
 
     view->finishCurrentScrollAnimations();
     
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameView* frameView = frame->view();
         if (!frameView)
             continue;
         FrameView* frameView = frame->view();
         if (!frameView)
             continue;
@@ -902,10 +895,10 @@ unsigned Page::pageCount() const
     if (m_pagination.mode == Pagination::Unpaginated)
         return 0;
 
     if (m_pagination.mode == Pagination::Unpaginated)
         return 0;
 
-    if (Document* document = mainFrame()->document())
+    if (Document* document = mainFrame().document())
         document->updateLayoutIgnorePendingStylesheets();
 
         document->updateLayoutIgnorePendingStylesheets();
 
-    RenderView* contentRenderer = mainFrame()->contentRenderer();
+    RenderView* contentRenderer = mainFrame().contentRenderer();
     return contentRenderer ? contentRenderer->columnCount(contentRenderer->columnInfo()) : 0;
 }
 
     return contentRenderer ? contentRenderer->columnCount(contentRenderer->columnInfo()) : 0;
 }
 
@@ -913,7 +906,7 @@ void Page::didMoveOnscreen()
 {
     m_isOnscreen = true;
 
 {
     m_isOnscreen = true;
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (FrameView* frameView = frame->view())
             frameView->didMoveOnscreen();
     }
         if (FrameView* frameView = frame->view())
             frameView->didMoveOnscreen();
     }
@@ -925,7 +918,7 @@ void Page::willMoveOffscreen()
 {
     m_isOnscreen = false;
 
 {
     m_isOnscreen = false;
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (FrameView* frameView = frame->view())
             frameView->willMoveOffscreen();
     }
         if (FrameView* frameView = frame->view())
             frameView->willMoveOffscreen();
     }
@@ -940,7 +933,7 @@ void Page::setIsInWindow(bool isInWindow)
 
     m_isInWindow = isInWindow;
 
 
     m_isInWindow = isInWindow;
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (FrameView* frameView = frame->view())
             frameView->setIsInWindow(isInWindow);
     }
         if (FrameView* frameView = frame->view())
             frameView->setIsInWindow(isInWindow);
     }
@@ -949,7 +942,7 @@ void Page::setIsInWindow(bool isInWindow)
 void Page::suspendScriptedAnimations()
 {
     m_scriptedAnimationsSuspended = true;
 void Page::suspendScriptedAnimations()
 {
     m_scriptedAnimationsSuspended = true;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->suspendScriptedAnimationControllerCallbacks();
     }
         if (frame->document())
             frame->document()->suspendScriptedAnimationControllerCallbacks();
     }
@@ -958,7 +951,7 @@ void Page::suspendScriptedAnimations()
 void Page::resumeScriptedAnimations()
 {
     m_scriptedAnimationsSuspended = false;
 void Page::resumeScriptedAnimations()
 {
     m_scriptedAnimationsSuspended = false;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->resumeScriptedAnimationControllerCallbacks();
     }
         if (frame->document())
             frame->document()->resumeScriptedAnimationControllerCallbacks();
     }
@@ -995,7 +988,7 @@ void Page::userStyleSheetLocationChanged()
             m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data(), styleSheetAsUTF8.size());
     }
 
             m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data(), styleSheetAsUTF8.size());
     }
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->styleSheetCollection()->updatePageUserSheet();
     }
         if (frame->document())
             frame->document()->styleSheetCollection()->updatePageUserSheet();
     }
@@ -1149,7 +1142,7 @@ void Page::setMemoryCacheClientCallsEnabled(bool enabled)
     if (!enabled)
         return;
 
     if (!enabled)
         return;
 
-    for (RefPtr<Frame> frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (RefPtr<Frame> frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->loader().tellClientAboutPastMemoryCacheLoads();
 }
 
         frame->loader().tellClientAboutPastMemoryCacheLoads();
 }
 
@@ -1157,7 +1150,7 @@ void Page::setMinimumTimerInterval(double minimumTimerInterval)
 {
     double oldTimerInterval = m_minimumTimerInterval;
     m_minimumTimerInterval = minimumTimerInterval;
 {
     double oldTimerInterval = m_minimumTimerInterval;
     m_minimumTimerInterval = minimumTimerInterval;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNextWithWrap(false)) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNextWithWrap(false)) {
         if (frame->document())
             frame->document()->adjustMinimumTimerInterval(oldTimerInterval);
     }
         if (frame->document())
             frame->document()->adjustMinimumTimerInterval(oldTimerInterval);
     }
@@ -1174,7 +1167,7 @@ void Page::setTimerAlignmentInterval(double interval)
         return;
 
     m_timerAlignmentInterval = interval;
         return;
 
     m_timerAlignmentInterval = interval;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNextWithWrap(false)) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNextWithWrap(false)) {
         if (frame->document())
             frame->document()->didChangeTimerAlignmentInterval();
     }
         if (frame->document())
             frame->document()->didChangeTimerAlignmentInterval();
     }
@@ -1187,13 +1180,13 @@ double Page::timerAlignmentInterval() const
 
 void Page::dnsPrefetchingStateChanged()
 {
 
 void Page::dnsPrefetchingStateChanged()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->document()->initDNSPrefetch();
 }
 
 void Page::collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBases)
 {
         frame->document()->initDNSPrefetch();
 }
 
 void Page::collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBases)
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameView* view = frame->view();
         if (!view)
             return;
         FrameView* view = frame->view();
         if (!view)
             return;
@@ -1212,7 +1205,7 @@ void Page::collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBase
 
 void Page::storageBlockingStateChanged()
 {
 
 void Page::storageBlockingStateChanged()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->document()->storageBlockingStateDidChange();
 
     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
         frame->document()->storageBlockingStateDidChange();
 
     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
@@ -1228,7 +1221,7 @@ void Page::privateBrowsingStateChanged()
 {
     bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
 
 {
     bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->document()->privateBrowsingStateDidChange();
 
     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
         frame->document()->privateBrowsingStateDidChange();
 
     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
@@ -1246,7 +1239,7 @@ void Page::checkSubframeCountConsistency() const
     ASSERT(m_subframeCount >= 0);
 
     int subframeCount = 0;
     ASSERT(m_subframeCount >= 0);
 
     int subframeCount = 0;
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         ++subframeCount;
 
     ASSERT(m_subframeCount + 1 == subframeCount);
         ++subframeCount;
 
     ASSERT(m_subframeCount + 1 == subframeCount);
@@ -1295,11 +1288,11 @@ void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
         if (m_pageThrottler->shouldThrottleTimers())
             throttleTimers();
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
         if (m_pageThrottler->shouldThrottleTimers())
             throttleTimers();
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
-            mainFrame()->animation().suspendAnimations();
+            mainFrame().animation().suspendAnimations();
     } else {
         unthrottleTimers();
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
     } else {
         unthrottleTimers();
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
-            mainFrame()->animation().resumeAnimations();
+            mainFrame().animation().resumeAnimations();
     }
 }
 #endif // ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
     }
 }
 #endif // ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
@@ -1316,7 +1309,7 @@ void Page::addHeaderWithHeight(int headerHeight)
 {
     m_headerHeight = headerHeight;
 
 {
     m_headerHeight = headerHeight;
 
-    FrameView* frameView = mainFrame() ? mainFrame()->view() : 0;
+    FrameView* frameView = mainFrame().view();
     if (!frameView)
         return;
 
     if (!frameView)
         return;
 
@@ -1332,7 +1325,7 @@ void Page::addFooterWithHeight(int footerHeight)
 {
     m_footerHeight = footerHeight;
 
 {
     m_footerHeight = footerHeight;
 
-    FrameView* frameView = mainFrame() ? mainFrame()->view() : 0;
+    FrameView* frameView = mainFrame().view();
     if (!frameView)
         return;
 
     if (!frameView)
         return;
 
@@ -1405,7 +1398,7 @@ void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& ob
         return;
 
     // Objects inside sub-frames are not considered to be relevant.
         return;
 
     // Objects inside sub-frames are not considered to be relevant.
-    if (&object->frame() != mainFrame())
+    if (&object->frame() != &mainFrame())
         return;
 
     LayoutRect relevantRect = relevantViewRect(&object->view());
         return;
 
     LayoutRect relevantRect = relevantViewRect(&object->view());
@@ -1458,7 +1451,7 @@ void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& ob
         && ratioOfViewThatIsUnpainted < gMaximumUnpaintedAreaRatio) {
         m_isCountingRelevantRepaintedObjects = false;
         resetRelevantPaintedObjectCounter();
         && ratioOfViewThatIsUnpainted < gMaximumUnpaintedAreaRatio) {
         m_isCountingRelevantRepaintedObjects = false;
         resetRelevantPaintedObjectCounter();
-        if (Frame* frame = mainFrame())
+        if (Frame* frame = &mainFrame())
             frame->loader().didLayout(DidHitRelevantRepaintedObjectsAreaThreshold);
     }
 }
             frame->loader().didLayout(DidHitRelevantRepaintedObjectsAreaThreshold);
     }
 }
@@ -1478,13 +1471,13 @@ void Page::addRelevantUnpaintedObject(RenderObject* object, const LayoutRect& ob
 
 void Page::suspendActiveDOMObjectsAndAnimations()
 {
 
 void Page::suspendActiveDOMObjectsAndAnimations()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->suspendActiveDOMObjectsAndAnimations();
 }
 
 void Page::resumeActiveDOMObjectsAndAnimations()
 {
         frame->suspendActiveDOMObjectsAndAnimations();
 }
 
 void Page::resumeActiveDOMObjectsAndAnimations()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->resumeActiveDOMObjectsAndAnimations();
 }
 
         frame->resumeActiveDOMObjectsAndAnimations();
 }
 
@@ -1551,9 +1544,9 @@ void Page::hiddenPageCSSAnimationSuspensionStateChanged()
 {
     if (m_visibilityState == WebCore::PageVisibilityStateHidden) {
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
 {
     if (m_visibilityState == WebCore::PageVisibilityStateHidden) {
         if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
-            mainFrame()->animation().suspendAnimations();
+            mainFrame().animation().suspendAnimations();
         else
         else
-            mainFrame()->animation().resumeAnimations();
+            mainFrame().animation().resumeAnimations();
     }
 }
 #endif
     }
 }
 #endif
@@ -1561,7 +1554,7 @@ void Page::hiddenPageCSSAnimationSuspensionStateChanged()
 #if ENABLE(VIDEO_TRACK)
 void Page::captionPreferencesChanged()
 {
 #if ENABLE(VIDEO_TRACK)
 void Page::captionPreferencesChanged()
 {
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext())
+    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
         frame->document()->captionPreferencesChanged();
 }
 #endif
         frame->document()->captionPreferencesChanged();
 }
 #endif
index d4107699f31ab777468fbc63308055608bd8d435..19f6bf950c3e5a04ffc2716fcac7ef79f6b90f20 100644 (file)
@@ -160,7 +160,7 @@ public:
     EditorClient* editorClient() const { return m_editorClient; }
     PlugInClient* plugInClient() const { return m_plugInClient; }
 
     EditorClient* editorClient() const { return m_editorClient; }
     PlugInClient* plugInClient() const { return m_plugInClient; }
 
-    Frame* mainFrame() const { return m_mainFrame.get(); }
+    Frame& mainFrame() const { return *m_mainFrame; }
 
     bool openedByDOM() const;
     void setOpenedByDOM();
 
     bool openedByDOM() const;
     void setOpenedByDOM();
@@ -462,7 +462,7 @@ private:
     const OwnPtr<ProgressTracker> m_progress;
 
     OwnPtr<BackForwardController> m_backForwardController;
     const OwnPtr<ProgressTracker> m_progress;
 
     OwnPtr<BackForwardController> m_backForwardController;
-    RefPtr<Frame> m_mainFrame;
+    const RefPtr<Frame> m_mainFrame;
 
     mutable RefPtr<PluginData> m_pluginData;
 
 
     mutable RefPtr<PluginData> m_pluginData;
 
index f5441da26dc754906e39f71181ab06f3e3a6013b..228c8396e0da9b36b05dc0cff51c1c538c4b7b28 100644 (file)
@@ -403,7 +403,7 @@ void PageGroup::invalidateInjectedStyleSheetCacheInAllFrames()
     // Clear our cached sheets and have them just reparse.
     HashSet<Page*>::const_iterator end = m_pages.end();
     for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
     // Clear our cached sheets and have them just reparse.
     HashSet<Page*>::const_iterator end = m_pages.end();
     for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
             frame->document()->styleSheetCollection()->invalidateInjectedStyleSheetCache();
             frame->document()->styleResolverChanged(DeferRecalcStyle);
         }
             frame->document()->styleSheetCollection()->invalidateInjectedStyleSheetCache();
             frame->document()->styleResolverChanged(DeferRecalcStyle);
         }
index 1f9d340d5e1ddbd9ddbdc314d357c7d4f0c9e9c3..7f4bb3cc1412e3fce94ae350de0ccdfbdf2bd65f 100644 (file)
@@ -42,11 +42,11 @@ PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
         Page* otherPage = *it;
         if ((deferSelf || otherPage != page)) {
             if (!otherPage->defersLoading()) {
         Page* otherPage = *it;
         if ((deferSelf || otherPage != page)) {
             if (!otherPage->defersLoading()) {
-                m_deferredFrames.append(otherPage->mainFrame());
+                m_deferredFrames.append(&otherPage->mainFrame());
 
                 // This code is not logically part of load deferring, but we do not want JS code executed beneath modal
                 // windows or sheets, which is exactly when PageGroupLoadDeferrer is used.
 
                 // This code is not logically part of load deferring, but we do not want JS code executed beneath modal
                 // windows or sheets, which is exactly when PageGroupLoadDeferrer is used.
-                for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree().traverseNext())
+                for (Frame* frame = &otherPage->mainFrame(); frame; frame = frame->tree().traverseNext())
                     frame->document()->suspendScheduledTasks(ActiveDOMObject::WillDeferLoading);
             }
         }
                     frame->document()->suspendScheduledTasks(ActiveDOMObject::WillDeferLoading);
             }
         }
@@ -64,7 +64,7 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
         if (Page* page = m_deferredFrames[i]->page()) {
             page->setDefersLoading(false);
 
         if (Page* page = m_deferredFrames[i]->page()) {
             page->setDefersLoading(false);
 
-            for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+            for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
                 frame->document()->resumeScheduledTasks(ActiveDOMObject::WillDeferLoading);
         }
     }
                 frame->document()->resumeScheduledTasks(ActiveDOMObject::WillDeferLoading);
         }
     }
index 976787bd081b2b6c0b498fed8870d256ffd9916d..93deb94e79c47db70b73792fa47a2d62a5371b1d 100644 (file)
@@ -189,7 +189,7 @@ PageSerializer::PageSerializer(Vector<PageSerializer::Resource>* resources)
 
 void PageSerializer::serialize(Page* page)
 {
 
 void PageSerializer::serialize(Page* page)
 {
-    serializeFrame(page->mainFrame());
+    serializeFrame(&page->mainFrame());
 }
 
 void PageSerializer::serializeFrame(Frame* frame)
 }
 
 void PageSerializer::serializeFrame(Frame* frame)
index 92ccaf30ae209b5a202869f27696adf0135a4e58..71a9fc78eeea8ce8fe113bb8e6f51ffd31430674 100644 (file)
@@ -61,7 +61,7 @@ void PageThrottler::throttlePage()
 
     m_page->chrome().client().decrementActivePageCount();
 
 
     m_page->chrome().client().decrementActivePageCount();
 
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->scriptedAnimationControllerSetThrottled(true);
     }
         if (frame->document())
             frame->document()->scriptedAnimationControllerSetThrottled(true);
     }
@@ -80,7 +80,7 @@ void PageThrottler::unthrottlePage()
     if (oldState == PageThrottledState)
         m_page->chrome().client().incrementActivePageCount();
     
     if (oldState == PageThrottledState)
         m_page->chrome().client().incrementActivePageCount();
     
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             frame->document()->scriptedAnimationControllerSetThrottled(false);
     }
         if (frame->document())
             frame->document()->scriptedAnimationControllerSetThrottled(false);
     }
index 54d1a32c778fab435154d1ed4055efef728a5007..3c14fb39bd79c6eadc00d8f9c08e835a1ca3b397 100644 (file)
@@ -52,7 +52,7 @@ namespace WebCore {
 
 static void setImageLoadingSettings(Page* page)
 {
 
 static void setImageLoadingSettings(Page* page)
 {
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         frame->document()->cachedResourceLoader()->setImagesEnabled(page->settings().areImagesEnabled());
         frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings().loadsImagesAutomatically());
     }
         frame->document()->cachedResourceLoader()->setImagesEnabled(page->settings().areImagesEnabled());
         frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings().loadsImagesAutomatically());
     }
@@ -336,9 +336,7 @@ void Settings::setMediaTypeOverride(const String& mediaTypeOverride)
 
     m_mediaTypeOverride = mediaTypeOverride;
 
 
     m_mediaTypeOverride = mediaTypeOverride;
 
-    Frame* mainFrame = m_page->mainFrame();
-    ASSERT(mainFrame);
-    FrameView* view = mainFrame->view();
+    FrameView* view = m_page->mainFrame().view();
     ASSERT(view);
 
     view->setMediaType(mediaTypeOverride);
     ASSERT(view);
 
     view->setMediaType(mediaTypeOverride);
@@ -542,8 +540,7 @@ void Settings::setTiledBackingStoreEnabled(bool enabled)
 {
     m_tiledBackingStoreEnabled = enabled;
 #if USE(TILED_BACKING_STORE)
 {
     m_tiledBackingStoreEnabled = enabled;
 #if USE(TILED_BACKING_STORE)
-    if (m_page->mainFrame())
-        m_page->mainFrame()->setTiledBackingStoreEnabled(enabled);
+    m_page->mainFrame().setTiledBackingStoreEnabled(enabled);
 #endif
 }
 
 #endif
 }
 
@@ -573,8 +570,8 @@ void Settings::setScrollingPerformanceLoggingEnabled(bool enabled)
 {
     m_scrollingPerformanceLoggingEnabled = enabled;
 
 {
     m_scrollingPerformanceLoggingEnabled = enabled;
 
-    if (m_page->mainFrame() && m_page->mainFrame()->view())
-        m_page->mainFrame()->view()->setScrollingPerformanceLoggingEnabled(enabled);
+    if (m_page->mainFrame().view())
+        m_page->mainFrame().view()->setScrollingPerformanceLoggingEnabled(enabled);
 }
     
 void Settings::setAggressiveTileRetentionEnabled(bool enabled)
 }
     
 void Settings::setAggressiveTileRetentionEnabled(bool enabled)
index 08a38787833df13bf432782e379f0e67c4d28aa5..7bc0234abde50e9aac9311b12f889d9578e1203c 100644 (file)
@@ -697,7 +697,7 @@ void distanceDataForNode(FocusDirection direction, const FocusCandidate& current
 
     float distance = euclidianDistance + sameAxisDistance + 2 * otherAxisDistance;
     candidate.distance = roundf(distance);
 
     float distance = euclidianDistance + sameAxisDistance + 2 * otherAxisDistance;
     candidate.distance = roundf(distance);
-    LayoutSize viewSize = candidate.visibleNode->document()->page()->mainFrame()->view()->visibleContentRect().size();
+    LayoutSize viewSize = candidate.visibleNode->document()->page()->mainFrame().view()->visibleContentRect().size();
     candidate.alignment = alignmentForRects(direction, currentRect, nodeRect, viewSize);
 }
 
     candidate.alignment = alignmentForRects(direction, currentRect, nodeRect, viewSize);
 }
 
index 726301f3813e20c3618d5446c73acce0baa7cd05..9b6652b8fb398f6320f59a0ef8e3c06c4ecb3a82 100644 (file)
@@ -56,7 +56,7 @@ DragOperation DragController::dragOperation(DragData* dragData)
 {
     ASSERT(dragData);
 
 {
     ASSERT(dragData);
 
-    if ((dragData->flags() & DragApplicationIsModal) || !dragData->containsURL(m_page->mainFrame()))
+    if ((dragData->flags() & DragApplicationIsModal) || !dragData->containsURL(&m_page->mainFrame()))
         return DragOperationNone;
 
     if (!m_documentUnderMouse || (!(dragData->flags() & (DragApplicationHasAttachedSheet | DragApplicationIsSource))))
         return DragOperationNone;
 
     if (!m_documentUnderMouse || (!(dragData->flags() & (DragApplicationHasAttachedSheet | DragApplicationIsSource))))
@@ -80,7 +80,7 @@ void DragController::cleanupAfterSystemDrag()
     // call it anyway to be on the safe side.
     // We don't want to do this for WebKit2, since the client call to start the drag
     // is asynchronous.
     // call it anyway to be on the safe side.
     // We don't want to do this for WebKit2, since the client call to start the drag
     // is asynchronous.
-    if (m_page->mainFrame()->view()->platformWidget())
+    if (m_page->mainFrame().view()->platformWidget())
         dragEnded();
 }
 
         dragEnded();
 }
 
index d4202663b164bdde942c9abd835a8ff615801fd4..e5a6a932d5b19c9c6089a27a0888e42ab1e86e65 100644 (file)
@@ -102,12 +102,12 @@ bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView
     ASSERT(m_page);
 
     // We currently only handle the main frame.
     ASSERT(m_page);
 
     // We currently only handle the main frame.
-    if (&frameView->frame() != m_page->mainFrame())
+    if (&frameView->frame() != &m_page->mainFrame())
         return false;
 
     // We currently only support composited mode.
 #if USE(ACCELERATED_COMPOSITING)
         return false;
 
     // We currently only support composited mode.
 #if USE(ACCELERATED_COMPOSITING)
-    RenderView* renderView = m_page->mainFrame()->contentRenderer();
+    RenderView* renderView = m_page->mainFrame().contentRenderer();
     if (!renderView)
         return false;
     return renderView->usesCompositing();
     if (!renderView)
         return false;
     return renderView->usesCompositing();
@@ -234,7 +234,7 @@ unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()
 {
     unsigned wheelEventHandlerCount = 0;
 
 {
     unsigned wheelEventHandlerCount = 0;
 
-    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (frame->document())
             wheelEventHandlerCount += frame->document()->wheelEventHandlerCount();
     }
         if (frame->document())
             wheelEventHandlerCount += frame->document()->wheelEventHandlerCount();
     }
@@ -384,7 +384,7 @@ void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollP
     if (!m_page)
         return;
 
     if (!m_page)
         return;
 
-    FrameView* frameView = m_page->mainFrame()->view();
+    FrameView* frameView = m_page->mainFrame().view();
     if (!frameView)
         return;
 
     if (!frameView)
         return;
 
@@ -438,7 +438,7 @@ void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase)
     if (!m_page)
         return;
 
     if (!m_page)
         return;
 
-    FrameView* frameView = m_page->mainFrame()->view();
+    FrameView* frameView = m_page->mainFrame().view();
     if (!frameView)
         return;
 
     if (!frameView)
         return;
 
@@ -470,7 +470,7 @@ bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
 
 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() const
 {
 
 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() const
 {
-    FrameView* frameView = m_page->mainFrame()->view();
+    FrameView* frameView = m_page->mainFrame().view();
     if (!frameView)
         return static_cast<MainThreadScrollingReasons>(0);
 
     if (!frameView)
         return static_cast<MainThreadScrollingReasons>(0);
 
@@ -484,7 +484,7 @@ MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
         mainThreadScrollingReasons |= HasViewportConstrainedObjectsWithoutSupportingFixedLayers;
     if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstrainedObjects(frameView))
         mainThreadScrollingReasons |= HasNonLayerViewportConstrainedObjects;
         mainThreadScrollingReasons |= HasViewportConstrainedObjectsWithoutSupportingFixedLayers;
     if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstrainedObjects(frameView))
         mainThreadScrollingReasons |= HasNonLayerViewportConstrainedObjects;
-    if (m_page->mainFrame()->document() && m_page->mainFrame()->document()->isImageDocument())
+    if (m_page->mainFrame().document() && m_page->mainFrame().document()->isImageDocument())
         mainThreadScrollingReasons |= IsImageDocument;
 
     return mainThreadScrollingReasons;
         mainThreadScrollingReasons |= IsImageDocument;
 
     return mainThreadScrollingReasons;
index 4a10056444d5ab06af1036e6b1b1e8fe57b666e8..31c5b6aaf8a195c0396d4942761b6aa7e0779885 100644 (file)
@@ -139,7 +139,7 @@ void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView)
     // Compute the region of the page that we can't do fast scrolling for. This currently includes
     // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
     // frame view whose layout was updated is not the main frame.
     // Compute the region of the page that we can't do fast scrolling for. This currently includes
     // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
     // frame view whose layout was updated is not the main frame.
-    Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint());
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint());
 
     // In the future, we may want to have the ability to set non-fast scrolling regions for more than
     // just the root node. But right now, this concept only applies to the root.
 
     // In the future, we may want to have the ability to set non-fast scrolling regions for more than
     // just the root node. But right now, this concept only applies to the root.
@@ -204,7 +204,7 @@ void ScrollingCoordinatorMac::scrollableAreaScrollbarLayerDidChange(ScrollableAr
     ASSERT(isMainThread());
     ASSERT(m_page);
 
     ASSERT(isMainThread());
     ASSERT(m_page);
 
-    if (scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame()->view()))
+    if (scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame().view()))
         return;
 
     // FIXME: Implement.
         return;
 
     // FIXME: Implement.
@@ -351,7 +351,7 @@ void ScrollingCoordinatorMac::updateMainFrameScrollLayerPosition()
     if (!m_page)
         return;
 
     if (!m_page)
         return;
 
-    FrameView* frameView = m_page->mainFrame()->view();
+    FrameView* frameView = m_page->mainFrame().view();
     if (!frameView)
         return;
 
     if (!frameView)
         return;
 
@@ -436,7 +436,7 @@ void ScrollingCoordinatorMac::commitTreeState()
     OwnPtr<ScrollingStateTree> treeState = m_scrollingStateTree->commit();
     ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release()));
 
     OwnPtr<ScrollingStateTree> treeState = m_scrollingStateTree->commit();
     ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release()));
 
-    FrameView* frameView = m_page->mainFrame()->view();
+    FrameView* frameView = m_page->mainFrame().view();
     if (!frameView)
         return;
     
     if (!frameView)
         return;
     
index 5095a1306bb551f197cd3a24ed59c021187fec11..b0e9a175510d5288c32053a649d972535ce9c3e5 100644 (file)
@@ -99,7 +99,7 @@ bool CompositingCoordinator::flushPendingLayerChanges()
     m_rootLayer->flushCompositingStateForThisLayerOnly();
     m_client->didFlushRootLayer();
 
     m_rootLayer->flushCompositingStateForThisLayerOnly();
     m_client->didFlushRootLayer();
 
-    bool didSync = m_page->mainFrame()->view()->flushCompositingStateIncludingSubframes();
+    bool didSync = m_page->mainFrame().view()->flushCompositingStateIncludingSubframes();
 
     toCoordinatedGraphicsLayer(m_rootLayer.get())->updateContentBuffersIncludingSubLayers();
     toCoordinatedGraphicsLayer(m_rootLayer.get())->syncPendingStateChangesIncludingSubLayers();
 
     toCoordinatedGraphicsLayer(m_rootLayer.get())->updateContentBuffersIncludingSubLayers();
     toCoordinatedGraphicsLayer(m_rootLayer.get())->syncPendingStateChangesIncludingSubLayers();
@@ -134,9 +134,9 @@ void CompositingCoordinator::syncDisplayState()
 #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     // Make sure that any previously registered animation callbacks are being executed before we flush the layers.
     m_lastAnimationServiceTime = WTF::monotonicallyIncreasingTime();
 #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     // Make sure that any previously registered animation callbacks are being executed before we flush the layers.
     m_lastAnimationServiceTime = WTF::monotonicallyIncreasingTime();
-    m_page->mainFrame()->view()->serviceScriptedAnimations(m_lastAnimationServiceTime);
+    m_page->mainFrame().view()->serviceScriptedAnimations(m_lastAnimationServiceTime);
 #endif
 #endif
-    m_page->mainFrame()->view()->updateLayoutAndStyleIfNeededRecursive();
+    m_page->mainFrame().view()->updateLayoutAndStyleIfNeededRecursive();
 }
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
 }
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
@@ -322,7 +322,7 @@ void CompositingCoordinator::setVisibleContentsRect(const FloatRect& rect, const
             it->value->setNeedsVisibleRectAdjustment();
     }
 
             it->value->setNeedsVisibleRectAdjustment();
     }
 
-    FrameView* view = m_page->mainFrame()->view();
+    FrameView* view = m_page->mainFrame().view();
     if (view->useFixedLayout()) {
         // Round the rect instead of enclosing it to make sure that its size stays
         // the same while panning. This can have nasty effects on layout.
     if (view->useFixedLayout()) {
         // Round the rect instead of enclosing it to make sure that its size stays
         // the same while panning. This can have nasty effects on layout.
index aba731f7d45c6332e6689a03d3769fad5353395f..e5a671abdfda6de6ae0a43ecaca560d0fe6ae262 100644 (file)
@@ -66,7 +66,7 @@ const String &DOMMimeType::description() const
 
 PassRefPtr<DOMPlugin> DOMMimeType::enabledPlugin() const
 {
 
 PassRefPtr<DOMPlugin> DOMMimeType::enabledPlugin() const
 {
-    if (!m_frame || !m_frame->page() || !m_frame->page()->mainFrame()->loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
+    if (!m_frame || !m_frame->page() || !m_frame->page()->mainFrame().loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
         return 0;
 
     return DOMPlugin::create(m_pluginData.get(), m_frame, m_pluginData->mimePluginIndices()[m_index]);
         return 0;
 
     return DOMPlugin::create(m_pluginData.get(), m_frame, m_pluginData->mimePluginIndices()[m_index]);
index 122ce5dd2316225d3dc0ca3cacfee10f03918a8e..b4cb6952d7f3256238e2c21bfb8e5ac62caa9640 100644 (file)
@@ -829,7 +829,7 @@ bool RenderBox::canAutoscroll() const
     if (node() != &document())
         return false;
     Page* page = frame().page();
     if (node() != &document())
         return false;
     Page* page = frame().page();
-    return page && page->mainFrame() == &frame() && view().frameView().isScrollable();
+    return page && &page->mainFrame() == &frame() && view().frameView().isScrollable();
 }
 
 // If specified point is in border belt, returned offset denotes direction of
 }
 
 // If specified point is in border belt, returned offset denotes direction of
index d05439e380f0f8ad7043314cecd6ddcf23d8b9b5..8cb9b55b5c4249a94d00caf7e338d34597cfe95a 100644 (file)
@@ -121,7 +121,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
 {
     if (layer->isRootLayer()) {
         Page* page = renderer().frame().page();
 {
     if (layer->isRootLayer()) {
         Page* page = renderer().frame().page();
-        if (page && page->mainFrame() == &renderer().frame()) {
+        if (page && &page->mainFrame() == &renderer().frame()) {
             m_isMainFrameRenderViewLayer = true;
 
 #if PLATFORM(MAC)
             m_isMainFrameRenderViewLayer = true;
 
 #if PLATFORM(MAC)
index 4a3b7f6d3b6b1b6080b5f823110b6a2c21285b89..9b2789a97aa1dde5767713e04bdf128a64939d65 100644 (file)
@@ -103,25 +103,25 @@ void TextAutosizer::recalculateMultipliers()
 
 bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
 {
 
 bool TextAutosizer::processSubtree(RenderObject* layoutRoot)
 {
-    // FIXME: Text Autosizing should only be enabled when m_document->page()->mainFrame()->view()->useFixedLayout()
+    // FIXME: Text Autosizing should only be enabled when m_document->page()->mainFrame().view()->useFixedLayout()
     // is true, but for now it's useful to ignore this so that it can be tested on desktop.
     if (!m_document->settings() || !m_document->settings()->textAutosizingEnabled() || layoutRoot->view()->printing() || !m_document->page())
         return false;
 
     // is true, but for now it's useful to ignore this so that it can be tested on desktop.
     if (!m_document->settings() || !m_document->settings()->textAutosizingEnabled() || layoutRoot->view()->printing() || !m_document->page())
         return false;
 
-    Frame* mainFrame = m_document->page()->mainFrame();
+    Frame& mainFrame = m_document->page()->mainFrame();
 
     TextAutosizingWindowInfo windowInfo;
 
     // Window area, in logical (density-independent) pixels.
     windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
     if (windowInfo.windowSize.isEmpty()) {
 
     TextAutosizingWindowInfo windowInfo;
 
     // Window area, in logical (density-independent) pixels.
     windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
     if (windowInfo.windowSize.isEmpty()) {
-        bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
-        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars);
+        bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(&mainFrame);
+        windowInfo.windowSize = mainFrame.view()->unscaledVisibleContentSize(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars);
     }
 
     // Largest area of block that can be visible at once (assuming the main
     // frame doesn't get scaled to less than overview scale), in CSS pixels.
     }
 
     // Largest area of block that can be visible at once (assuming the main
     // frame doesn't get scaled to less than overview scale), in CSS pixels.
-    windowInfo.minLayoutSize = mainFrame->view()->layoutSize();
+    windowInfo.minLayoutSize = mainFrame.view()->layoutSize();
     for (Frame* frame = m_document->frame(); frame; frame = frame->tree().parent()) {
         if (!frame->view()->isInChildFrameWithFrameFlattening())
             windowInfo.minLayoutSize = windowInfo.minLayoutSize.shrunkTo(frame->view()->layoutSize());
     for (Frame* frame = m_document->frame(); frame; frame = frame->tree().parent()) {
         if (!frame->view()->isInChildFrameWithFrameFlattening())
             windowInfo.minLayoutSize = windowInfo.minLayoutSize.shrunkTo(frame->view()->layoutSize());
index c1f7c645538e7fd7371a4eac13315c909ca23836..d7dc7b586359b275c34dda1f2f9db573c7c60915 100644 (file)
@@ -47,7 +47,7 @@ void StorageEventDispatcher::dispatchSessionStorageEvents(const String& key, con
     Vector<RefPtr<Frame> > frames;
 
     // Send events only to our page.
     Vector<RefPtr<Frame> > frames;
 
     // Send events only to our page.
-    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
             frames.append(frame);
     }
         if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
             frames.append(frame);
     }
@@ -66,7 +66,7 @@ void StorageEventDispatcher::dispatchLocalStorageEvents(const String& key, const
     // Send events to every page.
     const HashSet<Page*>& pages = page->group().pages();
     for (HashSet<Page*>::const_iterator it = pages.begin(), end = pages.end(); it != end; ++it) {
     // Send events to every page.
     const HashSet<Page*>& pages = page->group().pages();
     for (HashSet<Page*>::const_iterator it = pages.begin(), end = pages.end(); it != end; ++it) {
-        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        for (Frame* frame = &(*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
             if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
                 frames.append(frame);
         }
             if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
                 frames.append(frame);
         }
index 65e96c66db70c65b0c3c4dbf83378d5ecae717de..7b24ff9d164d33bae1e9acbe7f439fc8d9a3bfb1 100644 (file)
@@ -57,7 +57,7 @@ SVGImage::~SVGImage()
     if (m_page) {
         // Store m_page in a local variable, clearing m_page, so that SVGImageChromeClient knows we're destructed.
         OwnPtr<Page> currentPage = m_page.release();
     if (m_page) {
         // Store m_page in a local variable, clearing m_page, so that SVGImageChromeClient knows we're destructed.
         OwnPtr<Page> currentPage = m_page.release();
-        currentPage->mainFrame()->loader().frameDetached(); // Break both the loader and view references to the frame
+        currentPage->mainFrame().loader().frameDetached(); // Break both the loader and view references to the frame
     }
 
     // Verify that page teardown destroyed the Chrome
     }
 
     // Verify that page teardown destroyed the Chrome
@@ -69,8 +69,7 @@ bool SVGImage::hasSingleSecurityOrigin() const
     if (!m_page)
         return true;
 
     if (!m_page)
         return true;
 
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return true;
 
     if (!rootElement)
         return true;
 
@@ -88,8 +87,7 @@ void SVGImage::setContainerSize(const IntSize& size)
     if (!m_page || !usesContainerSize())
         return;
 
     if (!m_page || !usesContainerSize())
         return;
 
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return;
     RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());
     if (!rootElement)
         return;
     RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());
@@ -106,8 +104,7 @@ IntSize SVGImage::containerSize() const
 {
     if (!m_page)
         return IntSize();
 {
     if (!m_page)
         return IntSize();
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return IntSize();
 
     if (!rootElement)
         return IntSize();
 
@@ -256,8 +253,7 @@ RenderBox* SVGImage::embeddedContentBox() const
 {
     if (!m_page)
         return 0;
 {
     if (!m_page)
         return 0;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return 0;
     return toRenderBox(rootElement->renderer());
     if (!rootElement)
         return 0;
     return toRenderBox(rootElement->renderer());
@@ -267,16 +263,14 @@ FrameView* SVGImage::frameView() const
 {
     if (!m_page)
         return 0;
 {
     if (!m_page)
         return 0;
-
-    return m_page->mainFrame()->view();
+    return m_page->mainFrame().view();
 }
 
 bool SVGImage::hasRelativeWidth() const
 {
     if (!m_page)
         return false;
 }
 
 bool SVGImage::hasRelativeWidth() const
 {
     if (!m_page)
         return false;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return false;
     return rootElement->intrinsicWidth().isPercent();
     if (!rootElement)
         return false;
     return rootElement->intrinsicWidth().isPercent();
@@ -286,8 +280,7 @@ bool SVGImage::hasRelativeHeight() const
 {
     if (!m_page)
         return false;
 {
     if (!m_page)
         return false;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return false;
     return rootElement->intrinsicHeight().isPercent();
     if (!rootElement)
         return false;
     return rootElement->intrinsicHeight().isPercent();
@@ -297,8 +290,7 @@ void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrin
 {
     if (!m_page)
         return;
 {
     if (!m_page)
         return;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return;
 
     if (!rootElement)
         return;
 
@@ -317,8 +309,7 @@ void SVGImage::startAnimation(bool /* catchUpIfNecessary */)
 {
     if (!m_page)
         return;
 {
     if (!m_page)
         return;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return;
     rootElement->unpauseAnimations();
     if (!rootElement)
         return;
     rootElement->unpauseAnimations();
@@ -329,8 +320,7 @@ void SVGImage::stopAnimation()
 {
     if (!m_page)
         return;
 {
     if (!m_page)
         return;
-    Frame* frame = m_page->mainFrame();
-    SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+    SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement();
     if (!rootElement)
         return;
     rootElement->pauseAnimations();
     if (!rootElement)
         return;
     rootElement->pauseAnimations();
@@ -364,14 +354,14 @@ bool SVGImage::dataChanged(bool allDataReceived)
         m_page->settings().setScriptEnabled(false);
         m_page->settings().setPluginsEnabled(false);
 
         m_page->settings().setScriptEnabled(false);
         m_page->settings().setPluginsEnabled(false);
 
-        RefPtr<Frame> frame = m_page->mainFrame();
-        frame->setView(FrameView::create(frame.get()));
-        frame->init();
-        FrameLoader& loader = frame->loader();
+        Frame& frame = m_page->mainFrame();
+        frame.setView(FrameView::create(&frame));
+        frame.init();
+        FrameLoader& loader = frame.loader();
         loader.forceSandboxFlags(SandboxAll);
 
         loader.forceSandboxFlags(SandboxAll);
 
-        frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars.
-        frame->view()->setTransparent(true); // SVG Images are transparent.
+        frame.view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars.
+        frame.view()->setTransparent(true); // SVG Images are transparent.
 
         ASSERT(loader.activeDocumentLoader()); // DocumentLoader should have been created by frame->init().
         loader.activeDocumentLoader()->writer()->setMIMEType("image/svg+xml");
 
         ASSERT(loader.activeDocumentLoader()); // DocumentLoader should have been created by frame->init().
         loader.activeDocumentLoader()->writer()->setMIMEType("image/svg+xml");
index 7a951678df8c9101eb9e460682bf5f3f062d1ae8..caadfce4381816db564756b6e4b646d1dc1a9e0b 100644 (file)
@@ -213,7 +213,7 @@ static bool urlIsWhitelistedForSetShadowDOMEnabled(const String& url)
 
 void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
 {
 
 void InternalSettings::setShadowDOMEnabled(bool enabled, ExceptionCode& ec)
 {
-    if (!urlIsWhitelistedForSetShadowDOMEnabled(page()->mainFrame()->document()->url().string())) {
+    if (!urlIsWhitelistedForSetShadowDOMEnabled(page()->mainFrame().document()->url().string())) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
         ec = INVALID_ACCESS_ERR;
         return;
     }
index d22aa14a7be80a41f09bf0d19455fd1562e846ab..5bf441476ef80c9a0480dd7a60b8725744cad769 100644 (file)
@@ -248,7 +248,7 @@ void Internals::resetToConsistentState(Page* page)
     page->setPagination(Pagination());
 
 #if USE(ACCELERATED_COMPOSITING)
     page->setPagination(Pagination());
 
 #if USE(ACCELERATED_COMPOSITING)
-    FrameView* mainFrameView = page->mainFrame()->view();
+    FrameView* mainFrameView = page->mainFrame().view();
     if (mainFrameView) {
         mainFrameView->setHeaderHeight(0);
         mainFrameView->setFooterHeight(0);
     if (mainFrameView) {
         mainFrameView->setHeaderHeight(0);
         mainFrameView->setFooterHeight(0);
@@ -265,10 +265,10 @@ void Internals::resetToConsistentState(Page* page)
     page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
     page->group().captionPreferences()->setTestingMode(false);
 #endif
     page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
     page->group().captionPreferences()->setTestingMode(false);
 #endif
-    if (!page->mainFrame()->editor().isContinuousSpellCheckingEnabled())
-        page->mainFrame()->editor().toggleContinuousSpellChecking();
-    if (page->mainFrame()->editor().isOverwriteModeEnabled())
-        page->mainFrame()->editor().toggleOverwriteModeEnabled();
+    if (!page->mainFrame().editor().isContinuousSpellCheckingEnabled())
+        page->mainFrame().editor().toggleContinuousSpellChecking();
+    if (page->mainFrame().editor().isOverwriteModeEnabled())
+        page->mainFrame().editor().toggleOverwriteModeEnabled();
 }
 
 Internals::Internals(Document* document)
 }
 
 Internals::Internals(Document* document)
@@ -1060,7 +1060,7 @@ String Internals::rangeAsText(const Range* range, ExceptionCode& ec)
 void Internals::setDelegatesScrolling(bool enabled, Document* document, ExceptionCode& ec)
 {
     // Delegate scrolling is valid only on mainframe's view.
 void Internals::setDelegatesScrolling(bool enabled, Document* document, ExceptionCode& ec)
 {
     // Delegate scrolling is valid only on mainframe's view.
-    if (!document || !document->view() || !document->page() || document->page()->mainFrame() != document->frame()) {
+    if (!document || !document->view() || !document->page() || &document->page()->mainFrame() != document->frame()) {
         ec = INVALID_ACCESS_ERR;
         return;
     }
         ec = INVALID_ACCESS_ERR;
         return;
     }
@@ -1495,7 +1495,7 @@ PassRefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
     Page* page = contextDocument()->frame()->page();
     ASSERT(page);
 
     Page* page = contextDocument()->frame()->page();
     ASSERT(page);
 
-    DOMWindow* window = page->mainFrame()->document()->domWindow();
+    DOMWindow* window = page->mainFrame().document()->domWindow();
     ASSERT(window);
 
     m_frontendWindow = window->open(url, "", "", window, window);
     ASSERT(window);
 
     m_frontendWindow = window->open(url, "", "", window, window);
index 41edebbcebd0e8321db5fd4e14c08efab71886ca..9fa102d8a0e49d6718c87ff434da91603b079603 100644 (file)
@@ -71,7 +71,7 @@ void AcceleratedCompositingContext::syncLayersNow()
     if (m_rootGraphicsLayer)
         m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
 
     if (m_rootGraphicsLayer)
         m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
 
-    EWKPrivate::corePage(m_view)->mainFrame()->view()->flushCompositingStateIncludingSubframes();
+    EWKPrivate::corePage(m_view)->mainFrame().view()->flushCompositingStateIncludingSubframes();
 }
 
 void AcceleratedCompositingContext::renderLayers()
 }
 
 void AcceleratedCompositingContext::renderLayers()
index 84e29d7bc8d92b918dbb96e9ee9cc7741cf628a8..b73957e927751b888c6a0b68401c340322a9f1f5 100644 (file)
@@ -45,7 +45,7 @@ static void invalidateView(Evas_Object* webView)
     if (mainFrame && ewk_frame_contents_size_get(mainFrame, &width, &height)) {
         WebCore::Page* page = EWKPrivate::corePage(webView);
         if (page)
     if (mainFrame && ewk_frame_contents_size_get(mainFrame, &width, &height)) {
         WebCore::Page* page = EWKPrivate::corePage(webView);
         if (page)
-            page->mainFrame()->view()->invalidateRect(WebCore::IntRect(0, 0, width, height));
+            page->mainFrame().view()->invalidateRect(WebCore::IntRect(0, 0, width, height));
     }
 }
 
     }
 }
 
index 23040bf9a0383a2fda339a339f17e677e31794c5..8c3b0a23dea39a370361315382fe63ed3bc7cbcd 100644 (file)
@@ -1602,18 +1602,18 @@ Eina_Bool ewk_view_context_menu_forward_event(Evas_Object* ewkView, const Evas_E
     if (priv->contextMenu)
         ewk_context_menu_free(priv->contextMenu);
 
     if (priv->contextMenu)
         ewk_context_menu_free(priv->contextMenu);
 
-    WebCore::Frame* mainFrame = priv->page->mainFrame();
+    WebCore::Frame& mainFrame = priv->page->mainFrame();
     Evas_Coord x, y;
     evas_object_geometry_get(smartData->self, &x, &y, 0, 0);
 
     WebCore::PlatformMouseEvent event(downEvent, WebCore::IntPoint(x, y));
 
     Evas_Coord x, y;
     evas_object_geometry_get(smartData->self, &x, &y, 0, 0);
 
     WebCore::PlatformMouseEvent event(downEvent, WebCore::IntPoint(x, y));
 
-    if (mainFrame->view()) {
+    if (mainFrame.view()) {
         mouse_press_handled =
         mouse_press_handled =
-            mainFrame->eventHandler().handleMousePressEvent(event);
+            mainFrame.eventHandler().handleMousePressEvent(event);
     }
 
     }
 
-    if (!mainFrame->eventHandler().sendContextMenuEvent(event))
+    if (!mainFrame.eventHandler().sendContextMenuEvent(event))
         return false;
 
     WebCore::ContextMenu* coreMenu =
         return false;
 
     WebCore::ContextMenu* coreMenu =
@@ -4151,8 +4151,8 @@ WebCore::FloatRect ewk_view_page_rect_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0));
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0));
 
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0));
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, WebCore::FloatRect(-1.0, -1.0, -1.0, -1.0));
 
-    WebCore::Frame* main_frame = priv->page->mainFrame();
-    return main_frame->view()->frameRect();
+    WebCore::Frame& main_frame = priv->page->mainFrame();
+    return main_frame.view()->frameRect();
 }
 
 #if ENABLE(TOUCH_EVENTS)
 }
 
 #if ENABLE(TOUCH_EVENTS)
index 709c3551b08345ee1177303ef8aa844b02a9d6a9..5e3a724d04f1356b0bfac6a48425e8cf3e88e09e 100644 (file)
@@ -333,7 +333,7 @@ bool AcceleratedCompositingContext::flushPendingLayerChanges()
 {
     m_rootLayer->flushCompositingStateForThisLayerOnly();
     m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
 {
     m_rootLayer->flushCompositingStateForThisLayerOnly();
     m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
-    return core(m_webView)->mainFrame()->view()->flushCompositingStateIncludingSubframes();
+    return core(m_webView)->mainFrame().view()->flushCompositingStateIncludingSubframes();
 }
 
 void AcceleratedCompositingContext::flushAndRenderLayers()
 }
 
 void AcceleratedCompositingContext::flushAndRenderLayers()
@@ -341,10 +341,10 @@ void AcceleratedCompositingContext::flushAndRenderLayers()
     if (!enabled())
         return;
 
     if (!enabled())
         return;
 
-    Frame* frame = core(m_webView)->mainFrame();
-    if (!frame || !frame->contentRenderer() || !frame->view())
+    Frame& frame = core(m_webView)->mainFrame();
+    if (!frame.contentRenderer() || !frame.view())
         return;
         return;
-    frame->view()->updateLayoutAndStyleIfNeededRecursive();
+    frame.view()->updateLayoutAndStyleIfNeededRecursive();
 
     if (!enabled())
         return;
 
     if (!enabled())
         return;
@@ -388,7 +388,7 @@ void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, Graphics
 {
     context.save();
     context.clip(rectToPaint);
 {
     context.save();
     context.clip(rectToPaint);
-    core(m_webView)->mainFrame()->view()->paint(&context, rectToPaint);
+    core(m_webView)->mainFrame().view()->paint(&context, rectToPaint);
     context.restore();
 }
 
     context.restore();
 }
 
index 547cbcdfe017ccfb25eb6efae71883cc88f6daee..986689795f328931fe5f378f86ad74a8bddb65a6 100644 (file)
@@ -596,13 +596,13 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
         return;
     }
 
         return;
     }
 
-    Frame* frame = core(m_webView)->mainFrame();
-    if (!frame || !frame->contentRenderer() || !frame->view())
+    Frame& frame = core(m_webView)->mainFrame();
+    if (!frame.contentRenderer() || !frame.view())
         return;
 
         return;
 
-    frame->view()->updateLayoutAndStyleIfNeededRecursive();
+    frame.view()->updateLayoutAndStyleIfNeededRecursive();
     performAllPendingScrolls();
     performAllPendingScrolls();
-    paintWebView(m_webView, frame, m_dirtyRegion);
+    paintWebView(m_webView, &frame, m_dirtyRegion);
 
     HashSet<GtkWidget*> children = m_webView->priv->children;
     HashSet<GtkWidget*>::const_iterator end = children.end();
 
     HashSet<GtkWidget*> children = m_webView->priv->children;
     HashSet<GtkWidget*>::const_iterator end = children.end();
@@ -625,7 +625,7 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
     // the selection changing.
     Frame* focusedFrame = core(m_webView)->focusController().focusedOrMainFrame();
     if (focusedFrame && focusedFrame->editor().canEdit())
     // the selection changing.
     Frame* focusedFrame = core(m_webView)->focusController().focusedOrMainFrame();
     if (focusedFrame && focusedFrame->editor().canEdit())
-        m_webView->priv->imFilter.setCursorRect(frame->selection().absoluteCaretBounds());
+        m_webView->priv->imFilter.setCursorRect(frame.selection().absoluteCaretBounds());
 }
 
 void ChromeClient::forcePaint()
 }
 
 void ChromeClient::forcePaint()
@@ -752,7 +752,7 @@ void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
         gtk_widget_queue_resize_no_redraw(widget);
 
     // If this was a main frame size change, update the scrollbars.
         gtk_widget_queue_resize_no_redraw(widget);
 
     // If this was a main frame size change, update the scrollbars.
-    if (frame != frame->page()->mainFrame())
+    if (frame != &frame->page()->mainFrame())
         return;
     m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
 }
         return;
     m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
 }
index 3c1edacbe831fbb571a0de13123b04af1f0bb70b..e9615d15e4e42d09f398b4004634f29332bb2a81 100644 (file)
@@ -1226,7 +1226,7 @@ void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cached
     ASSERT(cachedFrame->view());
 
     Frame* frame = core(m_frame);
     ASSERT(cachedFrame->view());
 
     Frame* frame = core(m_frame);
-    if (frame != frame->page()->mainFrame())
+    if (frame != &frame->page()->mainFrame())
         return;
 
     postCommitFrameViewSetup(m_frame);
         return;
 
     postCommitFrameViewSetup(m_frame);
@@ -1246,7 +1246,7 @@ void FrameLoaderClient::transitionToCommittedForNewPage()
     frame->createView(size, backgroundColor, transparent);
 
     // We need to do further manipulation on the FrameView if it was the mainFrame
     frame->createView(size, backgroundColor, transparent);
 
     // We need to do further manipulation on the FrameView if it was the mainFrame
-    if (frame != frame->page()->mainFrame())
+    if (frame != &frame->page()->mainFrame())
         return;
 
     postCommitFrameViewSetup(m_frame);
         return;
 
     postCommitFrameViewSetup(m_frame);
index 24b040386fe922a065b82c9c22a7ad009dd8f02a..1acddf52cda036bfb0bfb8eeffad7d54676dab5f 100644 (file)
@@ -62,10 +62,10 @@ void GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars()
         return;
     if (m_handlingGtkAdjustmentChange)
         return;
         return;
     if (m_handlingGtkAdjustmentChange)
         return;
-    if (!core(m_webView) || !core(m_webView)->mainFrame())
+    if (!core(m_webView))
         return;
 
         return;
 
-    FrameView* frameView = core(m_webView)->mainFrame()->view();
+    FrameView* frameView = core(m_webView)->mainFrame().view();
     updateAdjustmentFromScrollbar(m_horizontalAdjustment.get(), frameView->horizontalScrollbar());
     updateAdjustmentFromScrollbar(m_verticalAdjustment.get(), frameView->verticalScrollbar());
     if (m_updateAdjustmentCallbackId) {
     updateAdjustmentFromScrollbar(m_horizontalAdjustment.get(), frameView->horizontalScrollbar());
     updateAdjustmentFromScrollbar(m_verticalAdjustment.get(), frameView->verticalScrollbar());
     if (m_updateAdjustmentCallbackId) {
@@ -123,7 +123,7 @@ void GtkAdjustmentWatcher::setVerticalAdjustment(GtkAdjustment* newAdjustment)
 
 void GtkAdjustmentWatcher::adjustmentValueChanged(GtkAdjustment* adjustment)
 {
 
 void GtkAdjustmentWatcher::adjustmentValueChanged(GtkAdjustment* adjustment)
 {
-    FrameView* frameView = core(m_webView)->mainFrame()->view();
+    FrameView* frameView = core(m_webView)->mainFrame().view();
     Scrollbar* scrollbar = (adjustment == m_horizontalAdjustment.get()) ? 
         frameView->horizontalScrollbar() : frameView->verticalScrollbar();
     if (!scrollbar)
     Scrollbar* scrollbar = (adjustment == m_horizontalAdjustment.get()) ? 
         frameView->horizontalScrollbar() : frameView->verticalScrollbar();
     if (!scrollbar)
index 97724668cf8ed9f9f7563d148da22d96cd1b43d2..fda3ea3e85798616b63229f97e46dd43627db342 100644 (file)
@@ -532,7 +532,7 @@ void webkitViewportAttributesRecompute(WebKitViewportAttributes* viewportAttribu
     // First of all, we give the application an opportunity to override some of the values.
     g_signal_emit_by_name(webView, "viewport-attributes-recompute-requested", viewportAttributes);
 
     // First of all, we give the application an opportunity to override some of the values.
     g_signal_emit_by_name(webView, "viewport-attributes-recompute-requested", viewportAttributes);
 
-    ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
+    ViewportArguments arguments = webView->priv->corePage->mainFrame().document()->viewportArguments();
 
     float devicePixelRatio = priv->deviceDPI / ViewportArguments::deprecatedTargetDPI;
     ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, devicePixelRatio, IntSize(priv->availableWidth, priv->availableHeight));
 
     float devicePixelRatio = priv->deviceDPI / ViewportArguments::deprecatedTargetDPI;
     ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, devicePixelRatio, IntSize(priv->availableWidth, priv->availableHeight));
index 753b949172902752afe8683a0a84ba17d7d017c8..6d1f9442dc06abe1e6c9c1968bd44f52de4f62ad 100644 (file)
@@ -552,8 +552,8 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView)
     WebKitWebViewPrivate* viewPriv = webView->priv;
 
     priv->webView = webView;
     WebKitWebViewPrivate* viewPriv = webView->priv;
 
     priv->webView = webView;
-    priv->coreFrame = viewPriv->corePage->mainFrame();
-    static_cast<WebKit::FrameLoaderClient*>(&viewPriv->corePage->mainFrame()->loader().client())->setWebFrame(frame);
+    priv->coreFrame = &viewPriv->corePage->mainFrame();
+    static_cast<WebKit::FrameLoaderClient*>(&viewPriv->corePage->mainFrame().loader().client())->setWebFrame(frame);
     priv->coreFrame->init();
 
     priv->origin = 0;
     priv->coreFrame->init();
 
     priv->origin = 0;
index 45185df4ae86e3564b59abbc4584523c0ca48126..b51698ccc39e00523e34ee8f5e7ca41f065c2ea3 100644 (file)
@@ -347,7 +347,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
     Page* page = core(webView);
     page->contextMenuController().clearContextMenu();
     Frame* focusedFrame;
     Page* page = core(webView);
     page->contextMenuController().clearContextMenu();
     Frame* focusedFrame;
-    Frame* mainFrame = page->mainFrame();
+    Frame* mainFrame = &page->mainFrame();
     gboolean mousePressEventResult = FALSE;
     GRefPtr<WebKitHitTestResult> hitTestResult;
 
     gboolean mousePressEventResult = FALSE;
     GRefPtr<WebKitHitTestResult> hitTestResult;
 
@@ -742,12 +742,12 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu
         return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event), false);
 #endif
 
         return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event), false);
 #endif
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame->view())
+    Frame& frame = core(webView)->mainFrame();
+    if (!frame.view())
         return FALSE;
 
     priv->imFilter.notifyMouseButtonPress();
         return FALSE;
 
     priv->imFilter.notifyMouseButtonPress();
-    gboolean result = frame->eventHandler().handleMousePressEvent(platformEvent);
+    gboolean result = frame.eventHandler().handleMousePressEvent(platformEvent);
 
     return result;
 }
 
     return result;
 }
@@ -756,9 +756,9 @@ static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEvent
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
-    Frame* mainFrame = core(webView)->mainFrame();
-    if (mainFrame->view())
-        mainFrame->eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(event));
+    Frame& mainFrame = core(webView)->mainFrame();
+    if (mainFrame.view())
+        mainFrame.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(event));
 
     /* We always return FALSE here because WebKit can, for the same click, decide
      * to not handle press-event but handle release-event, which can totally confuse
 
     /* We always return FALSE here because WebKit can, for the same click, decide
      * to not handle press-event but handle release-event, which can totally confuse
@@ -774,23 +774,23 @@ static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion*
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame->view())
+    Frame& frame = core(webView)->mainFrame();
+    if (!frame.view())
         return FALSE;
 
         return FALSE;
 
-    return frame->eventHandler().mouseMoved(PlatformMouseEvent(event));
+    return frame.eventHandler().mouseMoved(PlatformMouseEvent(event));
 }
 
 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
 }
 
 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame->view())
+    Frame& frame = core(webView)->mainFrame();
+    if (!frame.view())
         return FALSE;
 
     PlatformWheelEvent wheelEvent(event);
         return FALSE;
 
     PlatformWheelEvent wheelEvent(event);
-    return frame->eventHandler().handleWheelEvent(wheelEvent);
+    return frame.eventHandler().handleWheelEvent(wheelEvent);
 }
 
 #ifdef GTK_API_VERSION_2
 }
 
 #ifdef GTK_API_VERSION_2
@@ -856,7 +856,7 @@ static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* a
 {
     Page* page = core(webView);
     IntSize oldSize;
 {
     Page* page = core(webView);
     IntSize oldSize;
-    FrameView* frameView = page->mainFrame()->view();
+    FrameView* frameView = page->mainFrame().view();
     if (sizeChanged && frameView) {
         oldSize = frameView->size();
         frameView->resize(allocation->width, allocation->height);
     if (sizeChanged && frameView) {
         oldSize = frameView->size();
         frameView->resize(allocation->width, allocation->height);
@@ -914,7 +914,7 @@ static void webkit_web_view_grab_focus(GtkWidget* widget)
         if (focusController.focusedFrame())
             focusController.setFocused(true);
         else
         if (focusController.focusedFrame())
             focusController.setFocused(true);
         else
-            focusController.setFocusedFrame(core(webView)->mainFrame());
+            focusController.setFocusedFrame(&core(webView)->mainFrame());
     }
 
     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget);
     }
 
     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget);
@@ -935,7 +935,7 @@ static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus*
     if (focusController.focusedFrame())
         focusController.setFocused(true);
     else
     if (focusController.focusedFrame())
         focusController.setFocused(true);
     else
-        focusController.setFocusedFrame(core(webView)->mainFrame());
+        focusController.setFocusedFrame(&core(webView)->mainFrame());
 
     if (focusController.focusedFrame()->editor().canEdit())
         webView->priv->imFilter.notifyFocusedIn();
 
     if (focusController.focusedFrame()->editor().canEdit())
         webView->priv->imFilter.notifyFocusedIn();
@@ -1407,11 +1407,9 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
     if (!AXObjectCache::accessibilityEnabled())
         AXObjectCache::enableAccessibility();
 
     if (!AXObjectCache::accessibilityEnabled())
         AXObjectCache::enableAccessibility();
 
-    Frame* coreFrame = core(webView)->mainFrame();
-    if (!coreFrame)
-        return 0;
+    Frame& coreFrame = core(webView)->mainFrame();
 
 
-    Document* doc = coreFrame->document();
+    Document* doc = coreFrame.document();
     if (!doc)
         return 0;
 
     if (!doc)
         return 0;
 
@@ -4225,7 +4223,7 @@ void webkit_web_view_reload(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    core(webView)->mainFrame()->loader().reload();
+    core(webView)->mainFrame().loader().reload();
 }
 
 /**
 }
 
 /**
@@ -4240,7 +4238,7 @@ void webkit_web_view_reload_bypass_cache(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    core(webView)->mainFrame()->loader().reload(true);
+    core(webView)->mainFrame().loader().reload(true);
 }
 
 /**
 }
 
 /**
@@ -4334,7 +4332,7 @@ void webkit_web_view_stop_loading(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    core(webView)->mainFrame()->loader().stopForUserCancel();
+    core(webView)->mainFrame().loader().stopForUserCancel();
 }
 
 /**
 }
 
 /**
@@ -4392,7 +4390,7 @@ void webkit_web_view_set_highlight_text_matches(WebKitWebView* webView, gboolean
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    Frame *frame = core(webView)->mainFrame();
+    Frame* frame = &core(webView)->mainFrame();
     do {
         frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
         frame = frame->tree().traverseNextWithWrap(false);
     do {
         frame->editor().setMarkedTextMatchesAreHighlighted(shouldHighlight);
         frame = frame->tree().traverseNextWithWrap(false);
@@ -4448,7 +4446,7 @@ void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script)
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(script);
 
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(script);
 
-    core(webView)->mainFrame()->script().executeScript(String::fromUTF8(script), true);
+    core(webView)->mainFrame().script().executeScript(String::fromUTF8(script), true);
 }
 
 /**
 }
 
 /**
@@ -4630,11 +4628,8 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag)
 
     core(webView)->setEditable(flag);
 
 
     core(webView)->setEditable(flag);
 
-    Frame* frame = core(webView)->mainFrame();
-    g_return_if_fail(frame);
-
     if (flag) {
     if (flag) {
-        frame->editor().applyEditingStyleToBodyElement();
+        core(webView)->mainFrame().editor().applyEditingStyleToBodyElement();
         // TODO: If the WebKitWebView is made editable and the selection is empty, set it to something.
         //if (!webkit_web_view_get_selected_dom_range(webView))
         //    mainFrame->setSelectionFromNone();
         // TODO: If the WebKitWebView is made editable and the selection is empty, set it to something.
         //if (!webkit_web_view_get_selected_dom_range(webView))
         //    mainFrame->setSelectionFromNone();
@@ -4732,9 +4727,7 @@ void webkit_web_view_set_transparent(WebKitWebView* webView, gboolean flag)
 
     // TODO: This needs to be made persistent or it could become a problem when
     // the main frame is replaced.
 
     // TODO: This needs to be made persistent or it could become a problem when
     // the main frame is replaced.
-    Frame* frame = core(webView)->mainFrame();
-    g_return_if_fail(frame);
-    frame->view()->setTransparent(flag);
+    core(webView)->mainFrame().view()->setTransparent(flag);
     g_object_notify(G_OBJECT(webView), "transparent");
 }
 
     g_object_notify(G_OBJECT(webView), "transparent");
 }
 
@@ -4756,25 +4749,20 @@ gfloat webkit_web_view_get_zoom_level(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0f);
 
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0f);
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame)
-        return 1.0f;
-
+    Frame& frame = core(webView)->mainFrame();
     WebKitWebViewPrivate* priv = webView->priv;
     WebKitWebViewPrivate* priv = webView->priv;
-    return priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor();
+    return priv->zoomFullContent ? frame.pageZoomFactor() : frame.textZoomFactor();
 }
 
 static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoomLevel)
 {
 }
 
 static void webkit_web_view_apply_zoom_level(WebKitWebView* webView, gfloat zoomLevel)
 {
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame)
-        return;
+    Frame& frame = core(webView)->mainFrame();
 
     WebKitWebViewPrivate* priv = webView->priv;
     if (priv->zoomFullContent)
 
     WebKitWebViewPrivate* priv = webView->priv;
     if (priv->zoomFullContent)
-        frame->setPageZoomFactor(zoomLevel);
+        frame.setPageZoomFactor(zoomLevel);
     else
     else
-        frame->setTextZoomFactor(zoomLevel);
+        frame.setTextZoomFactor(zoomLevel);
 }
 
 /**
 }
 
 /**
@@ -4877,17 +4865,15 @@ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom
     if (priv->zoomFullContent == zoomFullContent)
       return;
 
     if (priv->zoomFullContent == zoomFullContent)
       return;
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame)
-      return;
+    Frame& frame = core(webView)->mainFrame();
 
 
-    gfloat zoomLevel = priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor();
+    gfloat zoomLevel = priv->zoomFullContent ? frame.pageZoomFactor() : frame.textZoomFactor();
 
     priv->zoomFullContent = zoomFullContent;
     if (priv->zoomFullContent)
 
     priv->zoomFullContent = zoomFullContent;
     if (priv->zoomFullContent)
-        frame->setPageAndTextZoomFactors(zoomLevel, 1);
+        frame.setPageAndTextZoomFactors(zoomLevel, 1);
     else
     else
-        frame->setPageAndTextZoomFactors(1, zoomLevel);
+        frame.setPageAndTextZoomFactors(1, zoomLevel);
 
     g_object_notify(G_OBJECT(webView), "full-content-zoom");
 }
 
     g_object_notify(G_OBJECT(webView), "full-content-zoom");
 }
@@ -4941,7 +4927,7 @@ gdouble webkit_web_view_get_progress(WebKitWebView* webView)
 const gchar* webkit_web_view_get_encoding(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
 const gchar* webkit_web_view_get_encoding(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
-    String encoding = core(webView)->mainFrame()->document()->encoding();
+    String encoding = core(webView)->mainFrame().document()->encoding();
     if (encoding.isEmpty())
         return 0;
     webView->priv->encoding = encoding.utf8();
     if (encoding.isEmpty())
         return 0;
     webView->priv->encoding = encoding.utf8();
@@ -4962,7 +4948,7 @@ void webkit_web_view_set_custom_encoding(WebKitWebView* webView, const char* enc
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    core(webView)->mainFrame()->loader().reloadWithOverrideEncoding(String::fromUTF8(encoding));
+    core(webView)->mainFrame().loader().reloadWithOverrideEncoding(String::fromUTF8(encoding));
 }
 
 /**
 }
 
 /**
@@ -4979,7 +4965,7 @@ void webkit_web_view_set_custom_encoding(WebKitWebView* webView, const char* enc
 const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
 const char* webkit_web_view_get_custom_encoding(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
-    String overrideEncoding = core(webView)->mainFrame()->loader().documentLoader()->overrideEncoding();
+    String overrideEncoding = core(webView)->mainFrame().loader().documentLoader()->overrideEncoding();
     if (overrideEncoding.isEmpty())
         return 0;
     webView->priv->customEncoding = overrideEncoding.utf8();
     if (overrideEncoding.isEmpty())
         return 0;
     webView->priv->customEncoding = overrideEncoding.utf8();
@@ -5165,8 +5151,7 @@ void webkit_web_view_set_view_source_mode (WebKitWebView* webView, gboolean mode
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    if (Frame* mainFrame = core(webView)->mainFrame())
-        mainFrame->setInViewSourceMode(mode);
+    core(webView)->mainFrame().setInViewSourceMode(mode);
 }
 
 /**
 }
 
 /**
@@ -5181,8 +5166,7 @@ gboolean webkit_web_view_get_view_source_mode (WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 
-    if (Frame* mainFrame = core(webView)->mainFrame())
-        return mainFrame->inViewSourceMode();
+    core(webView)->mainFrame().inViewSourceMode();
 
     return FALSE;
 }
 
     return FALSE;
 }
@@ -5259,7 +5243,7 @@ GList* webkit_web_view_get_subresources(WebKitWebView* webView)
     GList* subResources = 0;
     Vector<PassRefPtr<ArchiveResource> > coreSubResources;
 
     GList* subResources = 0;
     Vector<PassRefPtr<ArchiveResource> > coreSubResources;
 
-    core(webView)->mainFrame()->loader().documentLoader()->getSubresources(coreSubResources);
+    core(webView)->mainFrame().loader().documentLoader()->getSubresources(coreSubResources);
 
     for (unsigned i = 0; i < coreSubResources.size(); i++) {
         WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, NULL));
 
     for (unsigned i = 0; i < coreSubResources.size(); i++) {
         WebKitWebResource* webResource = WEBKIT_WEB_RESOURCE(g_object_new(WEBKIT_TYPE_WEB_RESOURCE, NULL));
@@ -5337,7 +5321,7 @@ WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView,
 const gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
 const gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
-    String iconURL = iconDatabase().synchronousIconURLForPageURL(core(webView)->mainFrame()->document()->url().string());
+    String iconURL = iconDatabase().synchronousIconURLForPageURL(core(webView)->mainFrame().document()->url().string());
     webView->priv->iconURI = iconURL.utf8();
     return webView->priv->iconURI.data();
 }
     webView->priv->iconURI = iconURL.utf8();
     return webView->priv->iconURI.data();
 }
@@ -5448,11 +5432,11 @@ webkit_web_view_get_snapshot(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
 
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
 
-    Frame* frame = core(webView)->mainFrame();
-    if (!frame || !frame->contentRenderer() || !frame->view())
+    Frame& frame = core(webView)->mainFrame();
+    if (!frame.contentRenderer() || !frame.view())
         return 0;
 
         return 0;
 
-    frame->view()->updateLayoutAndStyleIfNeededRecursive();
+    frame.view()->updateLayoutAndStyleIfNeededRecursive();
     GtkAllocation allocation;
     gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation);
     cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height);
     GtkAllocation allocation;
     gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation);
     cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height);
@@ -5460,12 +5444,12 @@ webkit_web_view_get_snapshot(WebKitWebView* webView)
     GraphicsContext gc(cr.get());
 
     IntRect rect = allocation;
     GraphicsContext gc(cr.get());
 
     IntRect rect = allocation;
-    gc.applyDeviceScaleFactor(frame->page()->deviceScaleFactor());
+    gc.applyDeviceScaleFactor(frame.page()->deviceScaleFactor());
     gc.save();
     gc.clip(rect);
     if (webView->priv->transparent)
         gc.clearRect(rect);
     gc.save();
     gc.clip(rect);
     if (webView->priv->transparent)
         gc.clearRect(rect);
-    frame->view()->paint(&gc, rect);
+    frame.view()->paint(&gc, rect);
     gc.restore();
 
     return surface;
     gc.restore();
 
     return surface;
index 3942fd941124c5afd6ea37c023bd802cee24ab6f..2d030974968af817ad84df167469f8be3b7d59e0 100644 (file)
@@ -63,7 +63,7 @@ static WebHTMLView *getTopHTMLView(Frame* frame)
 {
     ASSERT(frame);
     ASSERT(frame->page());
 {
     ASSERT(frame);
     ASSERT(frame->page());
-    return (WebHTMLView*)[[kit(frame->page()->mainFrame()) frameView] documentView];
+    return (WebHTMLView*)[[kit(&frame->page()->mainFrame()) frameView] documentView];
 }
 
 WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(WebCore::DragData* dragData)
 }
 
 WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(WebCore::DragData* dragData)
index 23bcae6597aacf7d7bfae3adbb7fd10c38065057..1cacd16659da6103e961f5c46e320f156ec590e6 100644 (file)
@@ -1065,7 +1065,7 @@ bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest& request) cons
 {
     Frame* frame = core(m_webFrame.get());
     Page* page = frame->page();
 {
     Frame* frame = core(m_webFrame.get());
     Page* page = frame->page();
-    BOOL forMainFrame = page && page->mainFrame() == frame;
+    BOOL forMainFrame = page && &page->mainFrame() == frame;
     return [WebView _canHandleRequest:request.nsURLRequest(UpdateHTTPBody) forMainFrame:forMainFrame];
 }
 
     return [WebView _canHandleRequest:request.nsURLRequest(UpdateHTTPBody) forMainFrame:forMainFrame];
 }
 
@@ -1265,7 +1265,7 @@ void WebFrameLoaderClient::transitionToCommittedForNewPage()
     // If we own the view, delete the old one - otherwise the render m_frame will take care of deleting the view.
     Frame* coreFrame = core(m_webFrame.get());
     Page* page = coreFrame->page();
     // If we own the view, delete the old one - otherwise the render m_frame will take care of deleting the view.
     Frame* coreFrame = core(m_webFrame.get());
     Page* page = coreFrame->page();
-    bool isMainFrame = coreFrame == page->mainFrame();
+    bool isMainFrame = coreFrame == &page->mainFrame();
     if (isMainFrame && coreFrame->view())
         coreFrame->view()->setParentVisible(false);
     coreFrame->setView(0);
     if (isMainFrame && coreFrame->view())
         coreFrame->view()->setParentVisible(false);
     coreFrame->setView(0);
index 65ba3625eacfb6fc3113e59917986032d80615b5..ac211fbb99414e119bb1fca47078f4a600f9d2f1 100644 (file)
@@ -327,7 +327,7 @@ void WebInspectorFrontendClient::save(const String& suggestedURL, const String&
         
         m_suggestedToActualURLMap.set(suggestedURLCopy, actualURL);
         [contentCopy writeToURL:actualURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
         
         m_suggestedToActualURLMap.set(suggestedURLCopy, actualURL);
         [contentCopy writeToURL:actualURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
-        core([m_windowController webView])->mainFrame()->script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
+        core([m_windowController webView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
     };
 
     if (!forceSaveDialog) {
     };
 
     if (!forceSaveDialog) {
@@ -361,7 +361,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
     [handle writeData:[content dataUsingEncoding:NSUTF8StringEncoding]];
     [handle closeFile];
 
     [handle writeData:[content dataUsingEncoding:NSUTF8StringEncoding]];
     [handle closeFile];
 
-    core([m_windowController webView])->mainFrame()->script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
+    core([m_windowController webView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
 }
 
 // MARK: -
 }
 
 // MARK: -
index 5f2ad8ce7ccffa6932187ab77d570888372b71fd..e29bbd99e74922f3754ff751170b18e0ea0979c9 100644 (file)
@@ -131,7 +131,7 @@ void WebPlatformStrategies::getPluginInfo(const Page* page, Vector<PluginInfo>&
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
     // WebKit1 has no application plug-ins, so we don't need to add them here.
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
     // WebKit1 has no application plug-ins, so we don't need to add them here.
-    if (!page->mainFrame()->loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
+    if (!page->mainFrame().loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
         return;
 
     NSArray* pluginsArray = [[WebPluginDatabase sharedDatabase] plugins];
         return;
 
     NSArray* pluginsArray = [[WebPluginDatabase sharedDatabase] plugins];
index c61d9e154f110adb733bb3639c1dedba75c6b8a4..2874c279dba000c5bc915d40dc57afa8b4968e0c 100644 (file)
@@ -286,12 +286,12 @@ WebView *getWebView(WebFrame *webFrame)
     WebView *webView = kit(page);
 
     WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
     WebView *webView = kit(page);
 
     WebFrame *frame = [[self alloc] _initWithWebFrameView:frameView webView:webView];
-    frame->_private->coreFrame = page->mainFrame();
-    static_cast<WebFrameLoaderClient&>(page->mainFrame()->loader().client()).setWebFrame(frame);
+    frame->_private->coreFrame = &page->mainFrame();
+    static_cast<WebFrameLoaderClient&>(page->mainFrame().loader().client()).setWebFrame(frame);
     [frame release];
 
     [frame release];
 
-    page->mainFrame()->tree().setName(name);
-    page->mainFrame()->init();
+    page->mainFrame().tree().setName(name);
+    page->mainFrame().init();
 
     [webView _setZoomMultiplier:[webView _realZoomMultiplier] isTextOnly:[webView _realZoomMultiplierIsTextOnly]];
 }
 
     [webView _setZoomMultiplier:[webView _realZoomMultiplier] isTextOnly:[webView _realZoomMultiplierIsTextOnly]];
 }
index d4fed3eea63c14c3c7cdd94ae7152bb028c29b70..cb03f422b956e75aa2c919257bf9e6aa56308516 100644 (file)
@@ -281,7 +281,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
     // If this isn't the main frame, it must have an owner element set, or it
     // won't ever get installed in the view hierarchy.
 
     // If this isn't the main frame, it must have an owner element set, or it
     // won't ever get installed in the view hierarchy.
-    ASSERT(frame == frame->page()->mainFrame() || frame->ownerElement());
+    ASSERT(frame == &frame->page()->mainFrame() || frame->ownerElement());
 
     FrameView* view = frame->view();
 
 
     FrameView* view = frame->view();
 
index 12a83c98ac232f7da84549d35f8aee2b8ed9a1e8..9126c171778faea19e057ac95fd29120d3f8df33 100644 (file)
@@ -3590,7 +3590,7 @@ static void setMenuTargets(NSMenu* menu)
     if (!_private->ignoringMouseDraggedEvents) {
         if (Frame* frame = core([self _frame])) {
             if (Page* page = frame->page())
     if (!_private->ignoringMouseDraggedEvents) {
         if (Frame* frame = core([self _frame])) {
             if (Page* page = frame->page())
-                page->mainFrame()->eventHandler().mouseDragged(event);
+                page->mainFrame().eventHandler().mouseDragged(event);
         }
     }
 
         }
     }
 
@@ -3717,7 +3717,7 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension
     [self _stopAutoscrollTimer];
     if (Frame* frame = core([self _frame])) {
         if (Page* page = frame->page())
     [self _stopAutoscrollTimer];
     if (Frame* frame = core([self _frame])) {
         if (Page* page = frame->page())
-            page->mainFrame()->eventHandler().mouseUp(event);
+            page->mainFrame().eventHandler().mouseUp(event);
     }
     [self _updateMouseoverWithFakeEvent];
 
     }
     [self _updateMouseoverWithFakeEvent];
 
index 0b4a4ccfe186389f306e15ef20f27552ad49db4a..8e01f75e1f11af2fb55e04b430b82526f2fb9971 100644 (file)
@@ -1299,7 +1299,7 @@ static bool fastDocumentTeardownEnabled()
             // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
             // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
-            otherView->_private->page->mainFrame()->loader().history().saveDocumentAndScrollState();
+            otherView->_private->page->mainFrame().loader().history().saveDocumentAndScrollState();
         }
         RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
         if (i == 0) 
         }
         RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
         if (i == 0) 
@@ -2005,7 +2005,7 @@ static inline IMP getMethod(id o, SEL s)
     if (!_private->page)
         return nil;
 
     if (!_private->page)
         return nil;
 
-    if (CFURLStorageSessionRef storageSession = _private->page->mainFrame()->loader().networkingContext()->storageSession().platformSession())
+    if (CFURLStorageSessionRef storageSession = _private->page->mainFrame().loader().networkingContext()->storageSession().platformSession())
         cachedResponse = WKCachedResponseForRequest(storageSession, request.get());
     else
         cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()];
         cachedResponse = WKCachedResponseForRequest(storageSession, request.get());
     else
         cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()];
@@ -2457,7 +2457,7 @@ static inline IMP getMethod(id o, SEL s)
 
 - (void)_clearMainFrameName
 {
 
 - (void)_clearMainFrameName
 {
-    _private->page->mainFrame()->tree().clearName();
+    _private->page->mainFrame().tree().clearName();
 }
 
 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag
 }
 
 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag
@@ -3918,7 +3918,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
     // This can be called in initialization, before _private has been set up (3465613)
     if (!_private || !_private->page)
         return nil;
     // This can be called in initialization, before _private has been set up (3465613)
     if (!_private || !_private->page)
         return nil;
-    return kit(_private->page->mainFrame());
+    return kit(&_private->page->mainFrame());
 }
 
 - (WebFrame *)selectedFrame
 }
 
 - (WebFrame *)selectedFrame
@@ -5418,7 +5418,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSC::JSValue j
     Page* page = core(self);
     if (!page)
         return nil;
     Page* page = core(self);
     if (!page)
         return nil;
-    return kit(page->mainFrame()->editor().rangeForPoint(IntPoint([self convertPoint:point toView:nil])).get());
+    return kit(page->mainFrame().editor().rangeForPoint(IntPoint([self convertPoint:point toView:nil])).get());
 }
 
 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
 }
 
 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
@@ -6385,7 +6385,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num)
 
 - (Frame*)_mainCoreFrame
 {
 
 - (Frame*)_mainCoreFrame
 {
-    return (_private && _private->page) ? _private->page->mainFrame() : 0;
+    return (_private && _private->page) ? &_private->page->mainFrame() : 0;
 }
 
 - (WebFrame *)_selectedOrMainFrame
 }
 
 - (WebFrame *)_selectedOrMainFrame
index e0e78adaf2f4e41fd26dc0a13098c6b1a25de852..546281a9dbed7a2af1ed1eb9c19fd64f510f3b18 100644 (file)
@@ -334,7 +334,7 @@ bool ChromeClientQt::runBeforeUnloadConfirmPanel(const String& message, Frame* f
 void ChromeClientQt::closeWindowSoon()
 {
     m_webPage->page->setGroupName(String());
 void ChromeClientQt::closeWindowSoon()
 {
     m_webPage->page->setGroupName(String());
-    m_webPage->page->mainFrame()->loader().stopAllLoaders();
+    m_webPage->page->mainFrame().loader().stopAllLoaders();
     QMetaObject::invokeMethod(m_webPage->handle(), "windowCloseRequested");
 }
 
     QMetaObject::invokeMethod(m_webPage->handle(), "windowCloseRequested");
 }
 
index f2efab2e6f11f0f9840509326cad308c1181dfb2..0e7b7e42843a92f18b1d9bdc2c9489b261833d63 100644 (file)
@@ -692,7 +692,7 @@ QStringList DumpRenderTreeSupportQt::contextMenu(QWebPageAdapter* page)
 bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPageAdapter *adapter, const QUrl& url, const QUrl& firstPartyUrl)
 {
     Page* corePage = adapter->page;
 bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPageAdapter *adapter, const QUrl& url, const QUrl& firstPartyUrl)
 {
     Page* corePage = adapter->page;
-    return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader().networkingContext(), url, firstPartyUrl);
+    return thirdPartyCookiePolicyPermits(corePage->mainFrame().loader().networkingContext(), url, firstPartyUrl);
 }
 
 void DumpRenderTreeSupportQt::enableMockScrollbars()
 }
 
 void DumpRenderTreeSupportQt::enableMockScrollbars()
index 2ab32a63fe6a5c9978e92d6053d19de9966ca665..4d33d4dc9e1ff7f5d0423855f508080c036f7af3 100644 (file)
@@ -288,7 +288,7 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
         hScrollbar, hLock,
         vScrollbar, vLock);
 
         hScrollbar, hLock,
         vScrollbar, vLock);
 
-    bool isMainFrame = m_frame == m_frame->page()->mainFrame();
+    bool isMainFrame = m_frame == &m_frame->page()->mainFrame();
     if (isMainFrame &&m_webFrame->pageAdapter->client) {
         bool resizesToContents = m_webFrame->pageAdapter->client->viewResizesToContentsEnabled();
 
     if (isMainFrame &&m_webFrame->pageAdapter->client) {
         bool resizesToContents = m_webFrame->pageAdapter->client->viewResizesToContentsEnabled();
 
@@ -492,7 +492,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
     // This properly resets the title when we navigate to a URI without a title.
     emit titleChanged(QString());
 
     // This properly resets the title when we navigate to a URI without a title.
     emit titleChanged(QString());
 
-    bool isMainFrame = (m_frame == m_frame->page()->mainFrame());
+    bool isMainFrame = (m_frame == &m_frame->page()->mainFrame());
     if (!isMainFrame)
         return;
 
     if (!isMainFrame)
         return;
 
index c982d0332f619bc0acdfebfdc3d5c3f0b7954816..05a37560cda6cf1e48436c213a6edda5f184a8c1 100644 (file)
@@ -251,12 +251,10 @@ void InspectorClientQt::highlight()
 
 void InspectorClientQt::hideHighlight()
 {
 
 void InspectorClientQt::hideHighlight()
 {
-    WebCore::Frame* frame = m_inspectedWebPage->page->mainFrame();
-    if (frame) {
-        QRect rect = m_inspectedWebPage->mainFrameAdapter()->frameRect();
-        if (!rect.isEmpty())
-            frame->view()->invalidateRect(rect);
-    }
+    WebCore::Frame& frame = m_inspectedWebPage->page->mainFrame();
+    QRect rect = m_inspectedWebPage->mainFrameAdapter()->frameRect();
+    if (!rect.isEmpty())
+        frame.view()->invalidateRect(rect);
 }
 
 bool InspectorClientQt::sendMessageToFrontend(const String& message)
 }
 
 bool InspectorClientQt::sendMessageToFrontend(const String& message)
index 600a8713234a5b2388ff8d8f8a366458500f7900..e89a143a90399283730ff3961a252e97ee9fd879 100644 (file)
@@ -126,7 +126,7 @@ const QUrl NotificationWrapper::openerPageUrl() const
     Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
     if (notification) {
         if (notification->scriptExecutionContext()) 
     Notification* notification = NotificationPresenterClientQt::notificationPresenter()->notificationForWrapper(this);
     if (notification) {
         if (notification->scriptExecutionContext()) 
-            url = static_cast<Document*>(notification->scriptExecutionContext())->page()->mainFrame()->document()->url();
+            url = static_cast<Document*>(notification->scriptExecutionContext())->page()->mainFrame().document()->url();
     }
 #endif
     return url;
     }
 #endif
     return url;
@@ -483,7 +483,7 @@ QWebPageAdapter* NotificationPresenterClientQt::toPage(ScriptExecutionContext* c
     Document* document = static_cast<Document*>(context);
 
     Page* page = document->page();
     Document* document = static_cast<Document*>(context);
 
     Page* page = document->page();
-    if (!page || !page->mainFrame())
+    if (!page)
         return 0;
 
     return QWebPageAdapter::kit(page);
         return 0;
 
     return QWebPageAdapter::kit(page);
index 9e3a328f386ef8d8baf2b4d8a81f5ba37b2e5ba3..49c19c188b371803cd222a7f32ea2db11a14ebf1 100644 (file)
@@ -196,7 +196,7 @@ static void openNewWindow(const QUrl& url, Frame* frame)
         NavigationAction action;
         FrameLoadRequest request = frameLoadRequest(url, frame);
         if (Page* newPage = oldPage->chrome().createWindow(frame, request, features, action)) {
         NavigationAction action;
         FrameLoadRequest request = frameLoadRequest(url, frame);
         if (Page* newPage = oldPage->chrome().createWindow(frame, request, features, action)) {
-            newPage->mainFrame()->loader().loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer);
+            newPage->mainFrame().loader().loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer);
             newPage->chrome().show();
         }
     }
             newPage->chrome().show();
         }
     }
@@ -421,8 +421,8 @@ bool QWebPageAdapter::findText(const QString& subString, FindFlag options)
     }
 
     if (subString.isEmpty()) {
     }
 
     if (subString.isEmpty()) {
-        page->mainFrame()->selection().clear();
-        Frame* frame = page->mainFrame()->tree().firstChild();
+        page->mainFrame().selection().clear();
+        Frame* frame = page->mainFrame().tree().firstChild();
         while (frame) {
             frame->selection().clear();
             frame = frame->tree().traverseNextWithWrap(false);
         while (frame) {
             frame->selection().clear();
             frame = frame->tree().traverseNextWithWrap(false);
@@ -453,7 +453,7 @@ void QWebPageAdapter::adjustPointForClicking(QMouseEvent* ev)
     IntRect touchRect(ev->pos().x() - leftPadding, ev->pos().y() - topPadding, leftPadding + rightPadding, topPadding + bottomPadding);
     IntPoint adjustedPoint;
     Node* adjustedNode;
     IntRect touchRect(ev->pos().x() - leftPadding, ev->pos().y() - topPadding, leftPadding + rightPadding, topPadding + bottomPadding);
     IntPoint adjustedPoint;
     Node* adjustedNode;
-    bool foundClickableNode = page->mainFrame()->eventHandler().bestClickableNodeForTouchPoint(touchRect.center(), touchRect.size(), adjustedPoint, adjustedNode);
+    bool foundClickableNode = page->mainFrame().eventHandler().bestClickableNodeForTouchPoint(touchRect.center(), touchRect.size(), adjustedPoint, adjustedNode);
     if (!foundClickableNode)
         return;
 
     if (!foundClickableNode)
         return;
 
index 560f2cf6c8113dce1413a6735530fb1e164f56d0..c73377589507be6b9e5a7e54477d98e8d89f56d2 100644 (file)
@@ -122,7 +122,7 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame)
 
     if (Page* page = frame->page()) {
         UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
 
     if (Page* page = frame->page()) {
         UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-        page->mainFrame()->loader().urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, MaybeSendReferrer);
+        page->mainFrame().loader().urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, MaybeSendReferrer);
     }
 }
 
     }
 }
 
index 9b427cb9d53f388de00d770cc8bfb99b5eb0dbc5..d5ad6d2828a107ed5d6a5dea50ba71b8bc360c8f 100644 (file)
@@ -88,12 +88,12 @@ void WebDragClient::willPerformDragDestinationAction(DragDestinationAction actio
 
 DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& windowPoint)
 {
 
 DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& windowPoint)
 {
-   COMPtr<IWebUIDelegate> delegateRef = 0;
-   WebDragSourceAction action = WebDragSourceActionAny;
-   POINT localpt = core(m_webView)->mainFrame()->view()->windowToContents(windowPoint);
-   if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
-       delegateRef->dragSourceActionMaskForPoint(m_webView, &localpt, &action);
-   return (DragSourceAction)action;
+    COMPtr<IWebUIDelegate> delegateRef = 0;
+    WebDragSourceAction action = WebDragSourceActionAny;
+    POINT localpt = core(m_webView)->mainFrame().view()->windowToContents(windowPoint);
+    if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
+        delegateRef->dragSourceActionMaskForPoint(m_webView, &localpt, &action);
+    return (DragSourceAction)action;
 }
 
 void WebDragClient::willPerformDragSourceAction(DragSourceAction action, const IntPoint& intPoint, Clipboard* clipboard)
 }
 
 void WebDragClient::willPerformDragSourceAction(DragSourceAction action, const IntPoint& intPoint, Clipboard* clipboard)
index f4a3fb64137e4627fcf1255f356591ffd8f8a73b..ffc47f3c14e68b78ee5a5b7456060f8a49dbe519 100644 (file)
@@ -145,7 +145,7 @@ STDMETHODIMP WebDropSource::GiveFeedback(DWORD dwEffect)
         return DRAGDROP_S_USEDEFAULTCURSORS;
     }
 
         return DRAGDROP_S_USEDEFAULTCURSORS;
     }
 
-    FrameView* view = m_webView->page()->mainFrame()->view();
+    FrameView* view = m_webView->page()->mainFrame().view();
     if (!view)
         return DRAGDROP_S_USEDEFAULTCURSORS;
 
     if (!view)
         return DRAGDROP_S_USEDEFAULTCURSORS;
 
index c94579cb50780be5f32546151205afd94c8b9a79..ab71945f1d5660b265bd533ba4733c8225506312 100644 (file)
@@ -1094,7 +1094,7 @@ void WebFrame::initWithWebView(IWebView* webView, Page* page)
     d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
 
     this->AddRef(); // We release this ref in frameLoaderDestroyed()
     d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
 
     this->AddRef(); // We release this ref in frameLoaderDestroyed()
-    d->frame = page->mainFrame();
+    d->frame = &page->mainFrame();
 }
 
 Frame* WebFrame::impl()
 }
 
 Frame* WebFrame::impl()
index 4bbd9a53f15f033ec07e130ca7621c413b7b338f..1cb99ff2c6bcb62bd5ebb51490cdf383835b00a5 100644 (file)
@@ -705,10 +705,8 @@ HRESULT STDMETHODCALLTYPE WebView::close()
 
     removeFromAllWebViewsSet();
 
 
     removeFromAllWebViewsSet();
 
-    if (m_page) {
-        if (Frame* frame = m_page->mainFrame())
-            frame->loader().detachFromParent();
-    }
+    if (m_page)
+        m_page->mainFrame().loader().detachFromParent();
 
     if (m_mouseOutTracker) {
         m_mouseOutTracker->dwFlags = TME_CANCEL;
 
     if (m_mouseOutTracker) {
         m_mouseOutTracker->dwFlags = TME_CANCEL;
@@ -1348,8 +1346,8 @@ bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam)
 
     m_page->contextMenuController().clearContextMenu();
 
 
     m_page->contextMenuController().clearContextMenu();
 
-    IntPoint documentPoint(m_page->mainFrame()->view()->windowToContents(coords));
-    HitTestResult result = m_page->mainFrame()->eventHandler().hitTestResultAtPoint(documentPoint);
+    IntPoint documentPoint(m_page->mainFrame().view()->windowToContents(coords));
+    HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(documentPoint);
     Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController().focusedOrMainFrame();
 
     targetFrame->view()->setCursor(pointerCursor());
     Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController().focusedOrMainFrame();
 
     targetFrame->view()->setCursor(pointerCursor());
@@ -1478,7 +1476,7 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
     static LONG globalPrevMouseDownTime;
 
     if (message == WM_CANCELMODE) {
     static LONG globalPrevMouseDownTime;
 
     if (message == WM_CANCELMODE) {
-        m_page->mainFrame()->eventHandler().lostMouseCapture();
+        m_page->mainFrame().eventHandler().lostMouseCapture();
         return true;
     }
 
         return true;
     }
 
@@ -1517,29 +1515,29 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
         globalPrevPoint = mouseEvent.position();
         
         mouseEvent.setClickCount(globalClickCount);
         globalPrevPoint = mouseEvent.position();
         
         mouseEvent.setClickCount(globalClickCount);
-        handled = m_page->mainFrame()->eventHandler().handleMousePressEvent(mouseEvent);
+        handled = m_page->mainFrame().eventHandler().handleMousePressEvent(mouseEvent);
     } else if (message == WM_LBUTTONDBLCLK || message == WM_MBUTTONDBLCLK || message == WM_RBUTTONDBLCLK) {
         globalClickCount++;
         mouseEvent.setClickCount(globalClickCount);
     } else if (message == WM_LBUTTONDBLCLK || message == WM_MBUTTONDBLCLK || message == WM_RBUTTONDBLCLK) {
         globalClickCount++;
         mouseEvent.setClickCount(globalClickCount);
-        handled = m_page->mainFrame()->eventHandler().handleMousePressEvent(mouseEvent);
+        handled = m_page->mainFrame().eventHandler().handleMousePressEvent(mouseEvent);
     } else if (message == WM_LBUTTONUP || message == WM_MBUTTONUP || message == WM_RBUTTONUP) {
         // Record the global position and the button of the up.
         globalPrevButton = mouseEvent.button();
         globalPrevPoint = mouseEvent.position();
         mouseEvent.setClickCount(globalClickCount);
     } else if (message == WM_LBUTTONUP || message == WM_MBUTTONUP || message == WM_RBUTTONUP) {
         // Record the global position and the button of the up.
         globalPrevButton = mouseEvent.button();
         globalPrevPoint = mouseEvent.position();
         mouseEvent.setClickCount(globalClickCount);
-        m_page->mainFrame()->eventHandler().handleMouseReleaseEvent(mouseEvent);
+        m_page->mainFrame().eventHandler().handleMouseReleaseEvent(mouseEvent);
         ::ReleaseCapture();
     } else if (message == WM_MOUSELEAVE && m_mouseOutTracker) {
         // Once WM_MOUSELEAVE is fired windows clears this tracker
         // so there is no need to disable it ourselves.
         m_mouseOutTracker.clear();
         ::ReleaseCapture();
     } else if (message == WM_MOUSELEAVE && m_mouseOutTracker) {
         // Once WM_MOUSELEAVE is fired windows clears this tracker
         // so there is no need to disable it ourselves.
         m_mouseOutTracker.clear();
-        m_page->mainFrame()->eventHandler().mouseMoved(mouseEvent);
+        m_page->mainFrame().eventHandler().mouseMoved(mouseEvent);
         handled = true;
     } else if (message == WM_MOUSEMOVE) {
         if (!insideThreshold)
             globalClickCount = 0;
         mouseEvent.setClickCount(globalClickCount);
         handled = true;
     } else if (message == WM_MOUSEMOVE) {
         if (!insideThreshold)
             globalClickCount = 0;
         mouseEvent.setClickCount(globalClickCount);
-        handled = m_page->mainFrame()->eventHandler().mouseMoved(mouseEvent);
+        handled = m_page->mainFrame().eventHandler().mouseMoved(mouseEvent);
         if (!m_mouseOutTracker) {
             m_mouseOutTracker = adoptPtr(new TRACKMOUSEEVENT);
             m_mouseOutTracker->cbSize = sizeof(TRACKMOUSEEVENT);
         if (!m_mouseOutTracker) {
             m_mouseOutTracker = adoptPtr(new TRACKMOUSEEVENT);
             m_mouseOutTracker->cbSize = sizeof(TRACKMOUSEEVENT);
@@ -1569,7 +1567,7 @@ bool WebView::gestureNotify(WPARAM wParam, LPARAM lParam)
     bool hitScrollbar = false;
     POINT gestureBeginPoint = {gn->ptsLocation.x, gn->ptsLocation.y};
     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
     bool hitScrollbar = false;
     POINT gestureBeginPoint = {gn->ptsLocation.x, gn->ptsLocation.y};
     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
-    for (Frame* childFrame = m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) {
+    for (Frame* childFrame = &m_page->mainFrame(); childFrame; childFrame = EventHandler::subframeForTargetNode(m_gestureTargetNode.get())) {
         FrameView* frameView = childFrame->view();
         if (!frameView)
             break;
         FrameView* frameView = childFrame->view();
         if (!frameView)
             break;
@@ -2739,12 +2737,12 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
 
     WebFrame* webFrame = WebFrame::createInstance();
     webFrame->initWithWebView(this, m_page);
 
     WebFrame* webFrame = WebFrame::createInstance();
     webFrame->initWithWebView(this, m_page);
-    static_cast<WebFrameLoaderClient&>(m_page->mainFrame()->loader().client()).setWebFrame(webFrame);
+    static_cast<WebFrameLoaderClient&>(m_page->mainFrame().loader().client()).setWebFrame(webFrame);
     m_mainFrame = webFrame;
     webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
 
     m_mainFrame = webFrame;
     webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
 
-    m_page->mainFrame()->tree().setName(toString(frameName));
-    m_page->mainFrame()->init();
+    m_page->mainFrame().tree().setName(toString(frameName));
+    m_page->mainFrame().init();
     setGroupName(groupName);
 
     addToAllWebViewsSet();
     setGroupName(groupName);
 
     addToAllWebViewsSet();
@@ -3459,7 +3457,7 @@ HRESULT STDMETHODCALLTYPE WebView::searchFor(
     if (!found)
         return E_INVALIDARG;
     
     if (!found)
         return E_INVALIDARG;
     
-    if (!m_page || !m_page->mainFrame())
+    if (!m_page)
         return E_UNEXPECTED;
 
     if (!str || !SysStringLen(str))
         return E_UNEXPECTED;
 
     if (!str || !SysStringLen(str))
@@ -3488,9 +3486,9 @@ HRESULT STDMETHODCALLTYPE WebView::updateFocusedAndActiveState()
     updateActiveState();
 
     bool active = m_page->focusController().isActive();
     updateActiveState();
 
     bool active = m_page->focusController().isActive();
-    Frame* mainFrame = m_page->mainFrame();
+    Frame& mainFrame = m_page->mainFrame();
     Frame* focusedFrame = m_page->focusController().focusedOrMainFrame();
     Frame* focusedFrame = m_page->focusController().focusedOrMainFrame();
-    mainFrame->selection().setFocused(active && mainFrame == focusedFrame);
+    mainFrame.selection().setFocused(active && &mainFrame == focusedFrame);
 
     return S_OK;
 }
 
     return S_OK;
 }
@@ -3504,7 +3502,7 @@ HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR name, BSTR valu
 
 HRESULT STDMETHODCALLTYPE WebView::clearMainFrameName()
 {
 
 HRESULT STDMETHODCALLTYPE WebView::clearMainFrameName()
 {
-    m_page->mainFrame()->tree().clearName();
+    m_page->mainFrame().tree().clearName();
 
     return S_OK;
 }
 
     return S_OK;
 }
@@ -3515,7 +3513,7 @@ HRESULT STDMETHODCALLTYPE WebView::markAllMatchesForText(
     if (!matches)
         return E_INVALIDARG;
 
     if (!matches)
         return E_INVALIDARG;
 
-    if (!m_page || !m_page->mainFrame())
+    if (!m_page)
         return E_UNEXPECTED;
 
     if (!str || !SysStringLen(str))
         return E_UNEXPECTED;
 
     if (!str || !SysStringLen(str))
@@ -3527,7 +3525,7 @@ HRESULT STDMETHODCALLTYPE WebView::markAllMatchesForText(
 
 HRESULT STDMETHODCALLTYPE WebView::unmarkAllTextMatches()
 {
 
 HRESULT STDMETHODCALLTYPE WebView::unmarkAllTextMatches()
 {
-    if (!m_page || !m_page->mainFrame())
+    if (!m_page)
         return E_UNEXPECTED;
 
     m_page->unmarkAllTextMatches();
         return E_UNEXPECTED;
 
     m_page->unmarkAllTextMatches();
@@ -3538,7 +3536,7 @@ HRESULT STDMETHODCALLTYPE WebView::rectsForTextMatches(
     IEnumTextMatches** pmatches)
 {
     Vector<IntRect> allRects;
     IEnumTextMatches** pmatches)
 {
     Vector<IntRect> allRects;
-    WebCore::Frame* frame = m_page->mainFrame();
+    WebCore::Frame* frame = &m_page->mainFrame();
     do {
         if (Document* document = frame->document()) {
             IntRect visibleRect = frame->view()->visibleContentRect();
     do {
         if (Document* document = frame->document()) {
             IntRect visibleRect = frame->view()->visibleContentRect();
@@ -4302,7 +4300,7 @@ HRESULT STDMETHODCALLTYPE WebView::styleDeclarationWithText(
 HRESULT STDMETHODCALLTYPE WebView::hasSelectedRange( 
         /* [retval][out] */ BOOL* hasSelectedRange)
 {
 HRESULT STDMETHODCALLTYPE WebView::hasSelectedRange( 
         /* [retval][out] */ BOOL* hasSelectedRange)
 {
-    *hasSelectedRange = m_page->mainFrame()->selection().isRange();
+    *hasSelectedRange = m_page->mainFrame().selection().isRange();
     return S_OK;
 }
     
     return S_OK;
 }
     
@@ -4391,9 +4389,9 @@ HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithNode(
 HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithText( 
         /* [in] */ BSTR text)
 {
 HRESULT STDMETHODCALLTYPE WebView::replaceSelectionWithText( 
         /* [in] */ BSTR text)
 {
-    Position start = m_page->mainFrame()->selection().selection().start();
+    Position start = m_page->mainFrame().selection().selection().start();
     m_page->focusController().focusedOrMainFrame()->editor().insertText(toString(text), 0);
     m_page->focusController().focusedOrMainFrame()->editor().insertText(toString(text), 0);
-    m_page->mainFrame()->selection().setBase(start);
+    m_page->mainFrame().selection().setBase(start);
     return S_OK;
 }
     
     return S_OK;
 }
     
@@ -5139,7 +5137,7 @@ HRESULT STDMETHODCALLTYPE WebView::scrollOffset(
 {
     if (!offset)
         return E_POINTER;
 {
     if (!offset)
         return E_POINTER;
-    IntSize offsetIntSize = m_page->mainFrame()->view()->scrollOffset();
+    IntSize offsetIntSize = m_page->mainFrame().view()->scrollOffset();
     offset->x = offsetIntSize.width();
     offset->y = offsetIntSize.height();
     return S_OK;
     offset->x = offsetIntSize.width();
     offset->y = offsetIntSize.height();
     return S_OK;
@@ -5150,7 +5148,7 @@ HRESULT STDMETHODCALLTYPE WebView::scrollBy(
 {
     if (!offset)
         return E_POINTER;
 {
     if (!offset)
         return E_POINTER;
-    m_page->mainFrame()->view()->scrollBy(IntSize(offset->x, offset->y));
+    m_page->mainFrame().view()->scrollBy(IntSize(offset->x, offset->y));
     return S_OK;
 }
 
     return S_OK;
 }
 
@@ -5159,7 +5157,7 @@ HRESULT STDMETHODCALLTYPE WebView::visibleContentRect(
 {
     if (!rect)
         return E_POINTER;
 {
     if (!rect)
         return E_POINTER;
-    FloatRect visibleContent = m_page->mainFrame()->view()->visibleContentRect();
+    FloatRect visibleContent = m_page->mainFrame().view()->visibleContentRect();
     rect->left = (LONG) visibleContent.x();
     rect->top = (LONG) visibleContent.y();
     rect->right = (LONG) visibleContent.maxX();
     rect->left = (LONG) visibleContent.x();
     rect->top = (LONG) visibleContent.y();
     rect->right = (LONG) visibleContent.maxX();
@@ -5386,7 +5384,7 @@ HRESULT STDMETHODCALLTYPE WebView::loadBackForwardListFromOtherView(
             // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
             // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
-            otherWebView->m_page->mainFrame()->loader().history().saveDocumentAndScrollState();
+            otherWebView->m_page->mainFrame().loader().history().saveDocumentAndScrollState();
         }
         RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
         if (!i) 
         }
         RefPtr<HistoryItem> newItem = otherBackForwardList->itemAtIndex(i)->copy();
         if (!i) 
@@ -5439,7 +5437,7 @@ HRESULT WebView::setProhibitsMainFrameScrolling(BOOL b)
     if (!m_page)
         return E_FAIL;
 
     if (!m_page)
         return E_FAIL;
 
-    m_page->mainFrame()->view()->setProhibitsScrolling(b);
+    m_page->mainFrame().view()->setProhibitsScrolling(b);
     return S_OK;
 }
 
     return S_OK;
 }
 
index 2a6c3008e25ddb1594590cadf53111b9312b6511..73c62153ea067b4c63013daff007ab635c1ea113 100644 (file)
@@ -112,7 +112,7 @@ WebView::WebView(HWND hwnd, unsigned features)
     m_frame = frame.get();
     loaderClient->setFrame(m_frame);
 
     m_frame = frame.get();
     loaderClient->setFrame(m_frame);
 
-    m_page->mainFrame()->init();
+    m_page->mainFrame().init();
 
     if (view()) {
         RECT windowRect;
 
     if (view()) {
         RECT windowRect;
@@ -304,7 +304,7 @@ bool WebView::handleMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
 
         PlatformMouseEvent moveEvent(hWnd, WM_MOUSEMOV