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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 380303003: Enable resize and layout for frames with RemoteFrame ancestors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed DeferUpdatePageInfo problem Created 6 years, 5 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 2aeac594bd5bc54bfca841b43a094195f446cce6..13ce49b23cf60f32cd2fb4fd535a221ecf8c1d82 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -1589,12 +1589,52 @@ void WebViewImpl::resizePinchViewport(const WebSize& newSize)
page()->frameHost().pinchViewport().setSize(newSize);
}
+WebLocalFrameImpl* WebViewImpl::localFrameRootTemporary()
+{
+ // FIXME: This is a temporary method that finds the first localFrame in a traversal.
+ // This is equivalent to mainFrame() if the mainFrame is in-process. We need to create
+ // separate WebWidgets to be created by RenderWidgets, which are associated with *all*
+ // local frame roots, not just the first one in the tree. Until then, this limits us
+ // to having only one functioning connected LocalFrame subtree per process.
+ for (WebCore::Frame* frame = page()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (frame->isLocalRoot())
+ return WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
+ }
+ return 0;
+}
+
+void WebViewImpl::performResize()
+{
+ m_pageScaleConstraintsSet.didChangeViewSize(m_size);
+
+ updatePageDefinedViewportConstraints(localFrameRootTemporary()->frame()->document()->viewportDescription());
+ updateMainFrameLayoutSize();
+
+ // If the virtual viewport pinch mode is enabled, the main frame will be resized
+ // after layout so it can be sized to the contentsSize.
+ if (!pinchVirtualViewportEnabled() && localFrameRootTemporary()->frameView())
+ localFrameRootTemporary()->frameView()->resize(m_size);
+
+ if (pinchVirtualViewportEnabled())
+ page()->frameHost().pinchViewport().setSize(m_size);
+
+ // When device emulation is enabled, device size values may change - they are
+ // usually set equal to the view size. These values are not considered viewport-dependent
+ // (see MediaQueryExp::isViewportDependent), since they are only viewport-dependent in emulation mode,
+ // and thus will not be invalidated in |FrameView::performPreLayoutTasks|.
+ // Therefore we should force explicit media queries invalidation here.
+ if (page()->inspectorController().deviceEmulationEnabled()) {
+ if (Document* document = localFrameRootTemporary()->frame()->document())
+ document->mediaQueryAffectingValueChanged();
+ }
+}
+
void WebViewImpl::resize(const WebSize& newSize)
{
if (m_shouldAutoResize || m_size == newSize)
return;
- FrameView* view = mainFrameImpl()->frameView();
+ FrameView* view = localFrameRootTemporary()->frameView();
if (!view)
return;
@@ -1613,32 +1653,14 @@ void WebViewImpl::resize(const WebSize& newSize)
FloatSize(viewportAnchorXCoord, viewportAnchorYCoord));
}
+ // FIXME: FastTextAutosizer does not yet support out-of-process frames.
+ if (mainFrameImpl()->frame()->isLocalFrame())
{
// Avoids unnecessary invalidations while various bits of state in FastTextAutosizer are updated.
FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
-
- m_pageScaleConstraintsSet.didChangeViewSize(m_size);
-
- updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->viewportDescription());
- updateMainFrameLayoutSize();
-
- // If the virtual viewport pinch mode is enabled, the main frame will be resized
- // after layout so it can be sized to the contentsSize.
- if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
- mainFrameImpl()->frameView()->resize(m_size);
-
- if (pinchVirtualViewportEnabled())
- page()->frameHost().pinchViewport().setSize(m_size);
-
- // When device emulation is enabled, device size values may change - they are
- // usually set equal to the view size. These values are not considered viewport-dependent
- // (see MediaQueryExp::isViewportDependent), since they are only viewport-dependent in emulation mode,
- // and thus will not be invalidated in |FrameView::performPreLayoutTasks|.
- // Therefore we should force explicit media queries invalidation here.
- if (page()->inspectorController().deviceEmulationEnabled()) {
- if (Document* document = mainFrameImpl()->frame()->document())
- document->mediaQueryAffectingValueChanged();
- }
+ performResize();
+ } else {
+ performResize();
}
if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
@@ -1735,7 +1757,10 @@ void WebViewImpl::animate(double monotonicFrameBeginTime)
void WebViewImpl::layout()
{
TRACE_EVENT0("blink", "WebViewImpl::layout");
- PageWidgetDelegate::layout(m_page.get());
+ if (!localFrameRootTemporary())
+ return;
+
+ PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame());
updateLayerTreeBackgroundColor();
for (size_t i = 0; i < m_linkHighlights.size(); ++i)
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698