Bug 898209 patch 5: Remove the localContent variable in favor of writing mFrame->GetContent(). r=heycam

This commit is contained in:
L. David Baron 2013-07-30 17:36:09 -07:00
parent 62d516ab40
commit 4a58134c69

View File

@ -1994,8 +1994,9 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
// It would be nice if we could make stronger assertions here; they // It would be nice if we could make stronger assertions here; they
// would let us simplify the ?: expressions below setting |content| // would let us simplify the ?: expressions below setting |content|
// and |pseudoContent| in sensible ways as well as making what // and |pseudoContent| in sensible ways as well as making what
// |localContent|, |content|, and |pseudoContent| mean make more // |content| and |pseudoContent| mean, and their relationship to
// sense. However, we can't, because of frame trees like the one in // |mFrame->GetContent()|, make more sense. However, we can't,
// because of frame trees like the one in
// https://bugzilla.mozilla.org/show_bug.cgi?id=472353#c14 . Once we // https://bugzilla.mozilla.org/show_bug.cgi?id=472353#c14 . Once we
// fix bug 242277 we should be able to make this make more sense. // fix bug 242277 we should be able to make this make more sense.
NS_ASSERTION(mFrame->GetContent() || !aParentContent || NS_ASSERTION(mFrame->GetContent() || !aParentContent ||
@ -2026,13 +2027,13 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
nsIAtom* const pseudoTag = oldContext->GetPseudo(); nsIAtom* const pseudoTag = oldContext->GetPseudo();
const nsCSSPseudoElements::Type pseudoType = oldContext->GetPseudoType(); const nsCSSPseudoElements::Type pseudoType = oldContext->GetPseudoType();
nsIContent* localContent = mFrame->GetContent();
// |content| is the node that we used for rule matching of // |content| is the node that we used for rule matching of
// normal elements (not pseudo-elements) and for which we generate // normal elements (not pseudo-elements) and for which we generate
// framechange hints if we need them. // framechange hints if we need them.
// XXXldb Why does it make sense to use aParentContent? (See // XXXldb Why does it make sense to use aParentContent? (See
// comment above assertion at start of function.) // comment above assertion at start of function.)
nsIContent* content = localContent ? localContent : aParentContent; nsIContent* content = mFrame->GetContent() ? mFrame->GetContent()
: aParentContent;
if (content && content->IsElement()) { if (content && content->IsElement()) {
content->OwnerDoc()->FlushPendingLinkUpdates(); content->OwnerDoc()->FlushPendingLinkUpdates();
@ -2169,7 +2170,7 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
newContext = prevContinuationContext; newContext = prevContinuationContext;
} }
else if (pseudoTag == nsCSSAnonBoxes::mozNonElement) { else if (pseudoTag == nsCSSAnonBoxes::mozNonElement) {
NS_ASSERTION(localContent, NS_ASSERTION(mFrame->GetContent(),
"non pseudo-element frame without content node"); "non pseudo-element frame without content node");
newContext = styleSet->ResolveStyleForNonElement(parentContext); newContext = styleSet->ResolveStyleForNonElement(parentContext);
} }
@ -2223,7 +2224,7 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
} }
} }
else { else {
NS_ASSERTION(localContent, NS_ASSERTION(mFrame->GetContent(),
"non pseudo-element frame without content node"); "non pseudo-element frame without content node");
// Skip flex-item style fixup for anonymous subtrees: // Skip flex-item style fixup for anonymous subtrees:
TreeMatchContext::AutoFlexItemStyleFixupSkipper TreeMatchContext::AutoFlexItemStyleFixupSkipper
@ -2333,8 +2334,8 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
GetDocElementContainingBlock(); GetDocElementContainingBlock();
undisplayedParent = nullptr; undisplayedParent = nullptr;
} else { } else {
checkUndisplayed = !!localContent; checkUndisplayed = !!mFrame->GetContent();
undisplayedParent = localContent; undisplayedParent = mFrame->GetContent();
} }
if (checkUndisplayed) { if (checkUndisplayed) {
UndisplayedNode* undisplayed = UndisplayedNode* undisplayed =
@ -2416,7 +2417,7 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
// Checking for a :before frame is cheaper than getting the // Checking for a :before frame is cheaper than getting the
// :before style context. // :before style context.
if (!nsLayoutUtils::GetBeforeFrame(mFrame) && if (!nsLayoutUtils::GetBeforeFrame(mFrame) &&
nsLayoutUtils::HasPseudoStyle(localContent, newContext, nsLayoutUtils::HasPseudoStyle(mFrame->GetContent(), newContext,
nsCSSPseudoElements::ePseudo_before, nsCSSPseudoElements::ePseudo_before,
mPresContext)) { mPresContext)) {
// Have to create the new :before frame // Have to create the new :before frame
@ -2447,7 +2448,7 @@ ElementRestyler::Restyle(nsIContent *aParentContent,
if (!nextContinuation) { if (!nextContinuation) {
// Getting the :after frame is more expensive than getting the pseudo // Getting the :after frame is more expensive than getting the pseudo
// context, so get the pseudo context first. // context, so get the pseudo context first.
if (nsLayoutUtils::HasPseudoStyle(localContent, newContext, if (nsLayoutUtils::HasPseudoStyle(mFrame->GetContent(), newContext,
nsCSSPseudoElements::ePseudo_after, nsCSSPseudoElements::ePseudo_after,
mPresContext) && mPresContext) &&
!nsLayoutUtils::GetAfterFrame(mFrame)) { !nsLayoutUtils::GetAfterFrame(mFrame)) {