Bug 222342: Speed up txStylesheet::isStripSpaceAllowed by not filtering textnodes in the root of a document and by earlyreturning if there are no stripspace rules.

r=Pike sr=peterv
This commit is contained in:
sicking%bigfoot.com 2003-10-21 19:55:53 +00:00
Родитель 21a1ef2ab5
Коммит 3ec93e622e
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -275,7 +275,8 @@ txStylesheet::getKeyMap()
PRBool
txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
{
if (!aNode) {
PRInt32 frameCount = mStripSpaceTests.Count();
if (!aNode || frameCount == 0) {
return MB_FALSE;
}
@ -283,7 +284,7 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
case Node::ELEMENT_NODE:
{
// check Whitespace stipping handling list against given Node
PRInt32 i, frameCount = mStripSpaceTests.Count();
PRInt32 i;
for (i = 0; i < frameCount; ++i) {
txStripSpaceTest* sst =
NS_STATIC_CAST(txStripSpaceTest*, mStripSpaceTests[i]);
@ -304,10 +305,6 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
return MB_FALSE;
return isStripSpaceAllowed(aNode->getParentNode(), aContext);
}
case Node::DOCUMENT_NODE:
{
return MB_TRUE;
}
}
return MB_FALSE;
}