Bug 1297427: Discount border dots with negative radii. r=jrmuizel
MozReview-Commit-ID: 1CONhbL8ZAb
--- a/gfx/2d/PathD2D.cpp
+++ b/gfx/2d/PathD2D.cpp
@@ -246,16 +246,18 @@ PathBuilderD2D::Close()
EnsureActive(mBeginPoint);
}
}
void
PathBuilderD2D::Arc(const Point &aOrigin, Float aRadius, Float aStartAngle,
Float aEndAngle, bool aAntiClockwise)
{
+ MOZ_ASSERT(aRadius >= 0);
+
if (aAntiClockwise && aStartAngle < aEndAngle) {
// D2D does things a little differently, and draws the arc by specifying an
// beginning and an end point. This means the circle will be the wrong way
// around if the start angle is smaller than the end angle. It might seem
// tempting to invert aAntiClockwise but that would change the sweeping
// direction of the arc so instead we exchange start/begin.
Float oldStart = aStartAngle;
aStartAngle = aEndAngle;
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -2402,17 +2402,17 @@ nsCSSBorderRenderer::DrawDottedCornerSlo
RefPtr<Path> path = builder->Finish();
mDrawTarget->Fill(path, ColorPattern(ToDeviceColor(borderColor)));
builder = mDrawTarget->CreatePathBuilder();
segmentCount = 0;
}
DottedCornerFinder::Result result = finder.Next();
- if (marginedDirtyRect.Contains(result.C)) {
+ if (marginedDirtyRect.Contains(result.C) && result.r > 0) {
entered = true;
builder->MoveTo(Point(result.C.x + result.r, result.C.y));
builder->Arc(result.C, result.r, 0, Float(2.0 * M_PI));
segmentCount++;
} else if (entered) {
break;
}
}
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1297427-non-equal-centers.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<meta charset="utf-8" />
+<style>
+#box {
+ border-radius: 335px;
+ width: 600px;
+ height: 401px;
+ border-style: dotted;
+ border-width: 41px 1px;
+}
+</style>
+<div id="box"></div>
+</html>
\ No newline at end of file
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -630,8 +630,9 @@ load 1233191.html
asserts(2) load 1272983-1.html # bug 586628
asserts(2) load 1272983-2.html # bug 586628
load 1275059.html
load 1278007.html
load large-border-radius-dashed.html
load large-border-radius-dashed2.html
load large-border-radius-dotted.html
load large-border-radius-dotted2.html
+load 1297427-non-equal-centers.html