Bug 1001994. r=roc

This commit is contained in:
Mats Palmgren 2014-07-07 16:08:42 +00:00
parent dee96fd3f7
commit 1eba32a97e
2 changed files with 22 additions and 2 deletions

View File

@ -176,6 +176,20 @@ nsInlineFrame::PeekOffsetCharacter(bool aForward, int32_t* aOffset,
return CONTINUE;
}
void
nsInlineFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsFrameList* overflowFrames = GetOverflowFrames();
if (overflowFrames) {
// Fixup the parent pointers for any child frames on the OverflowList.
// nsIFrame::DestroyFrom depends on that to find the sticky scroll
// container (an ancestor).
nsIFrame* lineContainer = nsLayoutUtils::FindNearestBlockAncestor(this);
DrainSelfOverflowListInternal(eForDestroy, lineContainer);
}
nsContainerFrame::DestroyFrom(aDestructRoot);
}
void
nsInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@ -422,11 +436,12 @@ nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags,
if (aLineContainer && aLineContainer->GetPrevContinuation()) {
ReparentFloatsForInlineChild(aLineContainer, firstChild, true);
}
const bool inFirstLine = (aFlags & eInFirstLine);
const bool doReparentSC =
(aFlags & eInFirstLine) && !(aFlags & eForDestroy);
RestyleManager* restyleManager = PresContext()->RestyleManager();
for (nsIFrame* f = firstChild; f; f = f->GetNextSibling()) {
f->SetParent(this);
if (inFirstLine) {
if (doReparentSC) {
restyleManager->ReparentStyleContext(f);
nsLayoutUtils::MarkDescendantsDirty(f);
}

View File

@ -63,6 +63,8 @@ public:
virtual FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
bool aRespectClusters = true) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
// nsIHTMLReflow overrides
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
InlineMinWidthData *aData) MOZ_OVERRIDE;
@ -165,6 +167,9 @@ private:
enum DrainFlags {
eDontReparentFrames = 1, // skip reparenting the overflow list frames
eInFirstLine = 2, // the request is for an inline descendant of a nsFirstLineFrame
eForDestroy = 4, // the request is from DestroyFrom; in this case we do the
// minimal work required since the frame is about to be
// destroyed (just fixup parent pointers)
};
/**
* Move any frames on our overflow list to the end of our principal list.