зеркало из https://github.com/mozilla/pjs.git
Bug 660401 temporary backout the patches for bug 659820 and bug 659821 for investigating talos regression
This commit is contained in:
Родитель
3ee96d1e42
Коммит
1d5d965767
|
@ -561,6 +561,9 @@ public:
|
||||||
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
|
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
|
||||||
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
|
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
|
||||||
|
|
||||||
|
static nsAdoptingCString GetCharPref(const char *aPref);
|
||||||
|
static nsAdoptingString GetLocalizedStringPref(const char *aPref);
|
||||||
|
static nsAdoptingString GetStringPref(const char *aPref);
|
||||||
static void RegisterPrefCallback(const char *aPref,
|
static void RegisterPrefCallback(const char *aPref,
|
||||||
PrefChangedFunc aCallback,
|
PrefChangedFunc aCallback,
|
||||||
void * aClosure);
|
void * aClosure);
|
||||||
|
|
|
@ -2582,6 +2582,55 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
|
||||||
return aContent->IsLink(getter_AddRefs(absURI));
|
return aContent->IsLink(getter_AddRefs(absURI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsAdoptingCString
|
||||||
|
nsContentUtils::GetCharPref(const char *aPref)
|
||||||
|
{
|
||||||
|
nsAdoptingCString result;
|
||||||
|
|
||||||
|
if (sPrefBranch) {
|
||||||
|
sPrefBranch->GetCharPref(aPref, getter_Copies(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsAdoptingString
|
||||||
|
nsContentUtils::GetLocalizedStringPref(const char *aPref)
|
||||||
|
{
|
||||||
|
nsAdoptingString result;
|
||||||
|
|
||||||
|
if (sPrefBranch) {
|
||||||
|
nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
|
||||||
|
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsIPrefLocalizedString),
|
||||||
|
getter_AddRefs(prefLocalString));
|
||||||
|
if (prefLocalString) {
|
||||||
|
prefLocalString->GetData(getter_Copies(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsAdoptingString
|
||||||
|
nsContentUtils::GetStringPref(const char *aPref)
|
||||||
|
{
|
||||||
|
nsAdoptingString result;
|
||||||
|
|
||||||
|
if (sPrefBranch) {
|
||||||
|
nsCOMPtr<nsISupportsString> theString;
|
||||||
|
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsISupportsString),
|
||||||
|
getter_AddRefs(theString));
|
||||||
|
if (theString) {
|
||||||
|
theString->ToString(getter_Copies(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterPrefCallback/UnregisterPrefCallback are for backward compatiblity
|
// RegisterPrefCallback/UnregisterPrefCallback are for backward compatiblity
|
||||||
// with c-style observers.
|
// with c-style observers.
|
||||||
|
|
||||||
|
@ -4411,7 +4460,7 @@ nsContentUtils::GetLocalizedEllipsis()
|
||||||
{
|
{
|
||||||
static PRUnichar sBuf[4] = { 0, 0, 0, 0 };
|
static PRUnichar sBuf[4] = { 0, 0, 0, 0 };
|
||||||
if (!sBuf[0]) {
|
if (!sBuf[0]) {
|
||||||
nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis");
|
nsAutoString tmp(GetLocalizedStringPref("intl.ellipsis"));
|
||||||
PRUint32 len = NS_MIN(PRUint32(tmp.Length()),
|
PRUint32 len = NS_MIN(PRUint32(tmp.Length()),
|
||||||
PRUint32(NS_ARRAY_LENGTH(sBuf) - 1));
|
PRUint32(NS_ARRAY_LENGTH(sBuf) - 1));
|
||||||
CopyUnicodeTo(tmp, 0, sBuf, len);
|
CopyUnicodeTo(tmp, 0, sBuf, len);
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
#include "nsStringStream.h"
|
#include "nsStringStream.h"
|
||||||
#include "CheckedInt.h"
|
#include "CheckedInt.h"
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#include "plbase64.h"
|
#include "plbase64.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
|
@ -500,12 +499,12 @@ nsDOMFile::GuessCharset(nsIInputStream *aStream,
|
||||||
"universal_charset_detector");
|
"universal_charset_detector");
|
||||||
if (!detector) {
|
if (!detector) {
|
||||||
// No universal charset detector, try the default charset detector
|
// No universal charset detector, try the default charset detector
|
||||||
const nsAdoptingCString& detectorName =
|
const nsAdoptingString& detectorName =
|
||||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
|
||||||
if (!detectorName.IsEmpty()) {
|
if (!detectorName.IsEmpty()) {
|
||||||
nsCAutoString detectorContractID;
|
nsCAutoString detectorContractID;
|
||||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||||
detectorContractID += detectorName;
|
AppendUTF16toUTF8(detectorName, detectorContractID);
|
||||||
detector = do_CreateInstance(detectorContractID.get());
|
detector = do_CreateInstance(detectorContractID.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,6 @@
|
||||||
#include "nsLayoutStatics.h"
|
#include "nsLayoutStatics.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsFileDataProtocolHandler.h"
|
#include "nsFileDataProtocolHandler.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#define LOAD_STR "load"
|
#define LOAD_STR "load"
|
||||||
#define ERROR_STR "error"
|
#define ERROR_STR "error"
|
||||||
|
@ -687,12 +684,12 @@ nsDOMFileReader::GuessCharset(const char *aFileData,
|
||||||
"universal_charset_detector");
|
"universal_charset_detector");
|
||||||
if (!detector) {
|
if (!detector) {
|
||||||
// No universal charset detector, try the default charset detector
|
// No universal charset detector, try the default charset detector
|
||||||
const nsAdoptingCString& detectorName =
|
const nsAdoptingString& detectorName =
|
||||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
|
||||||
if (!detectorName.IsEmpty()) {
|
if (!detectorName.IsEmpty()) {
|
||||||
nsCAutoString detectorContractID;
|
nsCAutoString detectorContractID;
|
||||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||||
detectorContractID += detectorName;
|
AppendUTF16toUTF8(detectorName, detectorContractID);
|
||||||
detector = do_CreateInstance(detectorContractID.get());
|
detector = do_CreateInstance(detectorContractID.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,6 @@
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
#include "nsDOMPopStateEvent.h"
|
#include "nsDOMPopStateEvent.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
static const char* const sEventNames[] = {
|
static const char* const sEventNames[] = {
|
||||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||||
|
@ -1091,7 +1088,8 @@ nsDOMEvent::PopupAllowedEventsChanged()
|
||||||
nsMemory::Free(sPopupAllowedEvents);
|
nsMemory::Free(sPopupAllowedEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAdoptingCString str = Preferences::GetCString("dom.popup_allowed_events");
|
nsAdoptingCString str =
|
||||||
|
nsContentUtils::GetCharPref("dom.popup_allowed_events");
|
||||||
|
|
||||||
// We'll want to do this even if str is empty to avoid looking up
|
// We'll want to do this even if str is empty to avoid looking up
|
||||||
// this pref all the time if it's not set.
|
// this pref all the time if it's not set.
|
||||||
|
|
|
@ -143,9 +143,7 @@
|
||||||
#include "nsHtml5Module.h"
|
#include "nsHtml5Module.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
|
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
|
||||||
|
@ -186,13 +184,14 @@ static PRBool ConvertToMidasInternalCommand(const nsAString & inCommandID,
|
||||||
static int
|
static int
|
||||||
MyPrefChangedCallback(const char*aPrefName, void* instance_data)
|
MyPrefChangedCallback(const char*aPrefName, void* instance_data)
|
||||||
{
|
{
|
||||||
const nsAdoptingCString& detector_name =
|
const nsAdoptingString& detector_name =
|
||||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
|
||||||
|
|
||||||
if (!detector_name.IsEmpty()) {
|
if (detector_name.Length() > 0) {
|
||||||
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
|
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
|
||||||
DETECTOR_CONTRACTID_MAX);
|
DETECTOR_CONTRACTID_MAX);
|
||||||
PL_strncat(g_detector_contractid, detector_name,
|
PL_strncat(g_detector_contractid,
|
||||||
|
NS_ConvertUTF16toUTF8(detector_name).get(),
|
||||||
DETECTOR_CONTRACTID_MAX);
|
DETECTOR_CONTRACTID_MAX);
|
||||||
gPlugDetector = PR_TRUE;
|
gPlugDetector = PR_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -543,11 +542,11 @@ nsHTMLDocument::UseWeakDocTypeDefault(PRInt32& aCharsetSource,
|
||||||
// fallback value in case docshell return error
|
// fallback value in case docshell return error
|
||||||
aCharset.AssignLiteral("ISO-8859-1");
|
aCharset.AssignLiteral("ISO-8859-1");
|
||||||
|
|
||||||
const nsAdoptingCString& defCharset =
|
const nsAdoptingString& defCharset =
|
||||||
Preferences::GetLocalizedCString("intl.charset.default");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.default");
|
||||||
|
|
||||||
if (!defCharset.IsEmpty()) {
|
if (!defCharset.IsEmpty()) {
|
||||||
aCharset = defCharset;
|
LossyCopyUTF16toASCII(defCharset, aCharset);
|
||||||
aCharsetSource = kCharsetFromWeakDocTypeDefault;
|
aCharsetSource = kCharsetFromWeakDocTypeDefault;
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
@ -589,13 +588,14 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsACString& aCharset,
|
||||||
|
|
||||||
nsresult rv_detect;
|
nsresult rv_detect;
|
||||||
if(!gInitDetector) {
|
if(!gInitDetector) {
|
||||||
const nsAdoptingCString& detector_name =
|
const nsAdoptingString& detector_name =
|
||||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
|
||||||
|
|
||||||
if(!detector_name.IsEmpty()) {
|
if(!detector_name.IsEmpty()) {
|
||||||
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
|
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
|
||||||
DETECTOR_CONTRACTID_MAX);
|
DETECTOR_CONTRACTID_MAX);
|
||||||
PL_strncat(g_detector_contractid, detector_name,
|
PL_strncat(g_detector_contractid,
|
||||||
|
NS_ConvertUTF16toUTF8(detector_name).get(),
|
||||||
DETECTOR_CONTRACTID_MAX);
|
DETECTOR_CONTRACTID_MAX);
|
||||||
gPlugDetector = PR_TRUE;
|
gPlugDetector = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
#define SA_PER_STREAM_VOLUME 1
|
#define SA_PER_STREAM_VOLUME 1
|
||||||
|
@ -324,7 +321,8 @@ static mozilla::Mutex* gVolumeScaleLock = nsnull;
|
||||||
static double gVolumeScale = 1.0;
|
static double gVolumeScale = 1.0;
|
||||||
|
|
||||||
static int VolumeScaleChanged(const char* aPref, void *aClosure) {
|
static int VolumeScaleChanged(const char* aPref, void *aClosure) {
|
||||||
nsAdoptingString value = Preferences::GetString("media.volume_scale");
|
nsAdoptingString value =
|
||||||
|
nsContentUtils::GetStringPref("media.volume_scale");
|
||||||
mozilla::MutexAutoLock lock(*gVolumeScaleLock);
|
mozilla::MutexAutoLock lock(*gVolumeScaleLock);
|
||||||
if (value.IsEmpty()) {
|
if (value.IsEmpty()) {
|
||||||
gVolumeScale = 1.0;
|
gVolumeScale = 1.0;
|
||||||
|
|
|
@ -56,9 +56,6 @@
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
/*static*/ PRBool
|
/*static*/ PRBool
|
||||||
nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
|
nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
|
||||||
|
@ -242,7 +239,7 @@ nsSVGFeatures::PassesConditionalProcessingTests(nsIContent *aContent,
|
||||||
value)) {
|
value)) {
|
||||||
|
|
||||||
const nsAutoString acceptLangs(aAcceptLangs ? *aAcceptLangs :
|
const nsAutoString acceptLangs(aAcceptLangs ? *aAcceptLangs :
|
||||||
Preferences::GetLocalizedString("intl.accept_languages"));
|
nsContentUtils::GetLocalizedStringPref("intl.accept_languages"));
|
||||||
|
|
||||||
// Get our language preferences
|
// Get our language preferences
|
||||||
if (!acceptLangs.IsEmpty()) {
|
if (!acceptLangs.IsEmpty()) {
|
||||||
|
|
|
@ -39,9 +39,6 @@
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsISVGChildFrame.h"
|
#include "nsISVGChildFrame.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// implementation
|
// implementation
|
||||||
|
@ -165,7 +162,7 @@ nsSVGSwitchElement::FindActiveChild() const
|
||||||
nsGkAtoms::yes, eCaseMatters);
|
nsGkAtoms::yes, eCaseMatters);
|
||||||
|
|
||||||
const nsAdoptingString& acceptLangs =
|
const nsAdoptingString& acceptLangs =
|
||||||
Preferences::GetLocalizedString("intl.accept_languages");
|
nsContentUtils::GetLocalizedStringPref("intl.accept_languages");
|
||||||
|
|
||||||
PRUint32 count = GetChildCount();
|
PRUint32 count = GetChildCount();
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,6 @@
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsGUIEvent.h"
|
#include "nsGUIEvent.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
static nsINativeKeyBindings *sNativeEditorBindings = nsnull;
|
static nsINativeKeyBindings *sNativeEditorBindings = nsnull;
|
||||||
|
|
||||||
|
@ -127,7 +124,7 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
|
||||||
getter_AddRefs(mHTMLBindings));
|
getter_AddRefs(mHTMLBindings));
|
||||||
|
|
||||||
const nsAdoptingCString& userHTMLBindingStr =
|
const nsAdoptingCString& userHTMLBindingStr =
|
||||||
Preferences::GetCString("dom.userHTMLBindings.uri");
|
nsContentUtils::GetCharPref("dom.userHTMLBindings.uri");
|
||||||
if (!userHTMLBindingStr.IsEmpty()) {
|
if (!userHTMLBindingStr.IsEmpty()) {
|
||||||
NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
|
NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
|
||||||
if (!bindingURI) {
|
if (!bindingURI) {
|
||||||
|
|
|
@ -921,7 +921,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||||
|
|
||||||
if (gDumpFile == nsnull) {
|
if (gDumpFile == nsnull) {
|
||||||
const nsAdoptingCString& fname =
|
const nsAdoptingCString& fname =
|
||||||
Preferences::GetCString("browser.dom.window.dump.file");
|
nsContentUtils::GetCharPref("browser.dom.window.dump.file");
|
||||||
if (!fname.IsEmpty()) {
|
if (!fname.IsEmpty()) {
|
||||||
// if this fails to open, Dump() knows to just go to stdout
|
// if this fails to open, Dump() knows to just go to stdout
|
||||||
// on null.
|
// on null.
|
||||||
|
@ -5007,7 +5007,7 @@ nsGlobalWindow::Home()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsAdoptingString homeURL =
|
nsAdoptingString homeURL =
|
||||||
Preferences::GetLocalizedString(PREF_BROWSER_STARTUP_HOMEPAGE);
|
nsContentUtils::GetLocalizedStringPref(PREF_BROWSER_STARTUP_HOMEPAGE);
|
||||||
|
|
||||||
if (homeURL.IsEmpty()) {
|
if (homeURL.IsEmpty()) {
|
||||||
// if all else fails, use this
|
// if all else fails, use this
|
||||||
|
@ -10547,11 +10547,11 @@ nsresult
|
||||||
NS_GetNavigatorPlatform(nsAString& aPlatform)
|
NS_GetNavigatorPlatform(nsAString& aPlatform)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.platform.override");
|
nsContentUtils::GetCharPref("general.platform.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aPlatform = override;
|
CopyUTF8toUTF16(override, aPlatform);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10591,11 +10591,11 @@ nsresult
|
||||||
NS_GetNavigatorAppVersion(nsAString& aAppVersion)
|
NS_GetNavigatorAppVersion(nsAString& aAppVersion)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.appversion.override");
|
nsContentUtils::GetCharPref("general.appversion.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aAppVersion = override;
|
CopyUTF8toUTF16(override, aAppVersion);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10628,11 +10628,11 @@ nsresult
|
||||||
NS_GetNavigatorAppName(nsAString& aAppName)
|
NS_GetNavigatorAppName(nsAString& aAppName)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.appname.override");
|
nsContentUtils::GetCharPref("general.appname.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aAppName = override;
|
CopyUTF8toUTF16(override, aAppName);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10691,7 +10691,7 @@ nsNavigator::GetLanguage(nsAString& aLanguage)
|
||||||
{
|
{
|
||||||
// e.g. "de-de, en-us,en"
|
// e.g. "de-de, en-us,en"
|
||||||
const nsAdoptingString& acceptLang =
|
const nsAdoptingString& acceptLang =
|
||||||
Preferences::GetLocalizedString("intl.accept_languages");
|
nsContentUtils::GetLocalizedStringPref("intl.accept_languages");
|
||||||
// take everything before the first "," or ";", without trailing space
|
// take everything before the first "," or ";", without trailing space
|
||||||
nsCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
nsCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
||||||
const nsSubstring &firstLangPart = langTokenizer.nextToken();
|
const nsSubstring &firstLangPart = langTokenizer.nextToken();
|
||||||
|
@ -10736,11 +10736,11 @@ NS_IMETHODIMP
|
||||||
nsNavigator::GetOscpu(nsAString& aOSCPU)
|
nsNavigator::GetOscpu(nsAString& aOSCPU)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.oscpu.override");
|
nsContentUtils::GetCharPref("general.oscpu.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aOSCPU = override;
|
CopyUTF8toUTF16(override, aOSCPU);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10791,23 +10791,23 @@ NS_IMETHODIMP
|
||||||
nsNavigator::GetProductSub(nsAString& aProductSub)
|
nsNavigator::GetProductSub(nsAString& aProductSub)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.productSub.override");
|
nsContentUtils::GetCharPref("general.productSub.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aProductSub = override;
|
CopyUTF8toUTF16(override, aProductSub);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
|
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
|
||||||
const nsAdoptingString& override2 =
|
const nsAdoptingCString& override2 =
|
||||||
Preferences::GetString("general.useragent.productSub");
|
nsContentUtils::GetCharPref("general.useragent.productSub");
|
||||||
|
|
||||||
if (override2) {
|
if (override2) {
|
||||||
aProductSub = override2;
|
CopyUTF8toUTF16(override2, aProductSub);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIHttpProtocolHandler>
|
nsCOMPtr<nsIHttpProtocolHandler>
|
||||||
|
@ -10878,11 +10878,11 @@ NS_IMETHODIMP
|
||||||
nsNavigator::GetBuildID(nsAString& aBuildID)
|
nsNavigator::GetBuildID(nsAString& aBuildID)
|
||||||
{
|
{
|
||||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||||
const nsAdoptingString& override =
|
const nsAdoptingCString& override =
|
||||||
Preferences::GetString("general.buildID.override");
|
nsContentUtils::GetCharPref("general.buildID.override");
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
aBuildID = override;
|
CopyUTF8toUTF16(override, aBuildID);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,6 @@
|
||||||
#include "nsLayoutCID.h"
|
#include "nsLayoutCID.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsLayoutStylesheetCache.h"
|
#include "nsLayoutStylesheetCache.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#include "nsViewsCID.h"
|
#include "nsViewsCID.h"
|
||||||
#include "nsIDeviceContextSpec.h"
|
#include "nsIDeviceContextSpec.h"
|
||||||
|
@ -196,8 +195,6 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset
|
||||||
//switch to page layout
|
//switch to page layout
|
||||||
#include "nsGfxCIID.h"
|
#include "nsGfxCIID.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
|
|
||||||
#undef NOISY_VIEWER
|
#undef NOISY_VIEWER
|
||||||
|
@ -2995,15 +2992,14 @@ DocumentViewerImpl::GetDefaultCharacterSet(nsACString& aDefaultCharacterSet)
|
||||||
{
|
{
|
||||||
if (mDefaultCharacterSet.IsEmpty())
|
if (mDefaultCharacterSet.IsEmpty())
|
||||||
{
|
{
|
||||||
const nsAdoptingCString& defCharset =
|
const nsAdoptingString& defCharset =
|
||||||
Preferences::GetLocalizedCString("intl.charset.default");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.default");
|
||||||
|
|
||||||
if (!defCharset.IsEmpty()) {
|
if (!defCharset.IsEmpty())
|
||||||
mDefaultCharacterSet = defCharset;
|
LossyCopyUTF16toASCII(defCharset, mDefaultCharacterSet);
|
||||||
} else {
|
else
|
||||||
mDefaultCharacterSet.AssignLiteral("ISO-8859-1");
|
mDefaultCharacterSet.AssignLiteral("ISO-8859-1");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
aDefaultCharacterSet = mDefaultCharacterSet;
|
aDefaultCharacterSet = mDefaultCharacterSet;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,14 +125,14 @@ using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
static nscolor
|
static nscolor
|
||||||
MakeColorPref(const nsCString& aColor)
|
MakeColorPref(const char *colstr)
|
||||||
{
|
{
|
||||||
PRUint32 red, green, blue;
|
PRUint32 red, green, blue;
|
||||||
nscolor colorref;
|
nscolor colorref;
|
||||||
|
|
||||||
// 4.x stored RGB color values as a string rather than as an int,
|
// 4.x stored RGB color values as a string rather than as an int,
|
||||||
// thus we need to do this conversion
|
// thus we need to do this conversion
|
||||||
PR_sscanf(aColor.get(), "#%02x%02x%02x", &red, &green, &blue);
|
PR_sscanf(colstr, "#%02x%02x%02x", &red, &green, &blue);
|
||||||
colorref = NS_RGB(red, green, blue);
|
colorref = NS_RGB(red, green, blue);
|
||||||
return colorref;
|
return colorref;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ nsPresContext::GetFontPreferences()
|
||||||
PRInt32 unit = eUnit_px;
|
PRInt32 unit = eUnit_px;
|
||||||
|
|
||||||
nsAdoptingCString cvalue =
|
nsAdoptingCString cvalue =
|
||||||
Preferences::GetCString("font.size.unit");
|
nsContentUtils::GetCharPref("font.size.unit");
|
||||||
|
|
||||||
if (!cvalue.IsEmpty()) {
|
if (!cvalue.IsEmpty()) {
|
||||||
if (cvalue.Equals("px")) {
|
if (cvalue.Equals("px")) {
|
||||||
|
@ -521,13 +521,14 @@ nsPresContext::GetFontPreferences()
|
||||||
if (eType == eDefaultFont_Variable) {
|
if (eType == eDefaultFont_Variable) {
|
||||||
MAKE_FONT_PREF_KEY(pref, "font.name", generic_dot_langGroup);
|
MAKE_FONT_PREF_KEY(pref, "font.name", generic_dot_langGroup);
|
||||||
|
|
||||||
nsAdoptingString value = Preferences::GetString(pref.get());
|
nsAdoptingString value =
|
||||||
|
nsContentUtils::GetStringPref(pref.get());
|
||||||
if (!value.IsEmpty()) {
|
if (!value.IsEmpty()) {
|
||||||
font->name.Assign(value);
|
font->name.Assign(value);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);
|
MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);
|
||||||
value = Preferences::GetString(pref.get());
|
value = nsContentUtils::GetStringPref(pref.get());
|
||||||
if (!value.IsEmpty()) {
|
if (!value.IsEmpty()) {
|
||||||
mDefaultVariableFont.name.Assign(value);
|
mDefaultVariableFont.name.Assign(value);
|
||||||
}
|
}
|
||||||
|
@ -569,7 +570,7 @@ nsPresContext::GetFontPreferences()
|
||||||
// get font.size-adjust.[generic].[langGroup]
|
// get font.size-adjust.[generic].[langGroup]
|
||||||
// XXX only applicable on GFX ports that handle |font-size-adjust|
|
// XXX only applicable on GFX ports that handle |font-size-adjust|
|
||||||
MAKE_FONT_PREF_KEY(pref, "font.size-adjust", generic_dot_langGroup);
|
MAKE_FONT_PREF_KEY(pref, "font.size-adjust", generic_dot_langGroup);
|
||||||
cvalue = Preferences::GetCString(pref.get());
|
cvalue = nsContentUtils::GetCharPref(pref.get());
|
||||||
if (!cvalue.IsEmpty()) {
|
if (!cvalue.IsEmpty()) {
|
||||||
font->sizeAdjust = (float)atof(cvalue.get());
|
font->sizeAdjust = (float)atof(cvalue.get());
|
||||||
}
|
}
|
||||||
|
@ -608,13 +609,14 @@ nsPresContext::GetDocumentColorPreferences()
|
||||||
|
|
||||||
if (usePrefColors) {
|
if (usePrefColors) {
|
||||||
nsAdoptingCString colorStr =
|
nsAdoptingCString colorStr =
|
||||||
Preferences::GetCString("browser.display.foreground_color");
|
nsContentUtils::GetCharPref("browser.display.foreground_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mDefaultColor = MakeColorPref(colorStr);
|
mDefaultColor = MakeColorPref(colorStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
colorStr = Preferences::GetCString("browser.display.background_color");
|
colorStr =
|
||||||
|
nsContentUtils::GetCharPref("browser.display.background_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mBackgroundColor = MakeColorPref(colorStr);
|
mBackgroundColor = MakeColorPref(colorStr);
|
||||||
|
@ -666,19 +668,21 @@ nsPresContext::GetUserPreferences()
|
||||||
mUnderlineLinks =
|
mUnderlineLinks =
|
||||||
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
|
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
|
||||||
|
|
||||||
nsAdoptingCString colorStr = Preferences::GetCString("browser.anchor_color");
|
nsAdoptingCString colorStr =
|
||||||
|
nsContentUtils::GetCharPref("browser.anchor_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mLinkColor = MakeColorPref(colorStr);
|
mLinkColor = MakeColorPref(colorStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
colorStr = Preferences::GetCString("browser.active_color");
|
colorStr =
|
||||||
|
nsContentUtils::GetCharPref("browser.active_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mActiveLinkColor = MakeColorPref(colorStr);
|
mActiveLinkColor = MakeColorPref(colorStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
colorStr = Preferences::GetCString("browser.visited_color");
|
colorStr = nsContentUtils::GetCharPref("browser.visited_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mVisitedLinkColor = MakeColorPref(colorStr);
|
mVisitedLinkColor = MakeColorPref(colorStr);
|
||||||
|
@ -690,13 +694,14 @@ nsPresContext::GetUserPreferences()
|
||||||
mFocusTextColor = mDefaultColor;
|
mFocusTextColor = mDefaultColor;
|
||||||
mFocusBackgroundColor = mBackgroundColor;
|
mFocusBackgroundColor = mBackgroundColor;
|
||||||
|
|
||||||
colorStr = Preferences::GetCString("browser.display.focus_text_color");
|
colorStr = nsContentUtils::GetCharPref("browser.display.focus_text_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mFocusTextColor = MakeColorPref(colorStr);
|
mFocusTextColor = MakeColorPref(colorStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
colorStr = Preferences::GetCString("browser.display.focus_background_color");
|
colorStr =
|
||||||
|
nsContentUtils::GetCharPref("browser.display.focus_background_color");
|
||||||
|
|
||||||
if (!colorStr.IsEmpty()) {
|
if (!colorStr.IsEmpty()) {
|
||||||
mFocusBackgroundColor = MakeColorPref(colorStr);
|
mFocusBackgroundColor = MakeColorPref(colorStr);
|
||||||
|
@ -725,7 +730,7 @@ nsPresContext::GetUserPreferences()
|
||||||
|
|
||||||
// * image animation
|
// * image animation
|
||||||
const nsAdoptingCString& animatePref =
|
const nsAdoptingCString& animatePref =
|
||||||
Preferences::GetCString("image.animation_mode");
|
nsContentUtils::GetCharPref("image.animation_mode");
|
||||||
if (animatePref.Equals("normal"))
|
if (animatePref.Equals("normal"))
|
||||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||||
else if (animatePref.Equals("none"))
|
else if (animatePref.Equals("none"))
|
||||||
|
|
|
@ -4052,7 +4052,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||||
|
|
||||||
// "plugins.force.wmode" preference is forcing wmode type for plugins
|
// "plugins.force.wmode" preference is forcing wmode type for plugins
|
||||||
// possible values - "opaque", "transparent", "windowed"
|
// possible values - "opaque", "transparent", "windowed"
|
||||||
nsAdoptingCString wmodeType = Preferences::GetCString("plugins.force.wmode");
|
nsAdoptingCString wmodeType = nsContentUtils::GetCharPref("plugins.force.wmode");
|
||||||
if (!wmodeType.IsEmpty()) {
|
if (!wmodeType.IsEmpty()) {
|
||||||
mNumCachedAttrs++;
|
mNumCachedAttrs++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,15 +70,12 @@
|
||||||
#include "nsCSSRendering.h"
|
#include "nsCSSRendering.h"
|
||||||
#include "nsIReflowCallback.h"
|
#include "nsIReflowCallback.h"
|
||||||
#include "nsBoxFrame.h"
|
#include "nsBoxFrame.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
#include "nsBidiUtils.h"
|
#include "nsBidiUtils.h"
|
||||||
#include "nsBidiPresUtils.h"
|
#include "nsBidiPresUtils.h"
|
||||||
#endif // IBMBIDI
|
#endif // IBMBIDI
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#define CROP_LEFT "left"
|
#define CROP_LEFT "left"
|
||||||
#define CROP_RIGHT "right"
|
#define CROP_RIGHT "right"
|
||||||
#define CROP_CENTER "center"
|
#define CROP_CENTER "center"
|
||||||
|
@ -185,7 +182,7 @@ nsTextBoxFrame::AlwaysAppendAccessKey()
|
||||||
gAccessKeyPrefInitialized = PR_TRUE;
|
gAccessKeyPrefInitialized = PR_TRUE;
|
||||||
|
|
||||||
const char* prefName = "intl.menuitems.alwaysappendaccesskeys";
|
const char* prefName = "intl.menuitems.alwaysappendaccesskeys";
|
||||||
nsAdoptingString val = Preferences::GetLocalizedString(prefName);
|
nsAdoptingString val = nsContentUtils::GetLocalizedStringPref(prefName);
|
||||||
gAlwaysAppendAccessKey = val.Equals(NS_LITERAL_STRING("true"));
|
gAlwaysAppendAccessKey = val.Equals(NS_LITERAL_STRING("true"));
|
||||||
}
|
}
|
||||||
return gAlwaysAppendAccessKey;
|
return gAlwaysAppendAccessKey;
|
||||||
|
@ -199,7 +196,7 @@ nsTextBoxFrame::InsertSeparatorBeforeAccessKey()
|
||||||
gInsertSeparatorPrefInitialized = PR_TRUE;
|
gInsertSeparatorPrefInitialized = PR_TRUE;
|
||||||
|
|
||||||
const char* prefName = "intl.menuitems.insertseparatorbeforeaccesskeys";
|
const char* prefName = "intl.menuitems.insertseparatorbeforeaccesskeys";
|
||||||
nsAdoptingString val = Preferences::GetLocalizedString(prefName);
|
nsAdoptingString val = nsContentUtils::GetLocalizedStringPref(prefName);
|
||||||
gInsertSeparatorBeforeAccessKey = val.EqualsLiteral("true");
|
gInsertSeparatorBeforeAccessKey = val.EqualsLiteral("true");
|
||||||
}
|
}
|
||||||
return gInsertSeparatorBeforeAccessKey;
|
return gInsertSeparatorBeforeAccessKey;
|
||||||
|
|
|
@ -54,8 +54,6 @@
|
||||||
class nsIFile;
|
class nsIFile;
|
||||||
class nsCString;
|
class nsCString;
|
||||||
class nsString;
|
class nsString;
|
||||||
class nsAdoptingString;
|
|
||||||
class nsAdoptingCString;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -128,11 +126,6 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsAdoptingCString GetCString(const char* aPref);
|
|
||||||
static nsAdoptingString GetString(const char* aPref);
|
|
||||||
static nsAdoptingCString GetLocalizedCString(const char* aPref);
|
|
||||||
static nsAdoptingString GetLocalizedString(const char* aPref);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets int or bool type pref value with raw return value of nsIPrefBranch.
|
* Gets int or bool type pref value with raw return value of nsIPrefBranch.
|
||||||
*
|
*
|
||||||
|
@ -159,10 +152,9 @@ public:
|
||||||
* @param aResult Must not be NULL. The value is never modified when
|
* @param aResult Must not be NULL. The value is never modified when
|
||||||
* these methods fail.
|
* these methods fail.
|
||||||
*/
|
*/
|
||||||
static nsresult GetCString(const char* aPref, nsACString* aResult);
|
static nsresult GetChar(const char* aPref, nsCString* aResult);
|
||||||
static nsresult GetString(const char* aPref, nsAString* aResult);
|
static nsresult GetChar(const char* aPref, nsString* aResult);
|
||||||
static nsresult GetLocalizedCString(const char* aPref, nsACString* aResult);
|
static nsresult GetLocalizedString(const char* aPref, nsString* aResult);
|
||||||
static nsresult GetLocalizedString(const char* aPref, nsAString* aResult);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets various type pref values.
|
* Sets various type pref values.
|
||||||
|
@ -173,10 +165,10 @@ public:
|
||||||
{
|
{
|
||||||
return SetInt(aPref, static_cast<PRInt32>(aValue));
|
return SetInt(aPref, static_cast<PRInt32>(aValue));
|
||||||
}
|
}
|
||||||
static nsresult SetCString(const char* aPref, const char* aValue);
|
static nsresult SetChar(const char* aPref, const char* aValue);
|
||||||
static nsresult SetCString(const char* aPref, const nsACString &aValue);
|
static nsresult SetChar(const char* aPref, const nsCString &aValue);
|
||||||
static nsresult SetString(const char* aPref, const PRUnichar* aValue);
|
static nsresult SetChar(const char* aPref, const PRUnichar* aValue);
|
||||||
static nsresult SetString(const char* aPref, const nsAString &aValue);
|
static nsresult SetChar(const char* aPref, const nsString &aValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears user set pref.
|
* Clears user set pref.
|
||||||
|
|
|
@ -1019,31 +1019,13 @@ Preferences::GetInt(const char* aPref, PRInt32* aResult)
|
||||||
return sPreferences->mRootBranch->GetIntPref(aPref, aResult);
|
return sPreferences->mRootBranch->GetIntPref(aPref, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
nsAdoptingCString
|
|
||||||
Preferences::GetCString(const char* aPref)
|
|
||||||
{
|
|
||||||
nsAdoptingCString result;
|
|
||||||
GetCString(aPref, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
nsAdoptingString
|
|
||||||
Preferences::GetString(const char* aPref)
|
|
||||||
{
|
|
||||||
nsAdoptingString result;
|
|
||||||
GetString(aPref, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::GetCString(const char* aPref, nsACString* aResult)
|
Preferences::GetChar(const char* aPref, nsCString* aResult)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||||
nsCAutoString result;
|
nsAdoptingCString result;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
sPreferences->mRootBranch->GetCharPref(aPref, getter_Copies(result));
|
sPreferences->mRootBranch->GetCharPref(aPref, getter_Copies(result));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -1054,11 +1036,11 @@ Preferences::GetCString(const char* aPref, nsACString* aResult)
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::GetString(const char* aPref, nsAString* aResult)
|
Preferences::GetChar(const char* aPref, nsString* aResult)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||||
nsCAutoString result;
|
nsAdoptingCString result;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
sPreferences->mRootBranch->GetCharPref(aPref, getter_Copies(result));
|
sPreferences->mRootBranch->GetCharPref(aPref, getter_Copies(result));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -1067,40 +1049,9 @@ Preferences::GetString(const char* aPref, nsAString* aResult)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
nsAdoptingCString
|
|
||||||
Preferences::GetLocalizedCString(const char* aPref)
|
|
||||||
{
|
|
||||||
nsAdoptingCString result;
|
|
||||||
GetLocalizedCString(aPref, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
nsAdoptingString
|
|
||||||
Preferences::GetLocalizedString(const char* aPref)
|
|
||||||
{
|
|
||||||
nsAdoptingString result;
|
|
||||||
GetLocalizedString(aPref, &result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::GetLocalizedCString(const char* aPref, nsACString* aResult)
|
Preferences::GetLocalizedString(const char* aPref, nsString* aResult)
|
||||||
{
|
|
||||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
|
||||||
nsAutoString result;
|
|
||||||
nsresult rv = GetLocalizedString(aPref, &result);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
CopyUTF16toUTF8(result, *aResult);
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
nsresult
|
|
||||||
Preferences::GetLocalizedString(const char* aPref, nsAString* aResult)
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||||
|
@ -1109,15 +1060,18 @@ Preferences::GetLocalizedString(const char* aPref, nsAString* aResult)
|
||||||
NS_GET_IID(nsIPrefLocalizedString),
|
NS_GET_IID(nsIPrefLocalizedString),
|
||||||
getter_AddRefs(prefLocalString));
|
getter_AddRefs(prefLocalString));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
NS_ASSERTION(prefLocalString, "Succeeded but the result is NULL");
|
if (prefLocalString) {
|
||||||
prefLocalString->GetData(getter_Copies(*aResult));
|
prefLocalString->GetData(getter_Copies(*aResult));
|
||||||
|
} else {
|
||||||
|
aResult->Truncate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::SetCString(const char* aPref, const char* aValue)
|
Preferences::SetChar(const char* aPref, const char* aValue)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(InitStaticMembers(), PR_FALSE);
|
NS_ENSURE_TRUE(InitStaticMembers(), PR_FALSE);
|
||||||
return sPreferences->mRootBranch->SetCharPref(aPref, aValue);
|
return sPreferences->mRootBranch->SetCharPref(aPref, aValue);
|
||||||
|
@ -1125,25 +1079,25 @@ Preferences::SetCString(const char* aPref, const char* aValue)
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::SetCString(const char* aPref, const nsACString &aValue)
|
Preferences::SetChar(const char* aPref, const nsCString &aValue)
|
||||||
{
|
{
|
||||||
return SetCString(aPref, PromiseFlatCString(aValue).get());
|
return SetChar(aPref, nsPromiseFlatCString(aValue).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::SetString(const char* aPref, const PRUnichar* aValue)
|
Preferences::SetChar(const char* aPref, const PRUnichar* aValue)
|
||||||
{
|
{
|
||||||
NS_ConvertUTF16toUTF8 utf8(aValue);
|
NS_ConvertUTF16toUTF8 utf8(aValue);
|
||||||
return SetCString(aPref, utf8.get());
|
return SetChar(aPref, utf8.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
Preferences::SetString(const char* aPref, const nsAString &aValue)
|
Preferences::SetChar(const char* aPref, const nsString &aValue)
|
||||||
{
|
{
|
||||||
NS_ConvertUTF16toUTF8 utf8(aValue);
|
NS_ConvertUTF16toUTF8 utf8(aValue);
|
||||||
return SetCString(aPref, utf8.get());
|
return SetChar(aPref, utf8.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -52,9 +52,6 @@
|
||||||
#include "nsHtml5Module.h"
|
#include "nsHtml5Module.h"
|
||||||
#include "nsHtml5RefPtr.h"
|
#include "nsHtml5RefPtr.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
|
static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
|
||||||
|
|
||||||
|
@ -203,12 +200,12 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
|
||||||
// Chardet is initialized here even if it turns out to be useless
|
// Chardet is initialized here even if it turns out to be useless
|
||||||
// to make the chardet refcount its observer (nsHtml5StreamParser)
|
// to make the chardet refcount its observer (nsHtml5StreamParser)
|
||||||
// on the main thread.
|
// on the main thread.
|
||||||
const nsAdoptingCString& detectorName =
|
const nsAdoptingString& detectorName =
|
||||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
|
||||||
if (!detectorName.IsEmpty()) {
|
if (!detectorName.IsEmpty()) {
|
||||||
nsCAutoString detectorContractID;
|
nsCAutoString detectorContractID;
|
||||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||||
detectorContractID += detectorName;
|
AppendUTF16toUTF8(detectorName, detectorContractID);
|
||||||
if ((mChardet = do_CreateInstance(detectorContractID.get()))) {
|
if ((mChardet = do_CreateInstance(detectorContractID.get()))) {
|
||||||
(void) mChardet->Init(this);
|
(void) mChardet->Init(this);
|
||||||
mFeedChardet = PR_TRUE;
|
mFeedChardet = PR_TRUE;
|
||||||
|
|
|
@ -26,10 +26,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "ComplexTextInputPanel.h"
|
#import "ComplexTextInputPanel.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsServiceManagerUtils.h"
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#define kInputWindowHeight 20
|
#define kInputWindowHeight 20
|
||||||
|
|
||||||
|
@ -92,10 +91,12 @@ using namespace mozilla;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sDoCancel < 0) {
|
if (sDoCancel < 0) {
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
NS_ENSURE_TRUE(prefs, );
|
||||||
PRBool cancelComposition = PR_FALSE;
|
PRBool cancelComposition = PR_FALSE;
|
||||||
static const char* kPrefName =
|
nsresult rv =
|
||||||
"ui.plugin.cancel_composition_at_input_source_changed";
|
prefs->GetBoolPref("ui.plugin.cancel_composition_at_input_source_changed",
|
||||||
nsresult rv = Preferences::GetBool(kPrefName, &cancelComposition);
|
&cancelComposition);
|
||||||
NS_ENSURE_SUCCESS(rv, );
|
NS_ENSURE_SUCCESS(rv, );
|
||||||
sDoCancel = cancelComposition ? 1 : 0;
|
sDoCancel = cancelComposition ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,12 +55,15 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsToolkit.h"
|
#include "nsToolkit.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
|
||||||
#include "nsFontMetrics.h"
|
#include "nsFontMetrics.h"
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
#include "nsIRollupListener.h"
|
#include "nsIRollupListener.h"
|
||||||
#include "nsIViewManager.h"
|
#include "nsIViewManager.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsILocalFile.h"
|
#include "nsILocalFile.h"
|
||||||
#include "nsILocalFileMac.h"
|
#include "nsILocalFileMac.h"
|
||||||
#include "nsGfxCIID.h"
|
#include "nsGfxCIID.h"
|
||||||
|
@ -87,8 +90,6 @@
|
||||||
#include "LayerManagerOGL.h"
|
#include "LayerManagerOGL.h"
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
@ -96,7 +97,6 @@
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
using namespace mozilla::gl;
|
using namespace mozilla::gl;
|
||||||
using namespace mozilla::widget;
|
using namespace mozilla::widget;
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#undef DEBUG_IME
|
#undef DEBUG_IME
|
||||||
#undef DEBUG_UPDATE
|
#undef DEBUG_UPDATE
|
||||||
|
@ -2938,7 +2938,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||||
if (!gRollupWidget)
|
if (!gRollupWidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Preferences::GetBool("ui.use_native_popup_windows", PR_FALSE)) {
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
PRBool useNativeContextMenus;
|
||||||
|
nsresult rv = prefs->GetBoolPref("ui.use_native_popup_windows", &useNativeContextMenus);
|
||||||
|
if (NS_SUCCEEDED(rv) && useNativeContextMenus)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3762,8 +3766,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||||
|
|
||||||
float scrollDelta = 0;
|
float scrollDelta = 0;
|
||||||
float scrollDeltaPixels = 0;
|
float scrollDeltaPixels = 0;
|
||||||
PRBool checkPixels =
|
PRBool checkPixels = PR_TRUE;
|
||||||
Preferences::GetBool("mousewheel.enable_pixel_scrolling", PR_TRUE);
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs)
|
||||||
|
prefs->GetBoolPref("mousewheel.enable_pixel_scrolling", &checkPixels);
|
||||||
|
|
||||||
// Calling deviceDeltaX or deviceDeltaY on theEvent will trigger a Cocoa
|
// Calling deviceDeltaX or deviceDeltaY on theEvent will trigger a Cocoa
|
||||||
// assertion and an Objective-C NSInternalInconsistencyException if the
|
// assertion and an Objective-C NSInternalInconsistencyException if the
|
||||||
|
|
|
@ -52,8 +52,11 @@
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "nsIXULWindow.h"
|
#include "nsIXULWindow.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsToolkit.h"
|
#include "nsToolkit.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
|
@ -68,15 +71,12 @@
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "qcms.h"
|
#include "qcms.h"
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
class LayerManager;
|
class LayerManager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
// defined in nsAppShell.mm
|
// defined in nsAppShell.mm
|
||||||
extern nsCocoaAppModalWindowList *gCocoaAppModalWindowList;
|
extern nsCocoaAppModalWindowList *gCocoaAppModalWindowList;
|
||||||
|
@ -227,7 +227,13 @@ static void FitRectToVisibleAreaForScreen(nsIntRect &aRect, NSScreen *screen)
|
||||||
// (native context menus, native tooltips)
|
// (native context menus, native tooltips)
|
||||||
static PRBool UseNativePopupWindows()
|
static PRBool UseNativePopupWindows()
|
||||||
{
|
{
|
||||||
return Preferences::GetBool("ui.use_native_popup_windows", PR_FALSE);
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (!prefs)
|
||||||
|
return PR_FALSE;
|
||||||
|
|
||||||
|
PRBool useNativePopupWindows;
|
||||||
|
nsresult rv = prefs->GetBoolPref("ui.use_native_popup_windows", &useNativePopupWindows);
|
||||||
|
return (NS_SUCCEEDED(rv) && useNativePopupWindows);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||||
|
|
|
@ -53,11 +53,10 @@
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsArrayEnumerator.h"
|
#include "nsArrayEnumerator.h"
|
||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsCocoaUtils.h"
|
#include "nsCocoaUtils.h"
|
||||||
#include "nsToolkit.h"
|
#include "nsToolkit.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
const float kAccessoryViewPadding = 5;
|
const float kAccessoryViewPadding = 5;
|
||||||
const int kSaveTypeControlTag = 1;
|
const int kSaveTypeControlTag = 1;
|
||||||
|
@ -93,7 +92,10 @@ static void SetShowHiddenFileState(NSSavePanel* panel)
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
PRBool show = PR_FALSE;
|
PRBool show = PR_FALSE;
|
||||||
if (NS_SUCCEEDED(Preferences::GetBool(kShowHiddenFilesPref, &show))) {
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
nsresult rv = prefs->GetBoolPref(kShowHiddenFilesPref, &show);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
gCallSecretHiddenFileAPI = PR_TRUE;
|
gCallSecretHiddenFileAPI = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +147,12 @@ nsFilePicker::InitNative(nsIWidget *aParent, const nsAString& aTitle,
|
||||||
mMode = aMode;
|
mMode = aMode;
|
||||||
|
|
||||||
// read in initial type index from prefs
|
// read in initial type index from prefs
|
||||||
mSelectedTypeIndex =
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
Preferences::GetInt(kLastTypeIndexPref, mSelectedTypeIndex);
|
if (prefs) {
|
||||||
|
int prefIndex;
|
||||||
|
if (NS_SUCCEEDED(prefs->GetIntPref(kLastTypeIndexPref, &prefIndex)))
|
||||||
|
mSelectedTypeIndex = prefIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSView* nsFilePicker::GetAccessoryView()
|
NSView* nsFilePicker::GetAccessoryView()
|
||||||
|
@ -506,7 +512,9 @@ nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultNam
|
||||||
if (popupButton) {
|
if (popupButton) {
|
||||||
mSelectedTypeIndex = [popupButton indexOfSelectedItem];
|
mSelectedTypeIndex = [popupButton indexOfSelectedItem];
|
||||||
// save out to prefs for initializing other file picker instances
|
// save out to prefs for initializing other file picker instances
|
||||||
Preferences::SetInt(kLastTypeIndexPref, mSelectedTypeIndex);
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs)
|
||||||
|
prefs->SetIntPref(kLastTypeIndexPref, mSelectedTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSURL* fileURL = [thePanel URL];
|
NSURL* fileURL = [thePanel URL];
|
||||||
|
|
|
@ -40,16 +40,17 @@
|
||||||
#include "nsPrintSettingsX.h"
|
#include "nsPrintSettingsX.h"
|
||||||
#include "nsObjCExceptions.h"
|
#include "nsObjCExceptions.h"
|
||||||
|
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsServiceManagerUtils.h"
|
||||||
|
|
||||||
#include "plbase64.h"
|
#include "plbase64.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
|
|
||||||
#include "nsCocoaUtils.h"
|
#include "nsCocoaUtils.h"
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
#define PRINTING_PREF_BRANCH "print."
|
||||||
|
#define MAC_OS_X_PAGE_SETUP_PREFNAME "macosx.pagesetup-2"
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#define MAC_OS_X_PAGE_SETUP_PREFNAME "print.macosx.pagesetup-2"
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX, nsPrintSettings, nsPrintSettingsX)
|
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX, nsPrintSettings, nsPrintSettingsX)
|
||||||
|
|
||||||
|
@ -135,12 +136,19 @@ NS_IMETHODIMP nsPrintSettingsX::ReadPageFormatFromPrefs()
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
|
|
||||||
nsCAutoString encodedData;
|
nsresult rv;
|
||||||
nsresult rv =
|
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
Preferences::GetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, &encodedData);
|
if (NS_FAILED(rv))
|
||||||
if (NS_FAILED(rv)) {
|
return rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
rv = prefService->GetBranch(PRINTING_PREF_BRANCH, getter_AddRefs(prefBranch));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsXPIDLCString encodedData;
|
||||||
|
rv = prefBranch->GetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, getter_Copies(encodedData));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
|
||||||
|
|
||||||
// decode the base64
|
// decode the base64
|
||||||
char* decodedData = PL_Base64Decode(encodedData.get(), encodedData.Length(), nsnull);
|
char* decodedData = PL_Base64Decode(encodedData.get(), encodedData.Length(), nsnull);
|
||||||
|
@ -168,17 +176,26 @@ NS_IMETHODIMP nsPrintSettingsX::WritePageFormatToPrefs()
|
||||||
if (pageFormat == kPMNoPageFormat)
|
if (pageFormat == kPMNoPageFormat)
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
return NS_ERROR_NOT_INITIALIZED;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
rv = prefService->GetBranch(PRINTING_PREF_BRANCH, getter_AddRefs(prefBranch));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
NSData* data = nil;
|
NSData* data = nil;
|
||||||
OSStatus err = ::PMPageFormatCreateDataRepresentation(pageFormat, (CFDataRef*)&data, kPMDataFormatXMLDefault);
|
OSStatus err = ::PMPageFormatCreateDataRepresentation(pageFormat, (CFDataRef*)&data, kPMDataFormatXMLDefault);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCAutoString encodedData;
|
nsXPIDLCString encodedData;
|
||||||
encodedData.Adopt(PL_Base64Encode((char*)[data bytes], [data length], nsnull));
|
encodedData.Adopt(PL_Base64Encode((char*)[data bytes], [data length], nsnull));
|
||||||
if (!encodedData.get())
|
if (!encodedData.get())
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
return Preferences::SetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData);
|
return prefBranch->SetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData);
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,8 @@ extern "C" {
|
||||||
|
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "nsIPrefBranch.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
// defined in nsChildView.mm
|
// defined in nsChildView.mm
|
||||||
extern nsIRollupListener * gRollupListener;
|
extern nsIRollupListener * gRollupListener;
|
||||||
|
@ -271,7 +269,12 @@ nsToolkit::RegisterForAllProcessMouseEvents()
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||||
|
|
||||||
// Don't do this for apps that (like Camino) use native context menus.
|
// Don't do this for apps that (like Camino) use native context menus.
|
||||||
if (Preferences::GetBool("ui.use_native_popup_windows", PR_FALSE)) {
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
PRBool useNativeContextMenus;
|
||||||
|
nsresult rv = prefs->GetBoolPref("ui.use_native_popup_windows",
|
||||||
|
&useNativeContextMenus);
|
||||||
|
if (NS_SUCCEEDED(rv) && useNativeContextMenus)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mEventMonitorHandler) {
|
if (!mEventMonitorHandler) {
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
|
|
||||||
#include "nsDeviceContextSpecG.h"
|
#include "nsDeviceContextSpecG.h"
|
||||||
|
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "prenv.h" /* for PR_GetEnv */
|
#include "prenv.h" /* for PR_GetEnv */
|
||||||
|
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
|
@ -69,14 +71,10 @@
|
||||||
#include "nsILocalFile.h"
|
#include "nsILocalFile.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
/* Ensure that the result is always equal to either PR_TRUE or PR_FALSE */
|
/* Ensure that the result is always equal to either PR_TRUE or PR_FALSE */
|
||||||
#define MAKE_PR_BOOL(val) ((val)?(PR_TRUE):(PR_FALSE))
|
#define MAKE_PR_BOOL(val) ((val)?(PR_TRUE):(PR_FALSE))
|
||||||
|
|
||||||
|
@ -195,33 +193,29 @@ private:
|
||||||
void SetCharValue( const char *tagname, const char *value );
|
void SetCharValue( const char *tagname, const char *value );
|
||||||
|
|
||||||
nsXPIDLCString mPrinterName;
|
nsXPIDLCString mPrinterName;
|
||||||
|
nsCOMPtr<nsIPrefBranch> mPrefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
void nsPrinterFeatures::SetBoolValue( const char *tagname, PRBool value )
|
void nsPrinterFeatures::SetBoolValue( const char *tagname, PRBool value )
|
||||||
{
|
{
|
||||||
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
|
mPrefs->SetBoolPref(nsPrintfCString(256, PRINTERFEATURES_PREF ".%s.%s", mPrinterName.get(), tagname).get(), value);
|
||||||
mPrinterName.get(), tagname);
|
|
||||||
Preferences::SetBool(prefName.get(), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsPrinterFeatures::SetIntValue( const char *tagname, PRInt32 value )
|
void nsPrinterFeatures::SetIntValue( const char *tagname, PRInt32 value )
|
||||||
{
|
{
|
||||||
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
|
mPrefs->SetIntPref(nsPrintfCString(256, PRINTERFEATURES_PREF ".%s.%s", mPrinterName.get(), tagname).get(), value);
|
||||||
mPrinterName.get(), tagname);
|
|
||||||
Preferences::SetInt(prefName.get(), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsPrinterFeatures::SetCharValue( const char *tagname, const char *value )
|
void nsPrinterFeatures::SetCharValue( const char *tagname, const char *value )
|
||||||
{
|
{
|
||||||
nsPrintfCString prefName(256, PRINTERFEATURES_PREF ".%s.%s",
|
mPrefs->SetCharPref(nsPrintfCString(256, PRINTERFEATURES_PREF ".%s.%s", mPrinterName.get(), tagname).get(), value);
|
||||||
mPrinterName.get(), tagname);
|
|
||||||
Preferences::SetCString(prefName.get(), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPrinterFeatures::nsPrinterFeatures( const char *printername )
|
nsPrinterFeatures::nsPrinterFeatures( const char *printername )
|
||||||
{
|
{
|
||||||
DO_PR_DEBUG_LOG(("nsPrinterFeatures::nsPrinterFeatures('%s')\n", printername));
|
DO_PR_DEBUG_LOG(("nsPrinterFeatures::nsPrinterFeatures('%s')\n", printername));
|
||||||
mPrinterName.Assign(printername);
|
mPrinterName.Assign(printername);
|
||||||
|
mPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
|
||||||
SetBoolValue("has_special_printerfeatures", PR_TRUE);
|
SetBoolValue("has_special_printerfeatures", PR_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -665,8 +659,8 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
|
||||||
* - Get prefs
|
* - Get prefs
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
|
nsresult CopyPrinterCharPref(nsIPrefBranch *pref, const char *modulename, const char *printername,
|
||||||
const char *prefname, nsCString &return_buf)
|
const char *prefname, nsXPIDLCString &return_buf)
|
||||||
{
|
{
|
||||||
DO_PR_DEBUG_LOG(("CopyPrinterCharPref('%s', '%s', '%s')\n", modulename, printername, prefname));
|
DO_PR_DEBUG_LOG(("CopyPrinterCharPref('%s', '%s', '%s')\n", modulename, printername, prefname));
|
||||||
|
|
||||||
|
@ -676,7 +670,7 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
|
||||||
/* Get prefs per printer name and module name */
|
/* Get prefs per printer name and module name */
|
||||||
nsPrintfCString name(512, "print.%s.printer_%s.%s", modulename, printername, prefname);
|
nsPrintfCString name(512, "print.%s.printer_%s.%s", modulename, printername, prefname);
|
||||||
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
||||||
rv = Preferences::GetCString(name.get(), &return_buf);
|
rv = pref->GetCharPref(name.get(), getter_Copies(return_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
@ -684,7 +678,7 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
|
||||||
/* Get prefs per printer name */
|
/* Get prefs per printer name */
|
||||||
nsPrintfCString name(512, "print.printer_%s.%s", printername, prefname);
|
nsPrintfCString name(512, "print.printer_%s.%s", printername, prefname);
|
||||||
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
||||||
rv = Preferences::GetCString(name.get(), &return_buf);
|
rv = pref->GetCharPref(name.get(), getter_Copies(return_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
@ -692,14 +686,14 @@ nsresult CopyPrinterCharPref(const char *modulename, const char *printername,
|
||||||
/* Get prefs per module name */
|
/* Get prefs per module name */
|
||||||
nsPrintfCString name(512, "print.%s.%s", modulename, prefname);
|
nsPrintfCString name(512, "print.%s.%s", modulename, prefname);
|
||||||
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
||||||
rv = Preferences::GetCString(name.get(), &return_buf);
|
rv = pref->GetCharPref(name.get(), getter_Copies(return_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
/* Get prefs */
|
/* Get prefs */
|
||||||
nsPrintfCString name(512, "print.%s", prefname);
|
nsPrintfCString name(512, "print.%s", prefname);
|
||||||
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
DO_PR_DEBUG_LOG(("trying to get '%s'\n", name.get()));
|
||||||
rv = Preferences::GetCString(name.get(), &return_buf);
|
rv = pref->GetCharPref(name.get(), getter_Copies(return_buf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -775,6 +769,10 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
NS_ENSURE_TRUE(*aPrinterName, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(*aPrinterName, NS_ERROR_FAILURE);
|
||||||
NS_ENSURE_TRUE(aPrintSettings, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(aPrintSettings, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
nsXPIDLCString fullPrinterName, /* Full name of printer incl. driver-specific prefix */
|
nsXPIDLCString fullPrinterName, /* Full name of printer incl. driver-specific prefix */
|
||||||
printerName; /* "Stripped" name of printer */
|
printerName; /* "Stripped" name of printer */
|
||||||
fullPrinterName.Assign(NS_ConvertUTF16toUTF8(aPrinterName));
|
fullPrinterName.Assign(NS_ConvertUTF16toUTF8(aPrinterName));
|
||||||
|
@ -797,16 +795,13 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
|
|
||||||
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
|
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
|
||||||
/* Defaults to FALSE */
|
/* Defaults to FALSE */
|
||||||
nsPrintfCString prefName(256,
|
pPrefs->SetBoolPref(nsPrintfCString(256, PRINTERFEATURES_PREF ".%s.has_special_printerfeatures", fullPrinterName.get()).get(), PR_FALSE);
|
||||||
PRINTERFEATURES_PREF ".%s.has_special_printerfeatures",
|
|
||||||
fullPrinterName.get());
|
|
||||||
Preferences::SetBool(prefName.get(), PR_FALSE);
|
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
|
|
||||||
/* Set filename */
|
/* Set filename */
|
||||||
nsCAutoString filename;
|
nsXPIDLCString filename;
|
||||||
if (NS_FAILED(CopyPrinterCharPref(nsnull, printerName, "filename", filename))) {
|
if (NS_FAILED(CopyPrinterCharPref(pPrefs, nsnull, printerName, "filename", filename))) {
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
if (!(path = PR_GetEnv("PWD")))
|
if (!(path = PR_GetEnv("PWD")))
|
||||||
|
@ -839,9 +834,8 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
printerFeatures.SetCanChangeOrientation(PR_TRUE);
|
printerFeatures.SetCanChangeOrientation(PR_TRUE);
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
nsCAutoString orientation;
|
nsXPIDLCString orientation;
|
||||||
if (NS_SUCCEEDED(CopyPrinterCharPref("postscript", printerName,
|
if (NS_SUCCEEDED(CopyPrinterCharPref(pPrefs, "postscript", printerName, "orientation", orientation))) {
|
||||||
"orientation", orientation))) {
|
|
||||||
if (orientation.LowerCaseEqualsLiteral("portrait")) {
|
if (orientation.LowerCaseEqualsLiteral("portrait")) {
|
||||||
DO_PR_DEBUG_LOG(("setting default orientation to 'portrait'\n"));
|
DO_PR_DEBUG_LOG(("setting default orientation to 'portrait'\n"));
|
||||||
aPrintSettings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
|
aPrintSettings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
|
||||||
|
@ -897,12 +891,11 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
|
#ifdef SET_PRINTER_FEATURES_VIA_PREFS
|
||||||
printerFeatures.SetCanChangePaperSize(PR_TRUE);
|
printerFeatures.SetCanChangePaperSize(PR_TRUE);
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
nsCAutoString papername;
|
nsXPIDLCString papername;
|
||||||
if (NS_SUCCEEDED(CopyPrinterCharPref("postscript", printerName,
|
if (NS_SUCCEEDED(CopyPrinterCharPref(pPrefs, "postscript", printerName, "paper_size", papername))) {
|
||||||
"paper_size", papername))) {
|
|
||||||
nsPaperSizePS paper;
|
nsPaperSizePS paper;
|
||||||
|
|
||||||
if (paper.Find(papername.get())) {
|
if (paper.Find(papername)) {
|
||||||
DO_PR_DEBUG_LOG(("setting default paper size to '%s' (%g mm/%g mm)\n",
|
DO_PR_DEBUG_LOG(("setting default paper size to '%s' (%g mm/%g mm)\n",
|
||||||
paper.Name(), paper.Width_mm(), paper.Height_mm()));
|
paper.Name(), paper.Width_mm(), paper.Height_mm()));
|
||||||
aPrintSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
|
aPrintSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
|
||||||
|
@ -945,8 +938,8 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||||
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
#endif /* SET_PRINTER_FEATURES_VIA_PREFS */
|
||||||
|
|
||||||
if (hasSpoolerCmd) {
|
if (hasSpoolerCmd) {
|
||||||
nsCAutoString command;
|
nsXPIDLCString command;
|
||||||
if (NS_SUCCEEDED(CopyPrinterCharPref("postscript",
|
if (NS_SUCCEEDED(CopyPrinterCharPref(pPrefs, "postscript",
|
||||||
printerName, "print_command", command))) {
|
printerName, "print_command", command))) {
|
||||||
DO_PR_DEBUG_LOG(("setting default print command to '%s'\n",
|
DO_PR_DEBUG_LOG(("setting default print command to '%s'\n",
|
||||||
command.get()));
|
command.get()));
|
||||||
|
@ -980,6 +973,11 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
||||||
if (!mGlobalPrinterList)
|
if (!mGlobalPrinterList)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPrefBranch> pPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
nsPSPrinterList psMgr;
|
nsPSPrinterList psMgr;
|
||||||
if (NS_SUCCEEDED(psMgr.Init()) && psMgr.Enabled()) {
|
if (NS_SUCCEEDED(psMgr.Init()) && psMgr.Enabled()) {
|
||||||
/* Get the list of PostScript-module printers */
|
/* Get the list of PostScript-module printers */
|
||||||
|
|
|
@ -49,16 +49,14 @@
|
||||||
|
|
||||||
#include "nsGtkIMModule.h"
|
#include "nsGtkIMModule.h"
|
||||||
#include "nsWindow.h"
|
#include "nsWindow.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#ifdef MOZ_PLATFORM_MAEMO
|
#ifdef MOZ_PLATFORM_MAEMO
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
PRLogModuleInfo* gGtkIMLog = nsnull;
|
PRLogModuleInfo* gGtkIMLog = nsnull;
|
||||||
|
|
||||||
|
@ -596,13 +594,16 @@ nsGtkIMModule::SetInputMode(nsWindow* aCaller, const IMEContext* aContext)
|
||||||
if (mIMEContext.mStatus != nsIWidget::IME_STATUS_DISABLED &&
|
if (mIMEContext.mStatus != nsIWidget::IME_STATUS_DISABLED &&
|
||||||
mIMEContext.mStatus != nsIWidget::IME_STATUS_PLUGIN) {
|
mIMEContext.mStatus != nsIWidget::IME_STATUS_PLUGIN) {
|
||||||
|
|
||||||
PRBool useStrictPolicy =
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||||
Preferences::GetBool("content.ime.strict_policy", PR_FALSE);
|
|
||||||
|
PRBool useStrictPolicy = PR_FALSE;
|
||||||
|
if (NS_SUCCEEDED(prefs->GetBoolPref("content.ime.strict_policy", &useStrictPolicy))) {
|
||||||
if (useStrictPolicy && !mIMEContext.FocusMovedByUser() &&
|
if (useStrictPolicy && !mIMEContext.FocusMovedByUser() &&
|
||||||
mIMEContext.FocusMovedInContentProcess()) {
|
mIMEContext.FocusMovedInContentProcess()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// It is not desired that the hildon's autocomplete mechanism displays
|
// It is not desired that the hildon's autocomplete mechanism displays
|
||||||
// user previous entered passwds, so lets make completions invisible
|
// user previous entered passwds, so lets make completions invisible
|
||||||
|
|
|
@ -38,19 +38,18 @@
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCUPSShim.h"
|
#include "nsCUPSShim.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "nsPSPrinters.h"
|
#include "nsPSPrinters.h"
|
||||||
#include "nsReadableUtils.h" // StringBeginsWith()
|
#include "nsReadableUtils.h" // StringBeginsWith()
|
||||||
#include "nsCUPSShim.h"
|
#include "nsCUPSShim.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#include "prlink.h"
|
#include "prlink.h"
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#define NS_CUPS_PRINTER "CUPS/"
|
#define NS_CUPS_PRINTER "CUPS/"
|
||||||
#define NS_CUPS_PRINTER_LEN (sizeof(NS_CUPS_PRINTER) - 1)
|
#define NS_CUPS_PRINTER_LEN (sizeof(NS_CUPS_PRINTER) - 1)
|
||||||
|
|
||||||
|
@ -65,12 +64,16 @@ nsPSPrinterList::Init()
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
mPrefSvc = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
rv = mPrefSvc->GetBranch("print.", getter_AddRefs(mPref));
|
||||||
|
NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
|
||||||
// Should we try cups?
|
// Should we try cups?
|
||||||
PRBool useCups =
|
PRBool useCups = PR_TRUE;
|
||||||
Preferences::GetBool("print.postscript.cups.enabled", PR_TRUE);
|
rv = mPref->GetBoolPref("postscript.cups.enabled", &useCups);
|
||||||
if (useCups && !gCupsShim.IsInitialized()) {
|
if (useCups && !gCupsShim.IsInitialized())
|
||||||
gCupsShim.Init();
|
gCupsShim.Init();
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +87,9 @@ nsPSPrinterList::Enabled()
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
// is the PS module enabled?
|
// is the PS module enabled?
|
||||||
return Preferences::GetBool("print.postscript.enabled", PR_TRUE);
|
PRBool setting = PR_TRUE;
|
||||||
|
mPref->GetBoolPref("postscript.enabled", &setting);
|
||||||
|
return setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,10 +131,10 @@ nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& aList)
|
||||||
aList.AppendElement(
|
aList.AppendElement(
|
||||||
NS_LITERAL_CSTRING(NS_POSTSCRIPT_DRIVER_NAME "default"));
|
NS_LITERAL_CSTRING(NS_POSTSCRIPT_DRIVER_NAME "default"));
|
||||||
|
|
||||||
nsCAutoString list(PR_GetEnv("MOZILLA_POSTSCRIPT_PRINTER_LIST"));
|
nsXPIDLCString list;
|
||||||
if (list.IsEmpty()) {
|
list.Assign(PR_GetEnv("MOZILLA_POSTSCRIPT_PRINTER_LIST"));
|
||||||
list = Preferences::GetCString("print.printer_list");
|
if (list.IsEmpty())
|
||||||
}
|
mPref->GetCharPref("printer_list", getter_Copies(list));
|
||||||
if (!list.IsEmpty()) {
|
if (!list.IsEmpty()) {
|
||||||
// For each printer (except "default" which was already added),
|
// For each printer (except "default" which was already added),
|
||||||
// construct a string "PostScript/<name>" and append it to the list.
|
// construct a string "PostScript/<name>" and append it to the list.
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "prtypes.h"
|
#include "prtypes.h"
|
||||||
|
|
||||||
|
class nsIPrefService;
|
||||||
|
class nsIPrefBranch;
|
||||||
class nsCUPSShim;
|
class nsCUPSShim;
|
||||||
|
|
||||||
class nsPSPrinterList {
|
class nsPSPrinterList {
|
||||||
|
@ -88,6 +90,10 @@ class nsPSPrinterList {
|
||||||
* @return The PrinterType value for this name.
|
* @return The PrinterType value for this name.
|
||||||
*/
|
*/
|
||||||
static PrinterType GetPrinterType(const nsACString& aName);
|
static PrinterType GetPrinterType(const nsACString& aName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsCOMPtr<nsIPrefService> mPrefSvc;
|
||||||
|
nsCOMPtr<nsIPrefBranch> mPref;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsPSPrinters_h___ */
|
#endif /* nsPSPrinters_h___ */
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
#include "nsDeviceContextSpecG.h"
|
#include "nsDeviceContextSpecG.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsImageToPixbuf.h"
|
#include "nsImageToPixbuf.h"
|
||||||
#include "nsPrintDialogGTK.h"
|
#include "nsPrintDialogGTK.h"
|
||||||
|
|
||||||
|
@ -81,8 +81,6 @@
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
/* from nsFilePicker.js */
|
/* from nsFilePicker.js */
|
||||||
#define XULFILEPICKER_CID \
|
#define XULFILEPICKER_CID \
|
||||||
{ 0x54ae32f8, 0x1dd2, 0x11b2, \
|
{ 0x54ae32f8, 0x1dd2, 0x11b2, \
|
||||||
|
@ -166,8 +164,16 @@ nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool allowPlatformPicker =
|
PRBool allowPlatformPicker = PR_TRUE;
|
||||||
Preferences::GetBool("ui.allow_platform_file_picker", PR_TRUE);
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
PRBool prefAllow;
|
||||||
|
nsresult rv = prefs->GetBoolPref("ui.allow_platform_file_picker",
|
||||||
|
&prefAllow);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
allowPlatformPicker = prefAllow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIFilePicker> picker;
|
nsCOMPtr<nsIFilePicker> picker;
|
||||||
if (allowPlatformPicker && gtk_check_version(2,6,3) == NULL) {
|
if (allowPlatformPicker && gtk_check_version(2,6,3) == NULL) {
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
#include <startup-notification-1.0/libsn/sn.h>
|
#include <startup-notification-1.0/libsn/sn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch.h"
|
#include "nsIPrefBranch.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
@ -98,9 +97,6 @@
|
||||||
#include "nsIAccessibleDocument.h"
|
#include "nsIAccessibleDocument.h"
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
static PRBool sAccessibilityChecked = PR_FALSE;
|
static PRBool sAccessibilityChecked = PR_FALSE;
|
||||||
/* static */
|
/* static */
|
||||||
PRBool nsWindow::sAccessibilityEnabled = PR_FALSE;
|
PRBool nsWindow::sAccessibilityEnabled = PR_FALSE;
|
||||||
|
@ -6155,10 +6151,20 @@ drag_data_received_event_cb(GtkWidget *aWidget,
|
||||||
static nsresult
|
static nsresult
|
||||||
initialize_prefs(void)
|
initialize_prefs(void)
|
||||||
{
|
{
|
||||||
gRaiseWindows =
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
Preferences::GetBool("mozilla.widget.raise-on-setfocus", PR_TRUE);
|
if (!prefs)
|
||||||
gDisableNativeTheme =
|
return NS_OK;
|
||||||
Preferences::GetBool("mozilla.widget.disable-native-theme", PR_FALSE);
|
|
||||||
|
PRBool val = PR_TRUE;
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
rv = prefs->GetBoolPref("mozilla.widget.raise-on-setfocus", &val);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
gRaiseWindows = val;
|
||||||
|
|
||||||
|
rv = prefs->GetBoolPref("mozilla.widget.disable-native-theme", &val);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
gDisableNativeTheme = val;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,10 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsTextStore.h"
|
#include "nsTextStore.h"
|
||||||
#include "nsWindow.h"
|
#include "nsWindow.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* nsTextStore */
|
/* nsTextStore */
|
||||||
|
@ -1332,8 +1331,19 @@ GetLayoutChangeIntervalTime()
|
||||||
if (sTime > 0)
|
if (sTime > 0)
|
||||||
return PRUint32(sTime);
|
return PRUint32(sTime);
|
||||||
|
|
||||||
sTime = NS_MAX(10,
|
sTime = 100;
|
||||||
Preferences::GetInt("intl.tsf.on_layout_change_interval", 100));
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (!prefs)
|
||||||
|
return PRUint32(sTime);
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||||
|
if (!prefBranch)
|
||||||
|
return PRUint32(sTime);
|
||||||
|
nsresult rv =
|
||||||
|
prefBranch->GetIntPref("intl.tsf.on_layout_change_interval", &sTime);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return PRUint32(sTime);
|
||||||
|
sTime = PR_MAX(10, sTime);
|
||||||
return PRUint32(sTime);
|
return PRUint32(sTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1615,8 +1625,15 @@ nsTextStore::Initialize(void)
|
||||||
sTextStoreLog = PR_NewLogModule("nsTextStoreWidgets");
|
sTextStoreLog = PR_NewLogModule("nsTextStoreWidgets");
|
||||||
#endif
|
#endif
|
||||||
if (!sTsfThreadMgr) {
|
if (!sTsfThreadMgr) {
|
||||||
PRBool enableTsf =
|
PRBool enableTsf = PR_TRUE;
|
||||||
Preferences::GetBool("intl.enable_tsf_support", PR_FALSE);
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||||
|
if (prefBranch && NS_FAILED(prefBranch->GetBoolPref(
|
||||||
|
"intl.enable_tsf_support", &enableTsf)))
|
||||||
|
enableTsf = PR_TRUE;
|
||||||
|
}
|
||||||
if (enableTsf) {
|
if (enableTsf) {
|
||||||
if (SUCCEEDED(CoCreateInstance(CLSID_TF_ThreadMgr, NULL,
|
if (SUCCEEDED(CoCreateInstance(CLSID_TF_ThreadMgr, NULL,
|
||||||
CLSCTX_INPROC_SERVER, IID_ITfThreadMgr,
|
CLSCTX_INPROC_SERVER, IID_ITfThreadMgr,
|
||||||
|
|
|
@ -43,11 +43,11 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsWinGesture.h"
|
#include "nsWinGesture.h"
|
||||||
#include "nsUXThemeData.h"
|
#include "nsUXThemeData.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIDOMSimpleGestureEvent.h"
|
#include "nsIDOMSimpleGestureEvent.h"
|
||||||
#include "nsGUIEvent.h"
|
#include "nsGUIEvent.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
|
@ -140,8 +140,17 @@ PRBool nsWinGesture::InitLibrary()
|
||||||
|
|
||||||
// Check to see if we want single finger gesture input. Only do this once
|
// Check to see if we want single finger gesture input. Only do this once
|
||||||
// for the app so we don't have to look it up on every window create.
|
// for the app so we don't have to look it up on every window create.
|
||||||
gEnableSingleFingerPanEvents =
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
Preferences::GetBool("gestures.enable_single_finger_input", PR_FALSE);
|
if (prefs) {
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
prefs->GetBranch(0, getter_AddRefs(prefBranch));
|
||||||
|
if (prefBranch) {
|
||||||
|
PRBool flag;
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetBoolPref("gestures.enable_single_finger_input", &flag))
|
||||||
|
&& flag)
|
||||||
|
gEnableSingleFingerPanEvents = PR_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,9 @@
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsIDOMNSUIEvent.h"
|
#include "nsIDOMNSUIEvent.h"
|
||||||
#include "nsITheme.h"
|
#include "nsITheme.h"
|
||||||
|
#include "nsIPrefBranch.h"
|
||||||
|
#include "nsIPrefBranch2.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIScreenManager.h"
|
#include "nsIScreenManager.h"
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
|
@ -157,7 +160,6 @@
|
||||||
#include "nsWindowGfx.h"
|
#include "nsWindowGfx.h"
|
||||||
#include "gfxWindowsPlatform.h"
|
#include "gfxWindowsPlatform.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "mozilla/Preferences.h"
|
|
||||||
|
|
||||||
#ifdef MOZ_ENABLE_D3D9_LAYER
|
#ifdef MOZ_ENABLE_D3D9_LAYER
|
||||||
#include "LayerManagerD3D9.h"
|
#include "LayerManagerD3D9.h"
|
||||||
|
@ -210,7 +212,6 @@
|
||||||
|
|
||||||
using namespace mozilla::widget;
|
using namespace mozilla::widget;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
using namespace mozilla;
|
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
**************************************************************
|
**************************************************************
|
||||||
|
@ -645,13 +646,37 @@ nsWindow::Create(nsIWidget *aParent,
|
||||||
// the working set when windows are minimized, but on Vista and up it has
|
// the working set when windows are minimized, but on Vista and up it has
|
||||||
// little to no effect. Since this feature has been the source of numerous
|
// little to no effect. Since this feature has been the source of numerous
|
||||||
// bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up.
|
// bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up.
|
||||||
sTrimOnMinimize =
|
sTrimOnMinimize = 0;
|
||||||
Preferences::GetBool("config.trim_on_minimize",
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
(GetWindowsVersion() >= VISTA_VERSION)) ? 1 : 0;
|
if (prefs) {
|
||||||
sSwitchKeyboardLayout =
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
Preferences::GetBool("intl.keyboard.per_window_layout", PR_FALSE);
|
prefs->GetBranch(0, getter_AddRefs(prefBranch));
|
||||||
gDisableNativeTheme =
|
if (prefBranch) {
|
||||||
Preferences::GetBool("mozilla.widget.disable-native-theme", PR_FALSE);
|
|
||||||
|
PRBool temp;
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetBoolPref("config.trim_on_minimize",
|
||||||
|
&temp))) {
|
||||||
|
if (temp) {
|
||||||
|
sTrimOnMinimize = 1;
|
||||||
|
}
|
||||||
|
} else if (GetWindowsVersion() >= VISTA_VERSION) {
|
||||||
|
sTrimOnMinimize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetBoolPref("intl.keyboard.per_window_layout",
|
||||||
|
&temp)))
|
||||||
|
sSwitchKeyboardLayout = temp;
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetBoolPref("mozilla.widget.disable-native-theme",
|
||||||
|
&temp)))
|
||||||
|
gDisableNativeTheme = temp;
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(prefBranch->GetBoolPref("mousewheel.enable_pixel_scrolling",
|
||||||
|
&temp))) {
|
||||||
|
sEnablePixelScrolling = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -3150,14 +3175,17 @@ struct LayerManagerPrefs {
|
||||||
static void
|
static void
|
||||||
GetLayerManagerPrefs(LayerManagerPrefs* aManagerPrefs)
|
GetLayerManagerPrefs(LayerManagerPrefs* aManagerPrefs)
|
||||||
{
|
{
|
||||||
Preferences::GetBool("layers.acceleration.disabled",
|
nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
prefs->GetBoolPref("layers.acceleration.disabled",
|
||||||
&aManagerPrefs->mDisableAcceleration);
|
&aManagerPrefs->mDisableAcceleration);
|
||||||
Preferences::GetBool("layers.acceleration.force-enabled",
|
prefs->GetBoolPref("layers.acceleration.force-enabled",
|
||||||
&aManagerPrefs->mForceAcceleration);
|
&aManagerPrefs->mForceAcceleration);
|
||||||
Preferences::GetBool("layers.prefer-opengl",
|
prefs->GetBoolPref("layers.prefer-opengl",
|
||||||
&aManagerPrefs->mPreferOpenGL);
|
&aManagerPrefs->mPreferOpenGL);
|
||||||
Preferences::GetBool("layers.prefer-d3d9",
|
prefs->GetBoolPref("layers.prefer-d3d9",
|
||||||
&aManagerPrefs->mPreferD3D9);
|
&aManagerPrefs->mPreferD3D9);
|
||||||
|
}
|
||||||
|
|
||||||
const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
|
const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
|
||||||
aManagerPrefs->mAccelerateByDefault =
|
aManagerPrefs->mAccelerateByDefault =
|
||||||
|
@ -3329,8 +3357,16 @@ nsWindow::OnDefaultButtonLoaded(const nsIntRect &aButtonRect)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool isAlwaysSnapCursor =
|
PRBool isAlwaysSnapCursor = PR_FALSE;
|
||||||
Preferences::GetBool("ui.cursor_snapping.always_enabled", PR_FALSE);
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
if (prefs) {
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||||
|
if (prefBranch) {
|
||||||
|
prefBranch->GetBoolPref("ui.cursor_snapping.always_enabled",
|
||||||
|
&isAlwaysSnapCursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAlwaysSnapCursor) {
|
if (!isAlwaysSnapCursor) {
|
||||||
BOOL snapDefaultButton;
|
BOOL snapDefaultButton;
|
||||||
|
@ -4625,10 +4661,16 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||||
// Changing nsIPrefBranch entry which triggers callbacks
|
// Changing nsIPrefBranch entry which triggers callbacks
|
||||||
// and flows into calling mDeviceContext->FlushFontCache()
|
// and flows into calling mDeviceContext->FlushFontCache()
|
||||||
// to update the font cache in all the instance of Browsers
|
// to update the font cache in all the instance of Browsers
|
||||||
const char* kPrefName = "font.internaluseonly.changed";
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
PRBool fontInternalChange =
|
if (prefs) {
|
||||||
Preferences::GetBool(kPrefName, PR_FALSE);
|
nsCOMPtr<nsIPrefBranch> fiPrefs;
|
||||||
Preferences::SetBool(kPrefName, !fontInternalChange);
|
prefs->GetBranch("font.internaluseonly.", getter_AddRefs(fiPrefs));
|
||||||
|
if (fiPrefs) {
|
||||||
|
PRBool fontInternalChange = PR_FALSE;
|
||||||
|
fiPrefs->GetBoolPref("changed", &fontInternalChange);
|
||||||
|
fiPrefs->SetBoolPref("changed", !fontInternalChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} //if (NS_SUCCEEDED(rv))
|
} //if (NS_SUCCEEDED(rv))
|
||||||
}
|
}
|
||||||
|
@ -6301,9 +6343,6 @@ nsWindow::InitMouseWheelScrollData()
|
||||||
// See the comments for the case sMouseWheelScrollLines > WHEEL_DELTA.
|
// See the comments for the case sMouseWheelScrollLines > WHEEL_DELTA.
|
||||||
sMouseWheelScrollChars = WHEEL_PAGESCROLL;
|
sMouseWheelScrollChars = WHEEL_PAGESCROLL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sEnablePixelScrolling =
|
|
||||||
Preferences::GetBool("mousewheel.enable_pixel_scrolling", PR_TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
@ -7676,8 +7715,15 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
||||||
{
|
{
|
||||||
static PRInt8 sMouseWheelEmulation = -1;
|
static PRInt8 sMouseWheelEmulation = -1;
|
||||||
if (sMouseWheelEmulation < 0) {
|
if (sMouseWheelEmulation < 0) {
|
||||||
PRBool emulate =
|
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
Preferences::GetBool("mousewheel.emulate_at_wm_scroll", PR_FALSE);
|
NS_ENSURE_TRUE(prefs, PR_FALSE);
|
||||||
|
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||||
|
prefs->GetBranch(0, getter_AddRefs(prefBranch));
|
||||||
|
NS_ENSURE_TRUE(prefBranch, PR_FALSE);
|
||||||
|
PRBool emulate;
|
||||||
|
nsresult rv =
|
||||||
|
prefBranch->GetBoolPref("mousewheel.emulate_at_wm_scroll", &emulate);
|
||||||
|
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||||
sMouseWheelEmulation = PRInt8(emulate);
|
sMouseWheelEmulation = PRInt8(emulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8040,8 +8086,10 @@ nsWindow::GetRootAccessible()
|
||||||
static int accForceDisable = -1;
|
static int accForceDisable = -1;
|
||||||
|
|
||||||
if (accForceDisable == -1) {
|
if (accForceDisable == -1) {
|
||||||
const char* kPrefName = "accessibility.win32.force_disabled";
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
if (Preferences::GetBool(kPrefName, PR_FALSE)) {
|
PRBool b = PR_FALSE;
|
||||||
|
nsresult rv = prefs->GetBoolPref("accessibility.win32.force_disabled", &b);
|
||||||
|
if (NS_SUCCEEDED(rv) && b) {
|
||||||
accForceDisable = 1;
|
accForceDisable = 1;
|
||||||
} else {
|
} else {
|
||||||
accForceDisable = 0;
|
accForceDisable = 0;
|
||||||
|
@ -8745,11 +8793,17 @@ PRBool nsWindow::CanTakeFocus()
|
||||||
|
|
||||||
void nsWindow::GetMainWindowClass(nsAString& aClass)
|
void nsWindow::GetMainWindowClass(nsAString& aClass)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aClass.IsEmpty(), "aClass should be empty string");
|
nsresult rv;
|
||||||
nsresult rv = Preferences::GetString("ui.window_class_override", &aClass);
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
if (NS_FAILED(rv) || aClass.IsEmpty()) {
|
if (NS_SUCCEEDED(rv) && prefs) {
|
||||||
aClass.AssignASCII(sDefaultMainWindowClass);
|
nsXPIDLCString name;
|
||||||
|
rv = prefs->GetCharPref("ui.window_class_override", getter_Copies(name));
|
||||||
|
if (NS_SUCCEEDED(rv) && !name.IsEmpty()) {
|
||||||
|
aClass.AssignASCII(name.get());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
aClass.AssignASCII(sDefaultMainWindowClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8769,8 +8823,12 @@ PRBool nsWindow::GetInputWorkaroundPref(const char* aPrefName,
|
||||||
return aValueIfAutomatic;
|
return aValueIfAutomatic;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 lHackValue = 0;
|
nsresult rv;
|
||||||
if (NS_SUCCEEDED(Preferences::GetInt(aPrefName, &lHackValue))) {
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||||
|
if (NS_SUCCEEDED(rv) && prefs) {
|
||||||
|
PRInt32 lHackValue;
|
||||||
|
rv = prefs->GetIntPref(aPrefName, &lHackValue);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
switch (lHackValue) {
|
switch (lHackValue) {
|
||||||
case 0: // disabled
|
case 0: // disabled
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
@ -8780,6 +8838,7 @@ PRBool nsWindow::GetInputWorkaroundPref(const char* aPrefName,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return aValueIfAutomatic;
|
return aValueIfAutomatic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,14 +197,13 @@ RemovePrefForFeature(PRInt32 aFeature)
|
||||||
static bool
|
static bool
|
||||||
GetPrefValueForDriverVersion(nsCString& aVersion)
|
GetPrefValueForDriverVersion(nsCString& aVersion)
|
||||||
{
|
{
|
||||||
return NS_SUCCEEDED(Preferences::GetCString(SUGGESTED_VERSION_PREF,
|
return NS_SUCCEEDED(Preferences::GetChar(SUGGESTED_VERSION_PREF, &aVersion));
|
||||||
&aVersion));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetPrefValueForDriverVersion(const nsAString& aVersion)
|
SetPrefValueForDriverVersion(const nsString& aVersion)
|
||||||
{
|
{
|
||||||
Preferences::SetString(SUGGESTED_VERSION_PREF, aVersion);
|
Preferences::SetChar(SUGGESTED_VERSION_PREF, aVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -308,7 +308,7 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
|
||||||
|
|
||||||
#define GETSTRPREF(_prefname, _retval) \
|
#define GETSTRPREF(_prefname, _retval) \
|
||||||
NS_SUCCEEDED( \
|
NS_SUCCEEDED( \
|
||||||
Preferences::GetString( \
|
Preferences::GetChar( \
|
||||||
GetPrefName(_prefname, aPrinterName), _retval \
|
GetPrefName(_prefname, aPrinterName), _retval \
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
@ -623,7 +623,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
DUMP_DBL(kWriteStr, kPrintPaperHeight, height);
|
DUMP_DBL(kWriteStr, kPrintPaperHeight, height);
|
||||||
WritePrefDouble(GetPrefName(kPrintPaperHeight, aPrinterName), height);
|
WritePrefDouble(GetPrefName(kPrintPaperHeight, aPrinterName), height);
|
||||||
DUMP_STR(kWriteStr, kPrintPaperName, name);
|
DUMP_STR(kWriteStr, kPrintPaperName, name);
|
||||||
Preferences::SetString(GetPrefName(kPrintPaperName, aPrinterName), name);
|
Preferences::SetChar(GetPrefName(kPrintPaperName, aPrinterName), name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) {
|
if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) {
|
||||||
if (NS_SUCCEEDED(aPS->GetHeaderStrLeft(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetHeaderStrLeft(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintHeaderStrLeft, uStr);
|
DUMP_STR(kWriteStr, kPrintHeaderStrLeft, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintHeaderStrLeft, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintHeaderStrLeft, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) {
|
if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) {
|
||||||
if (NS_SUCCEEDED(aPS->GetHeaderStrCenter(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetHeaderStrCenter(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintHeaderStrCenter, uStr);
|
DUMP_STR(kWriteStr, kPrintHeaderStrCenter, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintHeaderStrCenter, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintHeaderStrCenter, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) {
|
if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) {
|
||||||
if (NS_SUCCEEDED(aPS->GetHeaderStrRight(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetHeaderStrRight(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintHeaderStrRight, uStr);
|
DUMP_STR(kWriteStr, kPrintHeaderStrRight, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintHeaderStrRight, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintHeaderStrRight, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -676,7 +676,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) {
|
if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) {
|
||||||
if (NS_SUCCEEDED(aPS->GetFooterStrLeft(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetFooterStrLeft(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintFooterStrLeft, uStr);
|
DUMP_STR(kWriteStr, kPrintFooterStrLeft, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintFooterStrLeft, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintFooterStrLeft, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) {
|
if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) {
|
||||||
if (NS_SUCCEEDED(aPS->GetFooterStrCenter(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetFooterStrCenter(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintFooterStrCenter, uStr);
|
DUMP_STR(kWriteStr, kPrintFooterStrCenter, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintFooterStrCenter, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintFooterStrCenter, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveFooterRight) {
|
if (aFlags & nsIPrintSettings::kInitSaveFooterRight) {
|
||||||
if (NS_SUCCEEDED(aPS->GetFooterStrRight(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetFooterStrRight(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintFooterStrRight, uStr);
|
DUMP_STR(kWriteStr, kPrintFooterStrRight, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintFooterStrRight, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintFooterStrRight, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,7 +728,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSavePlexName) {
|
if (aFlags & nsIPrintSettings::kInitSavePlexName) {
|
||||||
if (NS_SUCCEEDED(aPS->GetPlexName(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetPlexName(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintPlexName, uStr);
|
DUMP_STR(kWriteStr, kPrintPlexName, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintPlexName, aPrinterName), uStr);
|
Preferences::SetChar(GetPrefName(kPrintPlexName, aPrinterName), uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,14 +743,14 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveColorspace) {
|
if (aFlags & nsIPrintSettings::kInitSaveColorspace) {
|
||||||
if (NS_SUCCEEDED(aPS->GetColorspace(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetColorspace(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintColorspace, uStr);
|
DUMP_STR(kWriteStr, kPrintColorspace, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintColorspace, aPrinterName), uStr);
|
Preferences::SetChar(GetPrefName(kPrintColorspace, aPrinterName), uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveResolutionName) {
|
if (aFlags & nsIPrintSettings::kInitSaveResolutionName) {
|
||||||
if (NS_SUCCEEDED(aPS->GetResolutionName(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetResolutionName(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintResolutionName, uStr);
|
DUMP_STR(kWriteStr, kPrintResolutionName, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintResolutionName, aPrinterName),
|
Preferences::SetChar(GetPrefName(kPrintResolutionName, aPrinterName),
|
||||||
uStr);
|
uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSavePrintCommand) {
|
if (aFlags & nsIPrintSettings::kInitSavePrintCommand) {
|
||||||
if (NS_SUCCEEDED(aPS->GetPrintCommand(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetPrintCommand(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintCommand, uStr);
|
DUMP_STR(kWriteStr, kPrintCommand, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintCommand, aPrinterName), uStr);
|
Preferences::SetChar(GetPrefName(kPrintCommand, aPrinterName), uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
&& aPrinterName.IsEmpty()) {
|
&& aPrinterName.IsEmpty()) {
|
||||||
if (NS_SUCCEEDED(aPS->GetPrinterName(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetPrinterName(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrinterName, uStr);
|
DUMP_STR(kWriteStr, kPrinterName, uStr);
|
||||||
Preferences::SetString(kPrinterName, uStr);
|
Preferences::SetChar(kPrinterName, uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,7 +795,7 @@ nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
|
||||||
if (aFlags & nsIPrintSettings::kInitSaveToFileName) {
|
if (aFlags & nsIPrintSettings::kInitSaveToFileName) {
|
||||||
if (NS_SUCCEEDED(aPS->GetToFileName(&uStr))) {
|
if (NS_SUCCEEDED(aPS->GetToFileName(&uStr))) {
|
||||||
DUMP_STR(kWriteStr, kPrintToFileName, uStr);
|
DUMP_STR(kWriteStr, kPrintToFileName, uStr);
|
||||||
Preferences::SetString(GetPrefName(kPrintToFileName, aPrinterName), uStr);
|
Preferences::SetChar(GetPrefName(kPrintToFileName, aPrinterName), uStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ nsPrintOptions::GetDefaultPrinterName(PRUnichar * *aDefaultPrinterName)
|
||||||
|
|
||||||
// Look up the printer from the last print job
|
// Look up the printer from the last print job
|
||||||
nsAutoString lastPrinterName;
|
nsAutoString lastPrinterName;
|
||||||
Preferences::GetString(kPrinterName, &lastPrinterName);
|
Preferences::GetChar(kPrinterName, &lastPrinterName);
|
||||||
if (!lastPrinterName.IsEmpty()) {
|
if (!lastPrinterName.IsEmpty()) {
|
||||||
// Verify it's still a valid printer
|
// Verify it's still a valid printer
|
||||||
nsCOMPtr<nsIStringEnumerator> printers;
|
nsCOMPtr<nsIStringEnumerator> printers;
|
||||||
|
@ -1096,7 +1096,7 @@ nsPrintOptions::ReadPrefDouble(const char * aPrefId, double& aVal)
|
||||||
NS_ENSURE_ARG_POINTER(aPrefId);
|
NS_ENSURE_ARG_POINTER(aPrefId);
|
||||||
|
|
||||||
nsCAutoString str;
|
nsCAutoString str;
|
||||||
nsresult rv = Preferences::GetCString(aPrefId, &str);
|
nsresult rv = Preferences::GetChar(aPrefId, &str);
|
||||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
||||||
aVal = atof(str.get());
|
aVal = atof(str.get());
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ nsPrintOptions::WritePrefDouble(const char * aPrefId, double aVal)
|
||||||
nsPrintfCString str("%6.2f", aVal);
|
nsPrintfCString str("%6.2f", aVal);
|
||||||
NS_ENSURE_TRUE(!str.IsEmpty(), NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!str.IsEmpty(), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
return Preferences::SetCString(aPrefId, str);
|
return Preferences::SetChar(aPrefId, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1119,9 +1119,9 @@ nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, PRInt32& aTwips,
|
||||||
const char * aMarginPref)
|
const char * aMarginPref)
|
||||||
{
|
{
|
||||||
nsCAutoString str;
|
nsCAutoString str;
|
||||||
nsresult rv = Preferences::GetCString(aPrefId, &str);
|
nsresult rv = Preferences::GetChar(aPrefId, &str);
|
||||||
if (NS_FAILED(rv) || str.IsEmpty()) {
|
if (NS_FAILED(rv) || str.IsEmpty()) {
|
||||||
rv = Preferences::GetCString(aMarginPref, &str);
|
rv = Preferences::GetChar(aMarginPref, &str);
|
||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
||||||
nsAutoString justStr;
|
nsAutoString justStr;
|
||||||
|
@ -1143,7 +1143,7 @@ nsPrintOptions::WriteInchesFromTwipsPref(const char * aPrefId, PRInt32 aTwips)
|
||||||
nsCAutoString inchesStr;
|
nsCAutoString inchesStr;
|
||||||
inchesStr.AppendFloat(inches);
|
inchesStr.AppendFloat(inches);
|
||||||
|
|
||||||
Preferences::SetCString(aPrefId, inchesStr);
|
Preferences::SetChar(aPrefId, inchesStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1175,7 +1175,7 @@ nsPrintOptions::ReadJustification(const char * aPrefId, PRInt16& aJust,
|
||||||
{
|
{
|
||||||
aJust = aInitValue;
|
aJust = aInitValue;
|
||||||
nsAutoString justStr;
|
nsAutoString justStr;
|
||||||
if (NS_SUCCEEDED(Preferences::GetString(aPrefId, &justStr))) {
|
if (NS_SUCCEEDED(Preferences::GetChar(aPrefId, &justStr))) {
|
||||||
if (justStr.EqualsASCII(kJustRight)) {
|
if (justStr.EqualsASCII(kJustRight)) {
|
||||||
aJust = nsIPrintSettings::kJustRight;
|
aJust = nsIPrintSettings::kJustRight;
|
||||||
} else if (justStr.EqualsASCII(kJustCenter)) {
|
} else if (justStr.EqualsASCII(kJustCenter)) {
|
||||||
|
@ -1192,15 +1192,15 @@ nsPrintOptions::WriteJustification(const char * aPrefId, PRInt16 aJust)
|
||||||
{
|
{
|
||||||
switch (aJust) {
|
switch (aJust) {
|
||||||
case nsIPrintSettings::kJustLeft:
|
case nsIPrintSettings::kJustLeft:
|
||||||
Preferences::SetCString(aPrefId, kJustLeft);
|
Preferences::SetChar(aPrefId, kJustLeft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsIPrintSettings::kJustCenter:
|
case nsIPrintSettings::kJustCenter:
|
||||||
Preferences::SetCString(aPrefId, kJustCenter);
|
Preferences::SetChar(aPrefId, kJustCenter);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsIPrintSettings::kJustRight:
|
case nsIPrintSettings::kJustRight:
|
||||||
Preferences::SetCString(aPrefId, kJustRight);
|
Preferences::SetChar(aPrefId, kJustRight);
|
||||||
break;
|
break;
|
||||||
} //switch
|
} //switch
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ void
|
||||||
nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
|
nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
|
||||||
{
|
{
|
||||||
nsAutoString colorStr;
|
nsAutoString colorStr;
|
||||||
nsresult rv = Preferences::GetString(prefName, &colorStr);
|
nsresult rv = Preferences::GetChar(prefName, &colorStr);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ void
|
||||||
nsXPLookAndFeel::InitColorFromPref(PRInt32 i)
|
nsXPLookAndFeel::InitColorFromPref(PRInt32 i)
|
||||||
{
|
{
|
||||||
nsAutoString colorStr;
|
nsAutoString colorStr;
|
||||||
nsresult rv = Preferences::GetString(sColorPrefs[i], &colorStr);
|
nsresult rv = Preferences::GetChar(sColorPrefs[i], &colorStr);
|
||||||
if (NS_FAILED(rv) || colorStr.IsEmpty()) {
|
if (NS_FAILED(rv) || colorStr.IsEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче