2013-03-07 08:45:08 +04:00
|
|
|
/* 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"
|
2017-03-20 15:45:15 +03:00
|
|
|
#include "nsHtml5Portability.h"
|
2018-03-16 18:26:06 +03:00
|
|
|
#include "nsHtml5String.h"
|
2019-07-11 21:49:50 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2019-07-26 04:10:23 +03:00
|
|
|
#include "mozilla/StaticPrefs_plain_text.h"
|
2013-03-07 08:45:08 +04:00
|
|
|
|
|
|
|
// static
|
|
|
|
nsHtml5HtmlAttributes* nsHtml5PlainTextUtils::NewLinkAttributes() {
|
|
|
|
nsHtml5HtmlAttributes* linkAttrs = new nsHtml5HtmlAttributes(0);
|
2019-05-24 14:26:01 +03:00
|
|
|
nsHtml5String rel = nsHtml5Portability::newStringFromLiteral("stylesheet");
|
2016-09-20 17:31:57 +03:00
|
|
|
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_REL, rel, -1);
|
2017-03-20 15:45:15 +03:00
|
|
|
nsHtml5String href = nsHtml5Portability::newStringFromLiteral(
|
2017-08-31 12:06:22 +03:00
|
|
|
"resource://content-accessible/plaintext.css");
|
2016-09-20 17:31:57 +03:00
|
|
|
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_HREF, href, -1);
|
2013-03-07 08:45:08 +04:00
|
|
|
return linkAttrs;
|
|
|
|
}
|
2019-07-11 21:49:50 +03:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|