зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1137859 - stroke-dashoffset not respecting pathLength property. r=dholbert
--HG-- rename : layout/reftests/svg/stroke-dasharray-and-pathLength-01.svg => layout/reftests/svg/stroke-dashoffset-and-pathLength-01.svg
This commit is contained in:
Родитель
c315668b7b
Коммит
1e7c4f6beb
|
@ -76,6 +76,7 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
|||
{
|
||||
size_t dashArrayLength;
|
||||
Float totalLengthOfDashes = 0.0, totalLengthOfGaps = 0.0;
|
||||
Float pathScale = 1.0;
|
||||
|
||||
if (aContextPaint && aStyleSVG->mStrokeDasharrayFromObject) {
|
||||
const FallibleTArray<gfxFloat>& dashSrc = aContextPaint->GetStrokeDashArray();
|
||||
|
@ -100,7 +101,6 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
|||
if (dashArrayLength <= 0) {
|
||||
return eContinuousStroke;
|
||||
}
|
||||
Float pathScale = 1.0;
|
||||
if (aElement->IsSVGElement(nsGkAtoms::path)) {
|
||||
pathScale = static_cast<SVGPathElement*>(aElement)->
|
||||
GetPathLengthScale(SVGPathElement::eForStroking);
|
||||
|
@ -161,7 +161,8 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
|||
aStrokeOptions->mDashOffset = Float(aContextPaint->GetStrokeDashOffset());
|
||||
} else {
|
||||
aStrokeOptions->mDashOffset =
|
||||
SVGContentUtils::CoordToFloat(aElement, aStyleSVG->mStrokeDashoffset);
|
||||
SVGContentUtils::CoordToFloat(aElement, aStyleSVG->mStrokeDashoffset) *
|
||||
pathScale;
|
||||
}
|
||||
|
||||
return eDashedStroke;
|
||||
|
|
|
@ -338,6 +338,7 @@ HTTP(..) == text-scale-03.svg text-scale-03-ref.svg
|
|||
== stroke-dasharray-and-pathLength-01.svg pass.svg
|
||||
== stroke-dasharray-and-text-01.svg stroke-dasharray-and-text-01-ref.svg
|
||||
== stroke-dashoffset-01.svg pass.svg
|
||||
== stroke-dashoffset-and-pathLength-01.svg pass.svg
|
||||
== stroke-linecap-round-w-zero-length-segs-01.svg pass.svg
|
||||
== stroke-linecap-round-w-zero-length-segs-02.svg pass.svg
|
||||
== stroke-linecap-square-w-zero-length-segs-01.svg pass.svg
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test stroke-dashoffset with pathLength</title>
|
||||
<!--
|
||||
The path is much longer than 100 user units, so if the pathLength is not
|
||||
factored into the stroke-dashoffset calculation, the stroke will be visible.
|
||||
A correct implementation will see the first dash pushed off the end of the
|
||||
path which will mean that the path does not display at all.
|
||||
-->
|
||||
<style>
|
||||
path {
|
||||
fill: none;
|
||||
stroke-width: 5;
|
||||
stroke: red;
|
||||
stroke-dasharray: 100;
|
||||
stroke-dashoffset: 100;
|
||||
}
|
||||
</style>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
|
||||
<path pathLength="100" d="M175,25 A150,150,0,1,1,175,325 A150,150,0,1,1,175,25"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 827 B |
Загрузка…
Ссылка в новой задаче