Changeset 239222 in webkit


Ignore:
Timestamp:
Dec 14, 2018 11:05:43 AM (5 years ago)
Author:
Simon Fraser
Message:

REGRESSION (r233268): contents of an animated element inside overflow:hidden disappear
https://bugs.webkit.org/show_bug.cgi?id=188655
rdar://problem/43382687

Reviewed by Antoine Quint.

Source/WebCore:

The logic that computes animation extent, used by backing store attachment code, failed
to account for the behavior where a keyframe animation with a missing 0% keyframe uses
the transform from the unanimated style. This resulted in the computed extent being wrong,
which caused us to remove the layer's backing store in some scenarios.

Fix both animation code paths to use the renderer style if the first keyframe doesn't
contain a transform.

Tests: compositing/backing/backing-store-attachment-empty-keyframe.html

legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html

  • animation/KeyframeEffect.cpp:

(WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):

  • page/animation/KeyframeAnimation.cpp:

(WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):

LayoutTests:

  • compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: Added.
  • compositing/backing/backing-store-attachment-empty-keyframe.html: Added.
  • legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: Added.
  • legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r239217 r239222  
     12018-12-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (r233268): contents of an animated element inside overflow:hidden disappear
     4        https://bugs.webkit.org/show_bug.cgi?id=188655
     5        rdar://problem/43382687
     6
     7        Reviewed by Antoine Quint.
     8
     9        * compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: Added.
     10        * compositing/backing/backing-store-attachment-empty-keyframe.html: Added.
     11        * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe-expected.txt: Added.
     12        * legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html: Added.
     13
    1142018-12-14  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r239219 r239222  
     12018-12-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (r233268): contents of an animated element inside overflow:hidden disappear
     4        https://bugs.webkit.org/show_bug.cgi?id=188655
     5        rdar://problem/43382687
     6
     7        Reviewed by Antoine Quint.
     8
     9        The logic that computes animation extent, used by backing store attachment code, failed
     10        to account for the behavior where a keyframe animation with a missing 0% keyframe uses
     11        the transform from the unanimated style. This resulted in the computed extent being wrong,
     12        which caused us to remove the layer's backing store in some scenarios.
     13
     14        Fix both animation code paths to use the renderer style if the first keyframe doesn't
     15        contain a transform.
     16
     17        Tests: compositing/backing/backing-store-attachment-empty-keyframe.html
     18               legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html
     19
     20        * animation/KeyframeEffect.cpp:
     21        (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
     22        * page/animation/KeyframeAnimation.cpp:
     23        (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
     24
    1252018-12-14  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebCore/animation/KeyframeEffect.cpp

    r237855 r239222  
    14091409        return true; // Non-boxes don't get transformed;
    14101410
    1411     RenderBox& box = downcast<RenderBox>(*renderer());
    1412     FloatRect rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
    1413 
    1414     FloatRect cumulativeBounds = bounds;
     1411    auto& box = downcast<RenderBox>(*renderer());
     1412    auto rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
     1413
     1414    auto cumulativeBounds = bounds;
    14151415
    14161416    for (const auto& keyframe : m_blendingKeyframes.keyframes()) {
     1417        const auto* keyframeStyle = keyframe.style();
     1418
    14171419        // FIXME: maybe for declarative animations we always say it's true for the first and last keyframe.
    1418         if (!keyframe.containsProperty(CSSPropertyTransform))
    1419             continue;
    1420 
    1421         LayoutRect keyframeBounds = bounds;
     1420        if (!keyframe.containsProperty(CSSPropertyTransform)) {
     1421            // If the first keyframe is missing transform style, use the current style.
     1422            if (!keyframe.key())
     1423                keyframeStyle = &box.style();
     1424            else
     1425                continue;
     1426        }
     1427
     1428        auto keyframeBounds = bounds;
    14221429
    14231430        bool canCompute;
    14241431        if (transformFunctionListsMatch())
    1425             canCompute = computeTransformedExtentViaTransformList(rendererBox, *keyframe.style(), keyframeBounds);
     1432            canCompute = computeTransformedExtentViaTransformList(rendererBox, *keyframeStyle, keyframeBounds);
    14261433        else
    1427             canCompute = computeTransformedExtentViaMatrix(rendererBox, *keyframe.style(), keyframeBounds);
     1434            canCompute = computeTransformedExtentViaMatrix(rendererBox, *keyframeStyle, keyframeBounds);
    14281435
    14291436        if (!canCompute)
     
    14331440    }
    14341441
    1435     bounds = LayoutRect(cumulativeBounds);
     1442    bounds = cumulativeBounds;
    14361443    return true;
    14371444}
  • trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp

    r234073 r239222  
    246246        return true; // Non-boxes don't get transformed;
    247247
    248     RenderBox& box = downcast<RenderBox>(*renderer());
    249     FloatRect rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
    250 
    251     FloatRect cumulativeBounds = bounds;
     248    auto& box = downcast<RenderBox>(*renderer());
     249    auto rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
     250
     251    auto cumulativeBounds = bounds;
    252252
    253253    for (auto& keyframe : m_keyframes.keyframes()) {
    254         if (!keyframe.containsProperty(CSSPropertyTransform))
    255             continue;
    256 
    257         LayoutRect keyframeBounds = bounds;
     254        const RenderStyle* keyframeStyle = keyframe.style();
     255
     256        if (!keyframe.containsProperty(CSSPropertyTransform)) {
     257            // If the first keyframe is missing transform style, use the current style.
     258            if (!keyframe.key())
     259                keyframeStyle = &box.style();
     260            else
     261                continue;
     262        }
     263
     264        auto keyframeBounds = bounds;
    258265       
    259266        bool canCompute;
    260267        if (transformFunctionListsMatch())
    261             canCompute = computeTransformedExtentViaTransformList(rendererBox, *keyframe.style(), keyframeBounds);
     268            canCompute = computeTransformedExtentViaTransformList(rendererBox, *keyframeStyle, keyframeBounds);
    262269        else
    263             canCompute = computeTransformedExtentViaMatrix(rendererBox, *keyframe.style(), keyframeBounds);
     270            canCompute = computeTransformedExtentViaMatrix(rendererBox, *keyframeStyle, keyframeBounds);
    264271       
    265272        if (!canCompute)
     
    269276    }
    270277
    271     bounds = LayoutRect(cumulativeBounds);
     278    bounds = cumulativeBounds;
    272279    return true;
    273280}
Note: See TracChangeset for help on using the changeset viewer.