зеркало из https://github.com/mozilla/pjs.git
Bug 337917 Make consumers stop using cids from other modules
r=dveditz sr=darin
This commit is contained in:
Родитель
9391198a55
Коммит
f24522c8fd
|
@ -59,8 +59,6 @@
|
|||
|
||||
#include "nsIScreenManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
nscoord nsDeviceContextBeOS::mDpi = 96;
|
||||
|
||||
nsDeviceContextBeOS::nsDeviceContextBeOS()
|
||||
|
@ -80,7 +78,7 @@ nsDeviceContextBeOS::nsDeviceContextBeOS()
|
|||
nsDeviceContextBeOS::~nsDeviceContextBeOS()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
prefs->UnregisterCallback("layout.css.dpi", prefChanged, (void *)this);
|
||||
}
|
||||
|
@ -121,7 +119,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::Init(nsNativeWidget aNativeWidget)
|
|||
PRInt32 prefVal = -1;
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
if (NS_SUCCEEDED(res) && prefs)
|
||||
{
|
||||
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
|
||||
|
@ -422,7 +420,7 @@ int nsDeviceContextBeOS::prefChanged(const char *aPref, void *aClosure)
|
|||
if (nsCRT::strcmp(aPref, "layout.css.dpi")==0)
|
||||
{
|
||||
PRInt32 dpi;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
rv = prefs->GetIntPref(aPref, &dpi);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
context->SetDPI(dpi);
|
||||
|
|
|
@ -85,8 +85,6 @@ static PRInt32 GetXftDPI(void);
|
|||
|
||||
static PRInt32 GetOSDPI(void);
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define GDK_DEFAULT_FONT1 "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"
|
||||
#define GDK_DEFAULT_FONT2 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-*-*"
|
||||
|
||||
|
@ -157,7 +155,7 @@ nsDeviceContextGTK::nsDeviceContextGTK()
|
|||
nsDeviceContextGTK::~nsDeviceContextGTK()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->UnregisterCallback("layout.css.dpi",
|
||||
prefChanged, (void *)this);
|
||||
|
@ -242,7 +240,7 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
|
|||
// If it's positive, we use it as the logical resolution
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
if (NS_SUCCEEDED(res) && prefs) {
|
||||
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -687,7 +685,7 @@ int nsDeviceContextGTK::prefChanged(const char *aPref, void *aClosure)
|
|||
|
||||
if (nsCRT::strcmp(aPref, "layout.css.dpi")==0) {
|
||||
PRInt32 dpi;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
rv = prefs->GetIntPref(aPref, &dpi);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
context->SetDPI(dpi);
|
||||
|
|
|
@ -153,7 +153,6 @@ struct nsFontPropertyName
|
|||
int mValue;
|
||||
};
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static void SetCharsetLangGroup(nsFontCharSetInfo* aCharSetInfo);
|
||||
|
||||
static int gFontMetricsGTKCount = 0;
|
||||
|
@ -1093,7 +1092,7 @@ InitGlobals(nsIDeviceContext *aDevice)
|
|||
FreeGlobals();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
CallGetService(kPrefCID, &gPref);
|
||||
CallGetService(NS_PREF_CONTRACTID, &gPref);
|
||||
if (!gPref) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -888,11 +888,6 @@ nsresult nsDeviceContextMac::CreateFontAliasTable()
|
|||
|
||||
#pragma mark -
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIDeviceContext.h
|
||||
* @update 12/9/98 dwc
|
||||
|
@ -905,7 +900,7 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
|
|||
initialized = PR_TRUE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
PRInt32 intVal;
|
||||
if (NS_SUCCEEDED(prefs->GetIntPref("layout.css.dpi", &intVal)) && intVal > 0) {
|
||||
|
|
|
@ -1,494 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsUnicodeMappingUtil.h"
|
||||
#include "nsUnicodeFontMappingMac.h"
|
||||
#include "nsDeviceContextMac.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
nsUnicodeMappingUtil *nsUnicodeMappingUtil::gSingleton = nsnull;
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
#ifdef DEBUG
|
||||
static int gUnicodeMappingUtilCount = 0;
|
||||
#endif
|
||||
|
||||
int PR_CALLBACK nsUnicodeMappingUtil::PrefChangedCallback( const char* aPrefName, void* instance_data)
|
||||
{
|
||||
//printf("PrefChangeCallback \n");
|
||||
nsUnicodeMappingUtil::GetSingleton()->Reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsUnicodeMappingUtil::nsUnicodeMappingUtil()
|
||||
{
|
||||
Init();
|
||||
MOZ_COUNT_CTOR(nsUnicodeMappingUtil);
|
||||
#ifdef DEBUG
|
||||
++gUnicodeMappingUtilCount;
|
||||
NS_ASSERTION(gUnicodeMappingUtilCount == 1, "not singleton");
|
||||
#endif
|
||||
}
|
||||
void nsUnicodeMappingUtil::Reset()
|
||||
{
|
||||
CleanUp();
|
||||
Init();
|
||||
}
|
||||
void nsUnicodeMappingUtil::Init()
|
||||
{
|
||||
InitGenericFontMapping();
|
||||
InitFromPref();
|
||||
InitScriptFontMapping();
|
||||
InitBlockToScriptMapping();
|
||||
}
|
||||
void nsUnicodeMappingUtil::CleanUp()
|
||||
{
|
||||
for(int i= 0 ; i < smPseudoTotalScripts; i ++) {
|
||||
for(int j=0; j < 5; j++) {
|
||||
if(mGenericFontMapping[i][j])
|
||||
delete mGenericFontMapping[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
nsUnicodeMappingUtil::~nsUnicodeMappingUtil()
|
||||
{
|
||||
CleanUp();
|
||||
|
||||
#ifdef DEBUG
|
||||
--gUnicodeMappingUtilCount;
|
||||
#endif
|
||||
mPref->UnregisterCallback("font.name.", nsUnicodeMappingUtil::PrefChangedCallback, (void*) nsnull);
|
||||
MOZ_COUNT_DTOR(nsUnicodeMappingUtil);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void nsUnicodeMappingUtil::InitGenericFontMapping()
|
||||
{
|
||||
for(int i= 0 ; i < smPseudoTotalScripts; i ++)
|
||||
for(int j=0; j < 5; j++)
|
||||
mGenericFontMapping[i][j] = nsnull;
|
||||
|
||||
// We probabaly should put the following info into resource ....
|
||||
// smRoman
|
||||
mGenericFontMapping[smRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times") );
|
||||
mGenericFontMapping[smRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica") ); // note: MRJ use Geneva for Sans-Serif
|
||||
mGenericFontMapping[smRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier") );
|
||||
mGenericFontMapping[smRoman][kCursive] = new nsAutoString( NS_LITERAL_STRING("Zapf Chancery") );
|
||||
mGenericFontMapping[smRoman][kFantasy] = new nsAutoString( NS_LITERAL_STRING("New Century Schlbk") );
|
||||
|
||||
// smJapanese
|
||||
static PRUnichar jfontname1[] = {
|
||||
0x672C, 0x660E, 0x671D, 0x2212, 0xFF2D, 0x0000 // 本明朝-M
|
||||
};
|
||||
static PRUnichar jfontname2[] = {
|
||||
0x4E38, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x2212, 0xFF2D, 0x0000 // 丸ゴシック-M
|
||||
};
|
||||
static PRUnichar jfontname3[] = {
|
||||
0x004F, 0x0073, 0x0061, 0x006B, 0x0061, 0x2212, 0x7B49, 0x5E45, 0x0000 // Osaka-等幅
|
||||
};
|
||||
|
||||
mGenericFontMapping[smJapanese][kSerif] = new nsAutoString(jfontname1);
|
||||
mGenericFontMapping[smJapanese][kSansSerif] = new nsAutoString(jfontname2);
|
||||
mGenericFontMapping[smJapanese][kMonospace] = new nsAutoString(jfontname3);
|
||||
|
||||
// smTradChinese
|
||||
mGenericFontMapping[smTradChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiSung Light") );
|
||||
mGenericFontMapping[smTradChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") );
|
||||
mGenericFontMapping[smTradChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") );
|
||||
|
||||
// smKorean
|
||||
mGenericFontMapping[smKorean][kSerif] = new nsAutoString( NS_LITERAL_STRING("AppleMyungjo") );
|
||||
mGenericFontMapping[smKorean][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") );
|
||||
mGenericFontMapping[smKorean][kMonospace] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") );
|
||||
|
||||
// smArabic
|
||||
mGenericFontMapping[smArabic][kSerif] = new nsAutoString( NS_LITERAL_STRING("Lucida Grande") );
|
||||
mGenericFontMapping[smArabic][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Lucida Grande") );
|
||||
mGenericFontMapping[smArabic][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Monaco") );
|
||||
|
||||
// smHebrew
|
||||
mGenericFontMapping[smHebrew][kSerif] = new nsAutoString( NS_LITERAL_STRING("Lucida Grande") );
|
||||
mGenericFontMapping[smHebrew][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Lucida Grande") );
|
||||
mGenericFontMapping[smHebrew][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Monaco") );
|
||||
|
||||
// smCyrillic
|
||||
mGenericFontMapping[smCyrillic][kSerif] = new nsAutoString( NS_LITERAL_STRING("Latinski") );
|
||||
mGenericFontMapping[smCyrillic][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Pryamoy Prop") );
|
||||
mGenericFontMapping[smCyrillic][kMonospace] = new nsAutoString( NS_LITERAL_STRING("APC Courier") );
|
||||
|
||||
// smDevanagari
|
||||
mGenericFontMapping[smDevanagari][kSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
|
||||
mGenericFontMapping[smDevanagari][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
|
||||
mGenericFontMapping[smDevanagari][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") );
|
||||
|
||||
// smGurmukhi
|
||||
mGenericFontMapping[smGurmukhi][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
|
||||
mGenericFontMapping[smGurmukhi][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
|
||||
mGenericFontMapping[smGurmukhi][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") );
|
||||
|
||||
// smGujarati
|
||||
mGenericFontMapping[smGujarati][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
|
||||
mGenericFontMapping[smGujarati][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
|
||||
mGenericFontMapping[smGujarati][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") );
|
||||
|
||||
// smThai
|
||||
mGenericFontMapping[smThai][kSerif] = new nsAutoString( NS_LITERAL_STRING("Thonburi") );
|
||||
mGenericFontMapping[smThai][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Krungthep") );
|
||||
mGenericFontMapping[smThai][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Ayuthaya") );
|
||||
|
||||
// smSimpChinese
|
||||
mGenericFontMapping[smSimpChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Song") );
|
||||
mGenericFontMapping[smSimpChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Hei") );
|
||||
mGenericFontMapping[smSimpChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Hei") );
|
||||
|
||||
// smCentralEuroRoman
|
||||
mGenericFontMapping[smCentralEuroRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times CE") );
|
||||
mGenericFontMapping[smCentralEuroRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica CE") );
|
||||
mGenericFontMapping[smCentralEuroRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier CE") );
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// nsUnicodeMappingUtil::MapLangGroupToScriptCode
|
||||
//
|
||||
// This method normally returns ScriptCode values, but CAN RETURN pseudo-
|
||||
// ScriptCode values for Unicode (32) and User-Defined (33)
|
||||
//--------------------------------------------------------------------------
|
||||
ScriptCode nsUnicodeMappingUtil::MapLangGroupToScriptCode(const char* aLangGroup)
|
||||
{
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-western")) {
|
||||
return smRoman;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-central-euro")) {
|
||||
return smCentralEuroRoman;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-cyrillic")) {
|
||||
return smCyrillic;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "el")) {
|
||||
return smGreek;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "tr")) {
|
||||
return smRoman;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "he")) {
|
||||
return smHebrew;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "ar")) {
|
||||
return smArabic;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-baltic")) {
|
||||
return smRoman;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "th")) {
|
||||
return smThai;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "ja")) {
|
||||
return smJapanese;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "zh-CN")) {
|
||||
return smSimpChinese;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "ko")) {
|
||||
return smKorean;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "zh-TW")) {
|
||||
return smTradChinese;
|
||||
}
|
||||
// No separate script code for zh-HK. Use smTradChinese.
|
||||
if(0==nsCRT::strcmp(aLangGroup, "zh-HK")) {
|
||||
return smTradChinese;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-devanag")) {
|
||||
return smDevanagari;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-tamil")) {
|
||||
return smTamil;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-beng")) {
|
||||
return smBengali;;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-armn")) {
|
||||
return smArmenian;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-geor")) {
|
||||
return smGeorgian;;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-gujr")) {
|
||||
return smGujarati;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-guru")) {
|
||||
return smGurmukhi;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-mlym")) {
|
||||
return smMalayalam;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-khmr")) {
|
||||
return smKhmer;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-ethi")) {
|
||||
return smEthiopic;
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-cans")) {
|
||||
return (smPseudoUnicode); // XXX : no script code for UCA
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-unicode")) {
|
||||
return (smPseudoUnicode);
|
||||
}
|
||||
if(0==nsCRT::strcmp(aLangGroup, "x-user-def")) {
|
||||
return (smPseudoUserDef);
|
||||
}
|
||||
{
|
||||
return smRoman;
|
||||
}
|
||||
}
|
||||
|
||||
#define FACESIZE 255 // font name is Str255 in Mac script code
|
||||
void PR_CALLBACK
|
||||
nsUnicodeMappingUtil::PrefEnumCallback(const char* aName, void* aClosure)
|
||||
{
|
||||
nsUnicodeMappingUtil* Self = (nsUnicodeMappingUtil*)aClosure;
|
||||
nsCAutoString curPrefName(aName);
|
||||
|
||||
PRInt32 p1 = curPrefName.RFindChar('.');
|
||||
if(-1==p1)
|
||||
return;
|
||||
PRInt32 p2 = curPrefName.RFindChar('.', p1-1);
|
||||
if(-1==p1)
|
||||
return;
|
||||
|
||||
nsCAutoString genName("");
|
||||
nsCAutoString langGroup("");
|
||||
|
||||
curPrefName.Mid(langGroup, p1+1, curPrefName.Length()-p1-1);
|
||||
curPrefName.Mid(genName, p2+1, p1-p2-1);
|
||||
|
||||
ScriptCode script = Self->MapLangGroupToScriptCode(langGroup.get());
|
||||
if(script >= (smPseudoTotalScripts))
|
||||
{
|
||||
// Because of the pseudo-scripts of Unicode and User-Defined, we have to handle
|
||||
// the expanded ScriptCode value.
|
||||
return;
|
||||
}
|
||||
if((script == smRoman) && !langGroup.Equals(nsCAutoString("x-western"))) {
|
||||
// need special processing for t,r x-baltic, x-usr-defined
|
||||
return;
|
||||
}
|
||||
|
||||
nsString genNameString;
|
||||
genNameString.AssignWithConversion(genName);
|
||||
nsGenericFontNameType type = Self->MapGenericFontNameType(genNameString);
|
||||
if(type >= kUnknownGenericFontName)
|
||||
return;
|
||||
|
||||
char* valueInUTF8 = nsnull;
|
||||
Self->mPref->CopyCharPref(aName, &valueInUTF8);
|
||||
if(!valueInUTF8)
|
||||
return;
|
||||
if(!*valueInUTF8)
|
||||
{
|
||||
Recycle(valueInUTF8);
|
||||
return;
|
||||
}
|
||||
PRUnichar valueInUCS2[FACESIZE]= { 0 };
|
||||
PRUnichar format[] = { '%', 's', 0 };
|
||||
PRUint32 n = nsTextFormatter::snprintf(valueInUCS2, FACESIZE, format, valueInUTF8);
|
||||
Recycle(valueInUTF8);
|
||||
if(n == 0)
|
||||
return;
|
||||
nsString *fontname = new nsAutoString(valueInUCS2);
|
||||
if(nsnull == fontname)
|
||||
return;
|
||||
if( Self->mGenericFontMapping[script][type] )
|
||||
delete Self->mGenericFontMapping[script][type];
|
||||
Self->mGenericFontMapping[script][type] = fontname;
|
||||
#ifdef DEBUG_ftang_font
|
||||
char* utf8 = ToNewUTF8String(*fontname);
|
||||
printf("font %d %d %s= %s\n",script , type, aName,utf8);
|
||||
if (utf8)
|
||||
Recycle(utf8);
|
||||
#endif
|
||||
}
|
||||
void nsUnicodeMappingUtil::InitFromPref()
|
||||
{
|
||||
if (!mPref) {
|
||||
mPref = do_GetService(kPrefCID);
|
||||
if (!mPref)
|
||||
return;
|
||||
mPref->RegisterCallback("font.name.", nsUnicodeMappingUtil::PrefChangedCallback, (void*) nsnull);
|
||||
}
|
||||
mPref->EnumerateChildren("font.name.", nsUnicodeMappingUtil::PrefEnumCallback, this);
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void nsUnicodeMappingUtil::InitScriptFontMapping()
|
||||
{
|
||||
// Get font from Script manager
|
||||
for(ScriptCode script = 0; script< smPseudoTotalScripts ; script++)
|
||||
{
|
||||
mScriptFontMapping[script] = BAD_FONT_NUM;
|
||||
short fontNum;
|
||||
if ((smPseudoUnicode == script) || (smPseudoUserDef == script))
|
||||
{
|
||||
char *theNeededPreference;
|
||||
|
||||
if (smPseudoUnicode == script)
|
||||
theNeededPreference = "font.name.serif.x-unicode";
|
||||
else
|
||||
theNeededPreference = "font.name.serif.x-user-def";
|
||||
|
||||
char *valueInUTF8 = nsnull;
|
||||
|
||||
mPref->CopyCharPref (theNeededPreference,&valueInUTF8);
|
||||
|
||||
if (valueInUTF8)
|
||||
{
|
||||
if (!*valueInUTF8)
|
||||
Recycle (valueInUTF8);
|
||||
else
|
||||
{
|
||||
PRUnichar valueInUCS2[FACESIZE]= { 0 };
|
||||
PRUnichar format[] = { '%', 's', 0 };
|
||||
PRUint32 n = nsTextFormatter::snprintf(valueInUCS2, FACESIZE, format, valueInUTF8);
|
||||
|
||||
Recycle (valueInUTF8);
|
||||
if (n != 0)
|
||||
{
|
||||
nsString *fontname = new nsAutoString (valueInUCS2);
|
||||
|
||||
if (nsnull != fontname)
|
||||
{
|
||||
short fontID = 0;
|
||||
|
||||
if (nsDeviceContextMac::GetMacFontNumber (*fontname,fontID))
|
||||
mScriptFontMapping[script] = fontID;
|
||||
|
||||
delete fontname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
long fondsize = ::GetScriptVariable(script, smScriptPrefFondSize);
|
||||
if (!fondsize)
|
||||
fondsize = ::GetScriptVariable(smUnicodeScript, smScriptPrefFondSize);
|
||||
|
||||
if((fondsize) && ((fondsize >> 16))) {
|
||||
fontNum = (fondsize >> 16);
|
||||
mScriptFontMapping[script] = fontNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
void nsUnicodeMappingUtil::InitBlockToScriptMapping()
|
||||
{
|
||||
static ScriptCode prebuildMapping[kUnicodeBlockSize] =
|
||||
{
|
||||
// start the fixed section
|
||||
smGreek, smCyrillic, smArmenian,
|
||||
smHebrew, smArabic, smDevanagari, smBengali,
|
||||
smGurmukhi, smGujarati, smOriya, smTamil,
|
||||
smTelugu, smKannada, smMalayalam, smThai,
|
||||
smLao, smTibetan, smGeorgian, smKorean,
|
||||
smTradChinese, smEthiopic, smKhmer,
|
||||
smPseudoUnicode, // for Unified Canadian Syllable
|
||||
smPseudoUserDef,
|
||||
|
||||
// start the variable section
|
||||
smRoman, smRoman, smJapanese, smJapanese, smJapanese,
|
||||
smRoman
|
||||
};
|
||||
for(PRUint32 i= 0; i < kUnicodeBlockSize; i++)
|
||||
{
|
||||
mBlockToScriptMapping[i] = prebuildMapping[i];
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
nsGenericFontNameType nsUnicodeMappingUtil::MapGenericFontNameType(const nsString& aGenericName)
|
||||
{
|
||||
if (aGenericName.LowerCaseEqualsLiteral("serif"))
|
||||
return kSerif;
|
||||
if (aGenericName.LowerCaseEqualsLiteral("sans-serif"))
|
||||
return kSansSerif;
|
||||
if (aGenericName.LowerCaseEqualsLiteral("monospace"))
|
||||
return kMonospace;
|
||||
if (aGenericName.LowerCaseEqualsLiteral("-moz-fixed"))
|
||||
return kMonospace;
|
||||
if (aGenericName.LowerCaseEqualsLiteral("cursive"))
|
||||
return kCursive;
|
||||
if (aGenericName.LowerCaseEqualsLiteral("fantasy"))
|
||||
return kFantasy;
|
||||
|
||||
return kUnknownGenericFontName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
nsUnicodeMappingUtil* nsUnicodeMappingUtil::GetSingleton()
|
||||
{
|
||||
if( ! gSingleton)
|
||||
gSingleton = new nsUnicodeMappingUtil();
|
||||
return gSingleton;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsUnicodeMappingUtil::FreeSingleton()
|
||||
{
|
||||
delete gSingleton;
|
||||
gSingleton = nsnull;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
|
@ -68,7 +68,6 @@
|
|||
|
||||
#define NS_REPLACEMENT_CHAR PRUnichar(0x003F) // question mark
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define NS_MAX_FONT_WEIGHT 900
|
||||
#define NS_MIN_FONT_WEIGHT 100
|
||||
|
@ -212,7 +211,7 @@ static nsFontCleanupObserver *gFontCleanupObserver;
|
|||
static nsresult
|
||||
InitGlobals(void)
|
||||
{
|
||||
CallGetService(kPrefCID, &gPref);
|
||||
CallGetService(NS_PREF_CONTRACTID, &gPref);
|
||||
if (!gPref) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
#include "nsPhGfxLog.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define NS_TO_PH_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff)
|
||||
|
||||
nscoord nsDeviceContextPh::mDpi = 96;
|
||||
|
@ -188,7 +186,7 @@ void nsDeviceContextPh :: CommonInit( nsNativeDeviceContext aDC ) {
|
|||
PRInt32 prefVal = -1;
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
if( NS_SUCCEEDED( res ) && prefs ) {
|
||||
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
|
||||
if( NS_FAILED( res ) ) {
|
||||
|
@ -542,7 +540,7 @@ int nsDeviceContextPh::prefChanged( const char *aPref, void *aClosure ) {
|
|||
|
||||
if( nsCRT::strcmp(aPref, "layout.css.dpi")==0 ) {
|
||||
PRInt32 dpi;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
rv = prefs->GetIntPref(aPref, &dpi);
|
||||
if( NS_SUCCEEDED( rv ) ) context->SetDPI( dpi );
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
nsDeviceContextSpecPh :: nsDeviceContextSpecPh()
|
||||
{
|
||||
mPC = PpCreatePC();
|
||||
|
@ -174,7 +172,7 @@ NS_IMETHODIMP nsDeviceContextSpecPh :: Init(nsIWidget* aWidget,
|
|||
|
||||
/* set the print frame / BG colors and images settings, according to the Pt_ARG_WEB_OPTION setting */
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
|
||||
PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone;
|
||||
aPS->GetHowToEnableFrameUI(&howToEnableFrameUI);
|
||||
|
|
|
@ -46,8 +46,6 @@
|
|||
#include <Pt.h>
|
||||
#include <errno.h>
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
nsPixelFormat nsDrawingSurfacePh::mPixFormat = {
|
||||
0, // mRedZeroMask; //red color mask in zero position
|
||||
0, // mGreenZeroMask; //green color mask in zero position
|
||||
|
@ -100,7 +98,7 @@ nsDrawingSurfacePh :: ~nsDrawingSurfacePh( )
|
|||
|
||||
if( mIsOffscreen ) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->UnregisterCallback("browser.display.internaluse.graphics_changed", prefChanged, (void *)this);
|
||||
}
|
||||
|
@ -244,7 +242,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Init( PRUint32 aWidth, PRUint32 aHeight, PRU
|
|||
PgSetDrawBufferSizeCx( mDrawContext, 0xffff );
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->RegisterCallback("browser.display.internaluse.graphics_changed", prefChanged, (void *)this);
|
||||
}
|
||||
|
|
|
@ -57,8 +57,6 @@ static nsIPref* gPref = nsnull;
|
|||
#undef USER_DEFINED
|
||||
#define USER_DEFINED "x-user-def"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
nsFontMetricsPh::nsFontMetricsPh()
|
||||
{
|
||||
mDeviceContext = nsnull;
|
||||
|
@ -87,7 +85,7 @@ nsFontMetricsPh::nsFontMetricsPh()
|
|||
|
||||
static nsresult InitGlobals()
|
||||
{
|
||||
CallGetService(kPrefCID, &gPref);
|
||||
CallGetService(NS_PREF_CONTRACTID, &gPref);
|
||||
if (!gPref) return NS_ERROR_FAILURE;
|
||||
|
||||
gFontMetricsCache = new nsHashtable();
|
||||
|
|
|
@ -109,7 +109,6 @@ class fpCString : public nsCAutoString {
|
|||
#define NS_RGB_TO_GRAY(r,g,b) ((int(r) * 77 + int(g) * 150 + int(b) * 29) / 256)
|
||||
#define NS_IS_BOLD(x) (((x) >= 401) ? 1 : 0)
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
/*
|
||||
* global
|
||||
|
@ -200,7 +199,7 @@ nsPostScriptObj::nsPostScriptObj() :
|
|||
{
|
||||
PR_LOG(nsPostScriptObjLM, PR_LOG_DEBUG, ("nsPostScriptObj::nsPostScriptObj()\n"));
|
||||
|
||||
CallGetService(kPrefCID, &gPrefs);
|
||||
CallGetService(NS_PREF_CONTRACTID, &gPrefs);
|
||||
|
||||
gLangGroups = new nsHashtable();
|
||||
}
|
||||
|
|
|
@ -95,8 +95,6 @@ static int x11_error_handler (Display *dpy, XErrorEvent *err) {
|
|||
PRLogModuleInfo* gThebesGFXLog = nsnull;
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsThebesDeviceContext, DeviceContextImpl)
|
||||
|
||||
nsThebesDeviceContext::nsThebesDeviceContext()
|
||||
|
@ -129,7 +127,7 @@ nsThebesDeviceContext::nsThebesDeviceContext()
|
|||
nsThebesDeviceContext::~nsThebesDeviceContext()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(kPrefCID, &rv);
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->UnregisterCallback("layout.css.dpi",
|
||||
prefChanged, (void *)this);
|
||||
|
@ -212,7 +210,7 @@ nsThebesDeviceContext::Init(nsNativeWidget aWidget)
|
|||
// If it's positive, we use it as the logical resolution
|
||||
nsresult res;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
if (NS_SUCCEEDED(res) && prefs) {
|
||||
res = prefs->GetIntPref("layout.css.dpi", &prefVal);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -631,7 +629,7 @@ nsThebesDeviceContext::prefChanged(const char *aPref, void *aClosure)
|
|||
|
||||
if (nsCRT::strcmp(aPref, "layout.css.dpi") == 0) {
|
||||
PRInt32 dpi;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
rv = prefs->GetIntPref(aPref, &dpi);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
context->SetDPI(dpi);
|
||||
|
|
|
@ -135,7 +135,6 @@ static PRUint16* GenerateMultiByte(nsCharsetInfo* aSelf);
|
|||
static PRBool LookupWinFontName(const nsAFlatString& aName,
|
||||
nsAString& aWinName);
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
nsVoidArray* nsFontMetricsWin::gGlobalFonts = nsnull;
|
||||
PLHashTable* nsFontMetricsWin::gFontWeights = nsnull;
|
||||
|
@ -360,7 +359,7 @@ InitGlobals(void)
|
|||
FreeGlobals();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
CallGetService(kPrefCID, &gPref);
|
||||
CallGetService(NS_PREF_CONTRACTID, &gPref);
|
||||
if (!gPref) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
#include "nsIDeviceContextXPrint.h"
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
#define XLIB_DEFAULT_FONT1 "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"
|
||||
#define XLIB_DEFAULT_FONT2 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-*-*"
|
||||
|
||||
|
@ -172,7 +170,7 @@ nsDeviceContextXlib::CommonInit(void)
|
|||
if (!initialized) {
|
||||
initialized = 1;
|
||||
nsresult res;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));
|
||||
if (NS_SUCCEEDED(res) && prefs) {
|
||||
PRInt32 intVal = 96;
|
||||
res = prefs->GetIntPref("layout.css.dpi", &intVal);
|
||||
|
|
|
@ -241,8 +241,6 @@ typedef struct
|
|||
/*-----------------------------------------------------------------
|
||||
* Globals
|
||||
*-----------------------------------------------------------------*/
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
nsPrefMigration* nsPrefMigration::mInstance = nsnull;
|
||||
|
||||
nsPrefMigration *
|
||||
|
@ -286,7 +284,7 @@ nsPrefMigration::getPrefService()
|
|||
// get the prefs service
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPref> pIMyService(do_GetService(kPrefServiceCID, &rv));
|
||||
nsCOMPtr<nsIPref> pIMyService(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD, NS_GET_IID(nsIPref),
|
||||
|
@ -2453,7 +2451,7 @@ nsPrefConverter::ConvertPrefsToUTF8()
|
|||
|
||||
nsCStringArray prefsToMigrate;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
if (!prefs) return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -860,11 +860,6 @@ nsresult nsDeviceContextMac::CreateFontAliasTable()
|
|||
|
||||
#pragma mark -
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIDeviceContext.h
|
||||
* @update 12/9/98 dwc
|
||||
|
@ -877,7 +872,7 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
|
|||
initialized = PR_TRUE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
PRInt32 intVal;
|
||||
if (NS_SUCCEEDED(prefs->GetIntPref("layout.css.dpi", &intVal)) && intVal > 0) {
|
||||
|
|
|
@ -1075,8 +1075,6 @@ static void debug_SetCachedBoolPref(const char * aPrefName,PRBool aValue)
|
|||
NS_ASSERTION(PR_FALSE, "cmon, this code is not reached dude.");
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
/* static */ int PR_CALLBACK
|
||||
debug_PrefChangedCallback(const char * name,void * closure)
|
||||
|
@ -1084,7 +1082,7 @@ debug_PrefChangedCallback(const char * name,void * closure)
|
|||
|
||||
nsIPref * prefs = nsnull;
|
||||
|
||||
nsresult rv = CallGetService(kPrefCID, &prefs);
|
||||
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
|
||||
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");
|
||||
|
@ -1114,7 +1112,7 @@ debug_RegisterPrefCallbacks()
|
|||
|
||||
nsIPref * prefs = nsnull;
|
||||
|
||||
nsresult rv = CallGetService(kPrefCID, &prefs);
|
||||
nsresult rv = CallGetService(NS_PREF_CONTRACTID, &prefs);
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get prefs service.");
|
||||
NS_ASSERTION(nsnull != prefs,"Prefs services is null.");
|
||||
|
|
|
@ -107,9 +107,6 @@
|
|||
#define ENABLE_PAGE_CYCLER
|
||||
#endif
|
||||
|
||||
/* Define Class IDs */
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
#ifdef DEBUG
|
||||
static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging.
|
||||
#else
|
||||
|
@ -632,7 +629,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetChromeUrlForTask(char **aChromeUrlForT
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
|
||||
if (prefs) {
|
||||
rv = prefs->CopyCharPref("browser.chromeURL", aChromeUrlForTask);
|
||||
if (NS_SUCCEEDED(rv) && (*aChromeUrlForTask)[0] == '\0') {
|
||||
|
@ -724,7 +721,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID));
|
||||
if (prefs) {
|
||||
if (NeedHomepageOverride(prefs)) {
|
||||
rv = prefs->GetLocalizedUnicharPref(PREF_HOMEPAGE_OVERRIDE_URL, aDefaultArgs);
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
static const char kURINC_RelatedLinksRoot[] = "NC:RelatedLinks";
|
||||
|
||||
|
@ -632,7 +631,7 @@ RelatedLinksHandlerImpl::Init()
|
|||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
|
||||
nsCOMPtr<nsIPref> prefServ(do_GetService(kPrefCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefServ(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
mRLServerURL = new nsString();
|
||||
if (NS_SUCCEEDED(rv) && (prefServ))
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче