Chromium Code Reviews| 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); |