Bug 1172239. Add NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE. r=bz

This commit is contained in:
Robert O'Callahan 2015-07-18 12:24:53 +12:00
parent f745685e54
commit 9dfcfbad3d
3 changed files with 38 additions and 1 deletions

View File

@ -4459,6 +4459,17 @@ AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext,
return result;
}
static void
AddStateBitToAncestors(nsIFrame* aFrame, nsFrameState aBit)
{
for (nsIFrame* f = aFrame; f; f = f->GetParent()) {
if (f->HasAnyStateBits(aBit)) {
break;
}
f->AddStateBits(aBit);
}
}
/* static */ nscoord
nsLayoutUtils::IntrinsicForAxis(PhysicalAxis aAxis,
nsRenderingContext* aRenderingContext,
@ -4594,6 +4605,9 @@ nsLayoutUtils::IntrinsicForAxis(PhysicalAxis aAxis,
nscoord ratioISize = (horizontalAxis ? ratio.width : ratio.height);
nscoord ratioBSize = (horizontalAxis ? ratio.height : ratio.width);
if (ratioBSize != 0) {
AddStateBitToAncestors(aFrame,
NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE);
nscoord bSizeTakenByBoxSizing = 0;
switch (boxSizing) {
case NS_STYLE_BOX_SIZING_BORDER: {

View File

@ -8815,7 +8815,25 @@ nsIFrame::SetParent(nsContainerFrame* aParent)
f->AddStateBits(NS_FRAME_HAS_CHILD_WITH_VIEW);
}
}
if (HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
for (nsIFrame* f = aParent; f; f = f->GetParent()) {
if (f->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)) {
break;
}
f->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
}
}
if (HasAnyStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
for (nsIFrame* f = aParent; f; f = f->GetParent()) {
if (f->HasAnyStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)) {
break;
}
f->AddStateBits(NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE);
}
}
if (HasInvalidFrameInSubtree()) {
for (nsIFrame* f = aParent;
f && !f->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);

View File

@ -175,6 +175,11 @@ FRAME_STATE_BIT(Generic, 32, NS_FRAME_IS_PUSHED_FLOAT)
// This bit acts as a loop flag for recursive paint server drawing.
FRAME_STATE_BIT(Generic, 33, NS_FRAME_DRAWING_AS_PAINTSERVER)
// Intrinsic ISize depending on the frame's BSize is rare but possible.
// This flag indicates that the frame has (or once had) a descendant in that
// situation (possibly the frame itself).
FRAME_STATE_BIT(Generic, 34, NS_FRAME_DESCENDANT_INTRINSIC_ISIZE_DEPENDS_ON_BSIZE)
// Frame is a display root and the retained layer tree needs to be updated
// at the next paint via display list construction.
// Only meaningful for display roots, so we don't really need a global state