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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 1003323004: Turn ViewportAnchors into stack allocated objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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') | Source/web/web.gypi » ('j') | 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 30a4a43100e1847891cc95728ebfc689c1ad513f..65d50b98ebeab6a8da58e802e7f243f99d40b551 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -1808,6 +1808,24 @@ TopControls& WebViewImpl::topControls()
return page()->frameHost().topControls();
}
+void WebViewImpl::resizeViewWhileAnchored(FrameView* view)
+{
+ // FIXME: TextAutosizer does not yet support out-of-process frames.
+ if (mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame()) {
+ // Avoids unnecessary invalidations while various bits of state in TextAutosizer are updated.
+ TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
+ performResize();
+ } else {
+ performResize();
+ }
+
+ m_fullscreenController->updateSize();
+
+ // Relayout immediately to recalculate the minimum scale limit for rotation anchoring.
+ if (view->needsLayout())
+ view->layout();
+}
+
void WebViewImpl::resize(const WebSize& newSize)
{
if (m_shouldAutoResize || m_size == newSize)
@@ -1828,30 +1846,13 @@ void WebViewImpl::resize(const WebSize& newSize)
m_size = newSize;
FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY);
- OwnPtr<ViewportAnchor> viewportAnchor = isRotation
- ? adoptPtr<ViewportAnchor>(new RotationViewportAnchor(*view, pinchViewport, viewportAnchorCoords, m_pageScaleConstraintsSet))
- : adoptPtr<ViewportAnchor>(new ResizeViewportAnchor(*view, pinchViewport));
-
- viewportAnchor->setAnchor();
-
- // FIXME: TextAutosizer does not yet support out-of-process frames.
- if (mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame())
- {
- // Avoids unnecessary invalidations while various bits of state in TextAutosizer are updated.
- TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
- performResize();
+ if (isRotation) {
+ RotationViewportAnchor anchor(*view, pinchViewport, viewportAnchorCoords, m_pageScaleConstraintsSet);
+ resizeViewWhileAnchored(view);
} else {
- performResize();
+ ResizeViewportAnchor anchor(*view, pinchViewport);
+ resizeViewWhileAnchored(view);
}
-
- m_fullscreenController->updateSize();
-
- // Relayout immediately to recalculate the minimum scale limit for rotation anchoring.
- if (view->needsLayout())
- view->layout();
-
- viewportAnchor->restoreToAnchor();
-
sendResizeEventAndRepaint();
}
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698