Bug 1532156 - correct marker-start for closed paths so it is the average of the start and end angles i.e. the same as marker-end r=dholbert

This commit is contained in:
longsonr 2019-03-16 17:00:23 +00:00
Родитель d7fb84d2e4
Коммит fd7d94f776
3 изменённых файлов: 24 добавлений и 2 удалений

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

@ -757,6 +757,7 @@ void SVGPathData::GetMarkerPositioningData(nsTArray<SVGMark>* aMarks) const {
// info on current [sub]path (reset every M command):
Point pathStart(0.0, 0.0);
float pathStartAngle = 0.0f;
uint32_t pathStartIndex = 0;
// info on previous segment:
uint16_t prevSegType = PATHSEG_UNKNOWN;
@ -788,6 +789,7 @@ void SVGPathData::GetMarkerPositioningData(nsTArray<SVGMark>* aMarks) const {
segEnd = segStart + Point(mData[i], mData[i + 1]);
}
pathStart = segEnd;
pathStartIndex = aMarks->Length();
// If authors are going to specify multiple consecutive moveto commands
// with markers, me might as well make the angle do something useful:
segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart);
@ -1042,8 +1044,7 @@ void SVGPathData::GetMarkerPositioningData(nsTArray<SVGMark>* aMarks) const {
}
if (segType == PATHSEG_CLOSEPATH && prevSegType != PATHSEG_CLOSEPATH) {
aMarks->LastElement().angle =
// aMarks->ElementAt(pathStartIndex).angle =
aMarks->LastElement().angle = aMarks->ElementAt(pathStartIndex).angle =
SVGContentUtils::AngleBisect(segEndAngle, pathStartAngle);
}

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

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<defs>
<marker id="arrowAutoStartRev" orient="auto-start-reverse" markerUnits="userSpaceOnUse" overflow="visible">
<path d="M25,25 L0,0 L0,50 z" fill="lime" stroke="lime" stroke-width="2" />
</marker>
<marker id="arrowSW" orient="135" markerUnits="userSpaceOnUse" overflow="visible">
<path d="M25,25 L0,0 L0,50 z" fill="red"/>
</marker>
<marker id="arrowAuto" orient="auto" markerUnits="userSpaceOnUse" overflow="visible">
<path d="M25,25 L0,0 L0,50 z" fill="red"/>
</marker>
</defs>
<rect width="100%" height="100%" fill="lime" />
<path d="M 340,100 h50 v50 h-50 z" marker-start="url(#arrowSW)" fill="none"/>
<path d="M 340,100 h50 v50 h-50 z" marker-start="url(#arrowAutoStartRev)" fill="none"/>
<g transform="translate(0, 50)">
<path d="M 340,100 h50 v50 h-50 z" marker-start="url(#arrowAuto)" fill="none"/>
<path d="M 340,100 h50 v50 h-50 z" marker-end="url(#arrowAutoStartRev)" fill="none"/>
</g>
</svg>

После

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

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

@ -269,6 +269,7 @@ fuzzy-if(skiaContent,0-1,0-100) == marker-orientation-01.svg marker-orientation-
fuzzy-if(skiaContent,0-1,0-5) == marker-orientation-02.svg marker-orientation-02-ref.svg
== marker-orientation-03.svg pass.svg
== marker-orientation-04.svg pass.svg
== marker-orientation-05.svg pass.svg
fuzzy(0-28,0-28) == mask-and-clipPath.html mask-and-clipPath-ref.html
== mask-and-clipPath-2.svg pass.svg