Bug 340543 - Use IsEmpty() rather than Length() == 0 or !Length() in nsSVGCairoGlyphGeometry. r+sr=tor

This commit is contained in:
longsonr%gmail.com 2006-06-15 11:27:19 +00:00
parent f300860e44
commit 1dbfc65b62

View File

@ -152,17 +152,10 @@ nsSVGCairoGlyphGeometry::Render(nsSVGGlyphFrame *aSource,
nsAutoString text;
aSource->GetCharacterData(text);
if (!text.Length()) {
if (text.IsEmpty()) {
return NS_OK;
}
nsAutoArrayPtr<nsSVGCharacterPosition> cp;
nsresult rv = aSource->GetCharacterPosition(getter_Transfers(cp));
NS_ENSURE_SUCCESS(rv, rv);
cairo_t *ctx = cairoCanvas->GetContext();
/* get the metrics */
nsCOMPtr<nsISVGCairoGlyphMetrics> metrics;
{
@ -175,6 +168,13 @@ nsSVGCairoGlyphGeometry::Render(nsSVGGlyphFrame *aSource,
}
}
nsAutoArrayPtr<nsSVGCharacterPosition> cp;
nsresult rv = aSource->GetCharacterPosition(getter_Transfers(cp));
NS_ENSURE_SUCCESS(rv, rv);
cairo_t *ctx = cairoCanvas->GetContext();
PRUint16 renderMode;
cairo_matrix_t matrix;
canvas->GetRenderMode(&renderMode);
@ -251,6 +251,13 @@ nsSVGCairoGlyphGeometry::GetCoveredRegion(nsSVGGlyphFrame *aSource,
return NS_OK;
}
nsAutoString text;
aSource->GetCharacterData(text);
if (text.IsEmpty()) {
return NS_OK;
}
/* get the metrics */
nsCOMPtr<nsISVGCairoGlyphMetrics> metrics;
{
@ -268,12 +275,6 @@ nsSVGCairoGlyphGeometry::GetCoveredRegion(nsSVGGlyphFrame *aSource,
nsresult rv = aSource->GetCharacterPosition(getter_Transfers(cp));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString text;
aSource->GetCharacterData(text);
if (text.Length() == 0)
return NS_OK;
cairo_t *ctx = cairo_create(gSVGCairoDummySurface);
rv = GetGlobalTransform(aSource, ctx, nsnull);
@ -359,7 +360,7 @@ nsSVGCairoGlyphGeometry::ContainsPoint(nsSVGGlyphFrame *aSource,
nsAutoString text;
aSource->GetCharacterData(text);
if (!text.Length()) {
if (text.IsEmpty()) {
return NS_OK;
}
@ -471,7 +472,7 @@ nsSVGCairoGlyphGeometry::GetBoundingBox(nsSVGGlyphFrame *aSource,
nsAutoString text;
aSource->GetCharacterData(text);
if (!text.Length()) {
if (text.IsEmpty()) {
return NS_OK;
}