Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: Source/core/page/Page.cpp

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: deprecatedLocalMainFrame Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/Page.cpp
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index 59c33b45e808bc7c88597cd56abb0b98f2d78142..26be6acad3f31ceb43fb483e915bbece462d2996 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -34,6 +34,8 @@
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/RemoteFrame.h"
+#include "core/frame/RemoteFrameView.h"
#include "core/frame/Settings.h"
#include "core/inspector/InspectorController.h"
#include "core/inspector/InspectorInstrumentation.h"
@@ -161,7 +163,7 @@ void Page::makeOrdinary()
ViewportDescription Page::viewportDescription() const
{
- return mainFrame() && mainFrame()->document() ? mainFrame()->document()->viewportDescription() : ViewportDescription();
+ return mainFrame() && mainFrame()->isLocalFrame() && deprecatedLocalMainFrame()->document() ? deprecatedLocalMainFrame()->document()->viewportDescription() : ViewportDescription();
}
ScrollingCoordinator* Page::scrollingCoordinator()
@@ -182,8 +184,8 @@ String Page::mainThreadScrollingReasonsAsText()
PassRefPtrWillBeRawPtr<ClientRectList> Page::nonFastScrollableRects(const LocalFrame* frame)
{
- if (Document* document = m_mainFrame->document())
- document->updateLayout();
+ if (m_mainFrame->isLocalFrame() && deprecatedLocalMainFrame()->document())
+ deprecatedLocalMainFrame()->document()->updateLayout();
Vector<IntRect> rects;
if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
@@ -195,7 +197,7 @@ PassRefPtrWillBeRawPtr<ClientRectList> Page::nonFastScrollableRects(const LocalF
return ClientRectList::create(quads);
}
-void Page::setMainFrame(PassRefPtr<LocalFrame> mainFrame)
+void Page::setMainFrame(PassRefPtr<Frame> mainFrame)
{
ASSERT(!m_mainFrame); // Should only be called during initialization
m_mainFrame = mainFrame;
@@ -283,7 +285,7 @@ void Page::refreshPlugins(bool reload)
PluginData* Page::pluginData() const
{
- if (!mainFrame()->loader().allowPlugins(NotAboutToInstantiatePlugin))
+ if (!deprecatedLocalMainFrame()->loader().allowPlugins(NotAboutToInstantiatePlugin))
return 0;
if (!m_pluginData)
m_pluginData = PluginData::create(this);
@@ -329,7 +331,10 @@ void Page::setDefersLoading(bool defers)
void Page::setPageScaleFactor(float scale, const IntPoint& origin)
{
- FrameView* view = mainFrame()->view();
+ if (!mainFrame()->isLocalFrame())
+ return;
+
+ FrameView* view = deprecatedLocalMainFrame()->view();
PinchViewport& viewport = frameHost().pinchViewport();
if (scale != viewport.scale()) {
@@ -338,7 +343,7 @@ void Page::setPageScaleFactor(float scale, const IntPoint& origin)
if (view && !settings().pinchVirtualViewportEnabled())
view->setVisibleContentScaleFactor(scale);
- mainFrame()->deviceOrPageScaleFactorChanged();
+ deprecatedLocalMainFrame()->deviceOrPageScaleFactorChanged();
m_chrome->client().deviceOrPageScaleFactorChanged();
// FIXME: In virtual-viewport pinch mode, scale doesn't change the fixed-pos viewport;
@@ -346,7 +351,7 @@ void Page::setPageScaleFactor(float scale, const IntPoint& origin)
if (view)
view->viewportConstrainedVisibleContentSizeChanged(true, true);
- mainFrame()->loader().saveScrollState();
+ deprecatedLocalMainFrame()->loader().saveScrollState();
}
if (view && view->scrollPosition() != origin)
@@ -366,8 +371,8 @@ void Page::setDeviceScaleFactor(float scaleFactor)
m_deviceScaleFactor = scaleFactor;
setNeedsRecalcStyleInAllFrames();
- if (mainFrame()) {
- mainFrame()->deviceOrPageScaleFactorChanged();
+ if (mainFrame() && mainFrame()->isLocalFrame()) {
+ deprecatedLocalMainFrame()->deviceOrPageScaleFactorChanged();
m_chrome->client().deviceOrPageScaleFactorChanged();
}
}
@@ -447,8 +452,8 @@ void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia
if (!isInitialState)
lifecycleNotifier().notifyPageVisibilityChanged();
- if (!isInitialState && m_mainFrame)
- m_mainFrame->didChangeVisibilityState();
+ if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
+ deprecatedLocalMainFrame()->didChangeVisibilityState();
}
PageVisibilityState Page::visibilityState() const
@@ -478,12 +483,14 @@ void Page::settingsChanged(SettingsDelegate::ChangeType changeType)
setNeedsRecalcStyleInAllFrames();
break;
case SettingsDelegate::ViewportDescriptionChange:
- if (mainFrame())
- mainFrame()->document()->updateViewportDescription();
+ if (mainFrame() && mainFrame()->isLocalFrame())
+ deprecatedLocalMainFrame()->document()->updateViewportDescription();
break;
case SettingsDelegate::MediaTypeChange:
- m_mainFrame->view()->setMediaType(AtomicString(settings().mediaTypeOverride()));
- setNeedsRecalcStyleInAllFrames();
+ if (m_mainFrame->isLocalFrame()) {
+ deprecatedLocalMainFrame()->view()->setMediaType(AtomicString(settings().mediaTypeOverride()));
+ setNeedsRecalcStyleInAllFrames();
+ }
break;
case SettingsDelegate::DNSPrefetchingChange:
for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
@@ -506,9 +513,9 @@ void Page::settingsChanged(SettingsDelegate::ChangeType changeType)
}
break;
case SettingsDelegate::TextAutosizingChange:
- if (!mainFrame())
+ if (!mainFrame() || !mainFrame()->isLocalFrame())
break;
- if (FastTextAutosizer* textAutosizer = mainFrame()->document()->fastTextAutosizer()) {
+ if (FastTextAutosizer* textAutosizer = deprecatedLocalMainFrame()->document()->fastTextAutosizer()) {
textAutosizer->updatePageInfoInAllFrames();
} else {
for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
@@ -597,7 +604,12 @@ void Page::willBeDestroyed()
// Disable all agents prior to resetting the frame view.
m_inspectorController->willBeDestroyed();
- m_mainFrame->setView(nullptr);
+ if (m_mainFrame->isLocalFrame()) {
+ toLocalFrame(m_mainFrame.get())->setView(nullptr);
+ } else {
+ ASSERT(m_mainFrame->isRemoteFrame());
+ toRemoteFrame(m_mainFrame.get())->setView(nullptr);
+ }
allPages().remove(this);
if (ordinaryPages().contains(this))

Powered by Google App Engine
This is Rietveld 408576698