Changeset 223605 in webkit


Ignore:
Timestamp:
Oct 18, 2017 7:18:24 AM (6 years ago)
Author:
Alan Bujtas
Message:

[FrameView::layout cleanup] Move frame flattening layout logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178425
<rdar://problem/35045836>

Reviewed by Antti Koivisto.

No change in functionality.

  • page/FrameView.cpp:

(WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
(WebCore::FrameView::layout):
(WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223604 r223605  
     12017-10-18  Zalan Bujtas  <zalan@apple.com>
     2
     3        [FrameView::layout cleanup] Move frame flattening layout logic to a separate function
     4        https://bugs.webkit.org/show_bug.cgi?id=178425
     5        <rdar://problem/35045836>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        No change in functionality.
     10
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
     13        (WebCore::FrameView::layout):
     14        (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
     15        * page/FrameView.h:
     16
    1172017-10-18  Antti Koivisto  <antti@apple.com>
    218
  • trunk/Source/WebCore/page/FrameView.cpp

    r223590 r223605  
    13231323#endif
    13241324
     1325bool FrameView::handleLayoutWithFrameFlatteningIfNeeded(bool allowSubtreeLayout)
     1326{
     1327    if (!isInChildFrameWithFrameFlattening())
     1328        return false;
     1329   
     1330    if (!m_frameFlatteningViewSizeForMediaQuery) {
     1331        LOG_WITH_STREAM(MediaQueries, stream << "FrameView " << this << " snapshotting size " <<  ScrollView::layoutSize() << " for media queries");
     1332        m_frameFlatteningViewSizeForMediaQuery = ScrollView::layoutSize();
     1333    }
     1334    startLayoutAtMainFrameViewIfNeeded(allowSubtreeLayout);
     1335    auto* layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : frame().document()->renderView();
     1336    return !layoutRoot || !layoutRoot->needsLayout();
     1337}
     1338
    13251339void FrameView::layout(bool allowSubtreeLayout)
    13261340{
     
    13471361    // Every scroll that happens during layout is programmatic.
    13481362    SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
    1349 
    1350     bool inChildFrameLayoutWithFrameFlattening = isInChildFrameWithFrameFlattening();
    1351 
    1352     if (inChildFrameLayoutWithFrameFlattening) {
    1353         if (!m_frameFlatteningViewSizeForMediaQuery) {
    1354             LOG_WITH_STREAM(MediaQueries, stream << "FrameView " << this << " snapshotting size " <<  ScrollView::layoutSize() << " for media queries");
    1355             m_frameFlatteningViewSizeForMediaQuery = ScrollView::layoutSize();
    1356         }
    1357         startLayoutAtMainFrameViewIfNeeded(allowSubtreeLayout);
    1358         auto* layoutRoot = m_subtreeLayoutRoot ? m_subtreeLayoutRoot : frame().document()->renderView();
    1359         if (!layoutRoot || !layoutRoot->needsLayout())
    1360             return;
    1361     }
    13621363   
    13631364    TraceScope tracingScope(LayoutStart, LayoutEnd);
     1365
     1366    if (handleLayoutWithFrameFlatteningIfNeeded(allowSubtreeLayout))
     1367        return;
    13641368
    13651369#if PLATFORM(IOS)
     
    13951399        SetForScope<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
    13961400
    1397         if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !inChildFrameLayoutWithFrameFlattening) {
     1401        if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening()) {
    13981402            // This is a new top-level layout. If there are any remaining tasks from the previous
    13991403            // layout, finish them now.
     
    15771581    if (!m_postLayoutTasksTimer.isActive()) {
    15781582        if (!m_inSynchronousPostLayout) {
    1579             if (inChildFrameLayoutWithFrameFlattening)
     1583            if (isInChildFrameWithFrameFlattening())
    15801584                updateWidgetPositions();
    15811585            else {
     
    15851589        }
    15861590
    1587         if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || inChildFrameLayoutWithFrameFlattening)) {
     1591        if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || isInChildFrameWithFrameFlattening())) {
    15881592            // If we need layout or are already in a synchronous call to postLayoutTasks(),
    15891593            // defer widget updates and event dispatch until after we return. postLayoutTasks()
     
    42904294}
    42914295
    4292 void FrameView::startLayoutAtMainFrameViewIfNeeded(bool allowSubtree)
     4296void FrameView::startLayoutAtMainFrameViewIfNeeded(bool allowSubtreeLayout)
    42934297{
    42944298    // When we start a layout at the child level as opposed to the topmost frame view and this child
     
    43114315
    43124316    LOG(Layout, "  frame flattening, starting from root");
    4313     parentView->layout(allowSubtree);
     4317    parentView->layout(allowSubtreeLayout);
    43144318}
    43154319
  • trunk/Source/WebCore/page/FrameView.h

    r223569 r223605  
    763763    FrameView* parentFrameView() const;
    764764
    765     void startLayoutAtMainFrameViewIfNeeded(bool allowSubtree);
     765    bool handleLayoutWithFrameFlatteningIfNeeded(bool allowSubtreeLayout);
     766    void startLayoutAtMainFrameViewIfNeeded(bool allowSubtreeLayout);
    766767    bool frameFlatteningEnabled() const;
    767768    bool isFrameFlatteningValidForThisFrame() const;
Note: See TracChangeset for help on using the changeset viewer.