Changeset 104874 in webkit


Ignore:
Timestamp:
Jan 12, 2012 4:19:10 PM (12 years ago)
Author:
benjamin@webkit.org
Message:

A Frame with frame flattening can be stuck in a state in which performPostLayoutTasks() is never executed
https://bugs.webkit.org/show_bug.cgi?id=76154

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-01-12
Reviewed by Beth Dakin.

In a frame with inSubframeLayoutWithFrameFlattening == true, if
-m_hasPendingPostLayoutTasks == true
-FrameView::unscheduleRelayout() is executed
-->the timer m_postLayoutTasksTimer is stopped
-->no timer is scheduled due to m_hasPendingPostLayoutTasks == true && inSubframeLayoutWithFrameFlattening == true

This patch revert the handling of the postLayoutTasks to its state prior to r66552.

The timer itself is used as the only state to know if post layout tasks are scheduled.

For the case without frame flattening:
-Prior to this patch, when FrameView::unscheduleRelayout() was executed, the postLayoutTasksTimer was killed,
and the post layout tasks would be executed during the next layout().
-After this patch, the post layout tasks stay scheduled and are executed on the next event loop if layout()
was not invoked before.

  • page/FrameView.cpp:

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

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r104873 r104874  
     12012-01-12  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        A Frame with frame flattening can be stuck in a state in which performPostLayoutTasks() is never executed
     4        https://bugs.webkit.org/show_bug.cgi?id=76154
     5
     6        Reviewed by Beth Dakin.
     7
     8        In a frame with inSubframeLayoutWithFrameFlattening == true, if
     9        -m_hasPendingPostLayoutTasks == true
     10        -FrameView::unscheduleRelayout() is executed
     11        -->the timer m_postLayoutTasksTimer is stopped
     12        -->no timer is scheduled due to m_hasPendingPostLayoutTasks == true && inSubframeLayoutWithFrameFlattening == true
     13
     14        This patch revert the handling of the postLayoutTasks to its state prior to r66552.
     15
     16        The timer itself is used as the only state to know if post layout tasks are scheduled.
     17
     18        For the case without frame flattening:
     19        -Prior to this patch, when FrameView::unscheduleRelayout() was executed, the postLayoutTasksTimer was killed,
     20        and the post layout tasks would be executed during the next layout().
     21        -After this patch, the post layout tasks stay scheduled and are executed on the next event loop if layout()
     22        was not invoked before.
     23
     24        * page/FrameView.cpp:
     25        (WebCore::FrameView::FrameView):
     26        (WebCore::FrameView::~FrameView):
     27        (WebCore::FrameView::reset):
     28        (WebCore::FrameView::layout):
     29        (WebCore::FrameView::unscheduleRelayout):
     30        (WebCore::FrameView::flushAnyPendingPostLayoutTasks):
     31        (WebCore::FrameView::performPostLayoutTasks):
     32        * page/FrameView.h:
     33
    1342012-01-12  Yongjun Zhang  <yongjun_zhang@apple.com>
    235
  • trunk/Source/WebCore/page/FrameView.cpp

    r104260 r104874  
    135135    , m_inLayoutParentView(false)
    136136#endif
    137     , m_hasPendingPostLayoutTasks(false)
    138137    , m_inSynchronousPostLayout(false)
    139138    , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
     
    187186FrameView::~FrameView()
    188187{
    189     if (m_hasPendingPostLayoutTasks) {
     188    if (m_postLayoutTasksTimer.isActive()) {
    190189        m_postLayoutTasksTimer.stop();
    191190        m_actionScheduler->clear();
     
    233232    m_inLayout = false;
    234233    m_inSynchronousPostLayout = false;
    235     m_hasPendingPostLayoutTasks = false;
    236234    m_layoutCount = 0;
    237235    m_nestedLayoutCount = 0;
     
    995993        TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
    996994
    997         if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_hasPendingPostLayoutTasks && !inSubframeLayoutWithFrameFlattening) {
     995        if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !inSubframeLayoutWithFrameFlattening) {
    998996            // This is a new top-level layout. If there are any remaining tasks from the previous
    999997            // layout, finish them now.
    1000998            m_inSynchronousPostLayout = true;
    1001             m_postLayoutTasksTimer.stop();
    1002999            performPostLayoutTasks();
    10031000            m_inSynchronousPostLayout = false;
     
    11711168                             layoutHeight() < contentsHeight());
    11721169
    1173     if (!m_hasPendingPostLayoutTasks) {
     1170    if (!m_postLayoutTasksTimer.isActive()) {
    11741171        if (!m_inSynchronousPostLayout) {
    11751172            if (inSubframeLayoutWithFrameFlattening) {
     
    11841181        }
    11851182       
    1186         if (!m_hasPendingPostLayoutTasks && (needsLayout() || m_inSynchronousPostLayout || inSubframeLayoutWithFrameFlattening)) {
     1183        if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || inSubframeLayoutWithFrameFlattening)) {
    11871184            // If we need layout or are already in a synchronous call to postLayoutTasks(),
    11881185            // defer widget updates and event dispatch until after we return. postLayoutTasks()
    11891186            // can make us need to update again, and we can get stuck in a nasty cycle unless
    11901187            // we call it through the timer here.
    1191             m_hasPendingPostLayoutTasks = true;
    11921188            m_postLayoutTasksTimer.startOneShot(0);
    11931189            if (needsLayout()) {
     
    20942090void FrameView::unscheduleRelayout()
    20952091{
    2096     m_postLayoutTasksTimer.stop();
    2097 
    20982092    if (!m_layoutTimer.isActive())
    20992093        return;
     
    22772271void FrameView::flushAnyPendingPostLayoutTasks()
    22782272{
    2279     if (!m_hasPendingPostLayoutTasks)
    2280         return;
    2281 
     2273    if (!m_postLayoutTasksTimer.isActive())
     2274        return;
     2275
     2276    performPostLayoutTasks();
     2277}
     2278
     2279void FrameView::performPostLayoutTasks()
     2280{
    22822281    m_postLayoutTasksTimer.stop();
    2283     performPostLayoutTasks();
    2284 }
    2285 
    2286 void FrameView::performPostLayoutTasks()
    2287 {
    2288     m_hasPendingPostLayoutTasks = false;
    22892282
    22902283    m_frame->selection()->setCaretRectNeedsUpdate();
  • trunk/Source/WebCore/page/FrameView.h

    r103565 r104874  
    426426    bool m_inLayoutParentView;
    427427#endif
    428     bool m_hasPendingPostLayoutTasks;
    429428    bool m_inSynchronousPostLayout;
    430429    int m_layoutCount;
Note: See TracChangeset for help on using the changeset viewer.