Avoid attempting to do CSS selector matching on text nodes, comments, or processing instructions by adding a 'NonElement' style resolution method that assumes that no rules match (temporarily, until we don't have style contexts for text nodes) and by cleaning code that was using textPseudo (the usual case) or passing the text node directly (only a few unusual cases). b=56117 r=hyatt sr=attinasi

git-svn-id: svn://10.0.0.236/trunk@106640 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu
2001-10-30 06:02:05 +00:00
parent 82f18832e5
commit 9b135c4afe
28 changed files with 583 additions and 469 deletions

View File

@@ -1631,7 +1631,13 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
}
else {
NS_ASSERTION(localContent, "non pseudo-element frame without content node");
aPresContext->ResolveStyleContextFor(content, aParentContext, PR_TRUE, &newContext);
if (content->IsContentOfType(nsIContent::eELEMENT)) {
aPresContext->ResolveStyleContextFor(content, aParentContext,
PR_TRUE, &newContext);
} else {
aPresContext->ResolveStyleContextForNonElement(aParentContext,
PR_TRUE, &newContext);
}
}
NS_ASSERTION(newContext, "failed to get new style context");
if (newContext) {
@@ -1845,7 +1851,13 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
}
else {
NS_ASSERTION(localContent, "non pseudo-element frame without content node");
aPresContext->ResolveStyleContextFor(content, aParentContext, PR_TRUE, &newContext);
if (content->IsContentOfType(nsIContent::eELEMENT)) {
aPresContext->ResolveStyleContextFor(content, aParentContext,
PR_TRUE, &newContext);
} else {
aPresContext->ResolveStyleContextForNonElement(aParentContext,
PR_TRUE, &newContext);
}
}
NS_ASSERTION(newContext, "failed to get new style context");
if (newContext) {
@@ -1927,13 +1939,20 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* undisplayedContext = nsnull;
undisplayed->mStyle->GetPseudoType(pseudoTag);
if (undisplayed->mContent && pseudoTag == nsnull) { // child content
aPresContext->ResolveStyleContextFor(undisplayed->mContent, newContext,
PR_TRUE, &undisplayedContext);
if (undisplayed->mContent->IsContentOfType(nsIContent::eELEMENT)) {
aPresContext->ResolveStyleContextFor(undisplayed->mContent,
newContext,
PR_TRUE, &undisplayedContext);
} else {
aPresContext->ResolveStyleContextForNonElement(newContext,
PR_TRUE, &undisplayedContext);
}
}
else { // pseudo element
NS_ASSERTION(pseudoTag, "pseudo element without tag");
aPresContext->ResolvePseudoStyleContextFor(localContent, pseudoTag, newContext, PR_FALSE,
&undisplayedContext);
aPresContext->ResolvePseudoStyleContextFor(localContent, pseudoTag,
newContext, PR_FALSE,
&undisplayedContext);
}
NS_IF_RELEASE(pseudoTag);
if (undisplayedContext) {