forked from mirrors/gecko-dev
		
	Bug 1264876 - Remove StripCites() from nsIEditorMailSupport r=m_kato
nsIEditorMailSupport::StripCites() is used only by QA addon of Seamonkey. So, this is not necessary API now. This patch removes it and removes its helper classes in InternetCiter. MozReview-Commit-ID: 4Esl3GXzo0U --HG-- extra : rebase_source : 8f5fa85b18613726bfa7e21e5a6312cbd42af7c2
This commit is contained in:
		
							parent
							
								
									4024c1e21e
								
							
						
					
					
						commit
						8245258aa0
					
				
					 5 changed files with 0 additions and 101 deletions
				
			
		|  | @ -1862,12 +1862,6 @@ HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText, | ||||||
|   return rv; |   return rv; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| NS_IMETHODIMP |  | ||||||
| HTMLEditor::StripCites() |  | ||||||
| { |  | ||||||
|   return TextEditor::StripCites(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP | NS_IMETHODIMP | ||||||
| HTMLEditor::Rewrap(bool aRespectNewlines) | HTMLEditor::Rewrap(bool aRespectNewlines) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -67,59 +67,6 @@ InternetCiter::GetCiteString(const nsAString& aInString, | ||||||
|   return NS_OK; |   return NS_OK; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nsresult |  | ||||||
| InternetCiter::StripCitesAndLinebreaks(const nsAString& aInString, |  | ||||||
|                                        nsAString& aOutString, |  | ||||||
|                                        bool aLinebreaksToo, |  | ||||||
|                                        int32_t* aCiteLevel) |  | ||||||
| { |  | ||||||
|   if (aCiteLevel) { |  | ||||||
|     *aCiteLevel = 0; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   aOutString.Truncate(); |  | ||||||
|   nsReadingIterator <char16_t> beginIter,endIter; |  | ||||||
|   aInString.BeginReading(beginIter); |  | ||||||
|   aInString.EndReading(endIter); |  | ||||||
|   while (beginIter!= endIter) { // loop over lines
 |  | ||||||
|     // Clear out cites first, at the beginning of the line:
 |  | ||||||
|     int32_t thisLineCiteLevel = 0; |  | ||||||
|     while (beginIter!= endIter && |  | ||||||
|            (*beginIter == gt || nsCRT::IsAsciiSpace(*beginIter))) { |  | ||||||
|       if (*beginIter == gt) { |  | ||||||
|         ++thisLineCiteLevel; |  | ||||||
|       } |  | ||||||
|       ++beginIter; |  | ||||||
|     } |  | ||||||
|     // Now copy characters until line end:
 |  | ||||||
|     while (beginIter != endIter && (*beginIter != '\r' && *beginIter != '\n')) { |  | ||||||
|       aOutString.Append(*beginIter); |  | ||||||
|       ++beginIter; |  | ||||||
|     } |  | ||||||
|     if (aLinebreaksToo) { |  | ||||||
|       aOutString.Append(char16_t(' ')); |  | ||||||
|     } else { |  | ||||||
|       aOutString.Append(char16_t('\n'));    // DOM linebreaks, not NS_LINEBREAK
 |  | ||||||
|     } |  | ||||||
|     // Skip over any more consecutive linebreak-like characters:
 |  | ||||||
|     while (beginIter != endIter && (*beginIter == '\r' || *beginIter == '\n')) { |  | ||||||
|       ++beginIter; |  | ||||||
|     } |  | ||||||
|     // Done with this line -- update cite level
 |  | ||||||
|     if (aCiteLevel && (thisLineCiteLevel > *aCiteLevel)) { |  | ||||||
|       *aCiteLevel = thisLineCiteLevel; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   return NS_OK; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| nsresult |  | ||||||
| InternetCiter::StripCites(const nsAString& aInString, |  | ||||||
|                           nsAString& aOutString) |  | ||||||
| { |  | ||||||
|   return StripCitesAndLinebreaks(aInString, aOutString, false, 0); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void AddCite(nsAString& aOutString, int32_t citeLevel) | static void AddCite(nsAString& aOutString, int32_t citeLevel) | ||||||
| { | { | ||||||
|   for (int32_t i = 0; i < citeLevel; ++i) { |   for (int32_t i = 0; i < citeLevel; ++i) { | ||||||
|  |  | ||||||
|  | @ -20,19 +20,10 @@ public: | ||||||
|   static nsresult GetCiteString(const nsAString& aInString, |   static nsresult GetCiteString(const nsAString& aInString, | ||||||
|                                 nsAString& aOutString); |                                 nsAString& aOutString); | ||||||
| 
 | 
 | ||||||
|   static nsresult StripCites(const nsAString& aInString, |  | ||||||
|                              nsAString& aOutString); |  | ||||||
| 
 |  | ||||||
|   static nsresult Rewrap(const nsAString& aInString, |   static nsresult Rewrap(const nsAString& aInString, | ||||||
|                          uint32_t aWrapCol, uint32_t aFirstLineOffset, |                          uint32_t aWrapCol, uint32_t aFirstLineOffset, | ||||||
|                          bool aRespectNewlines, |                          bool aRespectNewlines, | ||||||
|                          nsAString& aOutString); |                          nsAString& aOutString); | ||||||
| 
 |  | ||||||
| protected: |  | ||||||
|   static nsresult StripCitesAndLinebreaks(const nsAString& aInString, |  | ||||||
|                                           nsAString& aOutString, |  | ||||||
|                                           bool aLinebreaksToo, |  | ||||||
|                                           int32_t* aCiteLevel); |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace mozilla
 | } // namespace mozilla
 | ||||||
|  |  | ||||||
|  | @ -1998,33 +1998,6 @@ TextEditor::Rewrap(bool aRespectNewlines) | ||||||
|   return InsertTextWithQuotations(wrapped); |   return InsertTextWithQuotations(wrapped); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| NS_IMETHODIMP |  | ||||||
| TextEditor::StripCites() |  | ||||||
| { |  | ||||||
|   nsAutoString current; |  | ||||||
|   bool isCollapsed; |  | ||||||
|   nsresult rv = SharedOutputString(nsIDocumentEncoder::OutputFormatted, |  | ||||||
|                                    &isCollapsed, current); |  | ||||||
|   NS_ENSURE_SUCCESS(rv, rv); |  | ||||||
| 
 |  | ||||||
|   nsString stripped; |  | ||||||
|   rv = InternetCiter::StripCites(current, stripped); |  | ||||||
|   NS_ENSURE_SUCCESS(rv, rv); |  | ||||||
| 
 |  | ||||||
|   if (isCollapsed) { |  | ||||||
|     rv = SelectAllInternal(); |  | ||||||
|     if (NS_WARN_IF(NS_FAILED(rv))) { |  | ||||||
|       return rv; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   rv = InsertTextAsAction(stripped); |  | ||||||
|   if (NS_WARN_IF(NS_FAILED(rv))) { |  | ||||||
|     return rv; |  | ||||||
|   } |  | ||||||
|   return NS_OK; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP | NS_IMETHODIMP | ||||||
| TextEditor::GetEmbeddedObjects(nsIArray** aNodeList) | TextEditor::GetEmbeddedObjects(nsIArray** aNodeList) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -59,12 +59,6 @@ interface nsIEditorMailSupport : nsISupports | ||||||
|    */ |    */ | ||||||
|   void rewrap(in boolean aRespectNewlines); |   void rewrap(in boolean aRespectNewlines); | ||||||
| 
 | 
 | ||||||
|   /** |  | ||||||
|    * Strip any citations in the selected part of the document. |  | ||||||
|    */ |  | ||||||
|   void stripCites(); |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   /** |   /** | ||||||
|    * Get a list of IMG and OBJECT tags in the current document. |    * Get a list of IMG and OBJECT tags in the current document. | ||||||
|    */ |    */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Masayuki Nakano
						Masayuki Nakano