Bug 659533 Replace nsContentUtils::GetBoolPref() with Preferences::GetBool() r=roc

This commit is contained in:
Masayuki Nakano 2011-05-25 15:31:59 +09:00
parent 22fc5a364b
commit caee4cc73f
47 changed files with 265 additions and 183 deletions

View File

@ -551,8 +551,6 @@ public:
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
static nsAdoptingCString GetCharPref(const char *aPref);
static PRPackedBool GetBoolPref(const char *aPref,
PRBool aDefault = PR_FALSE);
static PRInt32 GetIntPref(const char *aPref, PRInt32 aDefault = 0);
static nsAdoptingString GetLocalizedStringPref(const char *aPref);
static nsAdoptingString GetStringPref(const char *aPref);

View File

@ -211,8 +211,11 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla;
const char kLoadAsData[] = "loadAsData";
@ -2608,20 +2611,6 @@ nsContentUtils::GetCharPref(const char *aPref)
return result;
}
// static
PRPackedBool
nsContentUtils::GetBoolPref(const char *aPref, PRBool aDefault)
{
PRBool result;
if (!sPrefBranch ||
NS_FAILED(sPrefBranch->GetBoolPref(aPref, &result))) {
result = aDefault;
}
return (PRPackedBool)result;
}
// static
PRInt32
nsContentUtils::GetIntPref(const char *aPref, PRInt32 aDefault)
@ -2734,8 +2723,8 @@ BoolVarChanged(const char *aPref, void *aClosure)
{
PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
*((PRBool*)cache->cacheLocation) =
nsContentUtils::GetBoolPref(aPref, cache->defaultValueBool);
Preferences::GetBool(aPref, cache->defaultValueBool);
return 0;
}
@ -2744,7 +2733,7 @@ nsContentUtils::AddBoolPrefVarCache(const char *aPref,
PRBool* aCache,
PRBool aDefault)
{
*aCache = GetBoolPref(aPref, aDefault);
*aCache = Preferences::GetBool(aPref, aDefault);
PrefCacheData* data = new PrefCacheData;
data->cacheLocation = aCache;
data->defaultValueBool = aDefault;

View File

@ -203,6 +203,9 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "nsXULAppAPI.h"
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
typedef nsTArray<Link*> LinkArray;
@ -8261,7 +8264,7 @@ nsresult
nsDocument::SetImageLockingState(PRBool aLocked)
{
if (XRE_GetProcessType() == GeckoProcessType_Content &&
!nsContentUtils::GetBoolPref("content.image.allow_locking", PR_TRUE)) {
!Preferences::GetBool("content.image.allow_locking", PR_TRUE)) {
return NS_OK;
}

View File

@ -57,6 +57,9 @@
#include "nsICharsetConverterManager.h"
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define REPLACEMENT_CHAR (PRUnichar)0xFFFD
#define BOM_CHAR (PRUnichar)0xFEFF
@ -775,7 +778,7 @@ nsEventSource::GetInterface(const nsIID & aIID,
PRBool
nsEventSource::PrefEnabled()
{
return nsContentUtils::GetBoolPref("dom.server-events.enabled", PR_FALSE);
return Preferences::GetBool("dom.server-events.enabled", PR_FALSE);
}
nsresult

View File

@ -114,6 +114,8 @@
#include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -1346,8 +1348,8 @@ nsFrameLoader::ShouldUseRemoteProcess()
return false;
}
PRBool remoteDisabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.disabled",
PR_FALSE);
PRBool remoteDisabled =
Preferences::GetBool("dom.ipc.tabs.disabled", PR_FALSE);
if (remoteDisabled) {
return false;
}
@ -1366,8 +1368,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
return true;
}
PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
PR_FALSE);
PRBool remoteEnabled = Preferences::GetBool("dom.ipc.tabs.enabled", PR_FALSE);
return (bool) remoteEnabled;
}

View File

