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/ChangeLog b/Source/WebCore/ChangeLog
index 241bbf3..c6d9f2c 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,40 @@
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
https://bugs.webkit.org/show_bug.cgi?id=153398
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();
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 689df7f..769f83d 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -2821,12 +2821,13 @@
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()));