Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index 7746f348bf0c895e4966c9ba283bd36ddec8831a..283d7901c6818960293fe2e1c833ea749f9a458e 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -3179,8 +3179,42 @@ void FrameView::setLayoutSizeInternal(const IntSize& size) |
if (m_layoutSize == size) |
return; |
+ bool widthChanged = m_layoutSize.width() != size.width(); |
m_layoutSize = size; |
- contentsResized(); |
+ |
+ // Update scrollbars. Not calling this->contentsResized() to avoid setNeedsLayout. |
+ ScrollView::contentsResized(); |
+ |
+ RenderView* renderView = this->renderView(); |
+ if (!renderView) |
+ return; |
+ |
+ // If needsLayout, the next layout will do all the things required on layoutSize change. |
+ if (renderView->needsLayout()) |
+ return; |
+ |
+ if (widthChanged) { |
+ setNeedsLayout(); |
+ return; |
+ } |
+ |
+ performPreLayoutTasks(); |
+ |
+ // During pre-layout tasks, viewport media queries, viewport sizes and others may cause |
+ // style update and set needsLayout flag. |
+ if (renderView->needsLayout()) |
+ return; |
+ |
+ if (!renderView->trySimplifiedLayoutOnHeightChange()) { |
+ setNeedsLayout(); |
+ return; |
+ } |
+ |
+ // RenderView has finished a simplified layout for the height change. We need to perform |
+ // necessary post-layout tasks for the simplified layout. |
+ scheduleOrPerformPostLayoutTasks(); |
+ if (frame().page()) |
+ frame().page()->chrome().client().layoutUpdated(m_frame.get()); |
} |
void FrameView::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation) |