Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | |
michael@0 | 6 | #include "nsHtml5PlainTextUtils.h" |
michael@0 | 7 | #include "nsHtml5AttributeName.h" |
michael@0 | 8 | #include "nsIServiceManager.h" |
michael@0 | 9 | #include "nsIStringBundle.h" |
michael@0 | 10 | #include "mozilla/Preferences.h" |
michael@0 | 11 | |
michael@0 | 12 | // static |
michael@0 | 13 | nsHtml5HtmlAttributes* |
michael@0 | 14 | nsHtml5PlainTextUtils::NewLinkAttributes() |
michael@0 | 15 | { |
michael@0 | 16 | nsHtml5HtmlAttributes* linkAttrs = new nsHtml5HtmlAttributes(0); |
michael@0 | 17 | nsString* rel = new nsString(NS_LITERAL_STRING("alternate stylesheet")); |
michael@0 | 18 | linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_REL, rel); |
michael@0 | 19 | nsString* type = new nsString(NS_LITERAL_STRING("text/css")); |
michael@0 | 20 | linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_TYPE, type); |
michael@0 | 21 | nsString* href = new nsString( |
michael@0 | 22 | NS_LITERAL_STRING("resource://gre-resources/plaintext.css")); |
michael@0 | 23 | linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_HREF, href); |
michael@0 | 24 | |
michael@0 | 25 | nsresult rv; |
michael@0 | 26 | nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); |
michael@0 | 27 | NS_ASSERTION(NS_SUCCEEDED(rv) && bundleService, "The bundle service could not be loaded"); |
michael@0 | 28 | nsCOMPtr<nsIStringBundle> bundle; |
michael@0 | 29 | rv = bundleService->CreateBundle("chrome://global/locale/browser.properties", |
michael@0 | 30 | getter_AddRefs(bundle)); |
michael@0 | 31 | NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/browser.properties could not be loaded"); |
michael@0 | 32 | nsXPIDLString title; |
michael@0 | 33 | if (bundle) { |
michael@0 | 34 | bundle->GetStringFromName(MOZ_UTF16("plainText.wordWrap"), getter_Copies(title)); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | nsString* titleCopy = new nsString(title); |
michael@0 | 38 | linkAttrs->addAttribute(nsHtml5AttributeName::ATTR_TITLE, titleCopy); |
michael@0 | 39 | return linkAttrs; |
michael@0 | 40 | } |