Bug 849422 Allow plain text document word-wrap to be turned on after the fact r=bz

This commit is contained in:
Neil Rashbrook 2013-03-13 19:56:24 +00:00
parent 674e5773f6
commit 239e82c1fa
2 changed files with 7 additions and 7 deletions

View File

@ -7,13 +7,16 @@
#include "nsHtml5AttributeName.h"
#include "nsIServiceManager.h"
#include "nsIStringBundle.h"
#include "mozilla/Preferences.h"
// static
nsHtml5HtmlAttributes*
nsHtml5PlainTextUtils::NewLinkAttributes()
{
nsHtml5HtmlAttributes* linkAttrs = new nsHtml5HtmlAttributes(0);
nsString* rel = new nsString(NS_LITERAL_STRING("stylesheet"));
nsString* rel = mozilla::Preferences::GetBool("plain_text.wrap_long_lines") ?
new nsString(NS_LITERAL_STRING("stylesheet")) :
new nsString(NS_LITERAL_STRING("alternate stylesheet"));
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_REL, rel);
nsString* type = new nsString(NS_LITERAL_STRING("text/css"));
linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_TYPE, type);

View File

@ -12,7 +12,6 @@
#include "nsNodeUtils.h"
#include "nsIFrame.h"
#include "mozilla/Likely.h"
#include "mozilla/Preferences.h"
class nsPresContext;
@ -729,11 +728,9 @@ nsHtml5TreeBuilder::StartPlainTextViewSource(const nsAutoString& aTitle)
void
nsHtml5TreeBuilder::StartPlainText()
{
if (mozilla::Preferences::GetBool("plain_text.wrap_long_lines", true)) {
startTag(nsHtml5ElementName::ELT_LINK,
nsHtml5PlainTextUtils::NewLinkAttributes(),
false);
}
startTag(nsHtml5ElementName::ELT_LINK,
nsHtml5PlainTextUtils::NewLinkAttributes(),
false);
StartPlainTextBody();
}