зеркало из https://github.com/mozilla/gecko-dev.git
Bug 861897 - Cleanup nsComposeTxtSrvFilter to use nsGkAtoms; r=roc
This commit is contained in:
Родитель
575b423ef1
Коммит
4134b5fe70
|
@ -45,6 +45,7 @@ GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
|
|||
GK_ATOM(mozgeneratedcontentafter, "_moz_generated_content_after")
|
||||
GK_ATOM(mozgeneratedcontentimage, "_moz_generated_content_image")
|
||||
GK_ATOM(mozquote, "_moz_quote")
|
||||
GK_ATOM(mozsignature, "moz-signature")
|
||||
GK_ATOM(_moz_is_glyph, "-moz-is-glyph")
|
||||
GK_ATOM(_moz_original_size, "_moz_original_size")
|
||||
GK_ATOM(_moz_target, "_moz_target")
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCaseTreatment.h"
|
||||
#include "nsComposeTxtSrvFilter.h"
|
||||
#include "nsError.h" // for NS_OK
|
||||
#include "nsIContent.h" // for nsIContent
|
||||
#include "nsID.h"
|
||||
#include "nsIDOMNode.h" // for nsIDOMNode
|
||||
#include "nsINameSpaceManager.h" // for kNameSpaceID_None
|
||||
#include "nsLiteralString.h" // for NS_LITERAL_STRING
|
||||
|
@ -16,25 +14,11 @@
|
|||
nsComposeTxtSrvFilter::nsComposeTxtSrvFilter() :
|
||||
mIsForMail(false)
|
||||
{
|
||||
|
||||
mBlockQuoteAtom = do_GetAtom("blockquote");
|
||||
mSpanAtom = do_GetAtom("span");
|
||||
mTableAtom = do_GetAtom("table");
|
||||
mMozQuoteAtom = do_GetAtom("_moz_quote");
|
||||
mClassAtom = do_GetAtom("class");
|
||||
mTypeAtom = do_GetAtom("type");
|
||||
mScriptAtom = do_GetAtom("script");
|
||||
mTextAreaAtom = do_GetAtom("textarea");
|
||||
mSelectAreaAtom = do_GetAtom("select");
|
||||
mMapAtom = do_GetAtom("map");
|
||||
mCiteAtom = do_GetAtom("cite");
|
||||
mTrueAtom = do_GetAtom("true");
|
||||
mMozSignatureAtom= do_GetAtom("moz-signature");
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsComposeTxtSrvFilter, nsITextServicesFilter)
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
|
||||
{
|
||||
*_retval = false;
|
||||
|
@ -45,32 +29,32 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
|
|||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (content) {
|
||||
nsIAtom *tag = content->Tag();
|
||||
if (tag == mBlockQuoteAtom) {
|
||||
if (tag == nsGkAtoms::blockquote) {
|
||||
if (mIsForMail) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, mTypeAtom,
|
||||
mCiteAtom, eIgnoreCase);
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::cite, eIgnoreCase);
|
||||
}
|
||||
} else if (tag == mSpanAtom) {
|
||||
} else if (tag == nsGkAtoms::span) {
|
||||
if (mIsForMail) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, mMozQuoteAtom,
|
||||
mTrueAtom, eIgnoreCase);
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
|
||||
nsGkAtoms::_true, eIgnoreCase);
|
||||
if (!*_retval) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, mClassAtom,
|
||||
mMozSignatureAtom, eCaseMatters);
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
nsGkAtoms::mozsignature, eCaseMatters);
|
||||
}
|
||||
}
|
||||
} else if (tag == mScriptAtom ||
|
||||
tag == mTextAreaAtom ||
|
||||
tag == mSelectAreaAtom ||
|
||||
tag == mMapAtom) {
|
||||
}
|
||||
} else if (tag == nsGkAtoms::script ||
|
||||
tag == nsGkAtoms::textarea ||
|
||||
tag == nsGkAtoms::select ||
|
||||
tag == nsGkAtoms::map) {
|
||||
*_retval = true;
|
||||
} else if (tag == mTableAtom) {
|
||||
} else if (tag == nsGkAtoms::table) {
|
||||
if (mIsForMail) {
|
||||
*_retval =
|
||||
content->AttrValueIs(kNameSpaceID_None, mClassAtom,
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("moz-email-headers-table"),
|
||||
eCaseMatters);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#ifndef nsComposeTxtSrvFilter_h__
|
||||
#define nsComposeTxtSrvFilter_h__
|
||||
|
||||
#include "nsCOMPtr.h" // for nsCOMPtr
|
||||
#include "nsIAtom.h" // for nsIAtom
|
||||
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS
|
||||
#include "nsITextServicesFilter.h"
|
||||
|
||||
|
@ -18,11 +16,10 @@
|
|||
* This filter is used to skip over various form control nodes and
|
||||
* mail's cite nodes
|
||||
*/
|
||||
class nsComposeTxtSrvFilter : public nsITextServicesFilter
|
||||
class nsComposeTxtSrvFilter MOZ_FINAL : public nsITextServicesFilter
|
||||
{
|
||||
public:
|
||||
nsComposeTxtSrvFilter();
|
||||
virtual ~nsComposeTxtSrvFilter() {}
|
||||
|
||||
// nsISupports interface...
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -33,21 +30,8 @@ public:
|
|||
// Helper - Intializer
|
||||
void Init(bool aIsForMail) { mIsForMail = aIsForMail; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
bool mIsForMail;
|
||||
nsCOMPtr<nsIAtom> mBlockQuoteAtom;
|
||||
nsCOMPtr<nsIAtom> mSpanAtom; // mail plain text quotes are wrapped in span tags
|
||||
nsCOMPtr<nsIAtom> mMozQuoteAtom; // _moz_quote_
|
||||
nsCOMPtr<nsIAtom> mTableAtom;
|
||||
nsCOMPtr<nsIAtom> mClassAtom;
|
||||
nsCOMPtr<nsIAtom> mTypeAtom;
|
||||
nsCOMPtr<nsIAtom> mScriptAtom;
|
||||
nsCOMPtr<nsIAtom> mTextAreaAtom;
|
||||
nsCOMPtr<nsIAtom> mSelectAreaAtom;
|
||||
nsCOMPtr<nsIAtom> mMapAtom;
|
||||
nsCOMPtr<nsIAtom> mCiteAtom;
|
||||
nsCOMPtr<nsIAtom> mTrueAtom;
|
||||
nsCOMPtr<nsIAtom> mMozSignatureAtom;
|
||||
};
|
||||
|
||||
#define NS_COMPOSERTXTSRVFILTER_CID \
|
||||
|
|
Загрузка…
Ссылка в новой задаче