Bug 1297427: Discount border dots with negative radii. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Thu, 08 Sep 2016 14:00:54 +0200
changeset 354489 1c72b311d2c62f022929d93593a23e30c4874644
parent 354488 d441ac0b35aedaf1df5ffe995cd4ffaaa697ee49
child 354490 5c2e946c182a8b755c8c873bc67101df3ce0913f
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1297427
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1297427: Discount border dots with negative radii. r=jrmuizel MozReview-Commit-ID: 1CONhbL8ZAb
gfx/2d/PathD2D.cpp
layout/base/nsCSSRenderingBorders.cpp
layout/generic/crashtests/1297427-non-equal-centers.html
layout/generic/crashtests/crashtests.list
--- 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