From 883265422d40dbada284517ef63ea1bd1788cc1c Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Sun, 6 Aug 2017 00:26:58 +0900 Subject: [PATCH] Bug 1356114 - Part 2: Consistently make the ends of dashed CSS borders a full dash if not connecting to a corner. r=jwatt --- layout/painting/nsCSSRenderingBorders.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/layout/painting/nsCSSRenderingBorders.cpp b/layout/painting/nsCSSRenderingBorders.cpp index a802a247f31a..6ae659ac8207 100644 --- a/layout/painting/nsCSSRenderingBorders.cpp +++ b/layout/painting/nsCSSRenderingBorders.cpp @@ -1665,16 +1665,26 @@ nsCSSBorderRenderer::SetupDashedOptions(StrokeOptions* aStrokeOptions, bool fullStart = false, fullEnd = false; Float halfDash; if (style == NS_STYLE_BORDER_STYLE_DASHED) { - if (IsZeroSize(mBorderRadii[GetCCWCorner(aSide)]) && - (mBorderStyles[PREV_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED || - mBorderWidths[PREV_SIDE(aSide)] == 0.0f || + // If either end of the side is not connecting onto a corner then we want a + // full dash at that end. + // + // Note that in the case that a corner is empty, either the adjacent side + // has zero width, or else DrawBorders() set the corner to be empty + // (it does that if the adjacent side has zero length and the border widths + // of this and the adjacent sides are thin enough that the corner will be + // insignificantly small). + + if (mBorderRadii[GetCCWCorner(aSide)].IsEmpty() && + (mBorderCornerDimensions[GetCCWCorner(aSide)].IsEmpty() || + mBorderStyles[PREV_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED || + // XXX why this <=1 check? borderWidth <= 1.0f)) { fullStart = true; } - if (IsZeroSize(mBorderRadii[GetCWCorner(aSide)]) && - (mBorderStyles[NEXT_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED || - mBorderWidths[NEXT_SIDE(aSide)] == 0.0f)) { + if (mBorderRadii[GetCWCorner(aSide)].IsEmpty() && + (mBorderCornerDimensions[GetCWCorner(aSide)].IsEmpty() || + mBorderStyles[NEXT_SIDE(aSide)] == NS_STYLE_BORDER_STYLE_DOTTED)) { fullEnd = true; }