Changeset 224241 in webkit


Ignore:
Timestamp:
Oct 31, 2017 1:27:18 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Layout viewport rect is too wide after window resize
https://bugs.webkit.org/show_bug.cgi?id=175235

Patch by Ali Juma <ajuma@chromium.org> on 2017-10-31
Reviewed by Dave Hyatt.

Source/WebCore:

After a window resize, ScrollView::updateScrollbars adds/removes scrollbars and triggers
layout. Each addition or removal triggers another pass, but at most 2 additional passes
are allowed. If a scrollbar is added or removed in the final allowed pass, layout is
left in an inconsistent state wrt the presence of scrollbars.

To avoid unnecessary passes, don't remove both scrollbars when only one needs to be
removed. This saves the extra pass needed to add the scrollbar back.

Test: fast/dom/Window/window-resize-update-scrollbars.html

  • platform/ScrollView.cpp:

(WebCore::ScrollView::updateScrollbars):

LayoutTests:

  • fast/dom/Window/window-resize-update-scrollbars-expected.txt: Added.
  • fast/dom/Window/window-resize-update-scrollbars.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224240 r224241  
     12017-10-31  Ali Juma  <ajuma@chromium.org>
     2
     3        Layout viewport rect is too wide after window resize
     4        https://bugs.webkit.org/show_bug.cgi?id=175235
     5
     6        Reviewed by Dave Hyatt.
     7
     8        * fast/dom/Window/window-resize-update-scrollbars-expected.txt: Added.
     9        * fast/dom/Window/window-resize-update-scrollbars.html: Added.
     10        * platform/ios/TestExpectations:
     11
    1122017-10-31  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/platform/ios/TestExpectations

    r224214 r224241  
    16591659# iOS does not support window resizing or window.resizeTo().
    16601660fast/css-grid-layout/flex-content-sized-columns-resize.html [ Skip ]
     1661fast/dom/Window/window-resize-update-scrollbars.html [ Skip ]
    16611662fast/dynamic/window-resize-scrollbars-test.html [ Skip ]
    16621663fast/images/animated-gif-window-resizing.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r224238 r224241  
     12017-10-31  Ali Juma  <ajuma@chromium.org>
     2
     3        Layout viewport rect is too wide after window resize
     4        https://bugs.webkit.org/show_bug.cgi?id=175235
     5
     6        Reviewed by Dave Hyatt.
     7
     8        After a window resize, ScrollView::updateScrollbars adds/removes scrollbars and triggers
     9        layout. Each addition or removal triggers another pass, but at most 2 additional passes
     10        are allowed. If a scrollbar is added or removed in the final allowed pass, layout is
     11        left in an inconsistent state wrt the presence of scrollbars.
     12
     13        To avoid unnecessary passes, don't remove both scrollbars when only one needs to be
     14        removed. This saves the extra pass needed to add the scrollbar back.
     15
     16        Test: fast/dom/Window/window-resize-update-scrollbars.html
     17
     18        * platform/ScrollView.cpp:
     19        (WebCore::ScrollView::updateScrollbars):
     20
    1212017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    222
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r223728 r224241  
    608608        bool needAnotherPass = false;
    609609        if (!hasOverlayScrollbars) {
    610             // If we ever turn one scrollbar off, always turn the other one off too. Never ever
     610            // If we ever turn one scrollbar off, do not turn the other one on. Never ever
    611611            // try to both gain/lose a scrollbar in the same pass.
    612612            if (!m_updateScrollbarsPass && docSize.width() <= fullVisibleSize.width() && docSize.height() <= fullVisibleSize.height()) {
     
    616616                    newHasVerticalScrollbar = false;
    617617            }
    618             if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != ScrollbarAlwaysOn) {
     618            if (!newHasHorizontalScrollbar && hasHorizontalScrollbar && vScroll != ScrollbarAlwaysOn &&!hasVerticalScrollbar) {
    619619                newHasVerticalScrollbar = false;
    620620                needAnotherPass = true;
    621621            }
    622             if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != ScrollbarAlwaysOn) {
     622            if (!newHasVerticalScrollbar && hasVerticalScrollbar && hScroll != ScrollbarAlwaysOn && !hasHorizontalScrollbar) {
    623623                newHasHorizontalScrollbar = false;
    624624                needAnotherPass = true;
Note: See TracChangeset for help on using the changeset viewer.