mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 377085 - line svg element getBBox() returns bad rect. r+sr=tor,a1.9=blocking1.9+
This commit is contained in:
parent
4ac54369b7
commit
c2e3385277
@ -538,6 +538,7 @@ public:
|
||||
/**
|
||||
** Extents - returns user space extent of current path
|
||||
**/
|
||||
gfxRect GetUserPathExtent();
|
||||
gfxRect GetUserFillExtent();
|
||||
gfxRect GetUserStrokeExtent();
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user