Changeset 195660 in webkit


Ignore:
Timestamp:
Jan 27, 2016 2:28:49 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r195659 r195660  
     12016-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Overlay scrollbars should always use the whole contents
     4        https://bugs.webkit.org/show_bug.cgi?id=153352
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        In case of having both horizontal and vertical scrollbars, the
     9        scrollbars respect the scroll corner. That looks good for legacy
     10        scrollbars that show the track, but with the overlay indicators
     11        it looks weird that the indicator stops so early before the end of
     12        the contents, giving the impression that there's something else to
     13        scroll. This happens because the scroll corner is transparent, so
     14        it's not obvious that's the scroll corner. It also happens with
     15        the text areas having a resizer. Legacy scrollbars take into
     16        account the resizer, which is good, but I expect overlay
     17        scrollbars to be rendered also over the resizer. The resizer takes
     18        precedence so you can still click and drag to resize the text area.
     19        In the case of main frame scrollbars we are indeed returning an
     20        empty rectangle from ScrollView::scrollCornerRect() when using
     21        overlay scrollbars, but when calculating the size of the
     22        scrollbars we are using the actual width/height instead of the
     23        occupied with/height. For other scrollbars
     24        RenderLayer::scrollCornerRect() is not checking whether scrollbars
     25        are overlay or not and we are always returning a scroll corner
     26        rectangle when scrollbars are present.
     27
     28        * platform/ScrollView.cpp:
     29        (WebCore::ScrollView::updateScrollbars): Use the occupied
     30        width/height when calculating the space the one scrollbar
     31        should leave for the other.
     32        * rendering/RenderLayer.cpp:
     33        (WebCore::RenderLayer::scrollCornerRect): Return an empty
     34        rectangle when using overlay scrollbars.
     35
    1362016-01-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    237
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r194515 r195660  
    712712        IntRect hBarRect(0,
    713713            height() - m_horizontalScrollbar->height(),
    714             width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
     714            width() - (m_verticalScrollbar ? m_verticalScrollbar->occupiedWidth() : 0),
    715715            m_horizontalScrollbar->height());
    716716        m_horizontalScrollbar->setFrameRect(hBarRect);
     
    734734            topContentInset(),
    735735            m_verticalScrollbar->width(),
    736             height() - topContentInset() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
     736            height() - topContentInset() - (m_horizontalScrollbar ? m_horizontalScrollbar->occupiedHeight() : 0));
    737737        m_verticalScrollbar->setFrameRect(vBarRect);
    738738        if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r195453 r195660  
    28222822IntRect RenderLayer::scrollCornerRect() const
    28232823{
    2824     // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
     2824    // We have a scrollbar corner when a non overlay scrollbar is visible and not filling the entire length of the box.
    28252825    // This happens when:
    2826     // (a) A resizer is present and at least one scrollbar is present
    2827     // (b) Both scrollbars are present.
    2828     bool hasHorizontalBar = horizontalScrollbar();
    2829     bool hasVerticalBar = verticalScrollbar();
     2826    // (a) A resizer is present and at least one non overlay scrollbar is present
     2827    // (b) Both non overlay scrollbars are present.
     2828    // Overlay scrollbars always fill the entire length of the box so we never have scroll corner in that case.
     2829    bool hasHorizontalBar = m_hBar && !m_hBar->isOverlayScrollbar();
     2830    bool hasVerticalBar = m_vBar && !m_vBar->isOverlayScrollbar();
    28302831    bool hasResizer = renderer().style().resize() != RESIZE_NONE;
    28312832    if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
Note: See TracChangeset for help on using the changeset viewer.