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

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

Issue 23441020: Make it possibe to lock the fixedLayoutSize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | « no previous file | Source/web/WebViewImpl.h » ('j') | Source/web/WebViewImpl.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index 8ed41521d20c67e53485fcd93b12ce409f7e4450..fa62e735c2ac54fe5b26d50cbf06f5a749d13776 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -2294,13 +2294,16 @@ void FrameView::autoSizeIfEnabled()
IntSize size = frameRect().size();
+ const bool fixedWidthMode = m_minAutoSize.width() == m_maxAutoSize.width();
+ const int iterations = fixedWidthMode ? 1 : 2;
+
// Do the resizing twice. The first time is basically a rough calculation using the preferred width
// which may result in a height change during the second iteration.
- for (int i = 0; i < 2; i++) {
+ for (int i = 0; i < iterations; i++) {
// Update various sizes including contentsSize, scrollHeight, etc.
document->updateLayoutIgnorePendingStylesheets();
- int width = documentView->minPreferredLogicalWidth();
- int height = documentRenderBox->scrollHeight();
+ int width = fixedWidthMode ? m_minAutoSize.width(): documentView->minPreferredLogicalWidth().toInt();
+ int height = fixedWidthMode ? 0 : documentRenderBox->scrollHeight();
mkosiba (inactive) 2013/08/30 18:25:09 ah, actually this should be fixedWidthMode ? m_m
IntSize newSize(width, height);
// Check to see if a scrollbar is needed for a given dimension and
@@ -2352,6 +2355,7 @@ void FrameView::autoSizeIfEnabled()
break;
resize(newSize.width(), newSize.height());
+
// Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example,
// a vertical scrollbar may cause text to wrap and thus increase the height (which is the only reason the scollbar is needed).
setVerticalScrollbarLock(false);
« no previous file with comments | « no previous file | Source/web/WebViewImpl.h » ('j') | Source/web/WebViewImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698