Bug 1389010, part 5 - Assert the line type invariant at the top of nsCSSBorderRenderer::SetupDashedOptions. r=dholbert
authorJonathan Watt <jwatt@jwatt.org>
Mon, 07 Aug 2017 21:53:26 +0100
changeset 647865 430be457b43b0f66eb1a8b3b2dee87285888856a
parent 647864 eaee7e7904880bb68467dedd1e45a01cbc830ef4
child 647866 ca14dc22d579a0b4a8af70d28308f715a8a38692
push id74569
push userbmo:topwu.tw@gmail.com
push dateThu, 17 Aug 2017 01:40:57 +0000
reviewersdholbert
bugs1389010
milestone57.0a1
Bug 1389010, part 5 - Assert the line type invariant at the top of nsCSSBorderRenderer::SetupDashedOptions. r=dholbert MozReview-Commit-ID: KUcCSjYRgMg
layout/painting/nsCSSRenderingBorders.cpp
--- a/layout/painting/nsCSSRenderingBorders.cpp
+++ b/layout/painting/nsCSSRenderingBorders.cpp
@@ -1629,16 +1629,20 @@ nsCSSBorderRenderer::DrawBorderSides(int
 }
 
 void
 nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions,
                                         Float aDash[2],
                                         mozilla::Side aSide,
                                         Float aBorderLength, bool isCorner)
 {
+  MOZ_ASSERT(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED ||
+             mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
+             "Style should be dashed or dotted.");
+
   uint8_t style = mBorderStyles[aSide];
   Float borderWidth = mBorderWidths[aSide];
 
   // Dashed line starts and ends with half segment in most case.
   //
   // __--+---+---+---+---+---+---+---+---+--__
   //     |###|   |   |###|###|   |   |###|
   //     |###|   |   |###|###|   |   |###|