@ -58,7 +58,9 @@
#include "nsCRT.h"
#include "nsIParserService.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define PREF_STRUCTS "converter.html2txt.structs"
@ -206,28 +208,27 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
if (mFlags & nsIDocumentEncoder::OutputFormatted) {
// Get some prefs that controls how we do formatted output
mStructs = nsContentUtils::GetBoolPref(PREF_STRUCTS, mStructs);
mStructs = Preferences::GetBool(PREF_STRUCTS, mStructs);
mHeaderStrategy =
nsContentUtils::GetIntPref(PREF_HEADER_STRATEGY, mHeaderStrategy);
// The quotesPreformatted pref is a temporary measure. See bug 69638.
mQuotesPreformatted =
nsContentUtils::GetBoolPref("editor.quotesPreformatted",
mQuotesPreformatted);
Preferences::GetBool("editor.quotesPreformatted", mQuotesPreformatted);
// DontWrapAnyQuotes is set according to whether plaintext mail
// is wrapping to window width -- see bug 134439.
// We'll only want this if we're wrapping and formatted.
if (mFlags & nsIDocumentEncoder::OutputWrap || mWrapColumn > 0) {
mDontWrapAnyQuotes =
nsContentUtils::GetBoolPref("mail.compose.wrap_to_window_width",
mDontWrapAnyQuotes);
Preferences::GetBool("mail.compose.wrap_to_window_width",
mDontWrapAnyQuotes);
}
}
// XXX We should let the caller pass this in.
if (nsContentUtils::GetBoolPref("browser.frames.enabled")) {
if (Preferences::GetBool("browser.frames.enabled")) {
mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
}
else {

View File

@ -75,6 +75,7 @@
#include "nsIWebSocketProtocol.h"
#include "nsILoadGroup.h"
#include "nsIRequest.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -902,7 +903,7 @@ nsWebSocket::CreateAndDispatchCloseEvent(PRBool aWasClean)
PRBool
nsWebSocket::PrefEnabled()
{
return nsContentUtils::GetBoolPref("network.websocket.enabled", PR_TRUE);
return Preferences::GetBool("network.websocket.enabled", PR_TRUE);
}
void

View File

@ -41,6 +41,9 @@
#include "nsIClassInfo.h"
#include "nsIXPCScriptable.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
DOMCI_DATA(Touch, nsDOMTouch)
@ -323,7 +326,7 @@ nsDOMTouchEvent::PrefEnabled()
static PRBool sPrefValue = PR_FALSE;
if (!sDidCheckPref) {
sDidCheckPref = PR_TRUE;
sPrefValue = nsContentUtils::GetBoolPref("dom.w3c_touch_events.enabled", PR_FALSE);
sPrefValue = Preferences::GetBool("dom.w3c_touch_events.enabled", PR_FALSE);
if (sPrefValue) {
nsContentUtils::InitializeTouchEventTable();
}

View File

@ -154,10 +154,13 @@
#include "mozilla/Services.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
#ifdef XP_MACOSX
#import <ApplicationServices/ApplicationServices.h>
#endif
using namespace mozilla;
using namespace mozilla::dom;
//#define DEBUG_DOCSHELL_FOCUS
@ -584,7 +587,7 @@ nsMouseWheelTransaction::OnFailToScrollTarget()
{
NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
sTargetFrame->GetContent()->GetOwnerDoc(),
@ -612,7 +615,7 @@ nsMouseWheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
// the next DOM event might create strange situation for us.
EndTransaction();
if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
frame->GetContent()->GetOwnerDoc(),
@ -843,8 +846,8 @@ nsEventStateManager::Init()
if (prefBranch) {
if (sESMInstanceCount == 1) {
sLeftClickOnly =
nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
sChromeAccessModifier =
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
sContentAccessModifier =
@ -875,7 +878,7 @@ nsEventStateManager::Init()
}
mClickHoldContextMenu =
nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
return NS_OK;
}
@ -968,12 +971,12 @@ nsEventStateManager::Observe(nsISupports *aSubject,
nsDependentString data(someData);
if (data.EqualsLiteral("accessibility.accesskeycausesactivation")) {
sKeyCausesActivation =
nsContentUtils::GetBoolPref("accessibility.accesskeycausesactivation",
sKeyCausesActivation);
Preferences::GetBool("accessibility.accesskeycausesactivation",
sKeyCausesActivation);
} else if (data.EqualsLiteral("nglayout.events.dispatchLeftClickOnly")) {
sLeftClickOnly =
nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
} else if (data.EqualsLiteral("ui.key.generalAccessKey")) {
sChromeAccessModifier =
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
@ -987,7 +990,7 @@ nsEventStateManager::Observe(nsISupports *aSubject,
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeContent);
} else if (data.EqualsLiteral("ui.click_hold_context_menus")) {
mClickHoldContextMenu =
nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
#if 0
} else if (data.EqualsLiteral("mousewheel.withaltkey.action")) {
} else if (data.EqualsLiteral("mousewheel.withaltkey.numlines")) {
@ -2464,10 +2467,11 @@ nsEventStateManager::DoScrollZoom(nsIFrame *aTargetFrame,
// positive adjustment to decrease zoom, negative to increase
PRInt32 change = (adjustment > 0) ? -1 : 1;
if (nsContentUtils::GetBoolPref("browser.zoom.full"))
if (Preferences::GetBool("browser.zoom.full")) {
ChangeFullZoom(change);
else
} else {
ChangeTextSize(change);
}
}
}
@ -2628,7 +2632,7 @@ nsEventStateManager::UseSystemScrollSettingFor(nsMouseScrollEvent* aMouseEvent)
nsCAutoString prefName;
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
prefName.Append(".sysnumlines");
return nsContentUtils::GetBoolPref(prefName.get());
return Preferences::GetBool(prefName.get());
}
nsresult
@ -3467,7 +3471,7 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
hotspotY = framecursor.mHotspotY;
}
if (nsContentUtils::GetBoolPref("ui.use_activity_cursor", PR_FALSE)) {
if (Preferences::GetBool("ui.use_activity_cursor", PR_FALSE)) {
// Check whether or not to show the busy cursor
nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));

View File

@ -116,6 +116,9 @@
#include "mozilla/dom/Element.h"
#include "nsHTMLFieldSetElement.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#include "nsThreadUtils.h"
@ -2545,7 +2548,7 @@ nsGenericHTMLFormElement::BindToTree(nsIDocument* aDocument,
// the document should not be already loaded and the "browser.autofocus"
// preference should be 'true'.
if (IsAutofocusable() && HasAttr(kNameSpaceID_None, nsGkAtoms::autofocus) &&
nsContentUtils::GetBoolPref("browser.autofocus", PR_TRUE)) {
Preferences::GetBool("browser.autofocus", PR_TRUE)) {
nsCOMPtr<nsIRunnable> event = new nsAutoFocusEvent(this);
rv = NS_DispatchToCurrentThread(event);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -62,6 +62,9 @@
#include "nsIObserverService.h"
#include "mozilla/dom/Link.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::net;
@ -99,7 +102,7 @@ nsHTMLDNSPrefetch::Initialize()
// Default is false, so we need an explicit call to prime the cache.
sDisablePrefetchHTTPSPref =
nsContentUtils::GetBoolPref("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
Preferences::GetBool("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
NS_IF_RELEASE(sDNSService);
nsresult rv;

View File

@ -75,7 +75,9 @@
#include "nsEventDispatcher.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
// XXX nav attrs: suppress
@ -500,7 +502,7 @@ nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
if (Preferences::GetBool("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return NS_OK;
}

View File

@ -119,6 +119,9 @@ static PRLogModuleInfo* gMediaElementEventsLog;
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -838,7 +841,7 @@ void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
static PRBool IsAutoplayEnabled()
{
return nsContentUtils::GetBoolPref("media.autoplay.enabled");
return Preferences::GetBool("media.autoplay.enabled");
}
void nsHTMLMediaElement::UpdatePreloadAction()
@ -1536,7 +1539,7 @@ static const char* gRawCodecs[] = {
static PRBool IsRawEnabled()
{
return nsContentUtils::GetBoolPref("media.raw.enabled");
return Preferences::GetBool("media.raw.enabled");
}
static PRBool IsRawType(const nsACString& aType)
@ -1568,7 +1571,7 @@ char const *const nsHTMLMediaElement::gOggCodecs[3] = {
bool
nsHTMLMediaElement::IsOggEnabled()
{
return nsContentUtils::GetBoolPref("media.ogg.enabled");
return Preferences::GetBool("media.ogg.enabled");
}
bool
@ -1603,7 +1606,7 @@ char const *const nsHTMLMediaElement::gWaveCodecs[2] = {
bool
nsHTMLMediaElement::IsWaveEnabled()
{
return nsContentUtils::GetBoolPref("media.wave.enabled");
return Preferences::GetBool("media.wave.enabled");
}
bool
@ -1635,7 +1638,7 @@ char const *const nsHTMLMediaElement::gWebMCodecs[4] = {
bool
nsHTMLMediaElement::IsWebMEnabled()
{
return nsContentUtils::GetBoolPref("media.webm.enabled");
return Preferences::GetBool("media.webm.enabled");
}
bool
@ -2083,8 +2086,7 @@ void nsHTMLMediaElement::DownloadStalled()
PRBool nsHTMLMediaElement::ShouldCheckAllowOrigin()
{
return nsContentUtils::GetBoolPref("media.enforce_same_site_origin",
PR_TRUE);
return Preferences::GetBool("media.enforce_same_site_origin", PR_TRUE);
}
void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)

View File

@ -74,7 +74,9 @@
#include "nsThreadUtils.h"
#include "nsIScrollableFrame.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
@ -288,10 +290,8 @@ nsImageDocument::Init()
nsresult rv = nsMediaDocument::Init();
NS_ENSURE_SUCCESS(rv, rv);
mResizeImageByDefault =
nsContentUtils::GetBoolPref(AUTOMATIC_IMAGE_RESIZING_PREF);
mClickResizingEnabled =
nsContentUtils::GetBoolPref(CLICK_IMAGE_RESIZING_PREF);
mResizeImageByDefault = Preferences::GetBool(AUTOMATIC_IMAGE_RESIZING_PREF);
mClickResizingEnabled = Preferences::GetBool(CLICK_IMAGE_RESIZING_PREF);
mShouldResize = mResizeImageByDefault;
mFirstResize = PR_TRUE;
@ -316,8 +316,7 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
}
mOriginalZoomLevel =
nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
1.0 : GetZoomLevel();
Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
NS_ASSERTION(aDocListener, "null aDocListener");
*aDocListener = new ImageListener(this);
@ -398,8 +397,7 @@ nsImageDocument::OnPageShow(PRBool aPersisted,
{
if (aPersisted) {
mOriginalZoomLevel =
nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
1.0 : GetZoomLevel();
Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
}
nsMediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
}

View File

@ -43,6 +43,7 @@
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxContext.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -170,7 +171,7 @@ nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
if (Preferences::GetBool("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return NS_OK;
}

View File

@ -52,7 +52,9 @@
#include "nsIDOMDocumentFragment.h"
#include "nsBindingManager.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
@ -114,7 +116,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
}
// check the pref
if (!nsContentUtils::GetBoolPref("layout.xml.prettyprint", PR_TRUE)) {
if (!Preferences::GetBool("layout.xml.prettyprint", PR_TRUE)) {
return NS_OK;
}

View File

@ -70,6 +70,7 @@
#include "nsFrameManager.h"
#include "nsHTMLReflowState.h"
#include "nsIObjectLoadingContent.h"
#include "mozilla/Preferences.h"
// for event firing in context menus
#include "nsPresContext.h"
@ -80,6 +81,8 @@
#include "nsDOMError.h"
#include "nsIMenuFrame.h"
using namespace mozilla;
// on win32 and os/2, context menus come up on mouse up. On other platforms,
// they appear on mouse down. Certain bits of code care about this difference.
#if !defined(XP_WIN) && !defined(XP_OS2)
@ -175,7 +178,7 @@ nsXULPopupListener::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
// Someone called preventDefault on a context menu.
// Let's make sure they are allowed to do so.
PRBool eventEnabled =
nsContentUtils::GetBoolPref("dom.event.contextmenu.enabled", PR_TRUE);
Preferences::GetBool("dom.event.contextmenu.enabled", PR_TRUE);
if (!eventEnabled) {
// If the target node is for plug-in, we should not open XUL context
// menu on windowless plug-ins.

View File

@ -63,6 +63,10 @@
#include "jsxdrapi.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
static PRBool gDisableXULCache = PR_FALSE; // enabled by default
@ -74,7 +78,7 @@ static int
DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
{
gDisableXULCache =
nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
// Flush the cache, regardless
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
@ -132,7 +136,7 @@ NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
// XXX Ignore return values.
gDisableXULCache =
nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
nsContentUtils::RegisterPrefCallback(kDisableXULCachePref,
DisableXULCacheChangedCallback,
nsnull);
@ -596,8 +600,7 @@ FastLoadPrefChangedCallback(const char* aPref, void* aClosure)
{
PRBool wasEnabled = !gDisableXULFastLoad;
gDisableXULFastLoad =
nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
gDisableXULFastLoad);
Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
if (wasEnabled && gDisableXULFastLoad) {
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
@ -609,8 +612,8 @@ FastLoadPrefChangedCallback(const char* aPref, void* aClosure)
}
gChecksumXULFastLoadFile =
nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
Preferences::GetBool(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
return 0;
}
@ -725,11 +728,10 @@ nsXULPrototypeCache::StartFastLoad(nsIURI* aURI)
return NS_ERROR_FAILURE;
gDisableXULFastLoad =
nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
gDisableXULFastLoad);
Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
gChecksumXULFastLoadFile =
nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
Preferences::GetBool(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
nsContentUtils::RegisterPrefCallback(kDisableXULFastLoadPref,
FastLoadPrefChangedCallback,
nsnull);

View File

@ -93,6 +93,7 @@
#include "nsContentUtils.h"
#include "nsDOMWindowUtils.h"
#include "nsIDOMGlobalPropertyInitializer.h"
#include "mozilla/Preferences.h"
// Window scriptable helper includes
#include "nsIDocShell.h"
@ -516,6 +517,7 @@
#include "nsDOMTouchEvent.h"
#include "nsIDOMCustomEvent.h"
using namespace mozilla;
using namespace mozilla::dom;
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
@ -4432,10 +4434,10 @@ nsDOMClassInfo::Init()
RegisterExternalClasses();
sDisableDocumentAllSupport =
nsContentUtils::GetBoolPref("browser.dom.document.all.disabled");
Preferences::GetBool("browser.dom.document.all.disabled");
sDisableGlobalScopePollutionSupport =
nsContentUtils::GetBoolPref("browser.dom.global_scope_pollution.disabled");
Preferences::GetBool("browser.dom.global_scope_pollution.disabled");
sIsInitialized = PR_TRUE;

View File

@ -85,12 +85,14 @@
#include "nsIPrincipal.h"
#include "mozilla/dom/Element.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_XUL
#include "nsIDOMXULTextboxElement.h"
#include "nsIDOMXULMenuListElement.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
//#define DEBUG_FOCUS 1
@ -188,11 +190,11 @@ nsFocusManager::Init()
sInstance = fm;
nsIContent::sTabFocusModelAppliesToXUL =
nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
sMouseFocusesFormControl =
nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
Preferences::GetBool("accessibility.mouse_focuses_formcontrol", PR_FALSE);
nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
if (prefBranch) {
@ -228,12 +230,13 @@ nsFocusManager::Observe(nsISupports *aSubject,
}
else if (data.EqualsLiteral("accessibility.tabfocus_applies_to_xul")) {
nsIContent::sTabFocusModelAppliesToXUL =
nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
}
else if (data.EqualsLiteral("accessibility.mouse_focuses_formcontrol")) {
sMouseFocusesFormControl =
nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
Preferences::GetBool("accessibility.mouse_focuses_formcontrol",
PR_FALSE);
}
} else if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
mActiveWindow = nsnull;
@ -1955,7 +1958,7 @@ nsFocusManager::UpdateCaret(PRBool aMoveCaretToFocus,
return; // Never browse with caret in chrome
PRPackedBool browseWithCaret =
nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
Preferences::GetBool("accessibility.browsewithcaret");
nsCOMPtr<nsIPresShell> presShell;
focusedDocShell->GetPresShell(getter_AddRefs(presShell));

View File

@ -69,6 +69,7 @@
#include "nsJSEnvironment.h"
#include "nsCharSeparatedTokenizer.h" // for Accept-Language parsing
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
// Other Classes
#include "nsIEventListenerManager.h"
@ -244,6 +245,7 @@ static PRLogModuleInfo* gDOMLeakPRLog;
static const char kStorageEnabled[] = "dom.storage.enabled";
using namespace mozilla;
using namespace mozilla::dom;
using mozilla::TimeStamp;
using mozilla::TimeDuration;
@ -5077,7 +5079,7 @@ nsGlobalWindow::Print()
nsCOMPtr<nsIPrintSettings> printSettings;
if (printSettingsService) {
PRBool printSettingsAreGlobal =
nsContentUtils::GetBoolPref("print.use_global_printsettings", PR_FALSE);
Preferences::GetBool("print.use_global_printsettings", PR_FALSE);
if (printSettingsAreGlobal) {
printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings));
@ -5101,7 +5103,7 @@ nsGlobalWindow::Print()
LeaveModalState(callerWin);
PRBool savePrintSettings =
nsContentUtils::GetBoolPref("print.save_print_settings", PR_FALSE);
Preferences::GetBool("print.save_print_settings", PR_FALSE);
if (printSettingsAreGlobal && savePrintSettings) {
printSettingsService->
SavePrintSettingsToPrefs(printSettings,
@ -5551,7 +5553,7 @@ nsGlobalWindow::CanSetProperty(const char *aPrefName)
// If the pref is set to true, we can not set the property
// and vice versa.
return !nsContentUtils::GetBoolPref(aPrefName, PR_TRUE);
return !Preferences::GetBool(aPrefName, PR_TRUE);
}
PRBool
@ -6187,8 +6189,7 @@ nsGlobalWindow::Close()
// that were not opened by script
if (!mHadOriginalOpener && !nsContentUtils::IsCallerTrustedForWrite()) {
PRBool allowClose =
nsContentUtils::GetBoolPref("dom.allow_scripts_to_close_windows",
PR_TRUE);
Preferences::GetBool("dom.allow_scripts_to_close_windows", PR_TRUE);
if (!allowClose) {
// We're blocking the close operation
// report localized error msg in JS console
@ -7844,8 +7845,9 @@ nsGlobalWindow::DispatchSyncPopState()
"Must be safe to run script here.");
// Check that PopState hasn't been pref'ed off.
if (!nsContentUtils::GetBoolPref(sPopStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sPopStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsresult rv = NS_OK;
@ -8022,7 +8024,7 @@ nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
return NS_OK;
}
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aSessionStorage = nsnull;
return NS_OK;
}
@ -8086,7 +8088,7 @@ nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
NS_ENSURE_ARG_POINTER(aGlobalStorage);
#ifdef MOZ_STORAGE
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aGlobalStorage = nsnull;
return NS_OK;
}
@ -8112,7 +8114,7 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
NS_ENSURE_ARG(aLocalStorage);
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aLocalStorage = nsnull;
return NS_OK;
}
@ -10067,6 +10069,13 @@ nsGlobalWindow::GetURL(nsIDOMMozURLProperty** aURL)
return NS_OK;
}
// static
bool
nsGlobalWindow::HasIndexedDBSupport()
{
return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE);
}
// nsGlobalChromeWindow implementation
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
@ -10975,7 +10984,7 @@ nsNavigator::RefreshMIMEArray()
bool
nsNavigator::HasDesktopNotificationSupport()
{
return nsContentUtils::GetBoolPref("notification.feature.enabled", PR_FALSE);
return Preferences::GetBool("notification.feature.enabled", PR_FALSE);
}
//*****************************************************************************

View File

@ -109,7 +109,6 @@
#include "nsIIDBFactory.h"
#include "nsFrameMessageManager.h"
#include "mozilla/TimeStamp.h"
#include "nsContentUtils.h"
// JS includes
#include "jsapi.h"
@ -568,9 +567,7 @@ public:
return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
}
static bool HasIndexedDBSupport() {
return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
}
static bool HasIndexedDBSupport();
private:
// Enable updates for the accelerometer.

View File

@ -44,7 +44,7 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "nsIControllerCommandTable.h"
#include "nsICommandParams.h"
@ -64,6 +64,8 @@
#include "nsIClipboardDragDropHooks.h"
#include "nsIClipboardDragDropHookList.h"
using namespace mozilla;
const char * const sSelectAllString = "cmd_selectAll";
const char * const sSelectNoneString = "cmd_selectNone";
const char * const sCopyImageLocationString = "cmd_copyImageLocation";
@ -246,7 +248,7 @@ nsSelectMoveScrollCommand::DoSelectCommand(const char *aCommandName, nsIDOMWindo
PRBool caretOn = PR_FALSE;
selCont->GetCaretEnabled(&caretOn);
if (!caretOn) {
caretOn = nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
caretOn = Preferences::GetBool("accessibility.browsewithcaret");
if (caretOn) {
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
if (piWindow) {

View File

@ -60,6 +60,9 @@
#include "nsContentUtils.h"
#include "nsIDOMNSDocument.h"
#include "nsISHistoryInternal.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static const char* sAllowPushStatePrefStr =
"browser.history.allowPushState";
@ -287,8 +290,9 @@ nsHistory::PushState(nsIVariant *aData, const nsAString& aTitle,
const nsAString& aURL, JSContext* aCx)
{
// Check that PushState hasn't been pref'ed off.
if (!nsContentUtils::GetBoolPref(sAllowPushStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sAllowPushStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win)
@ -316,8 +320,9 @@ nsHistory::ReplaceState(nsIVariant *aData, const nsAString& aTitle,
const nsAString& aURL, JSContext* aCx)
{
// Check that ReplaceState hasn't been pref'ed off
if (!nsContentUtils::GetBoolPref(sAllowReplaceStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sAllowReplaceStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win)

View File

@ -116,6 +116,7 @@
#include "prthread.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -926,9 +927,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
PRUint32 oldDefaultJSOptions = context->mDefaultJSOptions;
PRUint32 newDefaultJSOptions = oldDefaultJSOptions;
sPostGCEventsToConsole = nsContentUtils::GetBoolPref(js_memlog_option_str);
sPostGCEventsToConsole = Preferences::GetBool(js_memlog_option_str);
PRBool strict = nsContentUtils::GetBoolPref(js_strict_option_str);
PRBool strict = Preferences::GetBool(js_strict_option_str);
if (strict)
newDefaultJSOptions |= JSOPTION_STRICT;
else
@ -939,16 +940,16 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
// XXX components be covered by the chrome pref instead of the content one?
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
PRBool useTraceJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_tracejit_chrome_str :
js_tracejit_content_str);
PRBool useMethodJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
PRBool useProfiling = nsContentUtils::GetBoolPref(chromeWindow ?
js_profiling_chrome_str :
js_profiling_content_str);
PRBool useMethodJITAlways = nsContentUtils::GetBoolPref(js_methodjit_always_str);
PRBool useTraceJIT = Preferences::GetBool(chromeWindow ?
js_tracejit_chrome_str :
js_tracejit_content_str);
PRBool useMethodJIT = Preferences::GetBool(chromeWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
PRBool useProfiling = Preferences::GetBool(chromeWindow ?
js_profiling_chrome_str :
js_profiling_content_str);
PRBool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
PRBool safeMode = PR_FALSE;
@ -984,7 +985,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
#ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if
// javascript.options.strict.debug is true
PRBool strictDebug = nsContentUtils::GetBoolPref(js_strict_debug_option_str);
PRBool strictDebug = Preferences::GetBool(js_strict_debug_option_str);
// Note this callback is also called from context's InitClasses thus we don't
// need to enable this directly from InitContext
if (strictDebug && (newDefaultJSOptions & JSOPTION_STRICT) == 0) {
@ -993,13 +994,13 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
}
#endif
PRBool werror = nsContentUtils::GetBoolPref(js_werror_option_str);
PRBool werror = Preferences::GetBool(js_werror_option_str);
if (werror)
newDefaultJSOptions |= JSOPTION_WERROR;
else
newDefaultJSOptions &= ~JSOPTION_WERROR;
PRBool relimit = nsContentUtils::GetBoolPref(js_relimit_option_str);
PRBool relimit = Preferences::GetBool(js_relimit_option_str);
if (relimit)
newDefaultJSOptions |= JSOPTION_RELIMIT;
else
@ -3629,7 +3630,7 @@ MaxScriptRunTimePrefChangedCallback(const char *aPrefName, void *aClosure)
static int
ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRBool reportAll = nsContentUtils::GetBoolPref(aPrefName, PR_FALSE);
PRBool reportAll = Preferences::GetBool(aPrefName, PR_FALSE);
nsContentUtils::XPConnect()->SetReportAllJSExceptions(reportAll);
return 0;
}
@ -3657,7 +3658,7 @@ SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
static int
SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRBool enableCompartmentGC = nsContentUtils::GetBoolPref(aPrefName);
PRBool enableCompartmentGC = Preferences::GetBool(aPrefName);
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MODE, enableCompartmentGC
? JSGC_MODE_COMPARTMENT
: JSGC_MODE_GLOBAL);

View File

@ -51,6 +51,7 @@
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
#include "IndexedDatabaseManager.h"
@ -59,6 +60,7 @@
#define TOPIC_PERMISSIONS_PROMPT "indexedDB-permissions-prompt"
#define TOPIC_PERMISSIONS_RESPONSE "indexedDB-permissions-response"
using namespace mozilla;
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::services;
@ -71,7 +73,7 @@ GetIndexedDBPermissions(const nsACString& aASCIIOrigin,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!nsContentUtils::GetBoolPref(PREF_INDEXEDDB_ENABLED)) {
if (!Preferences::GetBool(PREF_INDEXEDDB_ENABLED)) {
return nsIPermissionManager::DENY_ACTION;
}

View File

@ -72,6 +72,7 @@
#include "nsThreadUtils.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include <math.h>
@ -91,6 +92,7 @@
#define MAX_GEO_REQUESTS_PER_WINDOW 1500
using mozilla::unused; // <snicker>
using namespace mozilla;
using namespace mozilla::dom;
class RequestPromptEvent : public nsRunnable
@ -499,15 +501,15 @@ static PRBool sGeoIgnoreLocationFilter = PR_FALSE;
static int
GeoEnabledChangedCallback(const char *aPrefName, void *aClosure)
{
sGeoEnabled = nsContentUtils::GetBoolPref("geo.enabled", PR_TRUE);
sGeoEnabled = Preferences::GetBool("geo.enabled", PR_TRUE);
return 0;
}
static int
GeoIgnoreLocationFilterChangedCallback(const char *aPrefName, void *aClosure)
{
sGeoIgnoreLocationFilter = nsContentUtils::GetBoolPref("geo.ignore.location_filter",
PR_TRUE);
sGeoIgnoreLocationFilter =
Preferences::GetBool("geo.ignore.location_filter", PR_TRUE);
return 0;
}
@ -1053,9 +1055,10 @@ nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
return true;
}
if (nsContentUtils::GetBoolPref("geo.prompt.testing", PR_FALSE))
{
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(nsContentUtils::GetBoolPref("geo.prompt.testing.allow", PR_FALSE), request);
if (Preferences::GetBool("geo.prompt.testing", PR_FALSE)) {
nsCOMPtr<nsIRunnable> ev =
new RequestAllowEvent(Preferences::GetBool("geo.prompt.testing.allow",
PR_FALSE), request);
NS_DispatchToMainThread(ev);
return true;
}

View File

@ -41,7 +41,9 @@
#include "mozilla/dom/PBrowserChild.h"
#include "TabChild.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
/* ------------------------------------------------------------------------ */
@ -109,13 +111,14 @@ nsDOMDesktopNotification::nsDOMDesktopNotification(const nsAString & title,
mOwner = aWindow;
mScriptContext = aScriptContext;
if (nsContentUtils::GetBoolPref("notification.disabled", PR_FALSE))
if (Preferences::GetBool("notification.disabled", PR_FALSE)) {
return;
}
// If we are in testing mode (running mochitests, for example)
// and we are suppose to allow requests, then just post an allow event.
if (nsContentUtils::GetBoolPref("notification.prompt.testing", PR_FALSE) &&
nsContentUtils::GetBoolPref("notification.prompt.testing.allow", PR_TRUE)) {
if (Preferences::GetBool("notification.prompt.testing", PR_FALSE) &&
Preferences::GetBool("notification.prompt.testing.allow", PR_TRUE)) {
mAllow = PR_TRUE;
return;
}

View File

@ -71,6 +71,9 @@ using mozilla::dom::StorageChild;
#include "nsDOMString.h"
#include "nsNetCID.h"
#include "nsIProxyObjectManager.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
static const PRUint32 ACCEPT_SESSION = 2;
@ -1459,8 +1462,9 @@ nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly)
NS_ASSERTION(aSessionOnly, "null session flag");
*aSessionOnly = PR_FALSE;
if (!nsContentUtils::GetBoolPref(kStorageEnabled))
if (!Preferences::GetBool(kStorageEnabled)) {
return PR_FALSE;
}
// chrome can always use storage regardless of permission preferences
if (nsContentUtils::IsCallerChrome())

View File

@ -68,6 +68,7 @@
#include "nsMenuPopupFrame.h"
#include "nsTextFragment.h"
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
// The bidi indicator hangs off the caret to one side, to show which
// direction the typing is in. It needs to be at least 2x2 to avoid looking like
@ -79,6 +80,8 @@ static const PRInt32 kMinBidiIndicatorPixels = 2;
#include "nsContentUtils.h"
#endif //IBMBIDI
using namespace mozilla;
/**
* Find the first frame in an in-order traversal of the frame subtree rooted
* at aFrame which is either a text frame logically at the end of a line,
@ -225,7 +228,7 @@ nsresult nsCaret::Init(nsIPresShell *inPresShell)
StartBlinking();
}
#ifdef IBMBIDI
mBidiUI = nsContentUtils::GetBoolPref("bidi.browser.ui");
mBidiUI = Preferences::GetBool("bidi.browser.ui");
#endif
return NS_OK;

View File

@ -112,6 +112,7 @@
#include "nsContentUtils.h"
#include "nsPIWindowRoot.h"
#include "mozilla/Preferences.h"
// Needed for Start/Stop of Image Animation
#include "imgIContainer.h"
@ -603,8 +604,7 @@ nsPresContext::GetDocumentColorPreferences()
}
if (usePrefColors) {
usePrefColors =
!nsContentUtils::GetBoolPref("browser.display.use_system_colors",
PR_FALSE);
!Preferences::GetBool("browser.display.use_system_colors", PR_FALSE);
}
if (usePrefColors) {
@ -637,8 +637,8 @@ nsPresContext::GetDocumentColorPreferences()
mBackgroundColor);
mUseDocumentColors = !useAccessibilityTheme &&
nsContentUtils::GetBoolPref("browser.display.use_document_colors",
mUseDocumentColors);
Preferences::GetBool("browser.display.use_document_colors",
mUseDocumentColors);
}
void
@ -662,12 +662,12 @@ nsPresContext::GetUserPreferences()
GetDocumentColorPreferences();
mSendAfterPaintToContent =
nsContentUtils::GetBoolPref("dom.send_after_paint_to_content",
mSendAfterPaintToContent);
Preferences::GetBool("dom.send_after_paint_to_content",
mSendAfterPaintToContent);
// * link colors
mUnderlineLinks =
nsContentUtils::GetBoolPref("browser.underline_anchors", mUnderlineLinks);
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
nsAdoptingCString colorStr =
nsContentUtils::GetCharPref("browser.anchor_color");
@ -690,8 +690,7 @@ nsPresContext::GetUserPreferences()
}
mUseFocusColors =
nsContentUtils::GetBoolPref("browser.display.use_focus_colors",
mUseFocusColors);
Preferences::GetBool("browser.display.use_focus_colors", mUseFocusColors);
mFocusTextColor = mDefaultColor;
mFocusBackgroundColor = mBackgroundColor;
@ -714,8 +713,8 @@ nsPresContext::GetUserPreferences()
mFocusRingWidth);
mFocusRingOnAnything =
nsContentUtils::GetBoolPref("browser.display.focus_ring_on_anything",
mFocusRingOnAnything);
Preferences::GetBool("browser.display.focus_ring_on_anything",
mFocusRingOnAnything);
mFocusRingStyle =
nsContentUtils::GetIntPref("browser.display.focus_ring_style",
@ -726,7 +725,7 @@ nsPresContext::GetUserPreferences()
// * replace backslashes with Yen signs? (bug 245770)
mEnableJapaneseTransform =
nsContentUtils::GetBoolPref("layout.enable_japanese_specific_transform");
Preferences::GetBool("layout.enable_japanese_specific_transform");
mPrefScrollbarSide =
nsContentUtils::GetIntPref("layout.scrollbar.side");

View File

@ -209,6 +209,7 @@
#include "gfxPlatform.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "Layers.h"
@ -1885,13 +1886,13 @@ PresShell::Init(nsIDocument* aDocument,
#ifdef MOZ_REFLOW_PERF
if (mReflowCountMgr) {
PRBool paintFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.showframecounts");
Preferences::GetBool("layout.reflow.showframecounts");
PRBool dumpFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.dumpframecounts");
Preferences::GetBool("layout.reflow.dumpframecounts");
PRBool dumpFrameByFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.dumpframebyframecounts");
Preferences::GetBool("layout.reflow.dumpframebyframecounts");
mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts);
mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts);
@ -3920,7 +3921,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
// Should we select the target? This action is controlled by a
// preference: the default is to not select.
PRBool selectAnchor = nsContentUtils::GetBoolPref("layout.selectanchor");
PRBool selectAnchor = Preferences::GetBool("layout.selectanchor");
// Even if select anchor pref is false, we must still move the
// caret there. That way tabbing will start from the new

View File

@ -90,8 +90,9 @@
#include "nsThemeConstants.h"
#include "nsPLDOMEvent.h"
#include "nsRenderingContext.h"
#include "mozilla/Preferences.h"
namespace dom = mozilla::dom;
using namespace mozilla;
NS_IMETHODIMP
nsComboboxControlFrame::RedisplayTextEvent::Run()
@ -1518,6 +1519,6 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState)
PRBool
nsComboboxControlFrame::ToolkitHasNativePopup()
{
return nsContentUtils::GetBoolPref("ui.use_native_popup_windows");
return Preferences::GetBool("ui.use_native_popup_windows");
}

View File

@ -130,6 +130,8 @@
#include "CSSCalc.h"
#include "nsAbsoluteContainingBlock.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::layers;
@ -2354,7 +2356,7 @@ nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
if (me->clickCount == 4) {
beginAmount = endAmount = eSelectParagraph;
} else if (me->clickCount == 3) {
if (nsContentUtils::GetBoolPref("browser.triple_click_selects_paragraph")) {
if (Preferences::GetBool("browser.triple_click_selects_paragraph")) {
beginAmount = endAmount = eSelectParagraph;
} else {
beginAmount = eSelectBeginLine;
@ -5650,7 +5652,7 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
// This pref only affects whether moving forward by word should go to the end of this word or start of the next word.
// When going backwards, the start of the word is always used, on every operating system.
wordSelectEatSpace = aPos->mDirection == eDirNext &&
nsContentUtils::GetBoolPref("layout.word_select.eat_space_to_next_word");
Preferences::GetBool("layout.word_select.eat_space_to_next_word");
}
// mSawBeforeType means "we already saw characters of the type
@ -5958,7 +5960,7 @@ nsFrame::BreakWordBetweenPunctuation(const PeekWordState* aState,
// We always stop between whitespace and punctuation
return PR_TRUE;
}
if (!nsContentUtils::GetBoolPref("layout.word_select.stop_at_punctuation")) {
if (!Preferences::GetBool("layout.word_select.stop_at_punctuation")) {
// When this pref is false, we never stop at a punctuation boundary unless
// it's after whitespace
return PR_FALSE;

View File

@ -73,6 +73,9 @@
#include "nsDisplayList.h"
#include "nsNodeUtils.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
// masks for mEdgeVisibility
#define LEFT_VIS 0x0001
@ -263,8 +266,7 @@ nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
}
frame->mForceFrameResizability =
nsContentUtils::GetBoolPref(kFrameResizePref,
frame->mForceFrameResizability);
Preferences::GetBool(kFrameResizePref, frame->mForceFrameResizability);
frame->RecalculateBorderResize();
if (doc) {
@ -974,8 +976,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
if (firstTime) {
nsContentUtils::RegisterPrefCallback(kFrameResizePref,
FrameResizePrefCallback, this);
mForceFrameResizability =
nsContentUtils::GetBoolPref(kFrameResizePref);
mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
}
// subtract out the width of all of the potential borders. There are

View File

@ -56,6 +56,7 @@
#include "nsIPercentHeightObserver.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#ifdef IBMBIDI
#include "nsBidiUtils.h"
#endif
@ -1613,7 +1614,7 @@ static int
PrefsChanged(const char *aPrefName, void *instance)
{
sBlinkIsAllowed =
nsContentUtils::GetBoolPref("browser.blink_allowed", sBlinkIsAllowed);
Preferences::GetBool("browser.blink_allowed", sBlinkIsAllowed);
return 0; /* PREF_OK */
}

View File

@ -103,6 +103,10 @@
#include "gfxRect.h"
#include "ImageLayers.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
// sizes (pixels) for image icon, padding and border frame
#define ICON_SIZE (16)
#define ICON_PADDING (3)
@ -1916,11 +1920,10 @@ nsImageFrame::IconLoad::Observe(nsISupports *aSubject, const char* aTopic,
void nsImageFrame::IconLoad::GetPrefs()
{
mPrefForceInlineAltText =
nsContentUtils::GetBoolPref("browser.display.force_inline_alttext");
Preferences::GetBool("browser.display.force_inline_alttext");
mPrefShowPlaceholders =
nsContentUtils::GetBoolPref("browser.display.show_image_placeholders",
PR_TRUE);
Preferences::GetBool("browser.display.show_image_placeholders", PR_TRUE);
}

View File

@ -87,6 +87,7 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/Preferences.h"
//included for desired x position;
#include "nsPresContext.h"
@ -113,6 +114,8 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#include "nsDOMError.h"
using namespace mozilla;
//#define DEBUG_TABLE 1
static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
@ -730,7 +733,7 @@ nsFrameSelection::nsFrameSelection()
// Check to see if the autocopy pref is enabled
// and add the autocopy listener if it is
if (nsContentUtils::GetBoolPref("clipboard.autocopy")) {
if (Preferences::GetBool("clipboard.autocopy")) {
nsAutoCopyListener *autoCopy = nsAutoCopyListener::GetInstance();
if (autoCopy) {

View File

@ -123,6 +123,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#include "nsViewsCID.h"
#include "nsWidgetsCID.h"
@ -165,6 +166,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIURIFixup.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::dom;
//-----------------------------------------------------
@ -597,8 +599,8 @@ nsPrintEngine::DoCommonPrint(PRBool aIsPrintPreview,
mPrt->mPrintSettings->GetPrintSilent(&printSilently);
// Check prefs for a default setting as to whether we should print silently
printSilently = nsContentUtils::GetBoolPref("print.always_print_silent",
printSilently);
printSilently =
Preferences::GetBool("print.always_print_silent", printSilently);
// Ask dialog to be Print Shown via the Plugable Printing Dialog Service
// This service is for the Print Dialog and the Print Progress Dialog
@ -1012,8 +1014,7 @@ nsPrintEngine::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify)
// if it is already being shown then don't bother to find out if it should be
// so skip this and leave mShowProgressDialog set to FALSE
if (!mProgressDialogIsShown) {
showProgresssDialog =
nsContentUtils::GetBoolPref("print.show_print_progress");
showProgresssDialog = Preferences::GetBool("print.show_print_progress");
}
// Turning off the showing of Print Progress in Prefs overrides

View File

@ -94,9 +94,10 @@
#include "mozilla/dom/Element.h"
#include "nsGenericElement.h"
#include "nsNthIndexCache.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace css = mozilla::css;
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
@ -964,8 +965,7 @@ nsCSSRuleProcessor::Startup()
nsContentUtils::AddBoolPrefVarCache(VISITED_PSEUDO_PREF,
&gSupportVisitedPseudo);
// We want to default to true, not false as AddBoolPrefVarCache does.
gSupportVisitedPseudo =
nsContentUtils::GetBoolPref(VISITED_PSEUDO_PREF, PR_TRUE);
gSupportVisitedPseudo = Preferences::GetBool(VISITED_PSEUDO_PREF, PR_TRUE);
gPrivateBrowsingObserver = new nsPrivateBrowsingObserver();
NS_ENSURE_TRUE(gPrivateBrowsingObserver, NS_ERROR_OUT_OF_MEMORY);

View File

@ -60,6 +60,9 @@
#include "mozilla/Services.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#ifdef CSS_REPORT_PARSE_ERRORS
static PRBool gReportErrors = PR_TRUE;
@ -325,7 +328,7 @@ nsCSSScanner::SetLowLevelError(nsresult aErrorCode)
static int
CSSErrorsPrefChanged(const char *aPref, void *aClosure)
{
gReportErrors = nsContentUtils::GetBoolPref(CSS_ERRORS_PREF, PR_TRUE);
gReportErrors = Preferences::GetBool(CSS_ERRORS_PREF, PR_TRUE);
return NS_OK;
}
#endif

View File

@ -88,6 +88,7 @@
#include "prdtoa.h"
#include "mozilla/dom/Element.h"
#include "gfxUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -175,7 +176,7 @@ static const char SMIL_PREF_STR[] = "svg.smil.enabled";
static int
SMILPrefChanged(const char *aPref, void *aClosure)
{
PRBool prefVal = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
PRBool prefVal = Preferences::GetBool(SMIL_PREF_STR);
gSMILEnabled = prefVal;
return 0;
}
@ -187,7 +188,7 @@ NS_SMILEnabled()
if (!sInitialized) {
/* check and register ourselves with the pref */
gSMILEnabled = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
gSMILEnabled = Preferences::GetBool(SMIL_PREF_STR);
nsContentUtils::RegisterPrefCallback(SMIL_PREF_STR, SMILPrefChanged, nsnull);
sInitialized = PR_TRUE;
@ -1299,7 +1300,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame)
if (svg) {
// It is possible to apply a gradient, pattern, clipping path, mask or
// filter to text. When one of these facilities is applied to text
// the bounding box is the entire text element in all
// the bounding box is the entire text element in all
// cases.
nsSVGTextContainerFrame* metrics = do_QueryFrame(
GetFirstNonAAncestorFrame(aFrame));

View File

@ -93,13 +93,15 @@
#include "nsEventDispatcher.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
// Needed for Print Preview
#include "nsIDocument.h"
#include "nsIURI.h"
using namespace mozilla;
//define DEBUG_REDRAW
#define DEBUG_SPRING_SIZE 8
@ -1246,7 +1248,7 @@ nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
void
nsBoxFrame::GetDebugPref(nsPresContext* aPresContext)
{
gDebug = nsContentUtils::GetBoolPref("xul.debug.box");
gDebug = Preferences::GetBool("xul.debug.box");
}
class nsDisplayXULDebug : public nsDisplayItem {

View File

@ -58,6 +58,9 @@
#include "nsIDOMElement.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
/*
* nsMenuBarListener implementation
@ -130,8 +133,7 @@ void nsMenuBarListener::InitAccessKey()
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_META)
mAccessKeyMask = MODIFIER_META;
mAccessKeyFocuses =
nsContentUtils::GetBoolPref("ui.key.menuAccessKeyFocuses");
mAccessKeyFocuses = Preferences::GetBool("ui.key.menuAccessKeyFocuses");
}
void

View File

@ -86,6 +86,9 @@
#include "nsIScreenManager.h"
#include "nsIServiceManager.h"
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
PRInt8 nsMenuPopupFrame::sDefaultLevelIsTop = -1;
@ -130,7 +133,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
if (sDefaultLevelIsTop >= 0)
return;
sDefaultLevelIsTop =
nsContentUtils::GetBoolPref("ui.panel.default_level_parent", PR_FALSE);
Preferences::GetBool("ui.panel.default_level_parent", PR_FALSE);
} // ctor

View File

@ -70,6 +70,9 @@
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
PRBool nsSliderFrame::gMiddlePref = PR_FALSE;
PRInt32 nsSliderFrame::gSnapMultiplier;
@ -117,7 +120,7 @@ nsSliderFrame::Init(nsIContent* aContent,
if (!gotPrefs) {
gotPrefs = PR_TRUE;
gMiddlePref = nsContentUtils::GetBoolPref("middlemouse.scrollbarPosition");
gMiddlePref = Preferences::GetBool("middlemouse.scrollbarPosition");
gSnapMultiplier = nsContentUtils::GetIntPref("slider.snapMultiplier");
}

View File

@ -62,6 +62,9 @@
#endif
#include "nsIRootBox.h"
#include "nsEventDispatcher.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
nsXULTooltipListener* nsXULTooltipListener::mInstance = nsnull;
@ -323,8 +326,8 @@ int
nsXULTooltipListener::ToolbarTipsPrefChanged(const char *aPref,
void *aClosure)
{
sShowTooltips = nsContentUtils::GetBoolPref("browser.chrome.toolbar_tips",
sShowTooltips);
sShowTooltips =
Preferences::GetBool("browser.chrome.toolbar_tips", sShowTooltips);
return 0;
}