gecko-dev/parser/html/nsHtml5PlainTextUtils.cpp
Nicholas Nethercote 18fae65f38 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

Differential Revision: https://phabricator.services.mozilla.com/D39138

--HG--
extra : moz-landing-system : lando
2019-07-26 01:10:23 +00:00

34 lines
1.3 KiB
C++

/* 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 "nsHtml5PlainTextUtils.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5Portability.h"
#include "nsHtml5String.h"
#include "nsGkAtoms.h"
#include "mozilla/StaticPrefs_plain_text.h"
// static
nsHtml5HtmlAttributes* nsHtml5PlainTextUtils::NewLinkAttributes() {
nsHtml5HtmlAttributes* linkAttrs = new nsHtml5HtmlAttributes(0);
nsHtml5String rel = nsHtml5Portability::newStringFromLiteral("stylesheet");
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_REL, rel, -1);
nsHtml5String href = nsHtml5Portability::newStringFromLiteral(
"resource://content-accessible/plaintext.css");
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_HREF, href, -1);
return linkAttrs;
}
// static
nsHtml5HtmlAttributes* nsHtml5PlainTextUtils::NewBodyAttributes() {
if (mozilla::StaticPrefs::plain_text_wrap_long_lines()) {
return nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES;
}
nsHtml5HtmlAttributes* bodyAttrs = new nsHtml5HtmlAttributes(0);
RefPtr<nsAtom> nowrap = nsGkAtoms::nowrap;
bodyAttrs->addAttribute(nsHtml5AttributeName::ATTR_CLASS,
nsHtml5String::FromAtom(nowrap.forget()), -1);
return bodyAttrs;
}