Changeset 223712 in webkit


Ignore:
Timestamp:
Oct 19, 2017 2:23:13 PM (6 years ago)
Author:
Alan Bujtas
Message:

[FrameView::layout cleanup] Move scrollbars setup logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178394
<rdar://problem/35031066>

Reviewed by Antti Koivisto.

Decouple scrollbars setup and the unrelated first-layout logic.
FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time).

Covered by existing test cases.

  • page/FrameView.cpp:

(WebCore::FrameView::adjustScrollbarsForLayout):
(WebCore::FrameView::layout):

  • page/FrameView.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223711 r223712  
     12017-10-19  Zalan Bujtas  <zalan@apple.com>
     2
     3        [FrameView::layout cleanup] Move scrollbars setup logic to a separate function
     4        https://bugs.webkit.org/show_bug.cgi?id=178394
     5        <rdar://problem/35031066>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Decouple scrollbars setup and the unrelated first-layout logic.
     10        FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time).
     11
     12        Covered by existing test cases.
     13
     14        * page/FrameView.cpp:
     15        (WebCore::FrameView::adjustScrollbarsForLayout):
     16        (WebCore::FrameView::layout):
     17        * page/FrameView.h:
     18
    1192017-10-19  Tim Horton  <timothy_horton@apple.com>
    220
  • trunk/Source/WebCore/page/FrameView.cpp

    r223696 r223712  
    13411341}
    13421342
     1343void FrameView::adjustScrollbarsForLayout(bool isFirstLayout)
     1344{
     1345    ScrollbarMode hMode;
     1346    ScrollbarMode vMode;
     1347    calculateScrollbarModesForLayout(hMode, vMode);
     1348    if (isFirstLayout && !isLayoutNested()) {
     1349        setScrollbarsSuppressed(true);
     1350        // Set the initial vMode to AlwaysOn if we're auto.
     1351        if (vMode == ScrollbarAuto)
     1352            setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
     1353        // Set the initial hMode to AlwaysOff if we're auto.
     1354        if (hMode == ScrollbarAuto)
     1355            setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
     1356        ASSERT(frame().page());
     1357        if (frame().page()->expectsWheelEventTriggers())
     1358            scrollAnimator().setWheelEventTestTrigger(frame().page()->testTrigger());
     1359        setScrollbarModes(hMode, vMode);
     1360        setScrollbarsSuppressed(false, true);
     1361    } else if (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())
     1362        setScrollbarModes(hMode, vMode);
     1363}
     1364
    13431365void FrameView::layout(bool allowSubtreeLayout)
    13441366{
     
    14371459                LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs\n", this, document.timeSinceDocumentCreation().value());
    14381460#endif
    1439             ScrollbarMode hMode;
    1440             ScrollbarMode vMode;   
    1441             calculateScrollbarModesForLayout(hMode, vMode);
    1442 
    1443             if (m_firstLayout || (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())) {
    1444                 if (m_firstLayout) {
    1445                     setScrollbarsSuppressed(true);
    1446 
    1447                     m_firstLayout = false;
    1448                     m_firstLayoutCallbackPending = true;
    1449                     m_lastViewportSize = sizeForResizeEvent();
    1450                     m_lastZoomFactor = layoutRoot->style().zoom();
    1451 
    1452                     // Set the initial vMode to AlwaysOn if we're auto.
    1453                     if (vMode == ScrollbarAuto)
    1454                         setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
    1455                     // Set the initial hMode to AlwaysOff if we're auto.
    1456                     if (hMode == ScrollbarAuto)
    1457                         setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
    1458                     Page* page = frame().page();
    1459                     if (page && page->expectsWheelEventTriggers())
    1460                         scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
    1461                     setScrollbarModes(hMode, vMode);
    1462                     setScrollbarsSuppressed(false, true);
    1463                 } else
    1464                     setScrollbarModes(hMode, vMode);
     1461            if (m_firstLayout) {
     1462                m_lastViewportSize = sizeForResizeEvent();
     1463                m_lastZoomFactor = layoutRoot->style().zoom();
     1464                m_firstLayoutCallbackPending = true;
    14651465            }
     1466            adjustScrollbarsForLayout(m_firstLayout);
    14661467
    14671468            auto oldSize = m_size;
     
    14741475            }
    14751476            m_layoutPhase = InPreLayout;
     1477            m_firstLayout = false;
    14761478        }
    14771479
  • trunk/Source/WebCore/page/FrameView.h

    r223696 r223712  
    736736    void sendResizeEventIfNeeded();
    737737
     738    void adjustScrollbarsForLayout(bool firstLayout);
     739
    738740    void handleDeferredScrollbarsUpdateAfterDirectionChange();
    739741
Note: See TracChangeset for help on using the changeset viewer.