Fix a hang by using a dedicated state bit instead of overloading NS_FRAME_IS_DIRTY. Bug 964821, r=roc

This commit is contained in:
Simon Montagu 2014-02-17 14:46:40 -08:00
parent 8ddf7de8a5
commit 90aff7d278
3 changed files with 22 additions and 6 deletions

View File

@ -10102,14 +10102,20 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
textContent->SetPrimaryFrame(newTextFrame);
// Wallpaper bug 822910.
if (prevSibling && prevSibling->GetType() == nsGkAtoms::textFrame) {
prevSibling->AddStateBits(NS_FRAME_IS_DIRTY);
bool offsetsNeedFixing =
prevSibling && prevSibling->GetType() == nsGkAtoms::textFrame;
if (offsetsNeedFixing) {
prevSibling->AddStateBits(TEXT_OFFSETS_NEED_FIXING);
}
// Insert text frame in its place
nsFrameList textList(newTextFrame, newTextFrame);
InsertFrames(parentFrame, kPrincipalList, prevSibling, textList);
if (offsetsNeedFixing) {
prevSibling->RemoveStateBits(TEXT_OFFSETS_NEED_FIXING);
}
return NS_OK;
}
@ -10153,14 +10159,20 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
textContent->SetPrimaryFrame(textFrame);
// Wallpaper bug 822910.
if (prevSibling && prevSibling->GetType() == nsGkAtoms::textFrame) {
prevSibling->AddStateBits(NS_FRAME_IS_DIRTY);
bool offsetsNeedFixing =
prevSibling && prevSibling->GetType() == nsGkAtoms::textFrame;
if (offsetsNeedFixing) {
prevSibling->AddStateBits(TEXT_OFFSETS_NEED_FIXING);
}
// Insert text frame in its place
nsFrameList textList(textFrame, textFrame);
InsertFrames(aFrame, kPrincipalList, prevSibling, textList);
if (offsetsNeedFixing) {
prevSibling->RemoveStateBits(TEXT_OFFSETS_NEED_FIXING);
}
*aStopLooking = true;
NS_ASSERTION(!aBlockFrame->GetPrevContinuation(),
"should have the first continuation here");

View File

@ -4777,9 +4777,9 @@ ShouldPutNextSiblingOnNewLine(nsIFrame* aLastFrame)
if (type == nsGkAtoms::brFrame) {
return true;
}
// XXX the IS_DIRTY check is a wallpaper for bug 822910.
// XXX the TEXT_OFFSETS_NEED_FIXING check is a wallpaper for bug 822910.
if (type == nsGkAtoms::textFrame &&
!(aLastFrame->GetStateBits() & NS_FRAME_IS_DIRTY)) {
!(aLastFrame->GetStateBits() & TEXT_OFFSETS_NEED_FIXING)) {
return aLastFrame->HasSignificantTerminalNewline();
}
return false;

View File

@ -380,6 +380,10 @@ FRAME_STATE_BIT(Text, 28, TEXT_ISNOT_ONLY_WHITESPACE)
// Set when this text frame is mentioned in the userdata for mTextRun
FRAME_STATE_BIT(Text, 29, TEXT_IN_TEXTRUN_USER_DATA)
// This state bit is set on frames whose character data offsets need to be
// fixed up
FRAME_STATE_BIT(Text, 30, TEXT_OFFSETS_NEED_FIXING)
// This state bit is set on frames that have some non-collapsed characters after
// reflow
FRAME_STATE_BIT(Text, 31, TEXT_HAS_NONCOLLAPSED_CHARACTERS)