Bug 720124 - Remove dead code from HTMLContentSink: IsFormOnStack; r=hsivonen
authorMs2ger <ms2ger@gmail.com>
Wed, 25 Jan 2012 08:50:04 +0100
changeset 86428 ffa1adda4c4ff548c0d99fa437c9c1913d70cea3
parent 86427 92474bceca8a2f890e00a608b7eaec545a6039dc
child 86429 86377c75fbca7e0e40f7a2165041931150230c38
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs720124
milestone12.0a1
Bug 720124 - Remove dead code from HTMLContentSink: IsFormOnStack; r=hsivonen
content/base/src/mozSanitizingSerializer.h
content/base/src/nsPlainTextSerializer.h
content/html/document/src/nsHTMLContentSink.cpp
parser/htmlparser/public/nsIHTMLContentSink.h
parser/htmlparser/src/CNavDTD.cpp
parser/htmlparser/src/nsLoggingSink.h
toolkit/components/places/nsPlacesImportExportService.cpp
--- a/content/base/src/mozSanitizingSerializer.h
+++ b/content/base/src/mozSanitizingSerializer.h
@@ -113,17 +113,16 @@ public:
   virtual void FlushPendingNotifications(mozFlushType aType) { }
   NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
   virtual nsISupports *GetTarget() { return nsnull; }
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn);
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
   NS_IMETHOD BeginContext(PRInt32 aPosition) { return NS_OK; }
   NS_IMETHOD EndContext(PRInt32 aPosition) { return NS_OK; }
   NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
   NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
   NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
 
   // nsISanitizingHTMLSerializer
   NS_IMETHOD Initialize(nsAString* aOutString,
--- a/content/base/src/nsPlainTextSerializer.h
+++ b/content/base/src/nsPlainTextSerializer.h
@@ -113,17 +113,16 @@ public:
   virtual void FlushPendingNotifications(mozFlushType aType) { }
   NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
   virtual nsISupports *GetTarget() { return nsnull; }
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn);
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
 
   NS_IMETHOD BeginContext(PRInt32 aPosition) { return NS_OK; }
   NS_IMETHOD EndContext(PRInt32 aPosition) { return NS_OK; }
   NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
   NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
   NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
 
   // nsIHTMLToTextSink
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -199,17 +199,16 @@ public:
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
   NS_IMETHOD DidProcessTokens(void);
   NS_IMETHOD WillProcessAToken(void);
   NS_IMETHOD DidProcessAToken(void);
   NS_IMETHOD BeginContext(PRInt32 aID);
   NS_IMETHOD EndContext(PRInt32 aID);
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn);
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
 
 #ifdef DEBUG
   // nsIDebugDumpContent
   NS_IMETHOD DumpContentModel();
 #endif
 
 protected:
   // If aCheckIfPresent is true, will only set an attribute in cases
--- a/parser/htmlparser/public/nsIHTMLContentSink.h
+++ b/parser/htmlparser/public/nsIHTMLContentSink.h
@@ -78,18 +78,18 @@
  * NOTE: I haven't figured out how sub-documents (non-frames)
  *       are going to be handled. Stay tuned.
  */
 #include "nsIParserNode.h"
 #include "nsIContentSink.h"
 #include "nsHTMLTags.h"
 
 #define NS_IHTML_CONTENT_SINK_IID \
-{ 0xa3aad227, 0xe137, 0x407c, \
-  { 0xa4, 0xa0, 0x9e, 0x23, 0xb6, 0x38, 0xf3, 0x42 } }
+{ 0xb6d6ae00, 0x0884, 0x4a30, \
+  { 0xa8, 0xb4, 0xce, 0xca, 0x57, 0x27, 0x1a, 0x3e } }
 
 #define MAX_REFLOW_DEPTH  200
 
 class nsIHTMLContentSink : public nsIContentSink 
 {
 public:
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTML_CONTENT_SINK_IID)
@@ -199,22 +199,14 @@ public:
    * 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 AddProcessingInstruction(const nsIParserNode& aNode) = 0;
