mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 659820 part.4 Replace nsContentUtils::Get(Char|String)Pref() with Preferences::GetC?String() r=roc
This commit is contained in:
parent
626032a54d
commit
1f171993d1
@ -561,9 +561,7 @@ public:
|
||||
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
|
||||
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,
|
||||
PrefChangedFunc aCallback,
|
||||
void * aClosure);
|
||||
|
@ -2597,19 +2597,6 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
|
||||
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)
|
||||
@ -2628,24 +2615,6 @@ nsContentUtils::GetLocalizedStringPref(const char *aPref)
|
||||
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
|
||||
// with c-style observers.
|
||||
|
||||
|
@ -57,6 +57,9 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsDOMPopStateEvent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static const char* const sEventNames[] = {
|
||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||
@ -1088,8 +1091,7 @@ nsDOMEvent::PopupAllowedEventsChanged()
|
||||
nsMemory::Free(sPopupAllowedEvents);
|
||||
}
|
||||
|
||||
nsAdoptingCString str =
|
||||
nsContentUtils::GetCharPref("dom.popup_allowed_events");
|
||||
nsAdoptingCString str = Preferences::GetCString("dom.popup_allowed_events");
|
||||
|
||||
// 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.
|
||||
|
@ -59,6 +59,9 @@ extern "C" {
|
||||
}
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#define SA_PER_STREAM_VOLUME 1
|
||||
@ -321,8 +324,7 @@ static mozilla::Mutex* gVolumeScaleLock = nsnull;
|
||||
static double gVolumeScale = 1.0;
|
||||
|
||||
static int VolumeScaleChanged(const char* aPref, void *aClosure) {
|
||||
nsAdoptingString value =
|
||||
nsContentUtils::GetStringPref("media.volume_scale");
|
||||
nsAdoptingString value = Preferences::GetString("media.volume_scale");
|
||||
mozilla::MutexAutoLock lock(*gVolumeScaleLock);
|
||||
if (value.IsEmpty()) {
|
||||
gVolumeScale = 1.0;
|
||||
|
@ -70,6 +70,9 @@
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static nsINativeKeyBindings *sNativeEditorBindings = nsnull;
|
||||
|
||||
@ -124,7 +127,7 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
|
||||
getter_AddRefs(mHTMLBindings));
|
||||
|
||||
const nsAdoptingCString& userHTMLBindingStr =
|
||||
nsContentUtils::GetCharPref("dom.userHTMLBindings.uri");
|
||||
Preferences::GetCString("dom.userHTMLBindings.uri");
|
||||
if (!userHTMLBindingStr.IsEmpty()) {
|
||||
NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
|
||||
if (!bindingURI) {
|
||||
|
@ -920,8 +920,8 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
}
|
||||
|
||||
if (gDumpFile == nsnull) {
|
||||
const nsAdoptingCString& fname =
|
||||
nsContentUtils::GetCharPref("browser.dom.window.dump.file");
|
||||
const nsAdoptingCString& fname =
|
||||
Preferences::GetCString("browser.dom.window.dump.file");
|
||||
if (!fname.IsEmpty()) {
|
||||
// if this fails to open, Dump() knows to just go to stdout
|
||||
// on null.
|
||||
@ -10547,11 +10547,11 @@ nsresult
|
||||
NS_GetNavigatorPlatform(nsAString& aPlatform)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.platform.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.platform.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aPlatform);
|
||||
aPlatform = override;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -10591,11 +10591,11 @@ nsresult
|
||||
NS_GetNavigatorAppVersion(nsAString& aAppVersion)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.appversion.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.appversion.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aAppVersion);
|
||||
aAppVersion = override;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -10628,11 +10628,11 @@ nsresult
|
||||
NS_GetNavigatorAppName(nsAString& aAppName)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.appname.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.appname.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aAppName);
|
||||
aAppName = override;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -10736,11 +10736,11 @@ NS_IMETHODIMP
|
||||
nsNavigator::GetOscpu(nsAString& aOSCPU)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.oscpu.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.oscpu.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aOSCPU);
|
||||
aOSCPU = override;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -10791,21 +10791,21 @@ NS_IMETHODIMP
|
||||
nsNavigator::GetProductSub(nsAString& aProductSub)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.productSub.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.productSub.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aProductSub);
|
||||
aProductSub = override;
|
||||
return NS_OK;
|
||||
} else {
|
||||
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
|
||||
const nsAdoptingCString& override2 =
|
||||
nsContentUtils::GetCharPref("general.useragent.productSub");
|
||||
}
|
||||
|
||||
if (override2) {
|
||||
CopyUTF8toUTF16(override2, aProductSub);
|
||||
return NS_OK;
|
||||
}
|
||||
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
|
||||
const nsAdoptingString& override2 =
|
||||
Preferences::GetString("general.useragent.productSub");
|
||||
|
||||
if (override2) {
|
||||
aProductSub = override2;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10878,11 +10878,11 @@ NS_IMETHODIMP
|
||||
nsNavigator::GetBuildID(nsAString& aBuildID)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
const nsAdoptingCString& override =
|
||||
nsContentUtils::GetCharPref("general.buildID.override");
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.buildID.override");
|
||||
|
||||
if (override) {
|
||||
CopyUTF8toUTF16(override, aBuildID);
|
||||
aBuildID = override;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -125,14 +125,14 @@ using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static nscolor
|
||||
MakeColorPref(const char *colstr)
|
||||
MakeColorPref(const nsCString& aColor)
|
||||
{
|
||||
PRUint32 red, green, blue;
|
||||
nscolor colorref;
|
||||
|
||||
// 4.x stored RGB color values as a string rather than as an int,
|
||||
// thus we need to do this conversion
|
||||
PR_sscanf(colstr, "#%02x%02x%02x", &red, &green, &blue);
|
||||
PR_sscanf(aColor.get(), "#%02x%02x%02x", &red, &green, &blue);
|
||||
colorref = NS_RGB(red, green, blue);
|
||||
return colorref;
|
||||
}
|
||||
@ -471,7 +471,7 @@ nsPresContext::GetFontPreferences()
|
||||
PRInt32 unit = eUnit_px;
|
||||
|
||||
nsAdoptingCString cvalue =
|
||||
nsContentUtils::GetCharPref("font.size.unit");
|
||||
Preferences::GetCString("font.size.unit");
|
||||
|
||||
if (!cvalue.IsEmpty()) {
|
||||
if (cvalue.Equals("px")) {
|
||||
@ -521,14 +521,13 @@ nsPresContext::GetFontPreferences()
|
||||
if (eType == eDefaultFont_Variable) {
|
||||
MAKE_FONT_PREF_KEY(pref, "font.name", generic_dot_langGroup);
|
||||
|
||||
nsAdoptingString value =
|
||||
nsContentUtils::GetStringPref(pref.get());
|
||||
nsAdoptingString value = Preferences::GetString(pref.get());
|
||||
if (!value.IsEmpty()) {
|
||||
font->name.Assign(value);
|
||||
}
|
||||
else {
|
||||
MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);
|
||||
value = nsContentUtils::GetStringPref(pref.get());
|
||||
value = Preferences::GetString(pref.get());
|
||||
if (!value.IsEmpty()) {
|
||||
mDefaultVariableFont.name.Assign(value);
|
||||
}
|
||||
@ -570,7 +569,7 @@ nsPresContext::GetFontPreferences()
|
||||
// get font.size-adjust.[generic].[langGroup]
|
||||
// XXX only applicable on GFX ports that handle |font-size-adjust|
|
||||
MAKE_FONT_PREF_KEY(pref, "font.size-adjust", generic_dot_langGroup);
|
||||
cvalue = nsContentUtils::GetCharPref(pref.get());
|
||||
cvalue = Preferences::GetCString(pref.get());
|
||||
if (!cvalue.IsEmpty()) {
|
||||
font->sizeAdjust = (float)atof(cvalue.get());
|
||||
}
|
||||
@ -609,14 +608,13 @@ nsPresContext::GetDocumentColorPreferences()
|
||||
|
||||
if (usePrefColors) {
|
||||
nsAdoptingCString colorStr =
|
||||
nsContentUtils::GetCharPref("browser.display.foreground_color");
|
||||
Preferences::GetCString("browser.display.foreground_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mDefaultColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr =
|
||||
nsContentUtils::GetCharPref("browser.display.background_color");
|
||||
colorStr = Preferences::GetCString("browser.display.background_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mBackgroundColor = MakeColorPref(colorStr);
|
||||
@ -668,21 +666,19 @@ nsPresContext::GetUserPreferences()
|
||||
mUnderlineLinks =
|
||||
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
|
||||
|
||||
nsAdoptingCString colorStr =
|
||||
nsContentUtils::GetCharPref("browser.anchor_color");
|
||||
nsAdoptingCString colorStr = Preferences::GetCString("browser.anchor_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mLinkColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr =
|
||||
nsContentUtils::GetCharPref("browser.active_color");
|
||||
colorStr = Preferences::GetCString("browser.active_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mActiveLinkColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr = nsContentUtils::GetCharPref("browser.visited_color");
|
||||
colorStr = Preferences::GetCString("browser.visited_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mVisitedLinkColor = MakeColorPref(colorStr);
|
||||
@ -694,14 +690,13 @@ nsPresContext::GetUserPreferences()
|
||||
mFocusTextColor = mDefaultColor;
|
||||
mFocusBackgroundColor = mBackgroundColor;
|
||||
|
||||
colorStr = nsContentUtils::GetCharPref("browser.display.focus_text_color");
|
||||
colorStr = Preferences::GetCString("browser.display.focus_text_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mFocusTextColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr =
|
||||
nsContentUtils::GetCharPref("browser.display.focus_background_color");
|
||||
colorStr = Preferences::GetCString("browser.display.focus_background_color");
|
||||
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mFocusBackgroundColor = MakeColorPref(colorStr);
|
||||
@ -730,7 +725,7 @@ nsPresContext::GetUserPreferences()
|
||||
|
||||
// * image animation
|
||||
const nsAdoptingCString& animatePref =
|
||||
nsContentUtils::GetCharPref("image.animation_mode");
|
||||
Preferences::GetCString("image.animation_mode");
|
||||
if (animatePref.Equals("normal"))
|
||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||
else if (animatePref.Equals("none"))
|
||||
|
@ -4052,7 +4052,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
|
||||
// "plugins.force.wmode" preference is forcing wmode type for plugins
|
||||
// possible values - "opaque", "transparent", "windowed"
|
||||
nsAdoptingCString wmodeType = nsContentUtils::GetCharPref("plugins.force.wmode");
|
||||
nsAdoptingCString wmodeType = Preferences::GetCString("plugins.force.wmode");
|
||||
if (!wmodeType.IsEmpty()) {
|
||||
mNumCachedAttrs++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user