New issue
Advanced search Search tips

Issue 847198 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

SVG getPointAtLength() doesn't clamp its argument

Reported by kari.pih...@gmail.com, May 28 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3443.0 Safari/537.36

Steps to reproduce the problem:
1. Open the example at https://codepen.io/anon/pen/WyeOxq?editors=1011 or try the code below:

    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 240">
        <path id="p" d="M0,0C28.5,-23.5,61.5,-14.5,75,-5" stroke="#000000" fill="none" 
              transform="translate(36.5,62.5)"/>
    </svg>

    var p = document.getElementById("p").getPointAtLength(-10);
    console.log("getPointAtLength(-10): "+p.x+","+p.y);

    p = document.getElementById("p").getPointAtLength(0);
    console.log("getPointAtLength(0): "+p.x+","+p.y);

    p = document.getElementById("p").getPointAtLength(10);
    console.log("getPointAtLength(10): "+p.x+","+p.y);

2. Observe the console output
3. getPointAtLength(-10) should print "0,0" but it prints "-10,0"

What is the expected behavior?
getPointAtLength() should clamp its parameter to [0, length], but it doesn't: https://svgwg.org/svg2-draft/types.html#__svg__SVGGeometryElement__getPointAtLength

What went wrong?
getPointAtLength() allows negative values.

Did this work before? N/A 

Does this work in other browsers? No
 Safari 11 has a similar bug.
This works on Firefox 60.

Chrome version: 69.0.3443.0  Channel: canary
OS Version: OS X 10.12.6
Flash Version:
 

Comment 1 by f...@opera.com, May 28 2018

Labels: OS-Android OS-Linux OS-Windows
Status: Available (was: Unconfirmed)
Summary: SVG getPointAtLength() doesn't clamp its argument (was: SVG getPathAtLength() doesn't clamp its argument)
Remnant from the unspecified behavior in SVG 1.1.
Project Member

Comment 2 by bugdroid1@chromium.org, May 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/acf0cdd6a2fb45a1757b1579e64ce54909747e48

commit acf0cdd6a2fb45a1757b1579e64ce54909747e48
Author: Fredrik Söderquist <fs@opera.com>
Date: Tue May 29 14:47:21 2018

Clamp argument to SVGGeometryElement.getPointAtLength to [0, length]

Per:

  https://svgwg.org/svg2-draft/types.html#__svg__SVGGeometryElement__getPointAtLength

Bug:  847198 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I9067ce9f196453bd54560d5119ebc38d35c8ac86
Reviewed-on: https://chromium-review.googlesource.com/1075332
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#562422}
[add] https://crrev.com/acf0cdd6a2fb45a1757b1579e64ce54909747e48/third_party/WebKit/LayoutTests/external/wpt/svg/types/scripted/SVGGeometryElement.getPointAtLength-01.svg
[modify] https://crrev.com/acf0cdd6a2fb45a1757b1579e64ce54909747e48/third_party/blink/renderer/core/svg/svg_geometry_element.cc
[modify] https://crrev.com/acf0cdd6a2fb45a1757b1579e64ce54909747e48/third_party/blink/renderer/core/svg/svg_path_element.cc

Comment 3 by f...@opera.com, May 29 2018

Owner: f...@opera.com
Status: Fixed (was: Available)

Sign in to add a comment