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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2622103002: Generalize browser controls adjustment for arbitrary scrollers. (Closed)
Patch Set: Fixed some comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 081d5ed6083e51b6a73e71b4bddbfcc3ddbf2afd..40a93cf9490bd8ae1b94211653805a6dbbfbca74 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -53,8 +53,10 @@
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/RootFrameViewport.h"
#include "core/frame/Settings.h"
+#include "core/frame/VisualViewport.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/input/EventHandler.h"
#include "core/layout/LayoutFlexibleBox.h"
@@ -499,20 +501,29 @@ IntSize PaintLayerScrollableArea::minimumScrollOffsetInt() const {
}
IntSize PaintLayerScrollableArea::maximumScrollOffsetInt() const {
- IntSize contentSize;
- IntSize visibleSize;
- if (box().hasOverflowClip()) {
- contentSize = contentsSize();
- visibleSize =
- pixelSnappedIntRect(box().overflowClipRect(box().location())).size();
-
- // TODO(skobes): We should really ASSERT that contentSize >= visibleSize
- // when we are not the root layer, but we can't because contentSize is
- // based on stale layout overflow data (http://crbug.com/576933).
- contentSize = contentSize.expandedTo(visibleSize);
- }
- if (box().isLayoutView())
- visibleSize += toLayoutView(box()).frameView()->browserControlsSize();
+ if (!box().hasOverflowClip())
+ return toIntSize(-scrollOrigin());
+
+ IntSize contentSize = contentsSize();
+ IntSize visibleSize =
+ pixelSnappedIntRect(box().overflowClipRect(box().location())).size();
+
+ FrameHost* host = layoutBox()->document().frameHost();
+ DCHECK(host);
+ TopDocumentRootScrollerController& controller =
+ host->globalRootScrollerController();
+
+ // The global root scroller should be clipped by the top FrameView rather
+ // than it's overflow clipping box. This is to ensure that content exposed by
+ // hiding the URL bar at the bottom of the screen is visible.
+ if (this == controller.rootScrollerArea())
+ visibleSize = controller.rootScrollerVisibleArea();
+
+ // TODO(skobes): We should really ASSERT that contentSize >= visibleSize
+ // when we are not the root layer, but we can't because contentSize is
+ // based on stale layout overflow data (http://crbug.com/576933).
+ contentSize = contentSize.expandedTo(visibleSize);
+
return toIntSize(-scrollOrigin() + (contentSize - visibleSize));
}

Powered by Google App Engine
This is Rietveld 408576698