Bug 377085 - line svg element getBBox() returns bad rect. r+sr=tor,a1.9=blocking1.9+

This commit is contained in:
longsonr@gmail.com 2008-01-27 06:55:53 -08:00
parent 4ac54369b7
commit c2e3385277
4 changed files with 14 additions and 12 deletions

View File

@ -538,6 +538,7 @@ public:
/**
** Extents - returns user space extent of current path
**/
gfxRect GetUserPathExtent();
gfxRect GetUserFillExtent();
gfxRect GetUserStrokeExtent();

View File

@ -740,6 +740,14 @@ gfxContext::PointInStroke(const gfxPoint& pt)
return cairo_in_stroke(mCairo, pt.x, pt.y);
}
gfxRect
gfxContext::GetUserPathExtent()
{
double xmin, ymin, xmax, ymax;
cairo_path_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
}
gfxRect
gfxContext::GetUserFillExtent()
{

View File

@ -450,7 +450,7 @@ nsSVGGlyphFrame::UpdateCoveredRegion()
extent = gfx->UserToDevice(extent);
} else {
gfx->IdentityMatrix();
extent = gfx->GetUserFillExtent();
extent = gfx->GetUserPathExtent();
}
mRect = nsSVGUtils::ToBoundingPixelRect(extent);
@ -520,7 +520,7 @@ nsSVGGlyphFrame::GetBBox(nsIDOMSVGRect **_retval)
LoopCharacters(gfx, text, cp, STROKE);
gfx->IdentityMatrix();
gfxRect rect = gfx->GetUserFillExtent();
gfxRect rect = gfx->GetUserPathExtent();
return NS_NewSVGRect(_retval, rect);
}
@ -889,7 +889,7 @@ nsSVGGlyphFrame::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
gfx->IdentityMatrix();
gfxRect rect = gfx->GetUserFillExtent();
gfxRect rect = gfx->GetUserPathExtent();
gfx->SetMatrix(matrix);

View File

@ -440,7 +440,7 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
}
} else {
context.IdentityMatrix();
extent = context.GetUserFillExtent();
extent = context.GetUserPathExtent();
if (!IsDegeneratePath(extent)) {
mRect = nsSVGUtils::ToBoundingPixelRect(extent);
}
@ -522,14 +522,7 @@ nsSVGPathGeometryFrame::GetBBox(nsIDOMSVGRect **_retval)
GeneratePath(&context);
context.IdentityMatrix();
gfxRect extent = context.GetUserFillExtent();
if (IsDegeneratePath(extent)) {
context.SetLineWidth(0);
extent = context.GetUserStrokeExtent();
}
return NS_NewSVGRect(_retval, extent);
return NS_NewSVGRect(_retval, context.GetUserPathExtent());
}
//----------------------------------------------------------------------