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

Unified 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 4 years 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 side-by-side diff with in-line comments
Download patch
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 591df0820f514de5342a6e2945f6739fe3c63646..1ee50960c8d0edcd29afd0cd43aa7cf27d863e09 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1558,6 +1558,7 @@ void FrameView::removeViewportConstrainedObject(LayoutObject* object) {
void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
DCHECK(widthChanged || heightChanged);
+ DCHECK(m_frame->host());
if (LayoutViewItem layoutView = this->layoutViewItem()) {
if (layoutView.usesCompositing())
@@ -1566,15 +1567,14 @@ void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
// Ensure the root scroller compositing layers update geometry in response to
// the URL bar resizing.
- if (m_frame->isMainFrame()) {
- m_frame->document()
- ->frameHost()
- ->globalRootScrollerController()
- .mainFrameViewResized();
- }
+ if (m_frame->isMainFrame())
+ m_frame->host()->globalRootScrollerController().mainFrameViewResized();
showOverlayScrollbars();
- if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+
+ bool rootLayerScrollingEnabled =
+ RuntimeEnabledFeatures::rootLayerScrollingEnabled();
+ if (rootLayerScrollingEnabled) {
// 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
@@ -1587,19 +1587,30 @@ void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
}
if (RuntimeEnabledFeatures::inertTopControlsEnabled() && layoutView() &&
- layoutView()->style()->hasFixedBackgroundImage()) {
- // In the case where we don't change layout size from top control resizes,
- // we wont perform a layout. If we have a fixed background image however,
- // the background layer needs to get resized so we should request a layout
- // explicitly.
- PaintLayer* layer = layoutView()->layer();
- if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) {
- setNeedsLayout();
- } else if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
- // If root layer scrolls is on, we've already issued a full invalidation
+ 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,
+ if (layoutView()->style()->hasFixedBackgroundImage()) {
+ // In the case where we don't change layout size from top control resizes,
+ // we wont perform a layout. If we have a fixed background image however,
+ // the background layer needs to get resized so we should request a layout
+ // explicitly.
+ PaintLayer* layer = layoutView()->layer();
+ if (layoutView()->compositor()->needsFixedRootBackgroundLayer(layer)) {
+ setNeedsLayout();
+ } else if (!rootLayerScrollingEnabled) {
+ // If root layer scrolls is on, we've already issued a full invalidation
+ // above.
+ layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded(
+ widthChanged, heightChanged);
+ }
+ } else if (heightChanged && !rootLayerScrollingEnabled) {
+ // 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
// above.
- layoutView()->setShouldDoFullPaintInvalidationOnResizeIfNeeded(
- widthChanged, heightChanged);
+ LayoutViewItem lvi = layoutViewItem();
+ DCHECK(!lvi.isNull());
+ if (lvi.documentRect().height() < lvi.viewRect().height())
+ lvi.setShouldDoFullPaintInvalidation();
}
}

Powered by Google App Engine
This is Rietveld 408576698