-
-  /**
-   * Call this method to determnine if a FORM is on the sink's stack
-   *
-   * @return true if found else false
-   */
-  NS_IMETHOD_(bool) IsFormOnStack() = 0;
-
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLContentSink, NS_IHTML_CONTENT_SINK_IID)
 
 #endif /* nsIHTMLContentSink_h___ */
 
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1742,26 +1742,16 @@ CNavDTD::HandleSavedTokens(PRInt32 anInd
         return NS_ERROR_OUT_OF_MEMORY;
       }
 
       CToken*   theToken;
       eHTMLTags theTag;
       PRInt32   attrCount;
       PRInt32   theTopIndex = anIndex + 1;
       PRInt32   theTagCount = mBodyContext->GetCount();
-      bool      formWasOnStack = mSink->IsFormOnStack();
-
-      if (formWasOnStack) {
-        // Do this to synchronize dtd stack and the sink stack.
-        // Note: FORM is never on the dtd stack because its always
-        // considered as a leaf. However, in the sink FORM can either
-        // be a container or a leaf. Therefore, we have to check
-        // with the sink -- Ref: Bug 20087.
-        ++anIndex;
-      }
 
       // Pause the main context and switch to the new context.
       result = mSink->BeginContext(anIndex);
       
       NS_ENSURE_SUCCESS(result, result);
 
       // The body context should contain contents only upto the marked position.
       mBodyContext->MoveEntries(*mTempContext, theTagCount - theTopIndex);
@@ -1817,22 +1807,16 @@ CNavDTD::HandleSavedTokens(PRInt32 anInd
       if (theTopIndex != mBodyContext->GetCount()) {
         // CloseContainersTo does not close any forms we might have opened while
         // handling saved tokens, because the parser does not track forms on its
         // mBodyContext stack.
         CloseContainersTo(theTopIndex, mBodyContext->TagAt(theTopIndex),
                           true);
       }      
 
-      if (!formWasOnStack && mSink->IsFormOnStack()) {
-        // If a form has appeared on the sink context stack since the beginning of
-        // HandleSavedTokens, have the sink close it:
-        mSink->CloseContainer(eHTMLTag_form);
-      }
-
       // Bad-contents were successfully processed. Now, itz time to get
       // back to the original body context state.
       mTempContext->MoveEntries(*mBodyContext, theTagCount - theTopIndex);
 
       // Terminate the new context and switch back to the main context
       mSink->EndContext(anIndex);
 
       mFlags &= ~NS_DTD_FLAG_IN_MISPLACED_CONTENT;
--- a/parser/htmlparser/src/nsLoggingSink.h
+++ b/parser/htmlparser/src/nsLoggingSink.h
@@ -76,17 +76,16 @@ public:
   virtual nsISupports *GetTarget() { return nsnull; }
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn) 
   /* Take the largest possible feature set. */
   { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = true; return NS_OK; }
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
 
   NS_IMETHOD BeginContext(PRInt32 aPosition);
   NS_IMETHOD EndContext(PRInt32 aPosition);
   NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
   NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
   NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
 
   // nsILoggingSink
--- a/toolkit/components/places/nsPlacesImportExportService.cpp
+++ b/toolkit/components/places/nsPlacesImportExportService.cpp
@@ -370,17 +370,16 @@ public:
   NS_IMETHOD WillProcessAToken() { return NS_OK; }
   NS_IMETHOD DidProcessAToken() { return NS_OK; }
   NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
   NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
   NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
   NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
 
 protected:
   nsCOMPtr<nsINavBookmarksService> mBookmarksService;
   nsCOMPtr<nsINavHistoryService> mHistoryService;
   nsCOMPtr<nsIAnnotationService> mAnnotationService;
   nsCOMPtr<nsILivemarkService> mLivemarkService;
 
   // If set, we will move root items to from their existing position