diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 0efc9540536e..9482acf59454 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -4565,18 +4565,21 @@ Maybe nsGridContainerFrame::GetNearestFragmentainer(const GridReflowInput& aState) const { Maybe 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); + if (gridRI->AvailableBSize() == NS_UNCONSTRAINEDSIZE) { + return data; + } + WritingMode wm = aState.mWM; + 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) { diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index ebf53ff1183e..eaedc0d5cbd7 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -3222,8 +3222,11 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, // 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