Skip to content

Commit

Permalink
Bug 1678098 - Remove redundant writing mode conversion after calling …
Browse files Browse the repository at this point in the history
…ReflowOutput::Size(). r=mats

As of bug 1671726, ReflowOutput::Size() accepts any writing mode, so we
don't need to do an extra conversion.

Differential Revision: https://phabricator.services.mozilla.com/D97480
  • Loading branch information
aethanyc committed Nov 19, 2020
1 parent d1cdafd commit 0a60272
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion layout/generic/nsAbsoluteContainingBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ void nsAbsoluteContainingBlock::ReflowAbsoluteFrame(
ReflowOutput kidDesiredSize(kidReflowInput);
aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowInput, aStatus);

const LogicalSize kidSize = kidDesiredSize.Size(wm).ConvertTo(outerWM, wm);
const LogicalSize kidSize = kidDesiredSize.Size(outerWM);

LogicalMargin offsets = kidReflowInput.ComputedLogicalOffsets(outerWM);

Expand Down
4 changes: 1 addition & 3 deletions layout/generic/nsContainerFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,7 @@ void nsContainerFrame::FinishReflowChild(
}

nsPoint curOrigin = aKidFrame->GetPosition();
WritingMode outerWM = aDesiredSize.GetWritingMode();
LogicalSize convertedSize =
aDesiredSize.Size(outerWM).ConvertTo(aWM, outerWM);
const LogicalSize convertedSize = aDesiredSize.Size(aWM);
LogicalPoint pos(aPos);

if (aFlags & ReflowChildFlags::ApplyRelativePositioning) {
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsFirstLetterFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
mBaseline = kidMetrics.BlockStartAscent();

// Place and size the child and update the output metrics
LogicalSize convertedSize = kidMetrics.Size(lineWM).ConvertTo(wm, lineWM);
LogicalSize convertedSize = kidMetrics.Size(wm);
kid->SetRect(nsRect(bp.IStart(wm), bp.BStart(wm), convertedSize.ISize(wm),
convertedSize.BSize(wm)));
kid->FinishAndStoreOverflow(&kidMetrics, rs.mStyleDisplay);
Expand Down
3 changes: 1 addition & 2 deletions layout/generic/nsIFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10431,7 +10431,6 @@ void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
}

nsReflowStatus status;
WritingMode wm = aDesiredSize.GetWritingMode();

bool needsReflow = IsSubtreeDirty();

Expand All @@ -10446,7 +10445,7 @@ void nsIFrame::BoxReflow(nsBoxLayoutState& aState, nsPresContext* aPresContext,
needsReflow = false;
aDesiredSize.Width() = aWidth;
aDesiredSize.Height() = aHeight;
SetSize(aDesiredSize.Size(wm).ConvertTo(GetWritingMode(), wm));
SetSize(aDesiredSize.Size(GetWritingMode()));
} else {
aDesiredSize.Width() = metrics->mLastSize.width;
aDesiredSize.Height() = metrics->mLastSize.height;
Expand Down
7 changes: 2 additions & 5 deletions layout/generic/nsRubyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ void nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowInput.AvailableISize(),
aReflowInput.AvailableBSize());
WritingMode rubyWM = GetWritingMode();
NS_ASSERTION(!rubyWM.IsOrthogonalTo(lineWM),
NS_ASSERTION(!GetWritingMode().IsOrthogonalTo(lineWM),
"Ruby frame writing-mode shouldn't be orthogonal to its line");

AutoRubyTextContainerArray textContainers(aBaseContainer);
Expand Down Expand Up @@ -297,9 +296,7 @@ void nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
// handled when reflowing the base containers.
NS_ASSERTION(textReflowStatus.IsEmpty(),
"Ruby text container must not break itself inside");
// The metrics is initialized with reflow input of this ruby frame,
// hence the writing-mode is tied to rubyWM instead of rtcWM.
LogicalSize size = textMetrics.Size(rubyWM).ConvertTo(lineWM, rubyWM);
const LogicalSize size = textMetrics.Size(lineWM);
textContainer->SetSize(lineWM, size);

nscoord reservedISize = RubyUtils::GetReservedISize(textContainer);
Expand Down
3 changes: 1 addition & 2 deletions layout/tables/nsTableCellFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ inline mozilla::LogicalSize nsTableCellFrame::GetDesiredSize() {
}

inline void nsTableCellFrame::SetDesiredSize(const ReflowOutput& aDesiredSize) {
mozilla::WritingMode wm = aDesiredSize.GetWritingMode();
mDesiredSize = aDesiredSize.Size(wm).ConvertTo(GetWritingMode(), wm);
mDesiredSize = aDesiredSize.Size(GetWritingMode());
}

inline bool nsTableCellFrame::GetContentEmpty() const {
Expand Down

0 comments on commit 0a60272

Please sign in to comment.