From 239e82c1fa107c7de98e646667d43b65a6b93d91 Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Wed, 13 Mar 2013 19:56:24 +0000 Subject: [PATCH] Bug 849422 Allow plain text document word-wrap to be turned on after the fact r=bz --- parser/html/nsHtml5PlainTextUtils.cpp | 5 ++++- parser/html/nsHtml5TreeBuilderCppSupplement.h | 9 +++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/parser/html/nsHtml5PlainTextUtils.cpp b/parser/html/nsHtml5PlainTextUtils.cpp index aac833bb870d..70e190fa706f 100644 --- a/parser/html/nsHtml5PlainTextUtils.cpp +++ b/parser/html/nsHtml5PlainTextUtils.cpp @@ -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); diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h index cbcb32823c79..87ed4ca95ee8 100644 --- a/parser/html/nsHtml5TreeBuilderCppSupplement.h +++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h @@ -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(); }