Bug 1128354: Don't optimize away a flex item's second reflow, if it has percent-height children. r=mats

This commit is contained in:
Daniel Holbert 2015-03-19 23:00:05 -07:00
Родитель 0b8d3e9eb3
Коммит acb8e18785
4 изменённых файлов: 86 добавлений и 5 удалений

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

@ -3695,11 +3695,19 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
// that reflow the same as its final (post-flexing/stretching) size?
if (finalFlexedPhysicalSize ==
item->Frame()->GetContentRectRelativeToSelf().Size()) {
// It has the correct size --> no need to reflow! Just make sure it's
// at the right position.
itemNeedsReflow = false;
MoveFlexItemToFinalPosition(aReflowState, *item, framePos,
containerWidth);
// Even if our size hasn't changed, some of our descendants might
// care that our height is now considered "definite" (whereas it
// wasn't in our previous "measuring" reflow), if they have a
// relative height.
if (!(item->Frame()->GetStateBits() &
NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
// Item has the correct size (and its children don't care that
// it's now "definite"). Let's just make sure it's at the right
// position.
itemNeedsReflow = false;
MoveFlexItemToFinalPosition(aReflowState, *item, framePos,
containerWidth);
}
}
}
if (itemNeedsReflow) {

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

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.flexVert {
display: flex;
flex-direction: column;
}
.flexIntermediateHoriz {
display: flex;
}
.flexInnerHoriz {
display: flex;
background: pink;
}
.spacer {
background: lightblue;
height: 200px;
width: 50px;
}
</style>
</head>
<body>
<div class="flexVert">
<div class="flexIntermediateHoriz">
<div class="flexInnerHoriz">text</div>
<div class="spacer"></div>
</div>
</div>
</body>
</html>

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

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.flexVert {
display: flex;
flex-direction: column;
}
.flexIntermediateHoriz {
display: flex;
}
.flexInnerHoriz {
display: flex;
height: 100%; /* If you delete this line, then pink area is stretched
to have its height match blue area. */
background: pink;
}
.spacer {
background: lightblue;
height: 200px;
width: 50px;
}
</style>
</head>
<body>
<div class="flexVert">
<div class="flexIntermediateHoriz">
<div class="flexInnerHoriz">text</div>
<div class="spacer"></div>
</div>
</div>
</body>
</html>

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

@ -1868,5 +1868,6 @@ fuzzy-if(d2d,36,304) HTTP(..) == 1116480-1-fakeitalic-overflow.html 1116480-1-fa
== 1127107-1b-pre.html 1127107-1-ref.html
== 1127107-2-capitalize.html 1127107-2-capitalize-ref.html
== 1127679-1a-inline-flex-relpos.html 1127679-1b-inline-flex-relpos.html
== 1128354-1.html 1128354-1-ref.html
== 1130231-1-button-padding-rtl.html 1130231-1-button-padding-rtl-ref.html
== 1130231-2-button-padding-rtl.html 1130231-2-button-padding-rtl-ref.html