Bug 871338: Handle NS_BLOCK_LOOK_FOR_DIRTY_FRAMES lazy marking in GetMinWidth and GetPrefWidth in addition to Reflow. r=bzbarsky

This commit is contained in:
L. David Baron 2013-05-13 15:37:00 -07:00
parent 736dd852cb
commit 8eed96b5d6
5 changed files with 40 additions and 15 deletions

View File

@ -641,6 +641,11 @@ nsBlockFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
AutoNoisyIndenter indenter(gNoisyIntrinsic);
#endif
for (nsBlockFrame* curFrame = this; curFrame;
curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
curFrame->LazyMarkLinesDirty();
}
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
ResolveBidi();
InlineMinWidthData data;
@ -721,6 +726,11 @@ nsBlockFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
AutoNoisyIndenter indenter(gNoisyIntrinsic);
#endif
for (nsBlockFrame* curFrame = this; curFrame;
curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
curFrame->LazyMarkLinesDirty();
}
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
ResolveBidi();
InlinePrefWidthData data;
@ -993,21 +1003,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
PrepareResizeReflow(state);
}
if (GetStateBits() & NS_BLOCK_LOOK_FOR_DIRTY_FRAMES) {
for (line_iterator line = begin_lines(), line_end = end_lines();
line != line_end; ++line) {
int32_t n = line->GetChildCount();
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
if (NS_SUBTREE_DIRTY(lineFrame)) {
// NOTE: MarkLineDirty does more than just marking the line dirty.
MarkLineDirty(line, &mLines);
break;
}
}
}
RemoveStateBits(NS_BLOCK_LOOK_FOR_DIRTY_FRAMES);
}
LazyMarkLinesDirty();
mState &= ~NS_FRAME_FIRST_REFLOW;
@ -1509,6 +1505,26 @@ nsBlockFrame::UpdateOverflow()
return nsBlockFrameSuper::UpdateOverflow();
}
void
nsBlockFrame::LazyMarkLinesDirty()
{
if (GetStateBits() & NS_BLOCK_LOOK_FOR_DIRTY_FRAMES) {
for (line_iterator line = begin_lines(), line_end = end_lines();
line != line_end; ++line) {
int32_t n = line->GetChildCount();
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
if (NS_SUBTREE_DIRTY(lineFrame)) {
// NOTE: MarkLineDirty does more than just marking the line dirty.
MarkLineDirty(line, &mLines);
break;
}
}
}
RemoveStateBits(NS_BLOCK_LOOK_FOR_DIRTY_FRAMES);
}
}
void
nsBlockFrame::MarkLineDirty(line_iterator aLine, const nsLineList* aLineList)
{

View File

@ -611,6 +611,12 @@ protected:
nscoord& aAvailableSpaceHeight, /* in-out */
bool* aKeepReflowGoing);
/**
* If NS_BLOCK_LOOK_FOR_DIRTY_FRAMES is set, call MarkLineDirty
* on any line with a child frame that is dirty.
*/
void LazyMarkLinesDirty();
/**
* Mark |aLine| dirty, and, if necessary because of possible
* pull-up, mark the previous line dirty as well. Also invalidates textruns

View File

@ -0,0 +1 @@
<!DOCTYPE html><body><div style="float: right"><span> <span id="comment-buttons-tools" style="display:inline-block">Report</span></span> <span>HoverMe</span></div>

View File

@ -0,0 +1 @@
<!DOCTYPE html><body onload="document.getElementById('comment-buttons-tools').style.display='inline-block'"><div style="float: right"><span> <span id="comment-buttons-tools" style="display:none">Report</span></span> <span>HoverMe</span></div>

View File

@ -1758,3 +1758,4 @@ test-pref(layout.css.flexbox.enabled,true) == 849407-1.html 849407-1-ref.html
== 849996-1.html 849996-1-ref.html
== 858803-1.html 858803-1-ref.html
!= 860370.html 860370-notref.html
== 871338-1.html 871338-1-ref.html