haikuwebkit/LayoutTests/fast/svg
Wenson Hsieh 905057ae7b REGRESSION (r258118): SVG paths that contain a single move command incorrect client bounding rects
https://bugs.webkit.org/show_bug.cgi?id=226447
rdar://72112744

Reviewed by Alan Bujtas.

Source/WebCore:

r258118 introduced a fast path for computing the bounding rect of a `WebCore::Path` without having to
materialize a platform path object (e.g. `CGPathRef` on platforms that use CoreGraphics). To do this, we
introduce `InlinePathData` -- a variant capable of representing several types of simple `Path` objects without
allocating a platform path.

However, in the case where a `Path` only consists of a single `moveTo` command, this fast path for computing the
bounding rect currently returns the zero rect (an empty rect at the origin), rather than an empty rect at the
location we've moved to. This causes the offset of the bounding rect of an SVG path element that contains only a
single `M` drawing command to be incorrect.

Simply fix this by returning an empty rect that is offset by the `moveTo` location, rather than the origin.

Test: fast/svg/bounding-rect-for-path-with-only-move-command.html

* platform/graphics/Path.cpp:
(WebCore::Path::boundingRectFromInlineData const):

LayoutTests:

Add a layout test to exercise the bug.

* fast/svg/bounding-rect-for-path-with-only-move-command-expected.txt: Added.
* fast/svg/bounding-rect-for-path-with-only-move-command.html: Added.


Canonical link: https://commits.webkit.org/238308@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278271 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-31 06:39:50 +00:00
..
bounding-rect-for-path-with-only-move-command-expected.txt
bounding-rect-for-path-with-only-move-command.html REGRESSION (r258118): SVG paths that contain a single move command incorrect client bounding rects 2021-05-31 06:39:50 +00:00
parsing-fill-opacity-expected.txt
parsing-fill-opacity.html
parsing-flood-opacity-expected.txt
parsing-flood-opacity.html
parsing-stop-opacity-expected.txt Opacity should always serialize as a number 2019-10-31 02:16:27 +00:00
parsing-stop-opacity.html
parsing-stroke-opacity-expected.txt
parsing-stroke-opacity.html