Bug 1074475 - Fix a bug in GetStrokeDashData. r=longsonr

This commit is contained in:
Jonathan Watt 2014-09-30 18:08:13 +01:00
Родитель f5f620a8d2
Коммит dc2daaef9e
1 изменённых файлов: 13 добавлений и 2 удалений

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

@ -122,10 +122,21 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
}
}
// Now that aStrokeOptions.mDashPattern is fully initialized we can safely
// set mDashLength:
// Now that aStrokeOptions.mDashPattern is fully initialized (we didn't
// return early above) we can safely set mDashLength:
aStrokeOptions->mDashLength = dashArrayLength;
if ((dashArrayLength % 2) == 1) {
// If we have a dash pattern with an odd number of lengths the pattern
// repeats a second time, per the SVG spec., and as implemented by Moz2D.
// When deciding whether to return eNoStroke or eContinuousStroke below we
// need to take into account that in the repeat pattern the dashes become
// gaps, and the gaps become dashes.
Float origTotalLengthOfDashes = totalLengthOfDashes;
totalLengthOfDashes += totalLengthOfGaps;
totalLengthOfGaps += origTotalLengthOfDashes;
}
if (totalLengthOfDashes <= 0 || totalLengthOfGaps <= 0) {
if (totalLengthOfGaps > 0 && totalLengthOfDashes <= 0) {
return eNoStroke;