зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1085092 - Fix stroking of SVG polygon elements. r=longsonr
This commit is contained in:
Родитель
0134edf746
Коммит
5b66e21f11
|
@ -5,8 +5,12 @@
|
|||
|
||||
#include "mozilla/dom/SVGPolygonElement.h"
|
||||
#include "mozilla/dom/SVGPolygonElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polygon)
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -57,5 +61,24 @@ SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
|||
nsSVGMark::eEnd));
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGPolygonElement::BuildPath(PathBuilder* aBuilder)
|
||||
{
|
||||
const SVGPointList &points = mPoints.GetAnimValue();
|
||||
|
||||
if (points.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aBuilder->MoveTo(points[0]);
|
||||
for (uint32_t i = 1; i < points.Length(); ++i) {
|
||||
aBuilder->LineTo(points[i]);
|
||||
}
|
||||
|
||||
aBuilder->Close();
|
||||
|
||||
return aBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -28,6 +28,7 @@ protected:
|
|||
public:
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
|
||||
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
};
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
#include "mozilla/dom/SVGPolylineElement.h"
|
||||
#include "mozilla/dom/SVGPolylineElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polyline)
|
||||
|
||||
|
@ -30,5 +34,25 @@ SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGPathGeometryElement methods
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGPolylineElement::BuildPath(PathBuilder* aBuilder)
|
||||
{
|
||||
const SVGPointList &points = mPoints.GetAnimValue();
|
||||
|
||||
if (points.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aBuilder->MoveTo(points[0]);
|
||||
for (uint32_t i = 1; i < points.Length(); ++i) {
|
||||
aBuilder->LineTo(points[i]);
|
||||
}
|
||||
|
||||
return aBuilder->Finish();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -24,6 +24,9 @@ protected:
|
|||
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// nsIContent interface
|
||||
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
|
|
@ -119,20 +119,3 @@ nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
|||
aMarks->LastElement().angle = prevAngle;
|
||||
aMarks->LastElement().type = nsSVGMark::eEnd;
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
nsSVGPolyElement::BuildPath(PathBuilder* aBuilder)
|
||||
{
|
||||
const SVGPointList &points = mPoints.GetAnimValue();
|
||||
|
||||
if (points.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aBuilder->MoveTo(points[0]);
|
||||
for (uint32_t i = 1; i < points.Length(); ++i) {
|
||||
aBuilder->LineTo(points[i]);
|
||||
}
|
||||
|
||||
return aBuilder->Finish();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ public:
|
|||
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
|
||||
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
|
||||
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<mozilla::DOMSVGPointList> Points();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Reference for stroking of close section of polygon</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=1085092 -->
|
||||
|
||||
<rect fill="none" stroke="blue" stroke-width="10"
|
||||
x="100" y="100" width="100" height="100"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 420 B |
|
@ -0,0 +1,13 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test stroking of close section of polygon</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=1085092 -->
|
||||
|
||||
<polygon fill="none" stroke="blue" stroke-width="10"
|
||||
transform="translate(50,50)"
|
||||
points="50,50 150,50 150,150 50,150"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 454 B |
|
@ -263,6 +263,7 @@ pref(svg.paint-order.enabled,true) == paint-order-03.svg paint-order-03-ref.svg
|
|||
== pattern-scale-01c.svg pattern-scale-01-ref.svg
|
||||
== pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
|
||||
== pattern-transformed-01.svg pattern-transformed-01-ref.svg
|
||||
== polygon-01.svg polygon-01-ref.svg
|
||||
== polygon-marker-01.svg pass.svg
|
||||
== polygon-points-negative-01.svg pass.svg
|
||||
== polyline-points-invalid-01.svg pass.svg
|
||||
|
|
Загрузка…
Ссылка в новой задаче