DescriptionImprove the reliability and accuracy of SVG getTotalLength
The existing code for SVG path.getTotalLength had two problems when
subdividing curves to estimate length. The subdivision terminated when
the straight-line vs curved length was within a fixed limit, regardless
of the scale of the curve. The termination condition for infinite loops
also failed to stop on infinite loops.
This patch fixes both issues. The subdivision threshold now accounts for
the magnitude of the values, so that we give more resolution on very small
curves and less on very large curves. This is consistent with the actual
precision we have in floating point numbers. The infinite loop termination
tracks and examines the total number of subdivisions thus far, terminating
after 20 (which is more than enough - most curves do no more than 10
subdivisions).
We also remove two unused variables and a FIXME that makes little sense and that we won't ever fix.
R=fmalita@chromium.org, pdr@chromium.org, fs@opera.com
BUG=349873
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=172519
Patch Set 1 #
Total comments: 10
Patch Set 2 : Improved #
Messages
Total messages: 12 (0 generated)
|