When re-resolving style, re-resolve root in undisplayed map too. (Bug 473042) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2009-01-13 11:50:41 -08:00
parent a59b1cf8db
commit 54c0fed0d2
2 changed files with 24 additions and 2 deletions

View File

@ -271,6 +271,10 @@ public:
nsIFrame* GetRootElementStyleFrame() { return mRootElementStyleFrame; } nsIFrame* GetRootElementStyleFrame() { return mRootElementStyleFrame; }
nsIFrame* GetPageSequenceFrame() { return mPageSequenceFrame; } nsIFrame* GetPageSequenceFrame() { return mPageSequenceFrame; }
// Get the frame that is the parent of the root element.
nsIFrame* GetDocElementContainingBlock()
{ return mDocElementContainingBlock; }
private: private:
nsresult ReconstructDocElementHierarchyInternal(); nsresult ReconstructDocElementHierarchyInternal();

View File

@ -1312,10 +1312,28 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
} }
// now look for undisplayed child content and pseudos // now look for undisplayed child content and pseudos
if (!pseudoTag && localContent && mUndisplayedMap) {
// When the root element is display:none, we still construct *some*
// frames that have the root element as their mContent, down to the
// DocElementContainingBlock.
PRBool checkUndisplayed;
nsIContent *undisplayedParent;
if (pseudoTag) {
checkUndisplayed = aFrame == mPresShell->FrameConstructor()->
GetDocElementContainingBlock();
undisplayedParent = nsnull;
} else {
checkUndisplayed = !!localContent;
undisplayedParent = localContent;
}
if (checkUndisplayed && mUndisplayedMap) {
for (UndisplayedNode* undisplayed = for (UndisplayedNode* undisplayed =
mUndisplayedMap->GetFirstNode(localContent); mUndisplayedMap->GetFirstNode(undisplayedParent);
undisplayed; undisplayed = undisplayed->mNext) { undisplayed; undisplayed = undisplayed->mNext) {
NS_ASSERTION(undisplayedParent ||
undisplayed->mContent ==
mPresShell->GetDocument()->GetRootContent(),
"undisplayed node child of null must be root");
nsRefPtr<nsStyleContext> undisplayedContext; nsRefPtr<nsStyleContext> undisplayedContext;
nsIAtom* const undisplayedPseudoTag = undisplayed->mStyle->GetPseudoType(); nsIAtom* const undisplayedPseudoTag = undisplayed->mStyle->GetPseudoType();
if (!undisplayedPseudoTag) { // child content if (!undisplayedPseudoTag) { // child content