зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1313421 part 2: Use flex container's FlexLine linked-list to determine the first flex item, rather than its child-frame list. r=mats
This shouldn't change our behavior right now, but it will make a difference after bug 1269045 -- when that bug lands, we'll have nsPlaceholderFrames (which are not flex items) in the child-frame list, which means we can't depend on its first entry being a flex item anymore. MozReview-Commit-ID: KRXYaK8R8bc
This commit is contained in:
Родитель
0f4079b53d
Коммит
b76fdcd7b9
|
@ -837,6 +837,20 @@ public:
|
|||
return mItems.getFirst();
|
||||
}
|
||||
|
||||
FlexItem* GetLastItem()
|
||||
{
|
||||
MOZ_ASSERT(mItems.isEmpty() == (mNumItems == 0),
|
||||
"mNumItems bookkeeping is off");
|
||||
return mItems.getLast();
|
||||
}
|
||||
|
||||
const FlexItem* GetLastItem() const
|
||||
{
|
||||
MOZ_ASSERT(mItems.isEmpty() == (mNumItems == 0),
|
||||
"mNumItems bookkeeping is off");
|
||||
return mItems.getLast();
|
||||
}
|
||||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
MOZ_ASSERT(mItems.isEmpty() == (mNumItems == 0),
|
||||
|
@ -4180,6 +4194,14 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
|||
logSize += aReflowInput.ComputedLogicalBorderPadding().Size(flexWM);
|
||||
nsSize containerSize = logSize.GetPhysicalSize(flexWM);
|
||||
|
||||
// If the flex container has no baseline-aligned items, it will use this item
|
||||
// (the first item, discounting any under-the-hood reversing that we've done)
|
||||
// to determine its baseline:
|
||||
const FlexItem* const firstItem =
|
||||
aAxisTracker.AreAxesInternallyReversed()
|
||||
? lines.getLast()->GetLastItem()
|
||||
: lines.getFirst()->GetFirstItem();
|
||||
|
||||
// FINAL REFLOW: Give each child frame another chance to reflow, now that
|
||||
// we know its final size and position.
|
||||
for (const FlexLine* line = lines.getFirst(); line; line = line->getNext()) {
|
||||
|
@ -4230,10 +4252,10 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
|||
*item, framePos, containerSize);
|
||||
}
|
||||
|
||||
// If this is our first child and we haven't established a baseline for
|
||||
// If this is our first item and we haven't established a baseline for
|
||||
// the container yet (i.e. if we don't have 'align-self: baseline' on any
|
||||
// children), then use this child's baseline as the container's baseline.
|
||||
if (item->Frame() == mFrames.FirstChild() &&
|
||||
if (item == firstItem &&
|
||||
flexContainerAscent == nscoord_MIN) {
|
||||
flexContainerAscent = itemNormalBPos + item->ResolvedAscent();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче