diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index 643cfd926bde..aac3bc37ecc4 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -725,15 +725,14 @@ void nsCanvasFrame::Reflow(nsPresContext* aPresContext, LogicalMargin margin = kidReflowInput.ComputedLogicalMargin(); LogicalPoint kidPt(kidWM, margin.IStart(kidWM), margin.BStart(kidWM)); - kidReflowInput.ApplyRelativePositioning(&kidPt, containerSize); - // Reflow the frame ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowInput, kidWM, kidPt, containerSize, ReflowChildFlags::Default, aStatus); // Complete the reflow and position and size the child frame FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowInput, - kidWM, kidPt, containerSize, ReflowChildFlags::Default); + kidWM, kidPt, containerSize, + ReflowChildFlags::ApplyRelativePositioning); if (!aStatus.IsFullyComplete()) { nsIFrame* nextFrame = kidFrame->GetNextInFlow(); diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 9540b9d24efb..6f6a345ca4ea 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -5210,6 +5210,21 @@ void nsFlexContainerFrame::ReflowFlexItem( "We gave flex item unconstrained available height, so it " "should be complete"); + // ApplyRelativePositioning in right-to-left writing modes needs to know the + // updated frame width to set the normal position correctly. + // + // It may look like we could handle this instead by passing the + // ApplyRelativePositioning flag to FinishReflowChild. However, we're + // unlike other callers of FinishReflowChild in that we're keeping its aPos + // (our aFramePos) in the parent's writing mode rather than the child's, and + // thus passing its aWM (our outerWM) as the parent's writing mode as well. + // + // Thus this could be converted, but requires a little bit of care to do so + // (and would probably require a point conversion like the one in + // nsBlockReflowContext::PlaceBlock). Alternatively, maybe things should be + // restructured a bit so that sort of conversion isn't needed. + aItem.Frame()->SetSize(outerWM, + childDesiredSize.Size(wm).ConvertTo(outerWM, wm)); LogicalMargin offsets = childReflowInput.ComputedLogicalOffsets().ConvertTo(outerWM, wm); ReflowInput::ApplyRelativePositioning(aItem.Frame(), outerWM, offsets, diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 8d118386e246..3aa21d391c72 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -6364,9 +6364,8 @@ void nsGridContainerFrame::ReflowInFlowChild( JustifySelf(*aGridItemInfo, justify, cbsz, wm, childRI, size, &childPos); } // else, nsAbsoluteContainingBlock.cpp will handle align/justify-self. - childRI.ApplyRelativePositioning(&childPos, aContainerSize); FinishReflowChild(aChild, pc, childSize, &childRI, childWM, childPos, - aContainerSize, ReflowChildFlags::Default); + aContainerSize, ReflowChildFlags::ApplyRelativePositioning); ConsiderChildOverflow(aDesiredSize.mOverflowAreas, aChild); } diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 6ac41b38de6b..e9557b3706c2 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -2110,7 +2110,7 @@ fuzzy-if(!webrender,0-6,0-34) fuzzy-if(geckoview,9-9,44-44) fails-if(webrender) == 1535040-1.html 1535040-1-ref.html == 1545360-1.xhtml 1545360-1-ref.xhtml skip-if(!asyncPan) == 1544895.html 1544895-ref.html -fails == 1547759-1.html 1547759-1-ref.html +== 1547759-1.html 1547759-1-ref.html == 1548809.html 1548809-ref.html != 1552789-1.html 1552789-ref-1.html == 1558937-1.html 1558937-1-ref.html diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 93674241dcdb..4b52a88d34d5 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -2687,7 +2687,7 @@ void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput, // Place and size the child FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, &aKidReflowInput, wm, aKidPosition, aContainerSize, - ReflowChildFlags::Default); + ReflowChildFlags::ApplyRelativePositioning); InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow, isFirstReflow); @@ -2861,7 +2861,6 @@ void nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowInput, ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput, wm, kidPosition, containerSize, ReflowChildFlags::Default, footerStatus); - footerReflowInput.ApplyRelativePositioning(&kidPosition, containerSize); PlaceChild(aReflowInput, aTfoot, footerReflowInput, kidPosition, containerSize, desiredSize, origTfootRect, @@ -3017,7 +3016,6 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput, ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput, wm, kidPosition, containerSize, ReflowChildFlags::Default, aStatus); - kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize); if (reorder) { // reorder row groups the reflow may have changed the nextinflows diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index db20ab27f989..5d364aec8baf 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -891,9 +891,11 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // Place the child desiredSize.ISize(wm) = availCellISize; + ReflowChildFlags flags = ReflowChildFlags::Default; + if (kidReflowInput) { // We reflowed. Apply relative positioning in the normal way. - kidReflowInput->ApplyRelativePositioning(&kidPosition, containerSize); + flags = ReflowChildFlags::ApplyRelativePositioning; } else if (kidFrame->IsRelativelyPositioned()) { // We didn't reflow. Do the positioning part of what // MovePositionBy does internally. (This codepath should really @@ -914,7 +916,7 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // For cases where that's wrong, we will fix up the position later. FinishReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput.ptrOr(nullptr), wm, kidPosition, - containerSize, ReflowChildFlags::Default); + containerSize, flags); nsTableFrame* tableFrame = GetTableFrame(); if (tableFrame->IsBorderCollapse()) { diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 4483dff08c3d..eba0769cd255 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -284,7 +284,7 @@ void nsTableRowGroupFrame::PlaceChild( // Place and size the child FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, &aKidReflowInput, aWM, aKidPosition, aContainerSize, - ReflowChildFlags::Default); + ReflowChildFlags::ApplyRelativePositioning); nsTableFrame* tableFrame = GetTableFrame(); if (tableFrame->IsBorderCollapse()) { @@ -410,7 +410,6 @@ void nsTableRowGroupFrame::ReflowChildren( ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, wm, kidPosition, containerSize, ReflowChildFlags::Default, aStatus); - kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize); // Place the child PlaceChild(aPresContext, aReflowInput, kidFrame, kidReflowInput, wm,