Changeset 236501 in webkit


Ignore:
Timestamp:
Sep 26, 2018 7:34:10 AM (6 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Ensure renderers with accelerated animations have layers
https://bugs.webkit.org/show_bug.cgi?id=189990
<rdar://problem/44791222>

Reviewed by Zalan Bujtas.

We have done some work already in webkit.org/b/189784 to prevent never-ending calls to DocumentTimeline::updateAnimations(). This was due to
the change made for webkit.org/b/186930 where we queued calls to updateAnimations() in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
while we were waiting for a renderer with a layer backing for a given animation target. Instead of doing this, we now ensure renderers always
have a layer when they have an accelerated animation applied.

No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.

  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): This method should have been marked const all along and it is
now required so it can be called through RenderBox::requiresLayer() and RenderInline::requiresLayer().
(WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Deleted.

  • animation/DocumentTimeline.h:
  • animation/KeyframeEffectReadOnly.cpp:

(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Stop enqueuing the accelerated actions in case we're lacking a composited renderer
since this situation should no longer arise.

  • rendering/RenderBox.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const): Query the document timeline, if it exists, to check that this renderer's element
has accelerated animations applied.

  • rendering/RenderBoxModelObject.h:
  • rendering/RenderInline.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r236494 r236501  
     12018-09-26  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Ensure renderers with accelerated animations have layers
     4        https://bugs.webkit.org/show_bug.cgi?id=189990
     5        <rdar://problem/44791222>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        We have done some work already in webkit.org/b/189784 to prevent never-ending calls to DocumentTimeline::updateAnimations(). This was due to
     10        the change made for webkit.org/b/186930 where we queued calls to updateAnimations() in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
     11        while we were waiting for a renderer with a layer backing for a given animation target. Instead of doing this, we now ensure renderers always
     12        have a layer when they have an accelerated animation applied.
     13
     14        No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
     15        which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
     16
     17        * animation/DocumentTimeline.cpp:
     18        (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): This method should have been marked const all along and it is
     19        now required so it can be called through RenderBox::requiresLayer() and RenderInline::requiresLayer().
     20        (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Deleted.
     21        * animation/DocumentTimeline.h:
     22        * animation/KeyframeEffectReadOnly.cpp:
     23        (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Stop enqueuing the accelerated actions in case we're lacking a composited renderer
     24        since this situation should no longer arise.
     25        * rendering/RenderBox.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
     26        * rendering/RenderBoxModelObject.cpp:
     27        (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const): Query the document timeline, if it exists, to check that this renderer's element
     28        has accelerated animations applied.
     29        * rendering/RenderBoxModelObject.h:
     30        * rendering/RenderInline.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
     31
    1322018-09-25  Eric Carlson  <eric.carlson@apple.com>
    233
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r236323 r236501  
    447447}
    448448
    449 bool DocumentTimeline::runningAnimationsForElementAreAllAccelerated(Element& element)
     449bool DocumentTimeline::runningAnimationsForElementAreAllAccelerated(Element& element) const
    450450{
    451451    // FIXME: This will let animations run using hardware compositing even if later in the active
  • trunk/Source/WebCore/animation/DocumentTimeline.h

    r236308 r236501  
    6060    void animationAcceleratedRunningStateDidChange(WebAnimation&);
    6161    void applyPendingAcceleratedAnimations();
    62     bool runningAnimationsForElementAreAllAccelerated(Element&);
     62    bool runningAnimationsForElementAreAllAccelerated(Element&) const;
    6363    bool resolveAnimationsForElement(Element&, RenderStyle&);
    6464    void detachFromDocument();
  • trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp

    r236308 r236501  
    12781278
    12791279    auto* renderer = this->renderer();
    1280     if (!renderer || !renderer->isComposited()) {
    1281         if (m_lastRecordedAcceleratedAction != AcceleratedAction::Stop || m_pendingAcceleratedActions.last() != AcceleratedAction::Stop)
    1282             animation()->acceleratedStateDidChange();
    1283         return;
    1284     }
     1280    if (!renderer || !renderer->isComposited())
     1281        return;
    12851282
    12861283    auto pendingAcceleratedActions = m_pendingAcceleratedActions;
  • trunk/Source/WebCore/rendering/RenderBox.h

    r236356 r236501  
    5454        return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip()
    5555            || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection() || style().specifiesColumns()
    56             || !style().hasAutoZIndex();
     56            || !style().hasAutoZIndex() || hasRunningAcceleratedAnimations();
    5757    }
    5858
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r234619 r236501  
    3030#include "BorderEdge.h"
    3131#include "CachedImage.h"
     32#include "Document.h"
     33#include "DocumentTimeline.h"
    3234#include "FloatRoundedRect.h"
    3335#include "Frame.h"
     
    26892691}
    26902692
     2693bool RenderBoxModelObject::hasRunningAcceleratedAnimations() const
     2694{
     2695    if (auto* node = element()) {
     2696        if (auto* timeline = node->document().existingTimeline())
     2697            return timeline->runningAnimationsForElementAreAllAccelerated(*node);
     2698    }
     2699    return false;
     2700}
     2701
    26912702} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r233886 r236501  
    271271    DecodingMode decodingModeForImageDraw(const Image&, const PaintInfo&) const;
    272272
     273    bool hasRunningAcceleratedAnimations() const;
     274
    273275public:
    274276    // For RenderBlocks and RenderInlines with m_style->styleType() == PseudoId::FirstLetter, this tracks their remaining text fragments
  • trunk/Source/WebCore/rendering/RenderInline.h

    r228908 r236501  
    121121    bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
    122122
    123     bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || willChangeCreatesStackingContext(); }
     123    bool requiresLayer() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || willChangeCreatesStackingContext() || hasRunningAcceleratedAnimations(); }
    124124
    125125    LayoutUnit offsetLeft() const final;
Note: See TracChangeset for help on using the changeset viewer.