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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 23441020: Make it possibe to lock the fixedLayoutSize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: dont need to disable content rects scaling? Created 7 years, 3 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/tests/WebFrameTest.cpp » ('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 1cdb62d6aa28f411514f57116393205350dad0ec..ed65fa31dd14385e0ac185d316db1e1074642a6a 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -379,6 +379,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_editorClientImpl(this)
, m_inspectorClientImpl(this)
, m_backForwardClientImpl(this)
+ , m_fixedLayoutSizeLock(false)
, m_shouldAutoResize(false)
, m_observedNewNavigation(false)
#ifndef NDEBUG
@@ -1673,7 +1674,7 @@ void WebViewImpl::resize(const WebSize& newSize)
}
}
- if (settings()->viewportEnabled()) {
+ if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
// Relayout immediately to recalculate the minimum scale limit.
if (view->needsLayout())
view->layout();
@@ -2964,7 +2965,7 @@ void WebViewImpl::refreshPageScaleFactorAfterLayout()
updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()->viewportArguments());
m_pageScaleConstraintsSet.computeFinalConstraints();
- if (settings()->viewportEnabled()) {
+ if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
int verticalScrollbarWidth = 0;
if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlayScrollbar())
verticalScrollbarWidth = view->verticalScrollbar()->width();
@@ -3006,7 +3007,8 @@ void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments&
if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && layoutSize.width != fixedLayoutSize().width)
page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers();
- setFixedLayoutSize(layoutSize);
+ if (page()->mainFrame() && page()->mainFrame()->view() && !m_fixedLayoutSizeLock)
+ page()->mainFrame()->view()->setFixedLayoutSize(layoutSize);
}
IntSize WebViewImpl::contentsSize() const
@@ -3095,10 +3097,19 @@ void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
return;
Frame* frame = page()->mainFrame();
- if (!frame || !frame->view())
+ if (!frame)
return;
- frame->view()->setFixedLayoutSize(layoutSize);
+ FrameView* view = frame->view();
+ if (!view)
+ return;
+
+ m_fixedLayoutSizeLock = layoutSize.width || layoutSize.height;
+
+ if (m_fixedLayoutSizeLock)
+ view->setFixedLayoutSize(layoutSize);
+ else
+ view->setFixedLayoutSize(flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstraints().layoutSize));
}
void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action,
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698