| Index: third_party/WebKit/Source/core/frame/FrameView.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| index 0bdecfb842957e480163c7d97d9c1e2253e8ff41..9244d5b1ff38b615ef8e7ea50ef20a43d85de51a 100644
|
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| @@ -547,26 +547,36 @@ void FrameView::InvalidateRect(const IntRect& rect) {
|
| }
|
|
|
| void FrameView::SetFrameRect(const IntRect& frame_rect) {
|
| - if (frame_rect == frame_rect_)
|
| + bool root_layer_scrolls = RuntimeEnabledFeatures::rootLayerScrollingEnabled();
|
| + IntRect old_rect = FrameRect();
|
| + if (frame_rect == old_rect)
|
| return;
|
|
|
| const bool width_changed = frame_rect_.Width() != frame_rect.Width();
|
| const bool height_changed = frame_rect_.Height() != frame_rect.Height();
|
| frame_rect_ = frame_rect;
|
|
|
| - needs_scrollbars_update_ = width_changed || height_changed;
|
| - // TODO(wjmaclean): find out why scrollbars fail to resize for complex
|
| - // subframes after changing the zoom level. For now always calling
|
| - // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to
|
| - // discover the deeper cause of this. http://crbug.com/607987.
|
| - UpdateScrollbarsIfNeeded();
|
| + needs_scrollbars_update_ |= old_rect.Size() != frame_rect.Size();
|
| +
|
| + // If this is not the main frame, then we got here via
|
| + // LayoutPart::UpdateGeometryInternal. In that case, we can't clamp the
|
| + // scroll offset yet, because we still need to run UpdateLayout(), so our
|
| + // clamping boundaries may yet change.
|
| + if (GetFrame().IsMainFrame()) {
|
| + if (root_layer_scrolls) {
|
| + if (LayoutView* lv = GetLayoutView())
|
| + lv->GetScrollableArea()->ClampScrollOffsetAfterOverflowChange();
|
| + } else {
|
| + AdjustScrollOffsetFromUpdateScrollbars();
|
| + }
|
| + }
|
|
|
| FrameRectsChanged();
|
|
|
| UpdateParentScrollableAreaSet();
|
|
|
| if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() &&
|
| - !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
|
| + !root_layer_scrolls) {
|
| // The overflow clip property depends on the frame size and the pre
|
| // translation property depends on the frame location.
|
| SetNeedsPaintPropertyUpdate();
|
| @@ -710,15 +720,13 @@ void FrameView::SetContentsSize(const IntSize& size) {
|
| return;
|
|
|
| contents_size_ = size;
|
| - UpdateScrollbars();
|
| + needs_scrollbars_update_ = true;
|
| ScrollableArea::ContentsResized();
|
|
|
| Page* page = GetFrame().GetPage();
|
| if (!page)
|
| return;
|
|
|
| - UpdateParentScrollableAreaSet();
|
| -
|
| page->GetChromeClient().ContentsSizeChanged(frame_.Get(), size);
|
|
|
| // Ensure the scrollToFragmentAnchor is called before
|
| @@ -742,12 +750,7 @@ void FrameView::AdjustViewSize() {
|
|
|
| const IntPoint origin(-rect.X(), -rect.Y());
|
| if (ScrollOrigin() != origin) {
|
| - SetScrollOrigin(origin);
|
| - // setContentSize (below) also calls updateScrollbars so we can avoid
|
| - // updating scrollbars twice by skipping the call here when the content
|
| - // size does not change.
|
| - if (!frame_->GetDocument()->Printing() && size == ContentsSize())
|
| - UpdateScrollbars();
|
| + ScrollableArea::SetScrollOrigin(origin);
|
| }
|
|
|
| SetContentsSize(size);
|
| @@ -884,6 +887,7 @@ void FrameView::RecalcOverflowAfterStyleChange() {
|
| }
|
|
|
| AdjustViewSize();
|
| + // UpdateScrollbars();
|
| UpdateScrollbarGeometry();
|
|
|
| if (ScrollOriginChanged())
|
| @@ -1308,10 +1312,25 @@ void FrameView::UpdateLayout() {
|
| TRACE_DISABLED_BY_DEFAULT("blink.debug.layout.trees"), "LayoutTree",
|
| this, TracedLayoutObject::Create(*GetLayoutView(), false));
|
|
|
| + IntSize old_size(Size());
|
| +
|
| PerformLayout(in_subtree_layout);
|
| + UpdateScrollbars();
|
| + UpdateParentScrollableAreaSet();
|
|
|
| - if (!in_subtree_layout && !document->Printing())
|
| - AdjustViewSizeAndLayout();
|
| + IntSize new_size(Size());
|
| + if (old_size != new_size) {
|
| + needs_scrollbars_update_ = true;
|
| + SetNeedsLayout();
|
| + MarkViewportConstrainedObjectsForLayout(
|
| + old_size.Width() != new_size.Width(),
|
| + old_size.Height() != new_size.Height());
|
| + }
|
| +
|
| + if (NeedsLayout()) {
|
| + AutoReset<bool> suppress(&suppress_adjust_view_size_, true);
|
| + UpdateLayout();
|
| + }
|
|
|
| ASSERT(layout_subtree_root_list_.IsEmpty());
|
| } // Reset m_layoutSchedulingEnabled to its previous value.
|
| @@ -1670,18 +1689,6 @@ void FrameView::ViewportSizeChanged(bool width_changed, bool height_changed) {
|
|
|
| ShowOverlayScrollbars();
|
|
|
| - if (root_layer_scrolling_enabled) {
|
| - // The background must be repainted when the FrameView is resized, even if
|
| - // the initial containing block does not change (so we can't rely on layout
|
| - // to issue the invalidation). This is because the background fills the
|
| - // main GraphicsLayer, which takes the size of the layout viewport.
|
| - // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
|
| - // layer and avoid this invalidation (http://crbug.com/568847).
|
| - LayoutViewItem lvi = GetLayoutViewItem();
|
| - if (!lvi.IsNull())
|
| - lvi.SetShouldDoFullPaintInvalidation();
|
| - }
|
| -
|
| if (RuntimeEnabledFeatures::inertTopControlsEnabled() && GetLayoutView() &&
|
| frame_->IsMainFrame() &&
|
| frame_->GetPage()->GetBrowserControls().Height()) {
|
| @@ -1693,13 +1700,13 @@ void FrameView::ViewportSizeChanged(bool width_changed, bool height_changed) {
|
| PaintLayer* layer = GetLayoutView()->Layer();
|
| if (GetLayoutView()->Compositor()->NeedsFixedRootBackgroundLayer(layer)) {
|
| SetNeedsLayout();
|
| - } else if (!root_layer_scrolling_enabled) {
|
| + } else {
|
| // If root layer scrolls is on, we've already issued a full invalidation
|
| // above.
|
| GetLayoutView()->SetShouldDoFullPaintInvalidationOnResizeIfNeeded(
|
| width_changed, height_changed);
|
| }
|
| - } else if (height_changed && !root_layer_scrolling_enabled) {
|
| + } else if (height_changed) {
|
| // If the document rect doesn't fill the full view height, hiding the
|
| // URL bar will expose area outside the current LayoutView so we need to
|
| // paint additional background. If RLS is on, we've already invalidated
|
| @@ -1711,7 +1718,13 @@ void FrameView::ViewportSizeChanged(bool width_changed, bool height_changed) {
|
| }
|
| }
|
|
|
| - if (!HasViewportConstrainedObjects())
|
| + if (GetFrame().GetDocument() && !IsInPerformLayout())
|
| + MarkViewportConstrainedObjectsForLayout(width_changed, height_changed);
|
| +}
|
| +
|
| +void FrameView::MarkViewportConstrainedObjectsForLayout(bool width_changed,
|
| + bool height_changed) {
|
| + if (!HasViewportConstrainedObjects() || !(width_changed || height_changed))
|
| return;
|
|
|
| for (const auto& viewport_constrained_object :
|
| @@ -2162,9 +2175,6 @@ void FrameView::ScrollbarExistenceDidChange() {
|
| ScrollbarTheme::GetTheme().UsesOverlayScrollbars() &&
|
| !ShouldUseCustomScrollbars(custom_scrollbar_element);
|
|
|
| - // FIXME: this call to layout() could be called within FrameView::layout(),
|
| - // but before performLayout(), causing double-layout. See also
|
| - // crbug.com/429242.
|
| if (!uses_overlay_scrollbars && NeedsLayout())
|
| UpdateLayout();
|
|
|
| @@ -3597,6 +3607,8 @@ void FrameView::ForceLayoutForPagination(const FloatSize& page_size,
|
| }
|
| }
|
|
|
| + if (TextAutosizer* text_autosizer = frame_->GetDocument()->GetTextAutosizer())
|
| + text_autosizer->UpdatePageInfo();
|
| AdjustViewSizeAndLayout();
|
| }
|
|
|
| @@ -4317,7 +4329,7 @@ bool FrameView::AdjustScrollbarExistence(
|
| return true;
|
|
|
| if (!HasOverlayScrollbars())
|
| - ContentsResized();
|
| + SetNeedsLayout();
|
| ScrollbarExistenceDidChange();
|
| return true;
|
| }
|
|
|