Bug 203687 - SVGGeometryElement.getPointAtLength should clamp its argument to [0, length]
Summary: SVGGeometryElement.getPointAtLength should clamp its argument to [0, length]
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 200143
  Show dependency treegraph
 
Reported: 2019-10-31 11:16 PDT by Said Abou-Hallawa
Modified: 2019-10-31 14:10 PDT (History)
16 users (show)

See Also:


Attachments
Patch (13.09 KB, patch)
2019-10-31 11:23 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (13.82 KB, patch)
2019-10-31 13:33 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2019-10-31 11:16:31 PDT
The spec link is: https://svgwg.org/svg2-draft/types.html#__svg__SVGGeometryElement__getPointAtLength
Comment 1 Said Abou-Hallawa 2019-10-31 11:23:04 PDT
Created attachment 382481 [details]
Patch
Comment 2 Simon Fraser (smfr) 2019-10-31 12:37:20 PDT
Comment on attachment 382481 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=382481&action=review

> Source/WebCore/svg/SVGGeometryElement.cpp:64
> +    // Sepc: If current element is a non-rendered element, throw an InvalidStateError.

"Sepc"

> Source/WebCore/svg/SVGGeometryElement.cpp:68
> +    // Sepc: Clamp distance to [0, length].

"Sepc"

> Source/WebCore/svg/SVGGeometryElement.cpp:69
> +    distance = std::min<float>(std::max<float>(distance, 0), getTotalLength());

We have a clampTo() function

> Source/WebCore/svg/SVGGeometryElement.cpp:71
> +    // Sepc: Return a newly created, detached SVGPoint object.

"Sepc"

> Source/WebCore/svg/SVGPathElement.cpp:117
> +    // Sepc: Clamp distance to [0, length].
> +    distance = std::min<float>(std::max<float>(distance, 0), getTotalLength());
> +
> +    // Sepc: Return a newly created, detached SVGPoint object.

Ditto.
Comment 3 Said Abou-Hallawa 2019-10-31 13:33:34 PDT
Created attachment 382493 [details]
Patch
Comment 4 WebKit Commit Bot 2019-10-31 14:09:07 PDT
Comment on attachment 382493 [details]
Patch

Clearing flags on attachment: 382493

Committed r251877: <https://trac.webkit.org/changeset/251877>
Comment 5 WebKit Commit Bot 2019-10-31 14:09:09 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-10-31 14:10:13 PDT
<rdar://problem/56794713>