Title: [278730] trunk/Source/WebCore
Revision
278730
Author
commit-qu...@webkit.org
Date
2021-06-10 13:56:57 -0700 (Thu, 10 Jun 2021)

Log Message

[Cairo] Fix Path::boundingRectSlowCase when the path is a single MoveTo
https://bugs.webkit.org/show_bug.cgi?id=226613

Cairo says there is no bounding rectangle in this case, whereas the SVG
standard says there it should be a zero-size rectangle at the moved-to
point. This fixes the recently added test
fast/svg/bounding-rect-for-path-with-only-move-command.html

Patch by Arcady Goldmints-Orlov <agoldmi...@igalia.com> on 2021-06-10
Reviewed by Fujii Hironori.

* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::boundingRectSlowCase const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278729 => 278730)


--- trunk/Source/WebCore/ChangeLog	2021-06-10 20:53:47 UTC (rev 278729)
+++ trunk/Source/WebCore/ChangeLog	2021-06-10 20:56:57 UTC (rev 278730)
@@ -1,3 +1,18 @@
+2021-06-10  Arcady Goldmints-Orlov  <agoldmi...@igalia.com>
+
+        [Cairo] Fix Path::boundingRectSlowCase when the path is a single MoveTo
+        https://bugs.webkit.org/show_bug.cgi?id=226613
+
+        Cairo says there is no bounding rectangle in this case, whereas the SVG
+        standard says there it should be a zero-size rectangle at the moved-to
+        point. This fixes the recently added test
+        fast/svg/bounding-rect-for-path-with-only-move-command.html
+
+        Reviewed by Fujii Hironori.
+
+        * platform/graphics/cairo/PathCairo.cpp:
+        (WebCore::Path::boundingRectSlowCase const):
+
 2021-06-10  Chris Dumez  <cdu...@apple.com>
 
         Fix incorrect check in AudioNode.disconnect()

Modified: trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp (278729 => 278730)


--- trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp	2021-06-10 20:53:47 UTC (rev 278729)
+++ trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp	2021-06-10 20:56:57 UTC (rev 278730)
@@ -410,6 +410,10 @@
 FloatRect Path::boundingRectSlowCase() const
 {
     double x0, x1, y0, y1;
+    if (m_elements && m_elements.value().size() == 1 && m_elements.value()[0].type == PathElement::Type::MoveToPoint) {
+        FloatPoint p = m_elements.value()[0].points[0];
+        return FloatRect(p.x(), p.y(), 0, 0);
+    }
     cairo_path_extents(m_path.get(), &x0, &y0, &x1, &y1);
     return FloatRect(x0, y0, x1 - x0, y1 - y0);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to