Skip to content
Permalink
Browse files
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.

Canonical link: https://commits.webkit.org/171607@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Jan 27, 2016
1 parent 654c816 commit fb0bdf1af21d28a97a551448c1ea68679b430984
Showing 3 changed files with 43 additions and 7 deletions.
@@ -1,3 +1,38 @@
2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com>

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.

2016-01-27 Carlos Garcia Campos <cgarcia@igalia.com>

ScrollAnimator is not notified when mouse entered, moved or exited a RenderListBox
@@ -711,7 +711,7 @@ void ScrollView::updateScrollbars(const ScrollPosition& desiredPosition)
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 @@ void ScrollView::updateScrollbars(const ScrollPosition& desiredPosition)
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();
@@ -2821,12 +2821,13 @@ static LayoutRect cornerRect(const RenderLayer* layer, const LayoutRect& bounds)

IntRect RenderLayer::scrollCornerRect() const
{
// We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
// We have a scrollbar corner when a non overlay scrollbar is visible and not filling the entire length of the box.
// This happens when:
// (a) A resizer is present and at least one scrollbar is present
// (b) Both scrollbars are present.
bool hasHorizontalBar = horizontalScrollbar();
bool hasVerticalBar = verticalScrollbar();
// (a) A resizer is present and at least one non overlay scrollbar is present
// (b) Both non overlay scrollbars are present.
// Overlay scrollbars always fill the entire length of the box so we never have scroll corner in that case.
bool hasHorizontalBar = m_hBar && !m_hBar->isOverlayScrollbar();
bool hasVerticalBar = m_vBar && !m_vBar->isOverlayScrollbar();
bool hasResizer = renderer().style().resize() != RESIZE_NONE;
if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
return snappedIntRect(cornerRect(this, renderBox()->borderBoxRect()));

0 comments on commit fb0bdf1

Please sign in to comment.