Changeset 66552 in webkit


Ignore:
Timestamp:
Aug 31, 2010 4:21:57 PM (14 years ago)
Author:
Beth Dakin
Message:

Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView
should make more calls to postLayoutTasks() using the timer
-and corresponding-
<rdar://problem/8064938>

Reviewed by Dave Hyatt.

WebCore:

This change only allows synchronous calls to postLayoutTasks() if
we are not already in a synchronous call to postLayoutTasks().
Furthermore, it de-couples the notion of "the post layout timer
should fire" from m_postLayoutTasksTimer.isActive(), instead using
a boolean to track the need to use the timer.

  • page/FrameView.cpp:

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

  • page/FrameView.h:

LayoutTests:

  • fast/events/change-overflow-on-overflow-change-expected.txt: Added.
  • fast/events/change-overflow-on-overflow-change.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66551 r66552  
     12010-08-31  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView
     6        should make more calls to postLayoutTasks() using the timer
     7        -and corresponding-
     8        <rdar://problem/8064938>
     9
     10        * fast/events/change-overflow-on-overflow-change-expected.txt: Added.
     11        * fast/events/change-overflow-on-overflow-change.html: Added.
     12
    1132010-08-31  Alexey Proskuryakov  <ap@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r66550 r66552  
     12010-08-31  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView
     6        should make more calls to postLayoutTasks() using the timer
     7        -and corresponding-
     8        <rdar://problem/8064938>
     9
     10        This change only allows synchronous calls to postLayoutTasks() if
     11        we are not already in a synchronous call to postLayoutTasks().
     12        Furthermore, it de-couples the notion of "the post layout timer
     13        should fire" from m_postLayoutTasksTimer.isActive(), instead using
     14        a boolean to track the need to use the timer.
     15
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::FrameView):
     18        (WebCore::FrameView::~FrameView):
     19        (WebCore::FrameView::reset):
     20        (WebCore::FrameView::layout):
     21        (WebCore::FrameView::unscheduleRelayout):
     22        (WebCore::FrameView::performPostLayoutTasks):
     23        * page/FrameView.h:
     24
    1252010-08-30  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/WebCore/page/FrameView.cpp

    r66240 r66552  
    129129    , m_layoutTimer(this, &FrameView::layoutTimerFired)
    130130    , m_layoutRoot(0)
     131    , m_shouldFirePostLayoutTimer(false)
     132    , m_inSynchronousPostLayout(false)
    131133    , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
    132134    , m_isTransparent(false)
     
    165167FrameView::~FrameView()
    166168{
    167     if (m_postLayoutTasksTimer.isActive()) {
     169    if (m_shouldFirePostLayoutTimer) {
    168170        m_postLayoutTasksTimer.stop();
    169171        m_scheduledEvents.clear();
     
    205207    m_layoutSchedulingEnabled = true;
    206208    m_inLayout = false;
     209    m_inSynchronousPostLayout = false;
     210    m_shouldFirePostLayoutTimer = false;
    207211    m_layoutCount = 0;
    208212    m_nestedLayoutCount = 0;
     
    639643    m_layoutSchedulingEnabled = false;
    640644
    641     if (!m_nestedLayoutCount && m_postLayoutTasksTimer.isActive()) {
     645    if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_shouldFirePostLayoutTimer) {
    642646        // This is a new top-level layout. If there are any remaining tasks from the previous
    643647        // layout, finish them now.
     648        m_inSynchronousPostLayout = true;
    644649        m_postLayoutTasksTimer.stop();
    645650        performPostLayoutTasks();
     651        m_inSynchronousPostLayout = false;
    646652    }
    647653
     
    822828                             layoutHeight() < contentsHeight());
    823829
    824     if (!m_postLayoutTasksTimer.isActive()) {
    825         // Calls resumeScheduledEvents()
    826         performPostLayoutTasks();
    827 
    828         if (!m_postLayoutTasksTimer.isActive() && needsLayout()) {
    829             // Post-layout widget updates or an event handler made us need layout again.
    830             // Lay out again, but this time defer widget updates and event dispatch until after
    831             // we return.
     830    if (!m_shouldFirePostLayoutTimer) {
     831        if (!m_inSynchronousPostLayout) {
     832            m_inSynchronousPostLayout = true;
     833            // Calls resumeScheduledEvents()
     834            performPostLayoutTasks();
     835            m_inSynchronousPostLayout = false;
     836        }
     837
     838        if (!m_shouldFirePostLayoutTimer && (needsLayout() || m_inSynchronousPostLayout)) {
     839            // If we need layout or are already in a synchronous call to postLayoutTasks(),
     840            // defer widget updates and event dispatch until after we return. postLayoutTasks()
     841            // can make us need to update again, and we can get stuck in a nasty cycle unless
     842            // we call it through the timer here.
     843            m_shouldFirePostLayoutTimer = true;
    832844            m_postLayoutTasksTimer.startOneShot(0);
    833             pauseScheduledEvents();
    834             layout();
     845            if (needsLayout()) {
     846                pauseScheduledEvents();
     847                layout();
     848            }
    835849        }
    836850    } else {
     
    14531467void FrameView::unscheduleRelayout()
    14541468{
     1469    m_postLayoutTasksTimer.stop();
     1470
    14551471    if (!m_layoutTimer.isActive())
    14561472        return;
     
    15961612void FrameView::performPostLayoutTasks()
    15971613{
     1614    m_shouldFirePostLayoutTimer = false;
     1615
    15981616    if (m_firstLayoutCallbackPending) {
    15991617        m_firstLayoutCallbackPending = false;
  • trunk/WebCore/page/FrameView.h

    r65681 r66552  
    320320    bool m_layoutSchedulingEnabled;
    321321    bool m_inLayout;
     322    bool m_shouldFirePostLayoutTimer;
     323    bool m_inSynchronousPostLayout;
    322324    int m_layoutCount;
    323325    unsigned m_nestedLayoutCount;
Note: See TracChangeset for help on using the changeset viewer.