1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsComposeTxtSrvFilter.h"
7 #include "nsError.h" // for NS_OK
8 #include "nsIContent.h" // for nsIContent
9 #include "nsLiteralString.h" // for NS_LITERAL_STRING
10 #include "mozilla/dom/Element.h" // for nsIContent
12 using namespace mozilla
;
14 bool nsComposeTxtSrvFilter::Skip(nsINode
* aNode
) const {
15 if (NS_WARN_IF(!aNode
)) {
19 // Check to see if we can skip this node
21 if (aNode
->IsAnyOfHTMLElements(nsGkAtoms::script
, nsGkAtoms::textarea
,
22 nsGkAtoms::select
, nsGkAtoms::style
,
31 // For nodes that are blockquotes, we must make sure
32 // their type is "cite"
33 if (aNode
->IsHTMLElement(nsGkAtoms::blockquote
)) {
34 return aNode
->AsElement()->AttrValueIs(kNameSpaceID_None
, nsGkAtoms::type
,
35 nsGkAtoms::cite
, eIgnoreCase
);
38 if (aNode
->IsHTMLElement(nsGkAtoms::span
)) {
39 if (aNode
->AsElement()->AttrValueIs(kNameSpaceID_None
, nsGkAtoms::mozquote
,
40 nsGkAtoms::_true
, eIgnoreCase
)) {
44 return aNode
->AsElement()->AttrValueIs(kNameSpaceID_None
, nsGkAtoms::_class
,
45 nsGkAtoms::mozsignature
,
49 if (aNode
->IsHTMLElement(nsGkAtoms::table
)) {
50 return aNode
->AsElement()->AttrValueIs(
51 kNameSpaceID_None
, nsGkAtoms::_class
,
52 NS_LITERAL_STRING("moz-email-headers-table"), eCaseMatters
);
59 UniquePtr
<nsComposeTxtSrvFilter
> nsComposeTxtSrvFilter::CreateHelper(
61 auto filter
= MakeUnique
<nsComposeTxtSrvFilter
>();
62 filter
->Init(aIsForMail
);