Ignore:
Timestamp:
Jan 5, 2022, 12:22:38 AM (3 years ago)
Author:
Martin Robinson
Message:

CSS transform property should take into account transform reference box
https://bugs.webkit.org/show_bug.cgi?id=234144
<rdar://problem/86630206>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-transforms/transform-percent-009-expected.txt:

Source/WebCore:

No new tests. This is covered by the existing WPT test:

web-platform-tests/css/css-transforms/transform-percent-009.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::computedTransform): Use the transform reference box when computing the
computed transform instead of always using the border box. This function is
modified to take in a RenderElement to avoid casting. All callers pass a RenderElement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r287602 r287606  
    618618}
    619619
    620 static Ref<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle& style)
     620static Ref<CSSValue> computedTransform(RenderElement* renderer, const RenderStyle& style)
    621621{
    622622    if (!rendererCanBeTransformed(renderer) || !style.hasTransform())
    623623        return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
    624624
    625     FloatRect pixelSnappedRect;
    626     if (is<RenderBox>(*renderer))
    627         pixelSnappedRect = snapRectToDevicePixels(downcast<RenderBox>(*renderer).borderBoxRect(), renderer->document().deviceScaleFactor());
    628 
    629625    TransformationMatrix transform;
    630     style.applyTransform(transform, pixelSnappedRect, { });
     626    style.applyTransform(transform, transformReferenceBox(style, *renderer), { });
    631627    // Note that this does not flatten to an affine transform if ENABLE(3D_TRANSFORMS) is off, by design.
    632628
Note: See TracChangeset for help on using the changeset viewer.