Bug 1117514 - lines with zero length dashes are not rendered. r=jwatt

This commit is contained in:
Robert Longson 2015-01-10 22:17:57 +00:00
Родитель 03307562df
Коммит 5f570eddfa
2 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -138,12 +138,24 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
totalLengthOfGaps += origTotalLengthOfDashes;
}
if (totalLengthOfDashes <= 0 || totalLengthOfGaps <= 0) {
if (totalLengthOfGaps > 0 && totalLengthOfDashes <= 0) {
return eNoStroke;
}
// Stroking using dashes is much slower than stroking a continuous line
// (see bug 609361 comment 40), and much, much slower than not stroking the
// line at all. Here we check for cases when the dash pattern causes the
// stroke to essentially be continuous or to be nonexistent in which case
// we can avoid expensive stroking operations (the underlying platform
// graphics libraries don't seem to optimize for this).
if (totalLengthOfDashes <= 0 && totalLengthOfGaps <= 0) {
return eNoStroke;
}
if (totalLengthOfGaps <= 0) {
return eContinuousStroke;
}
// We can only return eNoStroke if the value of stroke-linecap isn't
// adding caps to zero length dashes.
if (totalLengthOfDashes <= 0 &&
aStyleSVG->mStrokeLinecap == NS_STYLE_STROKE_LINECAP_BUTT) {
return eNoStroke;
}
if (aContextPaint && aStyleSVG->mStrokeDashoffsetFromObject) {
aStrokeOptions->mDashOffset = Float(aContextPaint->GetStrokeDashOffset());

Просмотреть файл

@ -144,4 +144,12 @@ path.coverer {
<path class="coverer" d="M20,20 L30,30 M70,70 L80,80"/>
</g>
<!-- Column 5: test stroke-dasharray -->
<g transform="translate(525,25)">
<circle cy="0" r="8"/>
<circle cy="40" r="8"/>
<circle cy="80" r="8"/>
<path class="circles-expected" d="M0,0v81" stroke-dasharray="0 40" />
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 4.6 KiB

После

Ширина:  |  Высота:  |  Размер: 4.8 KiB