| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/frame/FrameViewAutoSizeInfo.h" | 6 #include "core/frame/FrameViewAutoSizeInfo.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/rendering/RenderBox.h" | 10 #include "core/layout/LayoutBox.h" |
| 11 #include "core/rendering/RenderView.h" | 11 #include "core/rendering/RenderView.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 FrameViewAutoSizeInfo::FrameViewAutoSizeInfo(FrameView* view) | 15 FrameViewAutoSizeInfo::FrameViewAutoSizeInfo(FrameView* view) |
| 16 : m_frameView(view) | 16 : m_frameView(view) |
| 17 , m_inAutoSize(false) | 17 , m_inAutoSize(false) |
| 18 , m_didRunAutosize(false) | 18 , m_didRunAutosize(false) |
| 19 { | 19 { |
| 20 ASSERT(m_frameView); | 20 ASSERT(m_frameView); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 for (int i = 0; i < 2; i++) { | 68 for (int i = 0; i < 2; i++) { |
| 69 // Update various sizes including contentsSize, scrollHeight, etc. | 69 // Update various sizes including contentsSize, scrollHeight, etc. |
| 70 document->updateLayoutIgnorePendingStylesheets(); | 70 document->updateLayoutIgnorePendingStylesheets(); |
| 71 | 71 |
| 72 RenderView* renderView = document->renderView(); | 72 RenderView* renderView = document->renderView(); |
| 73 if (!renderView) | 73 if (!renderView) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 int width = renderView->minPreferredLogicalWidth(); | 76 int width = renderView->minPreferredLogicalWidth(); |
| 77 | 77 |
| 78 RenderBox* documentRenderBox = documentElement->renderBox(); | 78 LayoutBox* documentLayoutBox = documentElement->layoutBox(); |
| 79 if (!documentRenderBox) | 79 if (!documentLayoutBox) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 int height = documentRenderBox->scrollHeight(); | 82 int height = documentLayoutBox->scrollHeight(); |
| 83 IntSize newSize(width, height); | 83 IntSize newSize(width, height); |
| 84 | 84 |
| 85 // Check to see if a scrollbar is needed for a given dimension and | 85 // Check to see if a scrollbar is needed for a given dimension and |
| 86 // if so, increase the other dimension to account for the scrollbar. | 86 // if so, increase the other dimension to account for the scrollbar. |
| 87 // Since the dimensions are only for the view rectangle, once a | 87 // Since the dimensions are only for the view rectangle, once a |
| 88 // dimension exceeds the maximum, there is no need to increase it furthe
r. | 88 // dimension exceeds the maximum, there is no need to increase it furthe
r. |
| 89 if (newSize.width() > m_maxAutoSize.width()) { | 89 if (newSize.width() > m_maxAutoSize.width()) { |
| 90 RefPtrWillBeRawPtr<Scrollbar> localHorizontalScrollbar = m_frameView
->horizontalScrollbar(); | 90 RefPtrWillBeRawPtr<Scrollbar> localHorizontalScrollbar = m_frameView
->horizontalScrollbar(); |
| 91 if (!localHorizontalScrollbar) | 91 if (!localHorizontalScrollbar) |
| 92 localHorizontalScrollbar = m_frameView->createScrollbar(Horizont
alScrollbar); | 92 localHorizontalScrollbar = m_frameView->createScrollbar(Horizont
alScrollbar); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, | 134 // Force the scrollbar state to avoid the scrollbar code adding them and
causing them to be needed. For example, |
| 135 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). | 135 // a vertical scrollbar may cause text to wrap and thus increase the hei
ght (which is the only reason the scollbar is needed). |
| 136 m_frameView->setVerticalScrollbarLock(false); | 136 m_frameView->setVerticalScrollbarLock(false); |
| 137 m_frameView->setHorizontalScrollbarLock(false); | 137 m_frameView->setHorizontalScrollbarLock(false); |
| 138 m_frameView->setScrollbarModes(horizonalScrollbarMode, verticalScrollbar
Mode, true, true); | 138 m_frameView->setScrollbarModes(horizonalScrollbarMode, verticalScrollbar
Mode, true, true); |
| 139 } | 139 } |
| 140 m_didRunAutosize = true; | 140 m_didRunAutosize = true; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |