зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1474284
- cope with degenerate bezier curves r=baz
This commit is contained in:
Родитель
eddde0891e
Коммит
da1ac338dc
|
@ -45,6 +45,7 @@ support-files =
|
|||
[test_getCTM.html]
|
||||
[test_getElementById.xhtml]
|
||||
[test_getSubStringLength.xhtml]
|
||||
[test_getTotalLength.xhtml]
|
||||
[test_lang.xhtml]
|
||||
skip-if = true # disabled-for-intermittent-failures--bug-701060
|
||||
[test_length.xhtml]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1474284
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1474284</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1474284">Mozilla Bug 1474284</a>
|
||||
<p id="display"></p>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="path1" stroke="#000" fill="none"
|
||||
d="M 50,40
|
||||
C 50,40 0,60 30,20"/>
|
||||
</svg>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function expectValue(id, expected)
|
||||
{
|
||||
isfuzzy(document.getElementById(id).getTotalLength(),
|
||||
expected, expected * 0.02,
|
||||
`getTotalLength() on element id="${id}" returned the wrong value`);
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
expectValue("path1", 55.19);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", run, false);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -305,6 +305,10 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
|
|||
PointD cp21 = aControlPoints.mCP2 - aControlPoints.mCP1;
|
||||
PointD cp41 = aControlPoints.mCP4 - aControlPoints.mCP1;
|
||||
|
||||
if (cp21.x == 0. && cp21.y == 0.) {
|
||||
cp21 = aControlPoints.mCP3 - aControlPoints.mCP1;
|
||||
}
|
||||
|
||||
if (cp21.x == 0. && cp21.y == 0.) {
|
||||
// In this case s3 becomes lim[n->0] (cp41.x * n) / n - (cp41.y * n) / n = cp41.x - cp41.y.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче