Bug 1421105 - Part3:Split the drawing of borders between frames split by column-span. draft
authorNeerja Pancholi <npancholi@mozilla.com>
Mon, 27 Nov 2017 17:42:15 -0800
changeset 708740 b6988f872c9ba61e3c90f9ba8f6dfc0576ca5437
parent 708739 d8caf6f401d0f790133af3d3da67f31dc5f9cc8b
child 708741 cda90257e264ed55df169332ce365204f5ba0844
push id92427
push userbmo:npancholi@mozilla.com
push dateThu, 07 Dec 2017 01:40:41 +0000
bugs1421105
milestone59.0a1
Bug 1421105 - Part3:Split the drawing of borders between frames split by column-span. MozReview-Commit-ID: 4fvKbWdUi4E
layout/generic/nsSplittableFrame.cpp
layout/painting/nsCSSRendering.cpp
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -277,16 +277,36 @@ nsSplittableFrame::GetLogicalSkipSides(c
     }
   } else {
     nsIFrame* nif = GetNextInFlow();
     if (nif && !IS_TRUE_OVERFLOW_CONTAINER(nif)) {
       skip |= eLogicalSideBitsBEnd;
     }
   }
 
+  if (GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) {
+    // All but the last part of an column-span split should skip the "bottom"
+    // side (as determined by this frame's direction) and all but the first
+    // part of such a split should skip the "top" side.
+    // But figuring out which part of the split we are involves getting
+    // our first continuation, which might be expensive. So don't bother if
+    // we already have the relevant bits set.
+    if (skip != LogicalSides(eLogicalSideBitsBBoth)) {
+      // We're missing one of the skip bits, so check whether we need to set it.
+      // Only get the first continuation once, as an optimization.
+      nsIFrame* firstContinuation = FirstContinuation();
+      if (firstContinuation->FrameIsNonLastInIBSplit()) {
+        skip |= eLogicalSideBitsBEnd;
+      }
+      if (firstContinuation->FrameIsNonFirstInIBSplit()) {
+        skip |= eLogicalSideBitsBStart;
+      }
+    }
+  }
+
  return skip;
 }
 
 LogicalSides
 nsSplittableFrame::PreReflowBlockLevelLogicalSkipSides() const
 {
   if (MOZ_UNLIKELY(IS_TRUE_OVERFLOW_CONTAINER(this))) {
     return LogicalSides(mozilla::eLogicalSideBitsBBoth);
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -522,26 +522,30 @@ JoinBoxesForBlockAxisSlice(nsIFrame* aFr
 {
   // Inflate the block-axis size as if our continuations were laid out
   // adjacent in that axis.  Note that we don't touch the inline size.
   nsRect borderArea = aBorderArea;
   nscoord bSize = 0;
   auto wm = aFrame->GetWritingMode();
   nsIFrame* f = aFrame->GetNextContinuation();
   for (; f; f = f->GetNextContinuation()) {
-    MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT),
-               "anonymous ib-split block shouldn't have border/background");
+    MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) ||
+               f->HasMulticolAncestor(),
+               "anonymous ib-split block shouldn't have border/background "
+               "unless they are under a multicol ancestor");
     bSize += f->BSize(wm);
   }
   (wm.IsVertical() ? borderArea.width : borderArea.height) += bSize;
   bSize = 0;
   f = aFrame->GetPrevContinuation();
   for (; f; f = f->GetPrevContinuation()) {
-    MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT),
-               "anonymous ib-split block shouldn't have border/background");
+    MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) ||
+               f->HasMulticolAncestor(),
+               "anonymous ib-split block shouldn't have border/background "
+               "unless they are under a multicol ancestor");
     bSize += f->BSize(wm);
   }
   (wm.IsVertical() ? borderArea.x : borderArea.y) -= bSize;
   (wm.IsVertical() ? borderArea.width : borderArea.height) += bSize;
   return borderArea;
 }
 
 /**