diff --git a/dom/svg/SVGCircleElement.cpp b/dom/svg/SVGCircleElement.cpp index 9bc447dfdd1..deac6112db1 100644 --- a/dom/svg/SVGCircleElement.cpp +++ b/dom/svg/SVGCircleElement.cpp @@ -90,8 +90,7 @@ SVGCircleElement::GetGeometryBounds(Rect* aBounds, Float aStrokeWidth, if (r <= 0.f) { // Rendering of the element is disabled - aBounds->MoveTo(x, y); - aBounds->SetEmpty(); + *aBounds = Rect(aTransform * Point(x, y), Size()); return true; } diff --git a/dom/svg/SVGEllipseElement.cpp b/dom/svg/SVGEllipseElement.cpp index 47dc8eb3f91..a0ae35bb611 100644 --- a/dom/svg/SVGEllipseElement.cpp +++ b/dom/svg/SVGEllipseElement.cpp @@ -101,8 +101,7 @@ SVGEllipseElement::GetGeometryBounds(Rect* aBounds, Float aStrokeWidth, if (rx <= 0.f || ry <= 0.f) { // Rendering of the element is disabled - aBounds->MoveTo(x, y); - aBounds->SetEmpty(); + *aBounds = Rect(aTransform * Point(x, y), Size()); return true; } diff --git a/dom/svg/SVGImageElement.cpp b/dom/svg/SVGImageElement.cpp index 863e96f234f..31cde149d92 100644 --- a/dom/svg/SVGImageElement.cpp +++ b/dom/svg/SVGImageElement.cpp @@ -226,6 +226,23 @@ SVGImageElement::IsAttributeMapped(const nsIAtom* name) const /* For the purposes of the update/invalidation logic pretend to be a rectangle. */ +bool +SVGImageElement::GetGeometryBounds(Rect* aBounds, Float aStrokeWidth, + const Matrix& aTransform) +{ + Rect rect; + GetAnimatedLengthValues(&rect.x, &rect.y, &rect.width, + &rect.height, nullptr); + + if (rect.IsEmpty()) { + // Rendering of the element disabled + rect.SetEmpty(); // Make sure width/height are zero and not negative + } + + *aBounds = aTransform.TransformBounds(rect); + return true; +} + TemporaryRef SVGImageElement::BuildPath(PathBuilder* aBuilder) { diff --git a/dom/svg/SVGImageElement.h b/dom/svg/SVGImageElement.h index 0494df94a8c..c083c28d260 100644 --- a/dom/svg/SVGImageElement.h +++ b/dom/svg/SVGImageElement.h @@ -53,6 +53,8 @@ public: NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE; // nsSVGPathGeometryElement methods: + virtual bool GetGeometryBounds(Rect* aBounds, Float aStrokeWidth, + const Matrix& aTransform) MOZ_OVERRIDE; virtual TemporaryRef BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE; // nsSVGSVGElement methods: diff --git a/dom/svg/SVGRectElement.cpp b/dom/svg/SVGRectElement.cpp index 5b00e54b311..8bd69f458e3 100644 --- a/dom/svg/SVGRectElement.cpp +++ b/dom/svg/SVGRectElement.cpp @@ -122,7 +122,8 @@ SVGRectElement::GetGeometryBounds(Rect* aBounds, Float aStrokeWidth, if (rect.IsEmpty()) { // Rendering of the element disabled rect.SetEmpty(); // Make sure width/height are zero and not negative - *aBounds = rect; // We still want the x/y position from 'rect' + // We still want the x/y position from 'rect' + *aBounds = aTransform.TransformBounds(rect); return true; }