⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 227841 in webkit


Ignore:
Timestamp:
Jan 30, 2018, 11:46:38 AM (9 years ago)
Author:
dino@apple.com
Message:

CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
​https://bugs.webkit.org/show_bug.cgi?id=182299
<rdar://problem/36853088>

Reviewed by Simon Fraser.

Source/WebCore:

Mostly speculative fix for the case where a scrollTo moves an
animated SVG image into view, causing its animation to restart during
a paint operation. This was causing a release ASSERT, so we now defer
the resumption of the animation into a timer.

Test: svg/animated-svgImage-scroll.html

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the
animation if it is an SVGImage.

  • svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts.

(WebCore::SVGImage::SVGImage):
(WebCore::SVGImage::startAnimationTimerFired):
(WebCore::SVGImage::enqueueStartAnimation):
(WebCore::SVGImage::stopAnimation):

  • svg/graphics/SVGImage.h:

LayoutTests:

  • svg/animated-svgImage-scroll-expected.txt: Added.
  • svg/animated-svgImage-scroll.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r227785 r227841  
     12018-01-30  Dean Jackson  <dino@apple.com>
     2
     3        CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
     4        https://bugs.webkit.org/show_bug.cgi?id=182299
     5        <rdar://problem/36853088>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * svg/animated-svgImage-scroll-expected.txt: Added.
     10        * svg/animated-svgImage-scroll.html: Added.
     11
    1122018-01-30  Frederic Wang  <fwang@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r227796 r227841  
     12018-01-30  Dean Jackson  <dino@apple.com>
     2
     3        CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
     4        https://bugs.webkit.org/show_bug.cgi?id=182299
     5        <rdar://problem/36853088>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Mostly speculative fix for the case where a scrollTo moves an
     10        animated SVG image into view, causing its animation to restart during
     11        a paint operation. This was causing a release ASSERT, so we now defer
     12        the resumption of the animation into a timer.
     13
     14        Test: svg/animated-svgImage-scroll.html
     15
     16        * rendering/RenderElement.cpp:
     17        (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the
     18        animation if it is an SVGImage.
     19        * svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts.
     20        (WebCore::SVGImage::SVGImage):
     21        (WebCore::SVGImage::startAnimationTimerFired):
     22        (WebCore::SVGImage::enqueueStartAnimation):
     23        (WebCore::SVGImage::stopAnimation):
     24        * svg/graphics/SVGImage.h:
     25
    1262018-01-30  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r227791 r227841  
    6969#include "RenderTreeBuilder.h"
    7070#include "RenderView.h"
     71#include "SVGImage.h"
    7172#include "SVGRenderSupport.h"
    7273#include "Settings.h"
    … …  
    14691470    repaint();
    14701471
    1471     if (auto* image = cachedImage.image())
    1472         image->startAnimation();
     1472    if (auto* image = cachedImage.image()) {
     1473        // SVGImages might cause a layout when starting an animation, so
     1474        // schedule them rather than start immediately.
     1475        if (is<SVGImage>(image))
     1476            downcast<SVGImage>(image)->scheduleStartAnimation();
     1477        else
     1478            image->startAnimation();
     1479    }
    14731480
    14741481    // For directly-composited animated GIFs it does not suffice to call repaint() to resume animation. We need to mark the image as changed.
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r226425 r227841  
    7070SVGImage::SVGImage(ImageObserver& observer)
    7171    : Image(&observer)
     72    , m_startAnimationTimer(*this, &SVGImage::startAnimationTimerFired)
    7273{
    7374}
    … …  
    378379}
    379380
     381void SVGImage::startAnimationTimerFired()
     382{
     383    startAnimation();
     384}
     385
     386void SVGImage::scheduleStartAnimation()
     387{
     388    auto rootElement = this->rootElement();
     389    if (!rootElement || !rootElement->animationsPaused())
     390        return;
     391    m_startAnimationTimer.startOneShot(0_s);
     392}
     393
    380394void SVGImage::startAnimation()
    381395{
    … …  
    389403void SVGImage::stopAnimation()
    390404{
     405    m_startAnimationTimer.stop();
    391406    auto rootElement = this->rootElement();
    392407    if (!rootElement)
  • trunk/Source/WebCore/svg/graphics/SVGImage.h

    r224615 r227841  
    6161    bool isAnimating() const final;
    6262
     63    void scheduleStartAnimation();
     64
    6365#if USE(CAIRO)
    6466    NativeImagePtr nativeImageForCurrentFrame(const GraphicsContext* = nullptr) final;
    … …  
    9092    bool currentFrameKnownToBeOpaque() const final { return false; }
    9193
     94    void startAnimationTimerFired();
     95
    9296    explicit SVGImage(ImageObserver&);
    9397    ImageDrawResult draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode, DecodingMode, ImageOrientationDescription) final;
    … …  
    101105    std::unique_ptr<Page> m_page;
    102106    FloatSize m_intrinsicSize;
     107
     108    Timer m_startAnimationTimer;
    103109};
    104110
Note: See TracChangeset for help on using the changeset viewer.