Bug 1547759 - Ensure that we call ApplyRelativePositioning after the frame's new size has been set so it works correctly for RTL. r=jfkthame,dholbert

Differential Revision: https://phabricator.services.mozilla.com/D40568

--HG--
extra : moz-landing-system : lando
This commit is contained in:
L. David Baron 2019-08-08 20:04:40 +00:00
Родитель 440cf57cdd
Коммит 99fc596f62
7 изменённых файлов: 25 добавлений и 13 удалений

Просмотреть файл

@ -725,15 +725,14 @@ void nsCanvasFrame::Reflow(nsPresContext* aPresContext,
LogicalMargin margin = kidReflowInput.ComputedLogicalMargin(); LogicalMargin margin = kidReflowInput.ComputedLogicalMargin();
LogicalPoint kidPt(kidWM, margin.IStart(kidWM), margin.BStart(kidWM)); LogicalPoint kidPt(kidWM, margin.IStart(kidWM), margin.BStart(kidWM));
kidReflowInput.ApplyRelativePositioning(&kidPt, containerSize);
// Reflow the frame // Reflow the frame
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowInput, kidWM, ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowInput, kidWM,
kidPt, containerSize, ReflowChildFlags::Default, aStatus); kidPt, containerSize, ReflowChildFlags::Default, aStatus);
// Complete the reflow and position and size the child frame // Complete the reflow and position and size the child frame
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowInput, FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowInput,
kidWM, kidPt, containerSize, ReflowChildFlags::Default); kidWM, kidPt, containerSize,
ReflowChildFlags::ApplyRelativePositioning);
if (!aStatus.IsFullyComplete()) { if (!aStatus.IsFullyComplete()) {
nsIFrame* nextFrame = kidFrame->GetNextInFlow(); nsIFrame* nextFrame = kidFrame->GetNextInFlow();

Просмотреть файл

@ -5210,6 +5210,21 @@ void nsFlexContainerFrame::ReflowFlexItem(
"We gave flex item unconstrained available height, so it " "We gave flex item unconstrained available height, so it "
"should be complete"); "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 = LogicalMargin offsets =
childReflowInput.ComputedLogicalOffsets().ConvertTo(outerWM, wm); childReflowInput.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
ReflowInput::ApplyRelativePositioning(aItem.Frame(), outerWM, offsets, ReflowInput::ApplyRelativePositioning(aItem.Frame(), outerWM, offsets,

Просмотреть файл

@ -6364,9 +6364,8 @@ void nsGridContainerFrame::ReflowInFlowChild(
JustifySelf(*aGridItemInfo, justify, cbsz, wm, childRI, size, &childPos); JustifySelf(*aGridItemInfo, justify, cbsz, wm, childRI, size, &childPos);
} // else, nsAbsoluteContainingBlock.cpp will handle align/justify-self. } // else, nsAbsoluteContainingBlock.cpp will handle align/justify-self.
childRI.ApplyRelativePositioning(&childPos, aContainerSize);
FinishReflowChild(aChild, pc, childSize, &childRI, childWM, childPos, FinishReflowChild(aChild, pc, childSize, &childRI, childWM, childPos,
aContainerSize, ReflowChildFlags::Default); aContainerSize, ReflowChildFlags::ApplyRelativePositioning);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, aChild); ConsiderChildOverflow(aDesiredSize.mOverflowAreas, aChild);
} }

Просмотреть файл

@ -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 == 1535040-1.html 1535040-1-ref.html
== 1545360-1.xhtml 1545360-1-ref.xhtml == 1545360-1.xhtml 1545360-1-ref.xhtml
skip-if(!asyncPan) == 1544895.html 1544895-ref.html 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 == 1548809.html 1548809-ref.html
!= 1552789-1.html 1552789-ref-1.html != 1552789-1.html 1552789-ref-1.html
== 1558937-1.html 1558937-1-ref.html == 1558937-1.html 1558937-1-ref.html

Просмотреть файл

@ -2687,7 +2687,7 @@ void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
// Place and size the child // Place and size the child
FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, &aKidReflowInput, FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, &aKidReflowInput,
wm, aKidPosition, aContainerSize, wm, aKidPosition, aContainerSize,
ReflowChildFlags::Default); ReflowChildFlags::ApplyRelativePositioning);
InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow, InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow,
isFirstReflow); isFirstReflow);
@ -2861,7 +2861,6 @@ void nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowInput,
ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput, wm, ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default, kidPosition, containerSize, ReflowChildFlags::Default,
footerStatus); footerStatus);
footerReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
PlaceChild(aReflowInput, aTfoot, footerReflowInput, kidPosition, PlaceChild(aReflowInput, aTfoot, footerReflowInput, kidPosition,
containerSize, desiredSize, origTfootRect, containerSize, desiredSize, origTfootRect,
@ -3017,7 +3016,6 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput, wm, ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default, kidPosition, containerSize, ReflowChildFlags::Default,
aStatus); aStatus);
kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
if (reorder) { if (reorder) {
// reorder row groups the reflow may have changed the nextinflows // reorder row groups the reflow may have changed the nextinflows

Просмотреть файл

@ -891,9 +891,11 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// Place the child // Place the child
desiredSize.ISize(wm) = availCellISize; desiredSize.ISize(wm) = availCellISize;
ReflowChildFlags flags = ReflowChildFlags::Default;
if (kidReflowInput) { if (kidReflowInput) {
// We reflowed. Apply relative positioning in the normal way. // We reflowed. Apply relative positioning in the normal way.
kidReflowInput->ApplyRelativePositioning(&kidPosition, containerSize); flags = ReflowChildFlags::ApplyRelativePositioning;
} else if (kidFrame->IsRelativelyPositioned()) { } else if (kidFrame->IsRelativelyPositioned()) {
// We didn't reflow. Do the positioning part of what // We didn't reflow. Do the positioning part of what
// MovePositionBy does internally. (This codepath should really // 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. // For cases where that's wrong, we will fix up the position later.
FinishReflowChild(kidFrame, aPresContext, desiredSize, FinishReflowChild(kidFrame, aPresContext, desiredSize,
kidReflowInput.ptrOr(nullptr), wm, kidPosition, kidReflowInput.ptrOr(nullptr), wm, kidPosition,
containerSize, ReflowChildFlags::Default); containerSize, flags);
nsTableFrame* tableFrame = GetTableFrame(); nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame->IsBorderCollapse()) { if (tableFrame->IsBorderCollapse()) {

Просмотреть файл

@ -284,7 +284,7 @@ void nsTableRowGroupFrame::PlaceChild(
// Place and size the child // Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, &aKidReflowInput, FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, &aKidReflowInput,
aWM, aKidPosition, aContainerSize, aWM, aKidPosition, aContainerSize,
ReflowChildFlags::Default); ReflowChildFlags::ApplyRelativePositioning);
nsTableFrame* tableFrame = GetTableFrame(); nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame->IsBorderCollapse()) { if (tableFrame->IsBorderCollapse()) {
@ -410,7 +410,6 @@ void nsTableRowGroupFrame::ReflowChildren(
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, wm, ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default, kidPosition, containerSize, ReflowChildFlags::Default,
aStatus); aStatus);
kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
// Place the child // Place the child
PlaceChild(aPresContext, aReflowInput, kidFrame, kidReflowInput, wm, PlaceChild(aPresContext, aReflowInput, kidFrame, kidReflowInput, wm,