Skip to content

Commit

Permalink
Bug 1024454 (Part 1) - Eagerly propagate dirty bits so absolute child…
Browse files Browse the repository at this point in the history
…ren of table parts get reflowed reliably. r=dbaron
  • Loading branch information
sethfowler committed Aug 21, 2014
1 parent aeed365 commit e9ea912
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
12 changes: 12 additions & 0 deletions layout/generic/nsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4354,6 +4354,18 @@ nsFrame::ReflowAbsoluteFrames(nsPresContext* aPresContext,
}
}

void
nsFrame::PushDirtyBitToAbsoluteFrames()
{
if (!(GetStateBits() & NS_FRAME_IS_DIRTY)) {
return; // No dirty bit to push.
}
if (!HasAbsolutelyPositionedChildren()) {
return; // No absolute children to push to.
}
GetAbsoluteContainingBlock()->MarkAllFramesDirty();
}

/* virtual */ bool
nsFrame::CanContinueTextRun() const
{
Expand Down
14 changes: 14 additions & 0 deletions layout/generic/nsFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ class nsFrame : public nsBox
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
bool aConstrainHeight = true);

/*
* If this frame is dirty, marks all absolutely-positioned children of this
* frame dirty. If this frame isn't dirty, or if there are no
* absolutely-positioned children, does nothing.
*
* It's necessary to use PushDirtyBitToAbsoluteFrames() when you plan to
* reflow this frame's absolutely-positioned children after the dirty bit on
* this frame has already been cleared, which prevents nsHTMLReflowState from
* propagating the dirty bit normally. This situation generally only arises
* when a multipass layout algorithm is used.
*/
void PushDirtyBitToAbsoluteFrames();

virtual bool CanContinueTextRun() const MOZ_OVERRIDE;

virtual bool UpdateOverflow() MOZ_OVERRIDE;
Expand Down
5 changes: 5 additions & 0 deletions layout/tables/nsTableCellFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,11 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
// remember the desired size for this reflow
SetDesiredSize(aDesiredSize);

// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();

NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
}

Expand Down
5 changes: 5 additions & 0 deletions layout/tables/nsTableRowFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,11 @@ nsTableRowFrame::Reflow(nsPresContext* aPresContext,
InvalidateFrame();
}

// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();

NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
}

Expand Down
6 changes: 6 additions & 0 deletions layout/tables/nsTableRowGroupFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,12 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
}

FinishAndStoreOverflow(&aDesiredSize);

// Any absolutely-positioned children will get reflowed in
// nsFrame::FixupPositionedTableParts in another pass, so propagate our
// dirtiness to them before our parent clears our dirty bits.
PushDirtyBitToAbsoluteFrames();

NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
}

Expand Down

0 comments on commit e9ea912

Please sign in to comment.