summaryrefslogtreecommitdiffstats
path: root/editor/composer/nsComposeTxtSrvFilter.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /editor/composer/nsComposeTxtSrvFilter.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'editor/composer/nsComposeTxtSrvFilter.cpp')
-rw-r--r--editor/composer/nsComposeTxtSrvFilter.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/editor/composer/nsComposeTxtSrvFilter.cpp b/editor/composer/nsComposeTxtSrvFilter.cpp
new file mode 100644
index 000000000..ba66bca95
--- /dev/null
+++ b/editor/composer/nsComposeTxtSrvFilter.cpp
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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 "nsComposeTxtSrvFilter.h"
+#include "nsError.h" // for NS_OK
+#include "nsIContent.h" // for nsIContent
+#include "nsIDOMNode.h" // for nsIDOMNode
+#include "nsNameSpaceManager.h" // for kNameSpaceID_None
+#include "nsLiteralString.h" // for NS_LITERAL_STRING
+#include "nscore.h" // for NS_IMETHODIMP
+
+nsComposeTxtSrvFilter::nsComposeTxtSrvFilter() :
+ mIsForMail(false)
+{
+}
+
+NS_IMPL_ISUPPORTS(nsComposeTxtSrvFilter, nsITextServicesFilter)
+
+NS_IMETHODIMP
+nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
+{
+ *_retval = false;
+
+ // Check to see if we can skip this node
+ // For nodes that are blockquotes, we must make sure
+ // their type is "cite"
+ nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
+ if (content) {
+ if (content->IsHTMLElement(nsGkAtoms::blockquote)) {
+ if (mIsForMail) {
+ *_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+ nsGkAtoms::cite, eIgnoreCase);
+ }
+ } else if (content->IsHTMLElement(nsGkAtoms::span)) {
+ if (mIsForMail) {
+ *_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
+ nsGkAtoms::_true, eIgnoreCase);
+ if (!*_retval) {
+ *_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
+ nsGkAtoms::mozsignature, eCaseMatters);
+ }
+ }
+ } else if (content->IsAnyOfHTMLElements(nsGkAtoms::script,
+ nsGkAtoms::textarea,
+ nsGkAtoms::select,
+ nsGkAtoms::style,
+ nsGkAtoms::map)) {
+ *_retval = true;
+ } else if (content->IsHTMLElement(nsGkAtoms::table)) {
+ if (mIsForMail) {
+ *_retval =
+ content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
+ NS_LITERAL_STRING("moz-email-headers-table"),
+ eCaseMatters);
+ }
+ }
+ }
+
+ return NS_OK;
+}