Changeset 287606 in webkit


Ignore:
Timestamp:
Jan 5, 2022 12:22:38 AM (7 months 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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r287602 r287606  
     12022-01-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        CSS `transform` property  should take into account transform reference box
     4        https://bugs.webkit.org/show_bug.cgi?id=234144
     5        <rdar://problem/86630206>
     6
     7        Reviewed by Darin Adler.
     8
     9        * web-platform-tests/css/css-transforms/transform-percent-009-expected.txt:
     10
    1112022-01-04  Antoine Quint  <graouts@webkit.org>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-percent-009-expected.txt

    r282287 r287606  
    11
    2 FAIL Percentage 'translate(...)' with 'fill-box' transform-box assert_equals: expected "matrix(1, 0, 0, 1, 50, 50)" but got "matrix(1, 0, 0, 1, 0, 0)"
    3 FAIL Percentage 'translate(...)' with 'view-box' transform-box assert_equals: expected "matrix(1, 0, 0, 1, 150, 75)" but got "matrix(1, 0, 0, 1, 0, 0)"
    4 FAIL Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> with 'viewBox' assert_equals: expected "matrix(1, 0, 0, 1, 25, 25)" but got "matrix(1, 0, 0, 1, 0, 0)"
    5 FAIL Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> without 'viewBox' assert_equals: expected "matrix(1, 0, 0, 1, 50, 50)" but got "matrix(1, 0, 0, 1, 0, 0)"
     2PASS Percentage 'translate(...)' with 'fill-box' transform-box
     3PASS Percentage 'translate(...)' with 'view-box' transform-box
     4PASS Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> with 'viewBox'
     5PASS Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> without 'viewBox'
    66
  • trunk/Source/WebCore/ChangeLog

    r287604 r287606  
     12022-01-05  Martin Robinson  <mrobinson@webkit.org>
     2
     3        CSS `transform` property  should take into account transform reference box
     4        https://bugs.webkit.org/show_bug.cgi?id=234144
     5        <rdar://problem/86630206>
     6
     7        Reviewed by Darin Adler.
     8
     9        No new tests. This is covered by the existing WPT test:
     10            web-platform-tests/css/css-transforms/transform-percent-009.html
     11
     12        * css/CSSComputedStyleDeclaration.cpp:
     13        (WebCore::computedTransform): Use the transform reference box when computing the
     14        computed transform instead of always using the border box. This function is
     15        modified to take in a RenderElement to avoid casting. All callers pass a RenderElement.
     16
    1172022-01-04  Frédéric Wang  <fwang@igalia.com>
    218
  • 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.