Bug 720124 - Remove dead code from HTMLContentSink: AddComment; r=hsivonen

This commit is contained in:
Ms2ger 2012-01-25 08:50:04 +01:00
Родитель c1e941dcc3
Коммит a98525ac10
8 изменённых файлов: 1 добавлений и 111 удалений

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

@ -107,7 +107,6 @@ public:
NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsHTMLTag aTag); NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
virtual void FlushPendingNotifications(mozFlushType aType) { } virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset); NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
virtual nsISupports *GetTarget() { return nsnull; } virtual nsISupports *GetTarget() { return nsnull; }

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

@ -108,7 +108,6 @@ public:
NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsHTMLTag aTag); NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
virtual void FlushPendingNotifications(mozFlushType aType) { } virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; } NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; } virtual nsISupports *GetTarget() { return nsnull; }

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

@ -195,7 +195,6 @@ public:
NS_IMETHOD CloseContainer(const nsHTMLTag aTag); NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
NS_IMETHOD CloseMalformedContainer(const nsHTMLTag aTag); NS_IMETHOD CloseMalformedContainer(const nsHTMLTag aTag);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
NS_IMETHOD DidProcessTokens(void); NS_IMETHOD DidProcessTokens(void);
NS_IMETHOD WillProcessAToken(void); NS_IMETHOD WillProcessAToken(void);
NS_IMETHOD DidProcessAToken(void); NS_IMETHOD DidProcessAToken(void);
@ -290,7 +289,6 @@ public:
nsresult CloseContainer(const nsHTMLTag aTag); nsresult CloseContainer(const nsHTMLTag aTag);
nsresult AddLeaf(const nsIParserNode& aNode); nsresult AddLeaf(const nsIParserNode& aNode);
nsresult AddLeaf(nsIContent* aContent); nsresult AddLeaf(nsIContent* aContent);
nsresult AddComment(const nsIParserNode& aNode);
nsresult End(); nsresult End();
nsresult GrowStack(); nsresult GrowStack();
@ -955,51 +953,6 @@ SinkContext::AddLeaf(nsIContent* aContent)
return NS_OK; return NS_OK;
} }
nsresult
SinkContext::AddComment(const nsIParserNode& aNode)
{
SINK_TRACE_NODE(SINK_TRACE_CALLS,
"SinkContext::AddLeaf",
nsHTMLTag(aNode.GetNodeType()),
mStackPos, mSink);
FlushTextAndRelease();
if (!mSink) {
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIContent> comment;
nsresult rv = NS_NewCommentNode(getter_AddRefs(comment),
mSink->mNodeInfoManager);
NS_ENSURE_SUCCESS(rv, rv);
comment->SetText(aNode.GetText(), false);
NS_ASSERTION(mStackPos > 0, "stack out of bounds");
if (mStackPos <= 0) {
return NS_ERROR_FAILURE;
}
{
Node &parentNode = mStack[mStackPos - 1];
nsGenericHTMLElement *parent = parentNode.mContent;
if (!mSink->mBody && mSink->mHead)
// XXXbz but this will make DidAddContent use the wrong parent for
// the notification! That seems so bogus it's not even funny.
parentNode.mContent = mSink->mHead;
DidAddContent(parentNode.Add(comment));
parentNode.mContent = parent;
}
#ifdef DEBUG
if (SINK_LOG_TEST(gSinkLogModuleInfo, SINK_ALWAYS_REFLOW)) {
mSink->ForceReflow();
}
#endif
return rv;
}
nsresult nsresult
SinkContext::End() SinkContext::End()
{ {
@ -1928,20 +1881,6 @@ HTMLContentSink::AddLeaf(const nsIParserNode& aNode)
return rv; return rv;
} }
/**
* This gets called by the parsing system when we find a comment
* @update gess11/9/98
* @param aNode contains a comment token
* @return error code
*/
nsresult
HTMLContentSink::AddComment(const nsIParserNode& aNode)
{
nsresult rv = mCurrentContext->AddComment(aNode);
return rv;
}
NS_IMETHODIMP NS_IMETHODIMP
HTMLContentSink::DidProcessTokens(void) HTMLContentSink::DidProcessTokens(void)
{ {

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

@ -184,16 +184,6 @@ public:
* @param nsIParserNode reference to parser node interface * @param nsIParserNode reference to parser node interface
*/ */
NS_IMETHOD AddLeaf(const nsIParserNode& aNode) = 0; NS_IMETHOD AddLeaf(const nsIParserNode& aNode) = 0;
/**
* This gets called by the parser when you want to add
* a leaf node to the current container in the content
* model.
*
* @update 4/1/98 gess
* @param nsIParserNode reference to parser node interface
*/
NS_IMETHOD AddComment(const nsIParserNode& aNode) = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLContentSink, NS_IHTML_CONTENT_SINK_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLContentSink, NS_IHTML_CONTENT_SINK_IID)

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

@ -1889,15 +1889,7 @@ nsresult
CNavDTD::HandleCommentToken(CToken* aToken) CNavDTD::HandleCommentToken(CToken* aToken)
{ {
NS_PRECONDITION(nsnull != aToken, kNullToken); NS_PRECONDITION(nsnull != aToken, kNullToken);
return NS_OK;
nsCParserNode* theNode = mNodeAllocator.CreateNode(aToken, mTokenAllocator);
NS_ENSURE_TRUE(theNode, NS_ERROR_OUT_OF_MEMORY);
nsresult result = mSink ? mSink->AddComment(*theNode) : NS_OK;
IF_FREE(theNode, &mNodeAllocator);
return result;
} }

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

@ -215,33 +215,6 @@ nsLoggingSink::AddLeaf(const nsIParserNode& aNode) {
} }
/**
* This gets called by the parser when you want to add
* a comment node to the current container in the content
* model.
*
* @updated gess 3/25/98
* @param
* @return
*/
NS_IMETHODIMP
nsLoggingSink::AddComment(const nsIParserNode& aNode){
#ifdef VERBOSE_DEBUG
DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
#endif
nsresult theResult=NS_OK;
//then proxy the call to the real sink if you have one.
if(mSink) {
theResult=mSink->AddComment(aNode);
}
return theResult;
}
NS_IMETHODIMP NS_IMETHODIMP
nsLoggingSink::OpenHead() { nsLoggingSink::OpenHead() {
WriteTabs(mOutput,++mLevel); WriteTabs(mOutput,++mLevel);

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

@ -69,7 +69,6 @@ public:
NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsHTMLTag aTag); NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode);
virtual void FlushPendingNotifications(mozFlushType aType) { } virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; } NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; } virtual nsISupports *GetTarget() { return nsnull; }

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

@ -372,7 +372,6 @@ public:
NS_IMETHOD OpenContainer(const nsIParserNode& aNode); NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
NS_IMETHOD CloseContainer(const nsHTMLTag aTag); NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
NS_IMETHOD AddLeaf(const nsIParserNode& aNode); NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; } NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
protected: protected: