Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2575343004: Invalidate LayoutView when the URL bar is hidden on short pages. (Closed)
Patch Set: Nit Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 m_viewportConstrainedObjects->remove(object); 1551 m_viewportConstrainedObjects->remove(object);
1552 1552
1553 if (ScrollingCoordinator* scrollingCoordinator = 1553 if (ScrollingCoordinator* scrollingCoordinator =
1554 this->scrollingCoordinator()) 1554 this->scrollingCoordinator())
1555 scrollingCoordinator->frameViewFixedObjectsDidChange(this); 1555 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1556 } 1556 }
1557 } 1557 }
1558 1558
1559 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { 1559 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
1560 DCHECK(widthChanged || heightChanged); 1560 DCHECK(widthChanged || heightChanged);
1561 DCHECK(m_frame->host());
1561 1562
1562 if (LayoutViewItem layoutView = this->layoutViewItem()) { 1563 if (LayoutViewItem layoutView = this->layoutViewItem()) {
1563 if (layoutView.usesCompositing()) 1564 if (layoutView.usesCompositing())
1564 layoutView.compositor()->frameViewDidChangeSize(); 1565 layoutView.compositor()->frameViewDidChangeSize();
1565 } 1566 }
1566 1567
1567 // Ensure the root scroller compositing layers update geometry in response to 1568 // Ensure the root scroller compositing layers update geometry in response to
1568 // the URL bar resizing. 1569 // the URL bar resizing.
1569 if (m_frame->isMainFrame()) { 1570 if (m_frame->isMainFrame())
1570 m_frame->document() 1571 m_frame->host()->globalRootScrollerController().mainFrameViewResized();
1571 ->frameHost()
1572 ->globalRootScrollerController()
1573 .mainFrameViewResized();
1574 }
1575 1572
1576 showOverlayScrollbars(); 1573 showOverlayScrollbars();
1577 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 1574
1575 bool rootLayerScrollingEnabled =
1576 RuntimeEnabledFeatures::rootLayerScrollingEnabled();
1577 if (rootLayerScrollingEnabled) {
1578 // The background must be repainted when the FrameView is resized, even if 1578 // The background must be repainted when the FrameView is resized, even if
1579 // the initial containing block does not change (so we can't rely on layout 1579 // the initial containing block does not change (so we can't rely on layout
1580 // to issue the invalidation). This is because the background fills the 1580 // to issue the invalidation). This is because the background fills the
1581 // main GraphicsLayer, which takes the size of the layout viewport. 1581 // main GraphicsLayer, which takes the size of the layout viewport.
1582 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents 1582 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
1583 // layer and avoid this invalidation (http://crbug.com/568847). 1583 // layer and avoid this invalidation (http://crbug.com/568847).
1584 LayoutViewItem lvi = layoutViewItem(); 1584 LayoutViewItem lvi = layoutViewItem();
1585 if (!lvi.isNull()) 1585 if (!lvi.isNull())
1586 lvi.setShouldDoFullPaintInvalidation(); 1586 lvi.setShouldDoFullPaintInvalidation();
1587 } 1587 }
1588 1588
1589 if (RuntimeEnabledFeatures::inertTopControlsEnabled() && layoutView() && 1589 if (RuntimeEnabledFeatures::inertTopControlsEnabled() && layoutView() &&
1590 layoutView()->style()->hasFixedBackgroundImage()) { 1590 m_frame->isMainFrame() && m_frame->host()->browserControls().height()) {
bokan 2016/12/22 00:45:49 This doesn't really apply to non-main frames (yet,
1591 // In the case where we don't change layout size from top control resizes, 1591 if (layoutView()->style()->hasFixedBackgroundImage()) {
1592 // we wont perform a layout. If we have a fixed background image however, 1592 // In the case where we don't change layout size from top control resizes,
1593 // the background layer needs to get resized so we should request a layout 1593 // we wont perform a layout. If we have a fixed background image however,
1594 // explicitly. 1594 // the background layer needs to get resized so we should request a layout
1595 PaintLayer* layer = layoutView()->layer(); 1595 // explicitly.
1596 if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) { 1596 PaintLayer* layer = layoutView()->layer();
1597 setNeedsLayout(); 1597 if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) {
1598 } else if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 1598 setNeedsLayout();
1599 // If root layer scrolls is on, we've already issued a full invalidation 1599 } else if (!rootLayerScrollingEnabled) {
1600 // If root layer scrolls is on, we've already issued a full invalidation
1601 // above.
1602 layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded(
1603 widthChanged, heightChanged);
1604 }
1605 } else if (heightChanged && !rootLayerScrollingEnabled) {
1606 // If the document rect doesn't fill the full view height, hiding the
1607 // URL bar will expose area outside the current LayoutView so we need to
1608 // paint additional background. If RLS is on, we've already invalidated
1600 // above. 1609 // above.
1601 layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded( 1610 LayoutViewItem lvi = layoutViewItem();
1602 widthChanged, heightChanged); 1611 DCHECK(!lvi.isNull());
1612 if (lvi.documentRect().height() < lvi.viewRect().height())
1613 lvi.setShouldDoFullPaintInvalidation();
1603 } 1614 }
1604 } 1615 }
1605 1616
1606 if (!hasViewportConstrainedObjects()) 1617 if (!hasViewportConstrainedObjects())
1607 return; 1618 return;
1608 1619
1609 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1620 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1610 LayoutObject* layoutObject = viewportConstrainedObject; 1621 LayoutObject* layoutObject = viewportConstrainedObject;
1611 const ComputedStyle& style = layoutObject->styleRef(); 1622 const ComputedStyle& style = layoutObject->styleRef();
1612 if (widthChanged) { 1623 if (widthChanged) {
(...skipping 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after
4874 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; 4885 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4875 ++reason) { 4886 ++reason) {
4876 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { 4887 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4877 reasons |= 1 << (reason - 1); 4888 reasons |= 1 << (reason - 1);
4878 } 4889 }
4879 } 4890 }
4880 return reasons; 4891 return reasons;
4881 } 4892 }
4882 4893
4883 } // namespace blink 4894 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698