Title: [295119] trunk/Source/WebCore/svg/SVGGeometryElement.cpp
Revision
295119
Author
achristen...@apple.com
Date
2022-06-01 21:05:22 -0700 (Wed, 01 Jun 2022)

Log Message

Clamp distance earlier in SVGGeometryElement::getPointAtLength
https://bugs.webkit.org/show_bug.cgi?id=241212

Reviewed by Chris Dumez.

* LayoutTests/fast/svg/get-point-at-length-layout-expected.txt: Added.
* LayoutTests/fast/svg/get-point-at-length-layout.html: Added.
* Source/WebCore/svg/SVGGeometryElement.cpp:
(WebCore::SVGGeometryElement::getPointAtLength const):

Canonical link: https://commits.webkit.org/251210@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/svg/SVGGeometryElement.cpp (295118 => 295119)


--- trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2022-06-02 04:02:10 UTC (rev 295118)
+++ trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2022-06-02 04:05:22 UTC (rev 295119)
@@ -69,6 +69,9 @@
 {
     document().updateLayoutIgnorePendingStylesheets();
 
+    // Spec: Clamp distance to [0, length].
+    distance = clampTo<float>(distance, 0, getTotalLength());
+
     auto* renderer = this->renderer();
 
     // Spec: If current element is a non-rendered element, throw an InvalidStateError.
@@ -75,9 +78,6 @@
     if (!renderer)
         return Exception { InvalidStateError };
 
-    // Spec: Clamp distance to [0, length].
-    distance = clampTo<float>(distance, 0, getTotalLength());
-
     // Spec: Return a newly created, detached SVGPoint object.
     if (is<LegacyRenderSVGShape>(renderer))
         return SVGPoint::create(downcast<LegacyRenderSVGShape>(renderer)->getPointAtLength(distance));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to