Bug 1432341 - Draw column-rules with border-code in box-decoration-break: clone mode, rather than slice. r=mattwoodrow
authorL. David Baron <dbaron@dbaron.org>
Wed, 31 Jan 2018 07:18:49 +0000
changeset 454161 8d8a093e718c460c9252666a5e4d949a244483bf
parent 454160 45d0f06fb923eabd1520754de60b0a29d7941dc1
child 454162 ded3e23e2442aedea6392ceb02fe4b76b4b47f8c
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1432341
milestone60.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 1432341 - Draw column-rules with border-code in box-decoration-break: clone mode, rather than slice. r=mattwoodrow This fixes the bug. The underlying problem was that we were hitting the case where ConstructBorderRenderer sets aNeedsClip to true, but nothing in the column-rule drawing path was honoring that. (Choosing clone rather than slice may make a difference for dotted and dashed column-rules, but I think the clone behavior is preferable.) MozReview-Commit-ID: 7YYzyxYjhsV
layout/generic/nsColumnSetFrame.cpp
layout/painting/nsCSSRendering.cpp
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -257,16 +257,23 @@ nsColumnSetFrame::CreateBorderRenderers(
     skipSides |= mozilla::eSideBitsBottom;
   } else {
     border.SetBorderWidth(eSideLeft, ruleWidth);
     border.SetBorderStyle(eSideLeft, ruleStyle);
     border.mBorderLeftColor = StyleComplexColor::FromColor(ruleColor);
     skipSides |= mozilla::eSideBitsTopBottom;
     skipSides |= mozilla::eSideBitsRight;
   }
+  // If we use box-decoration-break: slice (the default), the border
+  // renderers will require clipping if we have continuations (see the
+  // aNeedsClip parameter to ConstructBorderRenderer in nsCSSRendering).
+  //
+  // Since it doesn't matter which box-decoration-break we use since
+  // we're only drawing borders (and not border-images), use 'clone'.
+  border.mBoxDecorationBreak = StyleBoxDecorationBreak::Clone;
 
   ForEachColumnRule([&]
                     (const nsRect& aLineRect)
                     {
                       // Assert that we're not drawing a border-image here; if we were, we
                       // couldn't ignore the ImgDrawResult that PaintBorderWithStyleBorder returns.
                       MOZ_ASSERT(border.mBorderImageSource.GetType() == eStyleImageType_Null);
 
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -828,21 +828,23 @@ ConstructBorderRenderer(nsPresContext* a
       // We're drawing borders around the joined continuation boxes so we need
       // to clip that to the slice that we want for this frame.
       *aNeedsClip = true;
     }
   } else {
     MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea),
                "Should use aBorderArea for box-decoration-break:clone");
     MOZ_ASSERT(aForFrame->GetSkipSides().IsEmpty() ||
-               IS_TRUE_OVERFLOW_CONTAINER(aForFrame),
+               IS_TRUE_OVERFLOW_CONTAINER(aForFrame) ||
+               aForFrame->IsColumnSetFrame(), // a little broader than column-rule
                "Should not skip sides for box-decoration-break:clone except "
                "::first-letter/line continuations or other frame types that "
                "don't have borders but those shouldn't reach this point. "
-               "Overflow containers do reach this point though.");
+               "Overflow containers do reach this point though, as does "
+               "column-rule drawing (which always involves a columnset).");
     border.ApplySkipSides(aSkipSides);
   }
 
   // Convert to dev pixels.
   nscoord oneDevPixel = aPresContext->DevPixelsToAppUnits(1);
   Rect joinedBorderAreaPx = NSRectToRect(joinedBorderArea, oneDevPixel);
   Float borderWidths[4] = { Float(border.top) / oneDevPixel,
                                    Float(border.right) / oneDevPixel,