mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 1547759 - Add a flag to allow FinishReflowChild to handle relative positioning, and convert the caller for which this makes sense. r=jfkthame
Note that this changes the writing mode used for the SetSize call from the parent's to the child's. (This controls what position is kept constant.) I don't think this changes behavior at all, since there is (for this caller) a SetRect call just below. Differential Revision: https://phabricator.services.mozilla.com/D40566 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c923b062b3
commit
b4137c33ae
@ -245,7 +245,7 @@ class ReflowOutput {
|
||||
nscoord& Width() { return mWritingMode.IsVertical() ? mBSize : mISize; }
|
||||
nscoord& Height() { return mWritingMode.IsVertical() ? mISize : mBSize; }
|
||||
|
||||
nsSize PhysicalSize() {
|
||||
nsSize PhysicalSize() const {
|
||||
return Size(mWritingMode).GetPhysicalSize(mWritingMode);
|
||||
}
|
||||
|
||||
|
@ -436,15 +436,10 @@ bool nsBlockReflowContext::PlaceBlock(const ReflowInput& aReflowInput,
|
||||
.ConvertTo(frameWM, mWritingMode,
|
||||
mContainerSize - mMetrics.PhysicalSize());
|
||||
|
||||
// ApplyRelativePositioning in right-to-left writing modes needs to
|
||||
// know the updated frame width
|
||||
mFrame->SetSize(mWritingMode, mMetrics.Size(mWritingMode));
|
||||
aReflowInput.ApplyRelativePositioning(&logPos, mContainerSize);
|
||||
|
||||
// Now place the frame and complete the reflow process
|
||||
nsContainerFrame::FinishReflowChild(
|
||||
mFrame, mPresContext, mMetrics, &aReflowInput, frameWM, logPos,
|
||||
mContainerSize, nsIFrame::ReflowChildFlags::Default);
|
||||
mContainerSize, nsIFrame::ReflowChildFlags::ApplyRelativePositioning);
|
||||
|
||||
aOverflowAreas = mMetrics.mOverflowAreas + mFrame->GetPosition();
|
||||
|
||||
|
@ -1041,10 +1041,19 @@ void nsContainerFrame::FinishReflowChild(
|
||||
WritingMode outerWM = aDesiredSize.GetWritingMode();
|
||||
LogicalSize convertedSize =
|
||||
aDesiredSize.Size(outerWM).ConvertTo(aWM, outerWM);
|
||||
LogicalPoint pos(aPos);
|
||||
|
||||
if (aFlags & ReflowChildFlags::ApplyRelativePositioning) {
|
||||
MOZ_ASSERT(aReflowInput, "caller must have passed reflow input");
|
||||
// ApplyRelativePositioning in right-to-left writing modes needs to know
|
||||
// the updated frame width to set the normal position correctly.
|
||||
aKidFrame->SetSize(aWM, convertedSize);
|
||||
aReflowInput->ApplyRelativePositioning(&pos, aContainerSize);
|
||||
}
|
||||
|
||||
if (ReflowChildFlags::NoMoveFrame !=
|
||||
(aFlags & ReflowChildFlags::NoMoveFrame)) {
|
||||
aKidFrame->SetRect(aWM, LogicalRect(aWM, aPos, convertedSize),
|
||||
aKidFrame->SetRect(aWM, LogicalRect(aWM, pos, convertedSize),
|
||||
aContainerSize);
|
||||
} else {
|
||||
aKidFrame->SetSize(aWM, convertedSize);
|
||||
@ -1081,14 +1090,19 @@ void nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
||||
const ReflowInput* aReflowInput,
|
||||
nscoord aX, nscoord aY,
|
||||
ReflowChildFlags aFlags) {
|
||||
MOZ_ASSERT(!(aFlags & ReflowChildFlags::ApplyRelativePositioning),
|
||||
"only the logical version supports ApplyRelativePositioning "
|
||||
"since ApplyRelativePositioning requires the container size");
|
||||
|
||||
nsPoint curOrigin = aKidFrame->GetPosition();
|
||||
nsPoint pos(aX, aY);
|
||||
nsSize size(aDesiredSize.PhysicalSize());
|
||||
|
||||
if (ReflowChildFlags::NoMoveFrame !=
|
||||
(aFlags & ReflowChildFlags::NoMoveFrame)) {
|
||||
aKidFrame->SetRect(
|
||||
nsRect(aX, aY, aDesiredSize.Width(), aDesiredSize.Height()));
|
||||
aKidFrame->SetRect(nsRect(pos, size));
|
||||
} else {
|
||||
aKidFrame->SetSize(nsSize(aDesiredSize.Width(), aDesiredSize.Height()));
|
||||
aKidFrame->SetSize(size);
|
||||
}
|
||||
|
||||
if (aKidFrame->HasView()) {
|
||||
@ -1099,8 +1113,7 @@ void nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
||||
aDesiredSize.VisualOverflow(), aFlags);
|
||||
}
|
||||
|
||||
if (!(aFlags & ReflowChildFlags::NoMoveView) &&
|
||||
(curOrigin.x != aX || curOrigin.y != aY)) {
|
||||
if (!(aFlags & ReflowChildFlags::NoMoveView) && curOrigin != pos) {
|
||||
if (!aKidFrame->HasView()) {
|
||||
// If the frame has moved, then we need to make sure any child views are
|
||||
// correctly positioned
|
||||
|
@ -2551,9 +2551,14 @@ class nsIFrame : public nsQueryFrame {
|
||||
NoMoveFrame = (1 << 1) | NoMoveView,
|
||||
NoSizeView = 1 << 2,
|
||||
NoVisibility = 1 << 3,
|
||||
|
||||
// Only applies to ReflowChild; if true, don't delete the next-in-flow, even
|
||||
// if the reflow is fully complete.
|
||||
NoDeleteNextInFlowChild = 1 << 4
|
||||
NoDeleteNextInFlowChild = 1 << 4,
|
||||
|
||||
// Only applies to FinishReflowChild. Tell it to call
|
||||
// ApplyRelativePositioning.
|
||||
ApplyRelativePositioning = 1 << 5
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user