Changeset 252486 in webkit


Ignore:
Timestamp:
Nov 15, 2019 8:58:59 AM (4 years ago)
Author:
Simon Fraser
Message:

The image is flashing if falls out and has an animation transform: rotate
https://bugs.webkit.org/show_bug.cgi?id=203613

Reviewed by Antti Koivisto.
Source/WebCore:

Code added in r218735 that maps the animation extent through the current animating transform
worked for translations, but not rotation where anchor point matters. This matrix
needs to take anchor point into account.

Shared some code that applies anchor point to a matrix.

Test: compositing/backing/backing-store-attachment-with-rotation.html

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::layerTransform const):
(WebCore::GraphicsLayerCA::transformByApplyingAnchorPoint const):
(WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):

  • platform/graphics/ca/GraphicsLayerCA.h:

LayoutTests:

  • compositing/backing/backing-store-attachment-with-rotation-expected.txt: Added.
  • compositing/backing/backing-store-attachment-with-rotation.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252478 r252486  
     12019-11-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        The image is flashing if falls out and has an animation transform: rotate
     4        https://bugs.webkit.org/show_bug.cgi?id=203613
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * compositing/backing/backing-store-attachment-with-rotation-expected.txt: Added.
     9        * compositing/backing/backing-store-attachment-with-rotation.html: Added.
     10
    1112019-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r252483 r252486  
     12019-11-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        The image is flashing if falls out and has an animation transform: rotate
     4        https://bugs.webkit.org/show_bug.cgi?id=203613
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        Code added in r218735 that maps the animation extent through the current animating transform
     9        worked for translations, but not rotation where anchor point matters. This matrix
     10        needs to take anchor point into account.
     11
     12        Shared some code that applies anchor point to a matrix.
     13
     14        Test: compositing/backing/backing-store-attachment-with-rotation.html
     15
     16        * platform/graphics/ca/GraphicsLayerCA.cpp:
     17        (WebCore::GraphicsLayerCA::layerTransform const):
     18        (WebCore::GraphicsLayerCA::transformByApplyingAnchorPoint const):
     19        (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
     20        * platform/graphics/ca/GraphicsLayerCA.h:
     21
    1222019-11-15  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r251385 r252486  
    13751375        currentTransform = *m_transform;
    13761376   
    1377     if (!currentTransform.isIdentity()) {
    1378         FloatPoint3D absoluteAnchorPoint(anchorPoint());
    1379         absoluteAnchorPoint.scale(size().width(), size().height(), 1);
    1380         transform.translate3d(absoluteAnchorPoint.x(), absoluteAnchorPoint.y(), absoluteAnchorPoint.z());
    1381         transform.multiply(currentTransform);
    1382         transform.translate3d(-absoluteAnchorPoint.x(), -absoluteAnchorPoint.y(), -absoluteAnchorPoint.z());
    1383     }
     1377    transform.multiply(transformByApplyingAnchorPoint(currentTransform));
    13841378
    13851379    if (GraphicsLayer* parentLayer = parent()) {
     
    13951389   
    13961390    return transform;
     1391}
     1392
     1393TransformationMatrix GraphicsLayerCA::transformByApplyingAnchorPoint(const TransformationMatrix& matrix) const
     1394{
     1395    if (matrix.isIdentity())
     1396        return matrix;
     1397
     1398    TransformationMatrix result;
     1399    FloatPoint3D absoluteAnchorPoint(anchorPoint());
     1400    absoluteAnchorPoint.scale(size().width(), size().height(), 1);
     1401    result.translate3d(absoluteAnchorPoint.x(), absoluteAnchorPoint.y(), absoluteAnchorPoint.z());
     1402    result.multiply(matrix);
     1403    result.translate3d(-absoluteAnchorPoint.x(), -absoluteAnchorPoint.y(), -absoluteAnchorPoint.z());
     1404    return result;
    13971405}
    13981406
     
    14871495    if (auto extent = animationExtent()) {
    14881496        // Adjust the animation extent to match the current animation position.
    1489         bounds = rects.animatingTransform.inverse().valueOr(TransformationMatrix()).mapRect(*extent);
     1497        auto animatingTransformWithAnchorPoint = transformByApplyingAnchorPoint(rects.animatingTransform);
     1498        bounds = animatingTransformWithAnchorPoint.inverse().valueOr(TransformationMatrix()).mapRect(*extent);
    14901499    }
    14911500
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r249511 r252486  
    307307
    308308    TransformationMatrix layerTransform(const FloatPoint& position, const TransformationMatrix* customTransform = 0) const;
     309    TransformationMatrix transformByApplyingAnchorPoint(const TransformationMatrix&) const;
    309310
    310311    enum ComputeVisibleRectFlag { RespectAnimatingTransforms = 1 << 0 };
Note: See TracChangeset for help on using the changeset viewer.