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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 1957103002: Exclude scrollbars from visual viewport dimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index f1aff6137b9a24f8171f984e4925f01b398067f7..5a15ad7de6be60c755e888a7db77c1cde662a3de 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -546,20 +546,14 @@ DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const
{
- int verticalScrollbarWidth = 0;
- int horizontalScrollbarHeight = 0;
-
- if (scrollbarInclusion == IncludeScrollbars) {
- if (Scrollbar* verticalBar = verticalScrollbar())
- verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
- if (Scrollbar* horizontalBar = horizontalScrollbar())
- horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
- }
+ int scrollbarWidth = scrollbarInclusion == IncludeScrollbars ? verticalScrollbarWidth() : 0;
+ int scrollbarHeight = scrollbarInclusion == IncludeScrollbars ? horizontalScrollbarHeight() : 0;
- return IntRect(scrollPosition().x(),
- scrollPosition().y(),
- std::max(0, visibleWidth() + verticalScrollbarWidth),
- std::max(0, visibleHeight() + horizontalScrollbarHeight));
+ return IntRect(
+ scrollPosition().x(),
+ scrollPosition().y(),
+ std::max(0, visibleWidth() + scrollbarWidth),
+ std::max(0, visibleHeight() + scrollbarHeight));
}
IntPoint ScrollableArea::clampScrollPosition(const IntPoint& scrollPosition) const
@@ -597,18 +591,24 @@ float ScrollableArea::pixelStep(ScrollbarOrientation) const
return 1;
}
-IntSize ScrollableArea::excludeScrollbars(const IntSize& size) const
+int ScrollableArea::verticalScrollbarWidth() const
{
- int verticalScrollbarWidth = 0;
- int horizontalScrollbarHeight = 0;
-
if (Scrollbar* verticalBar = verticalScrollbar())
- verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
+ return !verticalBar->isOverlayScrollbar() ? verticalBar->width() : 0;
+ return 0;
+}
+
+int ScrollableArea::horizontalScrollbarHeight() const
+{
if (Scrollbar* horizontalBar = horizontalScrollbar())
- horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
+ return !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
+ return 0;
+}
- return IntSize(std::max(0, size.width() - verticalScrollbarWidth),
- std::max(0, size.height() - horizontalScrollbarHeight));
+IntSize ScrollableArea::excludeScrollbars(const IntSize& size) const
+{
+ return IntSize(std::max(0, size.width() - verticalScrollbarWidth()),
+ std::max(0, size.height() - horizontalScrollbarHeight()));
}
DEFINE_TRACE(ScrollableArea)
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698