From ffd76c83a31aca9c636eced99726e12056e29ab7 Mon Sep 17 00:00:00 2001 From: "longsonr%gmail.com" Date: Mon, 22 Jan 2007 10:04:29 +0000 Subject: [PATCH] Bug 367209 - getBBox() returns ((0,0), (0,0)) on two point polyline. r+sr=tor git-svn-id: svn://10.0.0.236/trunk@218744 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/svg/base/src/nsSVGPathGeometryFrame.cpp | 9 ++++++--- mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h | 11 +++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp index c131d0db61a..3dea77b3909 100644 --- a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp @@ -411,13 +411,16 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion() if (HasStroke()) { SetupCairoStrokeGeometry(&context); cairo_stroke_extents(ctx, &xmin, &ymin, &xmax, &ymax); - nsSVGUtils::UserToDeviceBBox(ctx, &xmin, &ymin, &xmax, &ymax); + if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) { + nsSVGUtils::UserToDeviceBBox(ctx, &xmin, &ymin, &xmax, &ymax); + mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax); + } } else { cairo_identity_matrix(ctx); cairo_fill_extents(ctx, &xmin, &ymin, &xmax, &ymax); + if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) + mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax); } - if (!IsDegeneratePath(xmin, ymin, xmax, ymax)) - mRect = nsSVGUtils::ToBoundingPixelRect(xmin, ymin, xmax, ymax); // Add in markers mRect = GetCoveredRegion(); diff --git a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h index 3c5f1a50581..ed009d8f831 100644 --- a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h +++ b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h @@ -130,18 +130,17 @@ private: /* * Check for what cairo returns for the fill extents of a degenerate path * - * @param xmin the minimum x value in device units - * @param ymin the minimum y value in device units - * @param xmax the maximum x value in device units - * @param ymax the maximum y value in device units + * @param xmin the minimum x value in user units + * @param ymin the minimum y value in user units + * @param xmax the maximum x value in user units + * @param ymax the maximum y value in user units * * @return PR_TRUE if the path is degenerate */ static PRBool IsDegeneratePath(double xmin, double ymin, double xmax, double ymax) { - return (fabs(xmin - 32767) < 1 && fabs(ymin - 32767) < 1 && - fabs(xmax + 32768) < 1 && fabs(ymax + 32768) < 1); + return (xmin == 0 && ymin == 0 && xmax == 0 && ymax == 0); } nsSVGMarkerProperty *GetMarkerProperty();