Overlay scrollbars should always use the whole contents
https://bugs.webkit.org/show_bug.cgi?id=153352
Reviewed by Michael Catanzaro.
In case of having both horizontal and vertical scrollbars, the
scrollbars respect the scroll corner. That looks good for legacy
scrollbars that show the track, but with the overlay indicators
it looks weird that the indicator stops so early before the end of
the contents, giving the impression that there's something else to
scroll. This happens because the scroll corner is transparent, so
it's not obvious that's the scroll corner. It also happens with
the text areas having a resizer. Legacy scrollbars take into
account the resizer, which is good, but I expect overlay
scrollbars to be rendered also over the resizer. The resizer takes
precedence so you can still click and drag to resize the text area.
In the case of main frame scrollbars we are indeed returning an
empty rectangle from ScrollView::scrollCornerRect() when using
overlay scrollbars, but when calculating the size of the
scrollbars we are using the actual width/height instead of the
occupied with/height. For other scrollbars
RenderLayer::scrollCornerRect() is not checking whether scrollbars
are overlay or not and we are always returning a scroll corner
rectangle when scrollbars are present.
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars): Use the occupied
width/height when calculating the space the one scrollbar
should leave for the other.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollCornerRect): Return an empty
rectangle when using overlay scrollbars.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@195660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index c7c2f37..93118c2 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -711,7 +711,7 @@
IntRect oldRect(m_horizontalScrollbar->frameRect());
IntRect hBarRect(0,
height() - m_horizontalScrollbar->height(),
- width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
+ width() - (m_verticalScrollbar ? m_verticalScrollbar->occupiedWidth() : 0),
m_horizontalScrollbar->height());
m_horizontalScrollbar->setFrameRect(hBarRect);
if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect())
@@ -733,7 +733,7 @@
IntRect vBarRect(width() - m_verticalScrollbar->width(),
topContentInset(),
m_verticalScrollbar->width(),
- height() - topContentInset() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
+ height() - topContentInset() - (m_horizontalScrollbar ? m_horizontalScrollbar->occupiedHeight() : 0));
m_verticalScrollbar->setFrameRect(vBarRect);
if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
m_verticalScrollbar->invalidate();