Changeset 223696 in webkit


Ignore:
Timestamp:
Oct 19, 2017 11:39:39 AM (7 years ago)
Author:
Alan Bujtas
Message:

[FrameView::layout cleanup] Do not reenter FrameView::performPostLayoutTasks
https://bugs.webkit.org/show_bug.cgi?id=178518
<rdar://problem/35075409>

Reviewed by Antti Koivisto.

This patch tightens existing reentrancy policy on performPostLayoutTasks.

Covered by existing test cases.

  • page/FrameView.cpp:

(WebCore::FrameView::FrameView):
(WebCore::FrameView::reset):
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223692 r223696  
     12017-10-19  Zalan Bujtas  <zalan@apple.com>
     2
     3        [FrameView::layout cleanup] Do not reenter FrameView::performPostLayoutTasks
     4        https://bugs.webkit.org/show_bug.cgi?id=178518
     5        <rdar://problem/35075409>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This patch tightens existing reentrancy policy on performPostLayoutTasks.
     10
     11        Covered by existing test cases.
     12
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::FrameView):
     15        (WebCore::FrameView::reset):
     16        (WebCore::FrameView::layout):
     17        (WebCore::FrameView::performPostLayoutTasks):
     18        * page/FrameView.h:
     19
    1202017-10-19  Chris Dumez  <cdumez@apple.com>
    221
  • trunk/Source/WebCore/page/FrameView.cpp

    r223689 r223696  
    243243    , m_layoutTimer(*this, &FrameView::layoutTimerFired)
    244244    , m_layoutPhase(OutsideLayout)
    245     , m_inSynchronousPostLayout(false)
    246245    , m_postLayoutTasksTimer(*this, &FrameView::performPostLayoutTasks)
    247246    , m_updateEmbeddedObjectsTimer(*this, &FrameView::updateEmbeddedObjectsTimerFired)
     
    342341    m_layoutSchedulingEnabled = true;
    343342    m_layoutPhase = OutsideLayout;
    344     m_inSynchronousPostLayout = false;
    345343    m_layoutCount = 0;
    346344    m_postLayoutTasksTimer.stop();
     
    13961394    {
    13971395        SetForScope<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
    1398 
    1399         if (!isLayoutNested() && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening()) {
    1400             // This is a new top-level layout. If there are any remaining tasks from the previous
    1401             // layout, finish them now.
    1402             SetForScope<bool> inSynchronousPostLayoutChange(m_inSynchronousPostLayout, true);
     1396        // If this is a new top-level layout and there are any remaining tasks from the previous layout, finish them now.
     1397        if (!isLayoutNested() && m_postLayoutTasksTimer.isActive() && !isInChildFrameWithFrameFlattening())
    14031398            performPostLayoutTasks();
    1404         }
    14051399
    14061400        // Viewport-dependent media queries may cause us to need completely different style information.
     
    15541548
    15551549    if (!m_postLayoutTasksTimer.isActive()) {
    1556         if (!m_inSynchronousPostLayout) {
     1550        if (!m_inPerformPostLayoutTasks) {
    15571551            if (isInChildFrameWithFrameFlattening())
    15581552                updateWidgetPositions();
    1559             else {
    1560                 SetForScope<bool> inSynchronousPostLayoutChange(m_inSynchronousPostLayout, true);
     1553            else
    15611554                performPostLayoutTasks(); // Calls resumeScheduledEvents().
    1562             }
    15631555        }
    15641556
    1565         if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || isInChildFrameWithFrameFlattening())) {
     1557        if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inPerformPostLayoutTasks || isInChildFrameWithFrameFlattening())) {
    15661558            // If we need layout or are already in a synchronous call to postLayoutTasks(),
    15671559            // defer widget updates and event dispatch until after we return. postLayoutTasks()
     
    35023494void FrameView::performPostLayoutTasks()
    35033495{
     3496    if (m_inPerformPostLayoutTasks)
     3497        return;
     3498
     3499    SetForScope<bool> inPerformPostLayoutTasks(m_inPerformPostLayoutTasks, true);
    35043500    // FIXME: We should not run any JavaScript code in this function.
    35053501    LOG(Layout, "FrameView %p performPostLayoutTasks", this);
  • trunk/Source/WebCore/page/FrameView.h

    r223689 r223696  
    806806    LayoutPhase m_layoutPhase;
    807807    bool m_layoutSchedulingEnabled;
    808     bool m_inSynchronousPostLayout;
     808    bool m_inPerformPostLayoutTasks { false };
    809809    int m_layoutCount;
    810810    enum class LayoutNestedState { NotInLayout, NotNested, Nested };
Note: See TracChangeset for help on using the changeset viewer.