mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1110337 - Get bounds of image element using maths. r=jwatt
This commit is contained in:
parent
b92cad3917
commit
6383c920af
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<Path>
|
||||
SVGImageElement::BuildPath(PathBuilder* aBuilder)
|
||||
{
|
||||
|
@ -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<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user