Title: [287606] trunk
Revision
287606
Author
mrobin...@webkit.org
Date
2022-01-05 00:22:38 -0800 (Wed, 05 Jan 2022)

Log 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (287605 => 287606)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-05 08:02:48 UTC (rev 287605)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-05 08:22:38 UTC (rev 287606)
@@ -1,3 +1,13 @@
+2022-01-05  Martin Robinson  <mrobin...@webkit.org>
+
+        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.
+
+        * web-platform-tests/css/css-transforms/transform-percent-009-expected.txt:
+
 2022-01-04  Antoine Quint  <grao...@webkit.org>
 
         WPT test css/css-transitions/parsing/transition-shorthand.html has failures

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-percent-009-expected.txt (287605 => 287606)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-percent-009-expected.txt	2022-01-05 08:02:48 UTC (rev 287605)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-percent-009-expected.txt	2022-01-05 08:22:38 UTC (rev 287606)
@@ -1,6 +1,6 @@
 
-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)"
-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)"
-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)"
-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)"
+PASS Percentage 'translate(...)' with 'fill-box' transform-box
+PASS Percentage 'translate(...)' with 'view-box' transform-box
+PASS Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> with 'viewBox'
+PASS Percentage 'translate(...)' with 'view-box' transform-box in nested <svg> without 'viewBox'
 

Modified: trunk/Source/WebCore/ChangeLog (287605 => 287606)


--- trunk/Source/WebCore/ChangeLog	2022-01-05 08:02:48 UTC (rev 287605)
+++ trunk/Source/WebCore/ChangeLog	2022-01-05 08:22:38 UTC (rev 287606)
@@ -1,3 +1,19 @@
+2022-01-05  Martin Robinson  <mrobin...@webkit.org>
+
+        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.
+
+        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.
+
 2022-01-04  Frédéric Wang  <fw...@igalia.com>
 
         Protect frame from destruction in HTMLMediaElement::setupAndCallJS

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (287605 => 287606)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-05 08:02:48 UTC (rev 287605)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-05 08:22:38 UTC (rev 287606)
@@ -617,17 +617,13 @@
     return renderer && !is<RenderInline>(*renderer);
 }
 
-static Ref<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle& style)
+static Ref<CSSValue> computedTransform(RenderElement* renderer, const RenderStyle& style)
 {
     if (!rendererCanBeTransformed(renderer) || !style.hasTransform())
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
 
-    FloatRect pixelSnappedRect;
-    if (is<RenderBox>(*renderer))
-        pixelSnappedRect = snapRectToDevicePixels(downcast<RenderBox>(*renderer).borderBoxRect(), renderer->document().deviceScaleFactor());
-
     TransformationMatrix transform;
-    style.applyTransform(transform, pixelSnappedRect, { });
+    style.applyTransform(transform, transformReferenceBox(style, *renderer), { });
     // Note that this does not flatten to an affine transform if ENABLE(3D_TRANSFORMS) is off, by design.
 
     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to