Closed
Bug 344378
Opened 18 years ago
Closed 18 years ago
Implement nsSVGPathElement::GetPointAtLength
Categories
(Core :: SVG, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: malex, Assigned: malex)
Details
(Keywords: fixed1.8.1)
Attachments
(4 files, 2 obsolete files)
2.72 KB,
patch
|
roc
:
superreview+
|
Details | Diff | Splinter Review |
1.57 KB,
image/svg+xml
|
Details | |
4.18 KB,
patch
|
longsonr
:
review+
roc
:
superreview+
beltzner
:
approval1.8.1+
|
Details | Diff | Splinter Review |
4.23 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Upcoming patch implements GetPointAtLength Reproducible: Always
Assignee | ||
Comment 1•18 years ago
|
||
Attachment #228968 -
Flags: review?(tor)
Comment 2•18 years ago
|
||
> + nsresult rv = NS_NewSVGPoint(_retval, x, y);
> + if (NS_FAILED(rv))
> + return rv;
> +
> + return NS_OK;
better as
return NS_NewSVGPoint(_retval, x, y);
Comment on attachment 228968 [details] [diff] [review] Patch >? .cdtproject >? .project >? content/svg/content/src/.nsSVGFilters.cpp.marks >? content/svg/content/src/.nsSVGPathElement.cpp.marks >? layout/svg/base/src/.nsSVGTextFrame.cpp.marks >? security/nss/cmd/shlibsign/NONE >? security/nss/cmd/shlibsign/mangle/NONE >? security/nss/lib/ckfw/builtins/NONE >? security/nss/lib/freebl/NONE >? security/nss/lib/nss/NONE >? security/nss/lib/smime/NONE >? security/nss/lib/softoken/NONE >? security/nss/lib/ssl/NONE You know you can diff just a particular directory, and not the whole tree? Ex: "cvs diff content/svg". > /* nsIDOMSVGPoint getPointAtLength (in float distance); */ > NS_IMETHODIMP > nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval) > { >- return NS_ERROR_NOT_IMPLEMENTED; >+ nsAutoPtr<nsSVGFlattenedPath> flat(GetFlattenedPath()); >+ if (!flat) >+ return NS_ERROR_FAILURE; >+ >+ if (HasAttr(kNameSpaceID_None, nsGkAtoms::pathLength)) >+ { >+ float pLen, tLen; Rename these variable to be clearer what you're storing in them. >+ mPathLength->GetAnimVal(&pLen); >+ tLen = flat->GetLength(); >+ distance *= tLen / pLen; >+ } >+ >+ float x, y, ang; "ang" -> "angle" likewise. >+ flat->FindPoint(0, distance, 0, &x, &y, &ang); >+ nsresult rv = NS_NewSVGPoint(_retval, x, y); >+ if (NS_FAILED(rv)) >+ return rv; >+ >+ return NS_OK; You can just do "return NS_NewSVGPoint(...)". Out of range distance values (less than zero, greater than the length of the path) need to be handled. While at first glance it seems that returning NS_ERROR_DOM_SVG_INVALID_VALUE_ERR, the specification states that this method doesn't throw exceptions. If we follow that, pinning to the endpoints might be the appropriate action. Whichever approach you take, mail www-svg to make sure they'll address this in an errata or 1.2.
Attachment #228968 -
Flags: review?(tor) → review-
Assignee | ||
Comment 4•18 years ago
|
||
Updated patch implements comments above and modifies FindPoint to handle the case when aXOffset is equal to totalLength.
Attachment #228968 -
Attachment is obsolete: true
Attachment #229017 -
Flags: review?(tor)
Comment on attachment 229017 [details] [diff] [review] Updated Patch >+ if (HasAttr(kNameSpaceID_None, nsGkAtoms::pathLength)) >+ { Nit - open brace on the same line as the "if". With that, r=tor.
Attachment #229017 -
Flags: review?(tor) → review+
Assignee | ||
Comment 6•18 years ago
|
||
Attachment #229017 -
Attachment is obsolete: true
Attachment #229088 -
Flags: superreview?(roc)
Assignee | ||
Comment 7•18 years ago
|
||
In this test case two paths are created. Both are of length 200, but the bottom line has its pathLength attribute set to 100. A circle appears on each line at a point determined by a call to getPointAtLength(distance) where distance is a variable that changes with time. Distance is Initially set to -10 and is incremented by 10 every second. This tests the cases when distance is negative, zero, greater than zero but less than the length of the path, equal to the length of the path, and greater than the length of the path.
Attachment #229088 -
Flags: superreview?(roc) → superreview+
Attachment #229168 -
Flags: review?(longsonr)
Updated•18 years ago
|
Attachment #229168 -
Flags: review?(longsonr) → review+
Attachment #229168 -
Flags: superreview?(roc)
Comment on attachment 229168 [details] [diff] [review] branch version, won't work at onload time + *_retval = 0; nsnull
Attachment #229168 -
Flags: superreview?(roc) → superreview+
Comment 11•18 years ago
|
||
Comment on attachment 229168 [details] [diff] [review] branch version, won't work at onload time Low risk, useful DOM feature for content developers.
Attachment #229168 -
Flags: approval1.8.1?
Comment 12•18 years ago
|
||
Comment on attachment 229168 [details] [diff] [review] branch version, won't work at onload time a=drivers, early landing approved since we're not expecting bake time to get us much testing :)
Attachment #229168 -
Flags: approval1.8.1? → approval1.8.1+
Updated•18 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 13•18 years ago
|
||
Comment 14•18 years ago
|
||
Checked in on branch.
You need to log in
before you can comment on or make changes to this bug.
Description
•