Chromium Code Reviews| Index: Source/core/page/FrameView.cpp |
| diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp |
| index 7a898dfcce0d99adab4a31de5b2092eab53556c1..ee330e35f9f0e42ad04092958a62efadbc480dd5 100644 |
| --- a/Source/core/page/FrameView.cpp |
| +++ b/Source/core/page/FrameView.cpp |
| @@ -203,6 +203,8 @@ PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize |
| { |
| RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
| view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
| + view->setLayoutSize(initialSize); |
| + |
| view->show(); |
| return view.release(); |
| } |
| @@ -1056,7 +1058,7 @@ void FrameView::layout(bool allowSubtree) |
| LayoutSize oldSize = m_size; |
| - m_size = LayoutSize(layoutWidth(), layoutHeight()); |
| + m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
| if (oldSize != m_size) { |
| m_doFullRepaint = true; |
| @@ -1112,7 +1114,7 @@ void FrameView::layout(bool allowSubtree) |
| updateCanBlitOnScrollRecursively(); |
| if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) |
| - updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight()); |
| + updateOverflowStatus(layoutSize().width() < contentsWidth(), layoutSize().height() < contentsHeight()); |
| scheduleOrPerformPostLayoutTasks(); |
| @@ -1606,6 +1608,19 @@ void FrameView::setViewportConstrainedObjectsNeedLayout() |
| } |
| } |
| +IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const |
| +{ |
| + return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutSize) : m_layoutSize; |
| +} |
| + |
| +void FrameView::setLayoutSize(const IntSize& size) |
| +{ |
| + if (m_layoutSize == size) |
| + return; |
| + |
| + m_layoutSize = size; |
| + contentsResized(); |
| +} |
| void FrameView::scrollPositionChanged() |
| { |
| @@ -1722,7 +1737,7 @@ void FrameView::contentsResized() |
| setNeedsLayout(); |
| } |
| -void FrameView::visibleContentsResized() |
| +void FrameView::scrollbarExistenceDidChange() |
| { |
| // We check to make sure the view is attached to a frame() as this method can |
| // be triggered before the view is attached by Frame::createView(...) setting |
| @@ -1731,7 +1746,7 @@ void FrameView::visibleContentsResized() |
| if (!frame().view()) |
| return; |
| - if (!useFixedLayout() && needsLayout()) |
| + if (!m_frame->page()->settings().viewportEnabled() && needsLayout()) |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Checking viewportEnabled here doesn't seem very pr
bokan
2013/10/02 17:44:01
A few unit tests in WebFrameTest fail when I check
aelias_OOO_until_Jul13
2013/10/02 18:59:59
Yes, both Clank and WebView always use overlay scr
bokan
2013/10/02 21:27:26
Done.
|
| layout(); |
| if (RenderView* renderView = this->renderView()) { |
| @@ -2409,6 +2424,7 @@ void FrameView::autoSizeIfEnabled() |
| break; |
| resize(newSize.width(), newSize.height()); |
| + setLayoutSize(newSize); |
| // 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); |
| @@ -3415,4 +3431,18 @@ bool FrameView::isMainFrame() const |
| return m_frame->page() && m_frame->page()->mainFrame() == m_frame; |
| } |
| +void FrameView::frameRectsChanged() |
| +{ |
| + Document* doc = m_frame->document(); |
| + bool layoutSizeIsExplicitlySet = m_frame->page() && m_frame->page()->mainFrame() == m_frame |
|
aelias_OOO_until_Jul13
2013/10/01 05:09:30
Instead of this, how about a public method FrameVi
bokan
2013/10/02 17:44:01
Done, only I set it false from Frame::createView
|
| + && doc && (doc->isHTMLDocument() || doc->isXHTMLDocument()); |
| + |
| + // Non-main frames' layout size should always match the frame size. For main frames we |
| + // explicitly set the layout size from WebViewImpl |
| + if (!layoutSizeIsExplicitlySet) |
| + setLayoutSize(frameRect().size()); |
| + |
| + ScrollView::frameRectsChanged(); |
| +} |
| + |
| } // namespace WebCore |