Bug 580094 - Few SetInnerHTML micro optimizations , r=jst, a=benjamin

--HG--
extra : rebase_source : d23e9583ef631e1a93d6aece9c3543c4b23ed9c2
This commit is contained in:
Olli Pettay 2010-07-21 19:03:21 +03:00
parent 930343bd50
commit 8d289f0549
7 changed files with 17 additions and 20 deletions

View File

@ -1600,12 +1600,10 @@ nsContentSink::DropParserAndPerfHint(void)
// Do this hack to make sure that the parser
// doesn't get destroyed, accidently, before
// the circularity, between sink & parser, is
// actually borken.
nsCOMPtr<nsIParser> kungFuDeathGrip(mParser);
// actually broken.
// Drop our reference to the parser to get rid of a circular
// reference.
mParser = nsnull;
nsCOMPtr<nsIParser> kungFuDeathGrip(mParser.forget());
if (mDynamicLowerValue) {
// Reset the performance hint which was set to FALSE

View File

@ -3793,15 +3793,16 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
}
}
nsCOMPtr<nsIContent> fragment = do_QueryInterface(frag);
if (contextAsContent) {
parser->ParseFragment(aFragment,
frag,
fragment,
contextAsContent->Tag(),
contextAsContent->GetNameSpaceID(),
(document->GetCompatibilityMode() == eCompatibility_NavQuirks));
} else {
parser->ParseFragment(aFragment,
frag,
fragment,
nsGkAtoms::body,
kNameSpaceID_XHTML,
(document->GetCompatibilityMode() == eCompatibility_NavQuirks));

View File

@ -428,15 +428,12 @@ nsHtml5Parser::ParseFragment(const nsAString& aSourceBuffer,
NS_IMETHODIMP
nsHtml5Parser::ParseFragment(const nsAString& aSourceBuffer,
nsISupports* aTargetNode,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks)
{
nsCOMPtr<nsIContent> target = do_QueryInterface(aTargetNode);
NS_ASSERTION(target, "Target did not QI to nsIContent");
nsIDocument* doc = target->GetOwnerDoc();
nsIDocument* doc = aTargetNode->GetOwnerDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_AVAILABLE);
nsIURI* uri = doc->GetDocumentURI();
@ -447,10 +444,10 @@ nsHtml5Parser::ParseFragment(const nsAString& aSourceBuffer,
mExecutor->SetParser(this);
mExecutor->SetNodeInfoManager(doc->NodeInfoManager());
nsIContent* weakTarget = target;
nsIContent* target = aTargetNode;
mTreeBuilder->setFragmentContext(aContextLocalName,
aContextNamespace,
&weakTarget,
&target,
aQuirks);
mExecutor->EnableFragmentMode();

View File

@ -217,13 +217,13 @@ class nsHtml5Parser : public nsIParser,
* Invoke the fragment parsing algorithm (innerHTML).
*
* @param aSourceBuffer the string being set as innerHTML
* @param aTargetNode the target container (must QI to nsIContent)
* @param aTargetNode the target container
* @param aContextLocalName local name of context node
* @param aContextNamespace namespace of context node
* @param aQuirks true to make <table> not close <p>
*/
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsISupports* aTargetNode,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks);

View File

@ -55,8 +55,8 @@
#include "nsIAtom.h"
#define NS_IPARSER_IID \
{ 0x3db442c2, 0x8a4d, 0x4ce4, \
{ 0x86, 0x58, 0x48, 0xee, 0x55, 0x4b, 0xbb, 0xd4 } }
{ 0xcbc0cbd8, 0xbbb7, 0x46d6, \
{ 0xa5, 0x51, 0x37, 0x8a, 0x69, 0x53, 0xa7, 0x14 } }
// {41421C60-310A-11d4-816F-000064657374}
#define NS_IDEBUG_DUMP_CONTENT_IID \
@ -69,6 +69,7 @@ class nsIParserFilter;
class nsString;
class nsIURI;
class nsIChannel;
class nsIContent;
enum eParserCommands {
eViewNormal,
@ -263,7 +264,7 @@ class nsIParser : public nsISupports {
nsDTDMode aMode = eDTDMode_autodetect) = 0;
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsISupports* aTargetNode,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks) = 0;

View File

@ -2123,7 +2123,7 @@ nsParser::Parse(const nsAString& aSourceBuffer,
NS_IMETHODIMP
nsParser::ParseFragment(const nsAString& aSourceBuffer,
nsISupports* aTargetNode,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks)

View File

@ -216,7 +216,7 @@ class nsParser : public nsIParser,
nsDTDMode aMode = eDTDMode_autodetect);
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsISupports* aTargetNode,
nsIContent* aTargetNode,
nsIAtom* aContextLocalName,
PRInt32 aContextNamespace,
PRBool aQuirks);