mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1881495 part 1: Add ShrinkWrap flag for grid items that are self-aligned (not stretched) in MeasuringReflow(). r=dholbert
Bug 1350037 Part 3 [1] removed the code in ReflowInput that adds `ShrinkWrap` flag self-aligned grid items, to prevent the table-caption from getting aligned behavior, but it accidentally broke self-aligned behavior for other types of frames that are grid items. We actually already check if we need to add `ShrinkWrap` in grid item's final reflow [2], but we were missing the same logic in `MeasuringReflow()`. This patch adds that. [1] https://hg.mozilla.org/mozilla-central/rev/6e8085865f74 [2] https://searchfox.org/mozilla-central/rev/202c48686136360a23b73a49b611a19e64f3e1b8/layout/generic/nsGridContainerFrame.cpp#7651,7657 Differential Revision: https://phabricator.services.mozilla.com/D203514
This commit is contained in:
parent
2c8769c3c4
commit
5d27842b5d
@ -5300,7 +5300,8 @@ static nscoord MeasuringReflow(nsIFrame* aChild,
|
||||
const LogicalSize& aCBSize,
|
||||
nscoord aIMinSizeClamp = NS_MAXSIZE,
|
||||
nscoord aBMinSizeClamp = NS_MAXSIZE) {
|
||||
nsContainerFrame* parent = aChild->GetParent();
|
||||
MOZ_ASSERT(aChild->IsGridItem(), "aChild should be a grid item!");
|
||||
auto* parent = static_cast<nsGridContainerFrame*>(aChild->GetParent());
|
||||
nsPresContext* pc = aChild->PresContext();
|
||||
Maybe<ReflowInput> dummyParentState;
|
||||
const ReflowInput* rs = aReflowInput;
|
||||
@ -5319,6 +5320,11 @@ static nscoord MeasuringReflow(nsIFrame* aChild,
|
||||
#endif
|
||||
auto wm = aChild->GetWritingMode();
|
||||
ComputeSizeFlags csFlags = ComputeSizeFlag::IsGridMeasuringReflow;
|
||||
// Shrink-wrap grid items that will be aligned (rather than stretched) in
|
||||
// their own inline axis.
|
||||
if (!parent->GridItemShouldStretch(aChild, eLogicalAxisInline)) {
|
||||
csFlags += ComputeSizeFlag::ShrinkWrap;
|
||||
}
|
||||
if (aAvailableSize.ISize(wm) == INFINITE_ISIZE_COORD) {
|
||||
csFlags += ComputeSizeFlag::ShrinkWrap;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user