Changeset 162354 in webkit


Ignore:
Timestamp:
Jan 20, 2014 9:21:26 AM (10 years ago)
Author:
Antti Koivisto
Message:

Update overlay scrollbars in single pass
https://bugs.webkit.org/show_bug.cgi?id=127289

Reviewed by Anders Carlsson.

  • platform/ScrollView.cpp:

(WebCore::ScrollView::updateScrollbars):

Multi-pass scrollbar resolution is only needed for traditional scrollbars. Overlay scrollbars don't affect layout.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r162351 r162354  
     12014-01-20  Antti Koivisto  <antti@apple.com>
     2
     3        Update overlay scrollbars in single pass
     4        https://bugs.webkit.org/show_bug.cgi?id=127289
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * platform/ScrollView.cpp:
     9        (WebCore::ScrollView::updateScrollbars):
     10       
     11            Multi-pass scrollbar resolution is only needed for traditional scrollbars. Overlay scrollbars don't affect layout.
     12
    1132014-01-20  Jochen Eisinger  <jochen@chromium.org>
    214
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r161589 r162354  
    506506        return;
    507507
     508    bool hasOverlayScrollbars = (!m_horizontalScrollbar || m_horizontalScrollbar->isOverlayScrollbar()) && (!m_verticalScrollbar || m_verticalScrollbar->isOverlayScrollbar());
     509
    508510    // If we came in here with the view already needing a layout, then go ahead and do that
    509511    // first.  (This will be the common case, e.g., when the page changes due to window resizing for example).
    510512    // This layout will not re-enter updateScrollbars and does not count towards our max layout pass total.
    511     if (!m_scrollbarsSuppressed) {
     513    if (!m_scrollbarsSuppressed && !hasOverlayScrollbars) {
    512514        m_inUpdateScrollbars = true;
    513515        visibleContentsResized();
     
    549551        IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
    550552
    551         if (hScroll == ScrollbarAuto) {
     553        if (hScroll == ScrollbarAuto)
    552554            newHasHorizontalScrollbar = docSize.width() > visibleWidth();
    553             if (newHasHorizontalScrollbar && !m_updateScrollbarsPass && docSize.width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height())
     555        if (vScroll == ScrollbarAuto)
     556            newHasVerticalScrollbar = docSize.height() > visibleHeight();
     557
     558        bool needAnotherPass = false;
     559        if (!hasOverlayScrollbars) {
     560            // If we ever turn one scrollbar off, always turn the other one off too. Never ever
     561            // try to both gain/lose a scrollbar in the same pass.
     562            if (!m_updateScrollbarsPass && docSize.width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height()) {
     563                if (hScroll == ScrollbarAuto)
     564                    newHasHorizontalScrollbar = false;
     565                if (vScroll == ScrollbarAuto)
     566                    newHasVerticalScrollbar = false;
     567            }
     568            if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != ScrollbarAlwaysOn) {
     569                newHasVerticalScrollbar = false;
     570                needAnotherPass = true;
     571            }
     572            if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != ScrollbarAlwaysOn) {
    554573                newHasHorizontalScrollbar = false;
    555         }
    556         if (vScroll == ScrollbarAuto) {
    557             newHasVerticalScrollbar = docSize.height() > visibleHeight();
    558             if (newHasVerticalScrollbar && !m_updateScrollbarsPass && docSize.width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height())
    559                 newHasVerticalScrollbar = false;
    560         }
    561 
    562         // If we ever turn one scrollbar off, always turn the other one off too.  Never ever
    563         // try to both gain/lose a scrollbar in the same pass.
    564         bool needAnotherPass = false;
    565         if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != ScrollbarAlwaysOn) {
    566             newHasVerticalScrollbar = false;
    567             needAnotherPass = true;
    568         }
    569 
    570         if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != ScrollbarAlwaysOn) {
    571             newHasHorizontalScrollbar = false;
    572             needAnotherPass = true;
     574                needAnotherPass = true;
     575            }
    573576        }
    574577
Note: See TracChangeset for help on using the changeset viewer.