Changeset 113323 in webkit


Ignore:
Timestamp:
Apr 5, 2012 8:51:24 AM (12 years ago)
Author:
schenney@chromium.org
Message:

REGRESSION(99539): Infinite repaint loop with SVGImage and deferred repaint timers
https://bugs.webkit.org/show_bug.cgi?id=78315

Reviewed by Dimitri Glazkov.

The existing fix for this issue was failing to check if the frameView object
was currently _in_ layout, in addition to whether it needs layout. Calling the
redraw method while in layout leads to a debug assertion and potential infinite
layout loops. Now we check whether we need layout or are in layout. We also add
a check when the repaint timer fires to ensure we do not call redraw during layout
at that point.

This patch was tested with tens of thousands of runs on layout test cases that
previously crashed at a rate of about 1 in 25. Now we see no crashes and no test
failures.

No new tests, as this exists to fix flaky existing tests.

  • svg/graphics/SVGImageCache.cpp:

(WebCore::SVGImageCache::imageContentChanged):
(WebCore::SVGImageCache::redrawTimerFired):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113320 r113323  
     12012-04-05  Stephen Chenney  <schenney@chromium.org>
     2
     3        REGRESSION(99539): Infinite repaint loop with SVGImage and deferred repaint timers
     4        https://bugs.webkit.org/show_bug.cgi?id=78315
     5
     6        Reviewed by Dimitri Glazkov.
     7
     8        The existing fix for this issue was failing to check if the frameView object
     9        was currently _in_ layout, in addition to whether it needs layout. Calling the
     10        redraw method while in layout leads to a debug assertion and potential infinite
     11        layout loops. Now we check whether we need layout or are in layout. We also add
     12        a check when the repaint timer fires to ensure we do not call redraw during layout
     13        at that point.
     14
     15        This patch was tested with tens of thousands of runs on layout test cases that
     16        previously crashed at a rate of about 1 in 25. Now we see no crashes and no test
     17        failures.
     18
     19        No new tests, as this exists to fix flaky existing tests.
     20
     21        * svg/graphics/SVGImageCache.cpp:
     22        (WebCore::SVGImageCache::imageContentChanged):
     23        (WebCore::SVGImageCache::redrawTimerFired):
     24
    1252012-04-05  Keishi Hattori  <keishi@webkit.org>
    226
  • trunk/Source/WebCore/svg/graphics/SVGImageCache.cpp

    r111480 r113323  
    8585    // If we're in the middle of layout, start redrawing dirty
    8686    // images on a timer; otherwise it's safe to draw immediately.
    87 
    8887    FrameView* frameView = m_svgImage->frameView();
    89     if (frameView && frameView->needsLayout()) {
     88    if (frameView && (frameView->needsLayout() || frameView->isInLayout())) {
    9089        if (!m_redrawTimer.isActive())
    9190            m_redrawTimer.startOneShot(0);
     
    114113void SVGImageCache::redrawTimerFired(Timer<SVGImageCache>*)
    115114{
    116     redraw();
     115    // We have no guarantee that the frame does not require layout when the timer fired.
     116    // So be sure to check again in case it is still not safe to run redraw.
     117    FrameView* frameView = m_svgImage->frameView();
     118    if (frameView && (frameView->needsLayout() || frameView->isInLayout())) {
     119        if (!m_redrawTimer.isActive())
     120            m_redrawTimer.startOneShot(0);
     121    } else
     122       redraw();
    117123}
    118124
Note: See TracChangeset for help on using the changeset viewer.