Bug 1281102 - Don't create table continuations unless we're paginating, and don't do grid fragmentation with unconstrained available bsize. r=dholbert, a=ritu
authorMats Palmgren <mats@mozilla.com>
Tue, 23 Aug 2016 23:34:35 +0200
changeset 347887 e3325d1992029b7636ebfcbd1e0ef1fe13d36f46
parent 347886 eb26f80b9dc8f05442d16effbb5747afe062676a
child 347888 433caaa37ccff62cfc755946b69bdf958b8dbeb5
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, ritu
bugs1281102
milestone50.0a2
Bug 1281102 - Don't create table continuations unless we're paginating, and don't do grid fragmentation with unconstrained available bsize. r=dholbert, a=ritu
layout/generic/nsGridContainerFrame.cpp
layout/tables/nsTableFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -4561,28 +4561,31 @@ nsGridContainerFrame::GridReflowInput::C
  * ancestor chain of containing block (CB) reflow states.  We'll only
  * continue traversing the ancestor chain as long as the CBs have
  * the same writing-mode and have overflow:visible.
  */
 Maybe<nsGridContainerFrame::Fragmentainer>
 nsGridContainerFrame::GetNearestFragmentainer(const GridReflowInput& aState) const
 {
   Maybe<nsGridContainerFrame::Fragmentainer> data;
+  const ReflowInput* gridRI = aState.mReflowInput;
+  if (gridRI->AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
+    return data;
+  }
   WritingMode wm = aState.mWM;
-  const ReflowInput* gridRI = aState.mReflowInput;
-  const ReflowInput* cbRS = gridRI->mCBReflowInput;
-  for ( ; cbRS; cbRS = cbRS->mCBReflowInput) {
-    nsIScrollableFrame* sf = do_QueryFrame(cbRS->mFrame);
+  const ReflowInput* cbRI = gridRI->mCBReflowInput;
+  for ( ; cbRI; cbRI = cbRI->mCBReflowInput) {
+    nsIScrollableFrame* sf = do_QueryFrame(cbRI->mFrame);
     if (sf) {
       break;
     }
-    if (wm.IsOrthogonalTo(cbRS->GetWritingMode())) {
+    if (wm.IsOrthogonalTo(cbRI->GetWritingMode())) {
       break;
     }
-    nsIAtom* frameType = cbRS->mFrame->GetType();
+    nsIAtom* frameType = cbRI->mFrame->GetType();
     if ((frameType == nsGkAtoms::canvasFrame &&
          PresContext()->IsPaginated()) ||
         frameType == nsGkAtoms::columnSetFrame) {
       data.emplace();
       data->mIsTopOfPage = gridRI->mFlags.mIsTopOfPage;
       data->mToFragmentainerEnd = aState.mFragBStart +
         gridRI->AvailableBSize() - aState.mBorderPadding.BStart(wm);
       const auto numRows = aState.mRows.mSizes.Length();
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -3217,18 +3217,21 @@ nsTableFrame::ReflowChildren(TableReflow
       PlaceChild(aReflowInput, kidFrame,
                  kidPosition.GetPhysicalPoint(wm, containerSize -
                                                   desiredSize.PhysicalSize()),
                  desiredSize, oldKidRect, oldKidVisualOverflow);
 
       // Remember where we just were in case we end up pushing children
       prevKidFrame = kidFrame;
 
+      MOZ_ASSERT(!NS_FRAME_IS_NOT_COMPLETE(aStatus) || isPaginated,
+                 "Table contents should only fragment in paginated contexts");
+
       // Special handling for incomplete children
-      if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+      if (isPaginated && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
         nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow();
         if (!kidNextInFlow) {
           // The child doesn't have a next-in-flow so create a continuing
           // frame. This hooks the child into the flow
           kidNextInFlow = presContext->PresShell()->FrameConstructor()->
             CreateContinuingFrame(presContext, kidFrame, this);
 
           // Insert the kid's new next-in-flow into our sibling list...