Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / nsHtml5PlainTextUtils.cpp
blob17bf83c6ca14a213051445792386cf849bb0ff52
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsHtml5PlainTextUtils.h"
6 #include "nsHtml5AttributeName.h"
7 #include "nsHtml5Portability.h"
8 #include "nsHtml5String.h"
9 #include "nsGkAtoms.h"
10 #include "mozilla/StaticPrefs_plain_text.h"
12 // static
13 nsHtml5HtmlAttributes* nsHtml5PlainTextUtils::NewLinkAttributes() {
14 nsHtml5HtmlAttributes* linkAttrs = new nsHtml5HtmlAttributes(0);
15 nsHtml5String rel = nsHtml5Portability::newStringFromLiteral("stylesheet");
16 linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_REL, rel, -1);
17 nsHtml5String href = nsHtml5Portability::newStringFromLiteral(
18 "resource://content-accessible/plaintext.css");
19 linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_HREF, href, -1);
20 return linkAttrs;
23 // static
24 nsHtml5HtmlAttributes* nsHtml5PlainTextUtils::NewBodyAttributes() {
25 if (mozilla::StaticPrefs::plain_text_wrap_long_lines()) {
26 return nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES;
28 nsHtml5HtmlAttributes* bodyAttrs = new nsHtml5HtmlAttributes(0);
29 RefPtr<nsAtom> nowrap = nsGkAtoms::nowrap;
30 bodyAttrs->addAttribute(nsHtml5AttributeName::ATTR_CLASS,
31 nsHtml5String::FromAtom(nowrap.forget()), -1);
32 return bodyAttrs;