diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 0b643df7bf8..8f8ed7ed399 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -93,7 +93,8 @@ #include "nsIAnonymousContentCreator.h" #include "nsIFrameManager.h" #include "nsIAttributeContent.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsLegendFrame.h" #include "nsIContentIterator.h" #include "nsBoxLayoutState.h" @@ -4231,10 +4232,10 @@ nsCSSFrameConstructor::HasGfxScrollbars() #endif // Get the Prefs if (!mGotGfxPrefs) { - nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID)); - if (pref) { + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool hasGfxScroll = PR_FALSE; // use a temp since we have a PRPackedBool - pref->GetBoolPref("nglayout.widget.gfxscrollbars", &hasGfxScroll); + prefBranch->GetBoolPref("nglayout.widget.gfxscrollbars", &hasGfxScroll); mHasGfxScrollbars = hasGfxScroll; mGotGfxPrefs = PR_TRUE; } else { @@ -4251,10 +4252,10 @@ PRBool nsCSSFrameConstructor::UseXBLForms() { if (!mGotXBLFormPrefs) { - nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID)); - if (pref) { + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool useXBLForms = PR_FALSE; // use a temp since we have a PRPackedBool - pref->GetBoolPref("nglayout.debug.enable_xbl_forms", &useXBLForms); + prefBranch->GetBoolPref("nglayout.debug.enable_xbl_forms", &useXBLForms); mUseXBLForms = useXBLForms; mGotXBLFormPrefs = PR_TRUE; } diff --git a/mozilla/layout/base/nsCaret.cpp b/mozilla/layout/base/nsCaret.cpp index ed1d70c72f8..557c7acc988 100644 --- a/mozilla/layout/base/nsCaret.cpp +++ b/mozilla/layout/base/nsCaret.cpp @@ -75,7 +75,6 @@ #ifdef IBMBIDI //-------------------------------IBM BIDI-------------------------------------- // Mamdouh : Modifiaction of the caret to work with Bidi in the LTR and RTL -#include "nsIPref.h" #include "nsLayoutAtoms.h" //------------------------------END OF IBM BIDI-------------------------------- #endif //IBMBIDI diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 32d85633b9f..c22e8fd2d19 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -57,7 +57,8 @@ #include "prinrval.h" #include "nsVoidArray.h" #include "nsHashtable.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIViewObserver.h" #include "nsContainerFrame.h" #include "nsIDeviceContext.h" @@ -197,7 +198,6 @@ static nsresult CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet); static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kViewCID, NS_VIEW_CID); -static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); #undef NOISY @@ -1694,10 +1694,11 @@ PresShell::Init(nsIDocument* aDocument, gAsyncReflowDuringDocLoad = PR_TRUE; // Get the prefs service - nsCOMPtr prefs(do_GetService(kPrefServiceCID, &result)); - if (NS_SUCCEEDED(result)) { - prefs->GetIntPref("layout.reflow.timeslice", &gMaxRCProcessingTime); - prefs->GetBoolPref("layout.reflow.async.duringDocLoad", &gAsyncReflowDuringDocLoad); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { + prefBranch->GetIntPref("layout.reflow.timeslice", &gMaxRCProcessingTime); + prefBranch->GetBoolPref("layout.reflow.async.duringDocLoad", + &gAsyncReflowDuringDocLoad); } } @@ -1716,16 +1717,19 @@ PresShell::Init(nsIDocument* aDocument, #endif #ifdef MOZ_REFLOW_PERF - // Get the prefs service - nsCOMPtr prefs(do_GetService(kPrefServiceCID, &result)); - if (NS_SUCCEEDED(result)) { - if (mReflowCountMgr != nsnull) { + if (mReflowCountMgr) { + // Get the prefs service + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool paintFrameCounts = PR_FALSE; PRBool dumpFrameCounts = PR_FALSE; PRBool dumpFrameByFrameCounts = PR_FALSE; - prefs->GetBoolPref("layout.reflow.showframecounts", &paintFrameCounts); - prefs->GetBoolPref("layout.reflow.dumpframecounts", &dumpFrameCounts); - prefs->GetBoolPref("layout.reflow.dumpframebyframecounts", &dumpFrameByFrameCounts); + prefBranch->GetBoolPref("layout.reflow.showframecounts", + &paintFrameCounts); + prefBranch->GetBoolPref("layout.reflow.dumpframecounts", + &dumpFrameCounts); + prefBranch->GetBoolPref("layout.reflow.dumpframebyframecounts", + &dumpFrameByFrameCounts); mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts); mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts); @@ -2854,9 +2858,9 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) else { // Initialize the timer. PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value. - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); - if (prefs) - prefs->GetIntPref("nglayout.initialpaint.delay", &delay); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) + prefBranch->GetIntPref("nglayout.initialpaint.delay", &delay); nsCOMPtr ti = do_QueryInterface(mPaintSuppressionTimer); ti->SetIdle(PR_FALSE); @@ -4004,9 +4008,9 @@ PresShell::GoToAnchor(const nsAString& aAnchorName) // Should we select the target? // This action is controlled by a preference: the default is to not select. PRBool selectAnchor = PR_FALSE; - nsCOMPtr prefs(do_GetService(kPrefServiceCID,&rv)); - if (NS_SUCCEEDED(rv) && prefs) { - prefs->GetBoolPref("layout.selectanchor",&selectAnchor); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { + prefBranch->GetBoolPref("layout.selectanchor", &selectAnchor); } // Even if select anchor pref is false, we must still move the caret there. // That way tabbing will start from the new location diff --git a/mozilla/layout/base/src/nsCaret.cpp b/mozilla/layout/base/src/nsCaret.cpp index ed1d70c72f8..557c7acc988 100644 --- a/mozilla/layout/base/src/nsCaret.cpp +++ b/mozilla/layout/base/src/nsCaret.cpp @@ -75,7 +75,6 @@ #ifdef IBMBIDI //-------------------------------IBM BIDI-------------------------------------- // Mamdouh : Modifiaction of the caret to work with Bidi in the LTR and RTL -#include "nsIPref.h" #include "nsLayoutAtoms.h" //------------------------------END OF IBM BIDI-------------------------------- #endif //IBMBIDI diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index eb6959a2066..0aa50ae6c53 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -88,7 +88,8 @@ #include "nsIPercentHeightObserver.h" // For triple-click pref -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIServiceManager.h" #include "nsISelectionImageService.h" #include "imgIContainer.h" @@ -98,7 +99,6 @@ #include "nsWidgetsCID.h" // for NS_LOOKANDFEEL_CID #include "nsLayoutErrors.h" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);//for triple click pref static NS_DEFINE_CID(kSelectionImageService, NS_SELECTIONIMAGESERVICE_CID); static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -1527,9 +1527,9 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext, selectPara = PR_TRUE; else if (me->clickCount == 3) { - nsCOMPtr prefsService( do_GetService(kPrefCID, &rv) ); - if (NS_SUCCEEDED(rv) && prefsService) - prefsService->GetBoolPref("browser.triple_click_selects_paragraph", &selectPara); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); + if (prefBranch) + prefBranch->GetBoolPref("browser.triple_click_selects_paragraph", &selectPara); } else return NS_OK; diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 431ebedb76b..2ef7af1b850 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -68,7 +68,6 @@ #include "nsIStyleContext.h" #include "nsStyleConsts.h" #include "nsIDocumentLoader.h" -#include "nsIPref.h" #include "nsFrameSetFrame.h" #include "nsIDOMHTMLFrameElement.h" #include "nsIDOMHTMLIFrameElement.h" diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index d5676bf04f6..ab4da5e6da2 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -94,7 +94,8 @@ #include "nsIDOMWindow.h" #include "nsIDOMDocument.h" #include "nsCSSFrameConstructor.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -2270,21 +2271,21 @@ void nsImageFrame::IconLoad::GetPrefs(nsIPresContext *aPresContext) NS_ASSERTION(aPresContext, "null presContext is not allowed in GetAltModePref"); // NOTE: the presContext could be used to fetch a cached pref if needed, but is not for now - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID); - if (prefs) { + nsCOMPtr prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { PRBool boolPref; PRInt32 intPref; - if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display.force_inline_alttext", &boolPref))) { + if (NS_SUCCEEDED(prefBranch->GetBoolPref("browser.display.force_inline_alttext", &boolPref))) { mPrefForceInlineAltText = boolPref; } else { mPrefForceInlineAltText = PR_FALSE; } - if (NS_SUCCEEDED(prefs->GetIntPref("network.image.imageBehavior", &intPref)) && intPref == 2) { + if (NS_SUCCEEDED(prefBranch->GetIntPref("network.image.imageBehavior", &intPref)) && intPref == 2) { mPrefAllImagesBlocked = PR_TRUE; } else { mPrefAllImagesBlocked = PR_FALSE; } - if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display.show_image_placeholders", &boolPref))) { + if (NS_SUCCEEDED(prefBranch->GetBoolPref("browser.display.show_image_placeholders", &boolPref))) { mPrefShowPlaceholders = boolPref; } else { mPrefShowPlaceholders = PR_TRUE; diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index adaa5fd239e..da5023daa9d 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -114,7 +114,8 @@ #include "jsapi.h" // XXX temporary for Mac double buffering pref -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" // XXX For temporary paint code #include "nsIStyleContext.h" @@ -139,9 +140,6 @@ #include "nsContentCID.h" static NS_DEFINE_CID(kRangeCID, NS_RANGE_CID); -// XXX temporary for Mac double buffering pref -static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); - /* X headers suck */ #ifdef KeyPress #undef KeyPress @@ -797,10 +795,12 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, // Turn off double buffering on the Mac. This depends on bug 49743 and partially // fixes 32327, 19931 amd 51787 #if defined(XP_MAC) || defined(XP_MACOSX) - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); PRBool doubleBuffer = PR_FALSE; - prefs ? prefs->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer) : 0; - + if (prefBranch) { + prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer); + } + viewMan->AllowDoubleBuffering(doubleBuffer); #endif diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 83ce4f27dfe..cf95132a6ad 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -54,7 +54,9 @@ #include "nsRegion.h" #include "nsLayoutAtoms.h" -#include "nsIPref.h" // for header/footer gap & ExtraMargin for Print Preview +// for header/footer gap & ExtraMargin for Print Preview +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" // DateTime Includes #include "nsDateTimeFormatCID.h" @@ -216,23 +218,30 @@ nsSimplePageSequenceFrame::CreateContinuingPageFrame(nsIPresContext* aPresContex return rv; } -void nsSimplePageSequenceFrame::GetEdgePaperMarginCoord(nsIPref* aPref, char* aPrefName, nscoord& aCoord) +void +nsSimplePageSequenceFrame::GetEdgePaperMarginCoord(char* aPrefName, + nscoord& aCoord) { - if (NS_SUCCEEDED(mPageData->mPrintOptions->GetPrinterPrefInt(mPageData->mPrintSettings, - NS_ConvertASCIItoUCS2(aPrefName).get(), &aCoord))) { + nsresult rv = mPageData->mPrintOptions-> + GetPrinterPrefInt(mPageData->mPrintSettings, + NS_ConvertASCIItoUCS2(aPrefName).get(), + &aCoord); + + if (NS_SUCCEEDED(rv)) { nscoord inchInTwips = NS_INCHES_TO_TWIPS(1.0); aCoord = PR_MAX(NS_INCHES_TO_TWIPS(float(aCoord)/100.0f), 0); aCoord = PR_MIN(aCoord, inchInTwips); // an inch is still probably excessive } } -void nsSimplePageSequenceFrame::GetEdgePaperMargin(nsIPref* aPref, nsMargin& aMargin) +void +nsSimplePageSequenceFrame::GetEdgePaperMargin(nsMargin& aMargin) { aMargin.SizeTo(0,0,0,0); - GetEdgePaperMarginCoord(aPref, "print_edge_top", aMargin.top); - GetEdgePaperMarginCoord(aPref, "print_edge_left", aMargin.left); - GetEdgePaperMarginCoord(aPref, "print_edge_bottom", aMargin.bottom); - GetEdgePaperMarginCoord(aPref, "print_edge_right", aMargin.right); + GetEdgePaperMarginCoord("print_edge_top", aMargin.top); + GetEdgePaperMarginCoord("print_edge_left", aMargin.left); + GetEdgePaperMarginCoord("print_edge_bottom", aMargin.bottom); + GetEdgePaperMarginCoord("print_edge_right", aMargin.right); } NS_IMETHODIMP @@ -309,12 +318,12 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, aPresContext->GetPageDim(&pageSize, &adjSize); nscoord extraGap = 0; - nsCOMPtr pref = do_GetService(NS_PREF_CONTRACTID); - if (pref) { - GetEdgePaperMargin(pref, mPageData->mEdgePaperMargin); + nsCOMPtr prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { + GetEdgePaperMargin(mPageData->mEdgePaperMargin); nscoord extraThreshold = PR_MAX(pageSize.width, pageSize.height)/10; PRInt32 gapInTwips; - if (NS_SUCCEEDED(pref->GetIntPref("print.print_extra_margin", &gapInTwips))) { + if (NS_SUCCEEDED(prefBranch->GetIntPref("print.print_extra_margin", &gapInTwips))) { gapInTwips = PR_MAX(gapInTwips, 0); gapInTwips = PR_MIN(gapInTwips, extraThreshold); // clamp to 1/10 of the largest dim of the page extraGap = nscoord(gapInTwips); diff --git a/mozilla/layout/generic/nsSimplePageSequence.h b/mozilla/layout/generic/nsSimplePageSequence.h index e6552b374c2..5a160efe046 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.h +++ b/mozilla/layout/generic/nsSimplePageSequence.h @@ -153,8 +153,8 @@ protected: void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly); void SetPageSizes(const nsRect& aRect, const nsMargin& aMarginRect); - void GetEdgePaperMarginCoord(nsIPref* aPref, char* aPrefName, nscoord& aCoord); - void GetEdgePaperMargin(nsIPref* aPref, nsMargin& aMargin); + void GetEdgePaperMarginCoord(char* aPrefName, nscoord& aCoord); + void GetEdgePaperMargin(nsMargin& aMargin); NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();} NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();} diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index b81c3fa61a7..752b5ff0ec2 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -83,7 +83,8 @@ #include "nsILineIterator.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIServiceManager.h" #ifdef ACCESSIBILITY #include "nsIAccessible.h" @@ -105,8 +106,6 @@ #include "nsILE.h" #endif /* SUNCTL */ -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - #ifdef NS_DEBUG #undef NOISY_BLINK #undef DEBUG_WORD_WRAPPING @@ -1365,10 +1364,10 @@ nsTextFrame::nsTextFrame() { // read in our global word selection prefs if ( !sWordSelectPrefInited ) { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - if ( prefService ) { + nsCOMPtr prefBranch ( do_GetService(NS_PREFSERVICE_CONTRACTID) ); + if ( prefBranch ) { PRBool temp = PR_FALSE; - prefService->GetBoolPref("layout.word_select.eat_space_to_next_word", &temp); + prefBranch->GetBoolPref("layout.word_select.eat_space_to_next_word", &temp); sWordSelectEatSpaceAfter = temp; } sWordSelectPrefInited = PR_TRUE; @@ -2641,12 +2640,12 @@ nsTextFrame::GetPositionSlowly(nsIPresContext* aPresContext, ComputeExtraJustificationSpacing(*aRendContext, ts, paintBuffer.mBuffer, textLength, numSpaces); //IF STYLE SAYS TO SELECT TO END OF FRAME HERE... - nsCOMPtr prefs( do_GetService(kPrefCID, &rv) ); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); PRInt32 prefInt = 0; PRBool outofstylehandled = PR_FALSE; - if (NS_SUCCEEDED(rv) && prefs) + if (prefBranch) { - if (NS_SUCCEEDED(prefs->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) + if (NS_SUCCEEDED(prefBranch->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) { if (aPoint.y < origin.y)//above rectangle { @@ -3529,12 +3528,12 @@ nsTextFrame::GetPosition(nsIPresContext* aCX, GetOffsetFromView(aCX, origin, &view); //IF STYLE SAYS TO SELECT TO END OF FRAME HERE... - nsCOMPtr prefs( do_GetService(kPrefCID, &rv) ); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); PRInt32 prefInt = 0; PRBool outofstylehandled = PR_FALSE; - if (NS_SUCCEEDED(rv) && prefs) + if (prefBranch) { - if (NS_SUCCEEDED(prefs->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) + if (NS_SUCCEEDED(prefBranch->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) { if ((aPoint.y - origin.y) < 0)//above rectangle { diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index 23d9db35345..c5c498f525c 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -49,7 +49,8 @@ #include "nsUnicharUtils.h" #include "nsICaseConversion.h" #include "prenv.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #ifdef IBMBIDI #include "nsLayoutAtoms.h" #endif @@ -114,10 +115,11 @@ nsTextTransformer::Initialize() // read in our global word selection prefs if ( !sWordSelectPrefInited ) { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - if ( prefService ) { + nsCOMPtr prefBranch = + do_GetService( NS_PREFSERVICE_CONTRACTID ); + if ( prefBranch ) { PRBool temp = PR_FALSE; - prefService->GetBoolPref("layout.word_select.stop_at_punctuation", &temp); + prefBranch->GetBoolPref("layout.word_select.stop_at_punctuation", &temp); sWordSelectStopAtPunctuation = temp; } sWordSelectPrefInited = PR_TRUE; diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index eb6959a2066..0aa50ae6c53 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -88,7 +88,8 @@ #include "nsIPercentHeightObserver.h" // For triple-click pref -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIServiceManager.h" #include "nsISelectionImageService.h" #include "imgIContainer.h" @@ -98,7 +99,6 @@ #include "nsWidgetsCID.h" // for NS_LOOKANDFEEL_CID #include "nsLayoutErrors.h" -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);//for triple click pref static NS_DEFINE_CID(kSelectionImageService, NS_SELECTIONIMAGESERVICE_CID); static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -1527,9 +1527,9 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext, selectPara = PR_TRUE; else if (me->clickCount == 3) { - nsCOMPtr prefsService( do_GetService(kPrefCID, &rv) ); - if (NS_SUCCEEDED(rv) && prefsService) - prefsService->GetBoolPref("browser.triple_click_selects_paragraph", &selectPara); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); + if (prefBranch) + prefBranch->GetBoolPref("browser.triple_click_selects_paragraph", &selectPara); } else return NS_OK; diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index d5676bf04f6..ab4da5e6da2 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -94,7 +94,8 @@ #include "nsIDOMWindow.h" #include "nsIDOMDocument.h" #include "nsCSSFrameConstructor.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -2270,21 +2271,21 @@ void nsImageFrame::IconLoad::GetPrefs(nsIPresContext *aPresContext) NS_ASSERTION(aPresContext, "null presContext is not allowed in GetAltModePref"); // NOTE: the presContext could be used to fetch a cached pref if needed, but is not for now - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID); - if (prefs) { + nsCOMPtr prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { PRBool boolPref; PRInt32 intPref; - if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display.force_inline_alttext", &boolPref))) { + if (NS_SUCCEEDED(prefBranch->GetBoolPref("browser.display.force_inline_alttext", &boolPref))) { mPrefForceInlineAltText = boolPref; } else { mPrefForceInlineAltText = PR_FALSE; } - if (NS_SUCCEEDED(prefs->GetIntPref("network.image.imageBehavior", &intPref)) && intPref == 2) { + if (NS_SUCCEEDED(prefBranch->GetIntPref("network.image.imageBehavior", &intPref)) && intPref == 2) { mPrefAllImagesBlocked = PR_TRUE; } else { mPrefAllImagesBlocked = PR_FALSE; } - if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display.show_image_placeholders", &boolPref))) { + if (NS_SUCCEEDED(prefBranch->GetBoolPref("browser.display.show_image_placeholders", &boolPref))) { mPrefShowPlaceholders = boolPref; } else { mPrefShowPlaceholders = PR_TRUE; diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index adaa5fd239e..da5023daa9d 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -114,7 +114,8 @@ #include "jsapi.h" // XXX temporary for Mac double buffering pref -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" // XXX For temporary paint code #include "nsIStyleContext.h" @@ -139,9 +140,6 @@ #include "nsContentCID.h" static NS_DEFINE_CID(kRangeCID, NS_RANGE_CID); -// XXX temporary for Mac double buffering pref -static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); - /* X headers suck */ #ifdef KeyPress #undef KeyPress @@ -797,10 +795,12 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, // Turn off double buffering on the Mac. This depends on bug 49743 and partially // fixes 32327, 19931 amd 51787 #if defined(XP_MAC) || defined(XP_MACOSX) - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); PRBool doubleBuffer = PR_FALSE; - prefs ? prefs->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer) : 0; - + if (prefBranch) { + prefBranch->GetBoolPref("plugin.enable_double_buffer", &doubleBuffer); + } + viewMan->AllowDoubleBuffering(doubleBuffer); #endif diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 32d85633b9f..c22e8fd2d19 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -57,7 +57,8 @@ #include "prinrval.h" #include "nsVoidArray.h" #include "nsHashtable.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIViewObserver.h" #include "nsContainerFrame.h" #include "nsIDeviceContext.h" @@ -197,7 +198,6 @@ static nsresult CtlStyleWatch(PRUint32 aCtlValue, nsIStyleSet *aStyleSet); static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kViewCID, NS_VIEW_CID); -static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); #undef NOISY @@ -1694,10 +1694,11 @@ PresShell::Init(nsIDocument* aDocument, gAsyncReflowDuringDocLoad = PR_TRUE; // Get the prefs service - nsCOMPtr prefs(do_GetService(kPrefServiceCID, &result)); - if (NS_SUCCEEDED(result)) { - prefs->GetIntPref("layout.reflow.timeslice", &gMaxRCProcessingTime); - prefs->GetBoolPref("layout.reflow.async.duringDocLoad", &gAsyncReflowDuringDocLoad); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { + prefBranch->GetIntPref("layout.reflow.timeslice", &gMaxRCProcessingTime); + prefBranch->GetBoolPref("layout.reflow.async.duringDocLoad", + &gAsyncReflowDuringDocLoad); } } @@ -1716,16 +1717,19 @@ PresShell::Init(nsIDocument* aDocument, #endif #ifdef MOZ_REFLOW_PERF - // Get the prefs service - nsCOMPtr prefs(do_GetService(kPrefServiceCID, &result)); - if (NS_SUCCEEDED(result)) { - if (mReflowCountMgr != nsnull) { + if (mReflowCountMgr) { + // Get the prefs service + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool paintFrameCounts = PR_FALSE; PRBool dumpFrameCounts = PR_FALSE; PRBool dumpFrameByFrameCounts = PR_FALSE; - prefs->GetBoolPref("layout.reflow.showframecounts", &paintFrameCounts); - prefs->GetBoolPref("layout.reflow.dumpframecounts", &dumpFrameCounts); - prefs->GetBoolPref("layout.reflow.dumpframebyframecounts", &dumpFrameByFrameCounts); + prefBranch->GetBoolPref("layout.reflow.showframecounts", + &paintFrameCounts); + prefBranch->GetBoolPref("layout.reflow.dumpframecounts", + &dumpFrameCounts); + prefBranch->GetBoolPref("layout.reflow.dumpframebyframecounts", + &dumpFrameByFrameCounts); mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts); mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts); @@ -2854,9 +2858,9 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) else { // Initialize the timer. PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value. - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); - if (prefs) - prefs->GetIntPref("nglayout.initialpaint.delay", &delay); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) + prefBranch->GetIntPref("nglayout.initialpaint.delay", &delay); nsCOMPtr ti = do_QueryInterface(mPaintSuppressionTimer); ti->SetIdle(PR_FALSE); @@ -4004,9 +4008,9 @@ PresShell::GoToAnchor(const nsAString& aAnchorName) // Should we select the target? // This action is controlled by a preference: the default is to not select. PRBool selectAnchor = PR_FALSE; - nsCOMPtr prefs(do_GetService(kPrefServiceCID,&rv)); - if (NS_SUCCEEDED(rv) && prefs) { - prefs->GetBoolPref("layout.selectanchor",&selectAnchor); + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { + prefBranch->GetBoolPref("layout.selectanchor", &selectAnchor); } // Even if select anchor pref is false, we must still move the caret there. // That way tabbing will start from the new location diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 83ce4f27dfe..cf95132a6ad 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -54,7 +54,9 @@ #include "nsRegion.h" #include "nsLayoutAtoms.h" -#include "nsIPref.h" // for header/footer gap & ExtraMargin for Print Preview +// for header/footer gap & ExtraMargin for Print Preview +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" // DateTime Includes #include "nsDateTimeFormatCID.h" @@ -216,23 +218,30 @@ nsSimplePageSequenceFrame::CreateContinuingPageFrame(nsIPresContext* aPresContex return rv; } -void nsSimplePageSequenceFrame::GetEdgePaperMarginCoord(nsIPref* aPref, char* aPrefName, nscoord& aCoord) +void +nsSimplePageSequenceFrame::GetEdgePaperMarginCoord(char* aPrefName, + nscoord& aCoord) { - if (NS_SUCCEEDED(mPageData->mPrintOptions->GetPrinterPrefInt(mPageData->mPrintSettings, - NS_ConvertASCIItoUCS2(aPrefName).get(), &aCoord))) { + nsresult rv = mPageData->mPrintOptions-> + GetPrinterPrefInt(mPageData->mPrintSettings, + NS_ConvertASCIItoUCS2(aPrefName).get(), + &aCoord); + + if (NS_SUCCEEDED(rv)) { nscoord inchInTwips = NS_INCHES_TO_TWIPS(1.0); aCoord = PR_MAX(NS_INCHES_TO_TWIPS(float(aCoord)/100.0f), 0); aCoord = PR_MIN(aCoord, inchInTwips); // an inch is still probably excessive } } -void nsSimplePageSequenceFrame::GetEdgePaperMargin(nsIPref* aPref, nsMargin& aMargin) +void +nsSimplePageSequenceFrame::GetEdgePaperMargin(nsMargin& aMargin) { aMargin.SizeTo(0,0,0,0); - GetEdgePaperMarginCoord(aPref, "print_edge_top", aMargin.top); - GetEdgePaperMarginCoord(aPref, "print_edge_left", aMargin.left); - GetEdgePaperMarginCoord(aPref, "print_edge_bottom", aMargin.bottom); - GetEdgePaperMarginCoord(aPref, "print_edge_right", aMargin.right); + GetEdgePaperMarginCoord("print_edge_top", aMargin.top); + GetEdgePaperMarginCoord("print_edge_left", aMargin.left); + GetEdgePaperMarginCoord("print_edge_bottom", aMargin.bottom); + GetEdgePaperMarginCoord("print_edge_right", aMargin.right); } NS_IMETHODIMP @@ -309,12 +318,12 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext, aPresContext->GetPageDim(&pageSize, &adjSize); nscoord extraGap = 0; - nsCOMPtr pref = do_GetService(NS_PREF_CONTRACTID); - if (pref) { - GetEdgePaperMargin(pref, mPageData->mEdgePaperMargin); + nsCOMPtr prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (prefBranch) { + GetEdgePaperMargin(mPageData->mEdgePaperMargin); nscoord extraThreshold = PR_MAX(pageSize.width, pageSize.height)/10; PRInt32 gapInTwips; - if (NS_SUCCEEDED(pref->GetIntPref("print.print_extra_margin", &gapInTwips))) { + if (NS_SUCCEEDED(prefBranch->GetIntPref("print.print_extra_margin", &gapInTwips))) { gapInTwips = PR_MAX(gapInTwips, 0); gapInTwips = PR_MIN(gapInTwips, extraThreshold); // clamp to 1/10 of the largest dim of the page extraGap = nscoord(gapInTwips); diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.h b/mozilla/layout/html/base/src/nsSimplePageSequence.h index e6552b374c2..5a160efe046 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.h +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.h @@ -153,8 +153,8 @@ protected: void SetPageNumberFormat(PRUnichar * aFormatStr, PRBool aForPageNumOnly); void SetPageSizes(const nsRect& aRect, const nsMargin& aMarginRect); - void GetEdgePaperMarginCoord(nsIPref* aPref, char* aPrefName, nscoord& aCoord); - void GetEdgePaperMargin(nsIPref* aPref, nsMargin& aMargin); + void GetEdgePaperMarginCoord(char* aPrefName, nscoord& aCoord); + void GetEdgePaperMargin(nsMargin& aMargin); NS_IMETHOD_(nsrefcnt) AddRef(void) {return nsContainerFrame::AddRef();} NS_IMETHOD_(nsrefcnt) Release(void) {return nsContainerFrame::Release();} diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index b81c3fa61a7..752b5ff0ec2 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -83,7 +83,8 @@ #include "nsILineIterator.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsIServiceManager.h" #ifdef ACCESSIBILITY #include "nsIAccessible.h" @@ -105,8 +106,6 @@ #include "nsILE.h" #endif /* SUNCTL */ -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - #ifdef NS_DEBUG #undef NOISY_BLINK #undef DEBUG_WORD_WRAPPING @@ -1365,10 +1364,10 @@ nsTextFrame::nsTextFrame() { // read in our global word selection prefs if ( !sWordSelectPrefInited ) { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - if ( prefService ) { + nsCOMPtr prefBranch ( do_GetService(NS_PREFSERVICE_CONTRACTID) ); + if ( prefBranch ) { PRBool temp = PR_FALSE; - prefService->GetBoolPref("layout.word_select.eat_space_to_next_word", &temp); + prefBranch->GetBoolPref("layout.word_select.eat_space_to_next_word", &temp); sWordSelectEatSpaceAfter = temp; } sWordSelectPrefInited = PR_TRUE; @@ -2641,12 +2640,12 @@ nsTextFrame::GetPositionSlowly(nsIPresContext* aPresContext, ComputeExtraJustificationSpacing(*aRendContext, ts, paintBuffer.mBuffer, textLength, numSpaces); //IF STYLE SAYS TO SELECT TO END OF FRAME HERE... - nsCOMPtr prefs( do_GetService(kPrefCID, &rv) ); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); PRInt32 prefInt = 0; PRBool outofstylehandled = PR_FALSE; - if (NS_SUCCEEDED(rv) && prefs) + if (prefBranch) { - if (NS_SUCCEEDED(prefs->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) + if (NS_SUCCEEDED(prefBranch->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) { if (aPoint.y < origin.y)//above rectangle { @@ -3529,12 +3528,12 @@ nsTextFrame::GetPosition(nsIPresContext* aCX, GetOffsetFromView(aCX, origin, &view); //IF STYLE SAYS TO SELECT TO END OF FRAME HERE... - nsCOMPtr prefs( do_GetService(kPrefCID, &rv) ); + nsCOMPtr prefBranch( do_GetService(NS_PREFSERVICE_CONTRACTID) ); PRInt32 prefInt = 0; PRBool outofstylehandled = PR_FALSE; - if (NS_SUCCEEDED(rv) && prefs) + if (prefBranch) { - if (NS_SUCCEEDED(prefs->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) + if (NS_SUCCEEDED(prefBranch->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt) { if ((aPoint.y - origin.y) < 0)//above rectangle { diff --git a/mozilla/layout/html/base/src/nsTextTransformer.cpp b/mozilla/layout/html/base/src/nsTextTransformer.cpp index 23d9db35345..c5c498f525c 100644 --- a/mozilla/layout/html/base/src/nsTextTransformer.cpp +++ b/mozilla/layout/html/base/src/nsTextTransformer.cpp @@ -49,7 +49,8 @@ #include "nsUnicharUtils.h" #include "nsICaseConversion.h" #include "prenv.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #ifdef IBMBIDI #include "nsLayoutAtoms.h" #endif @@ -114,10 +115,11 @@ nsTextTransformer::Initialize() // read in our global word selection prefs if ( !sWordSelectPrefInited ) { - nsCOMPtr prefService ( do_GetService(NS_PREF_CONTRACTID) ); - if ( prefService ) { + nsCOMPtr prefBranch = + do_GetService( NS_PREFSERVICE_CONTRACTID ); + if ( prefBranch ) { PRBool temp = PR_FALSE; - prefService->GetBoolPref("layout.word_select.stop_at_punctuation", &temp); + prefBranch->GetBoolPref("layout.word_select.stop_at_punctuation", &temp); sWordSelectStopAtPunctuation = temp; } sWordSelectPrefInited = PR_TRUE; diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 431ebedb76b..2ef7af1b850 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -68,7 +68,6 @@ #include "nsIStyleContext.h" #include "nsStyleConsts.h" #include "nsIDocumentLoader.h" -#include "nsIPref.h" #include "nsFrameSetFrame.h" #include "nsIDOMHTMLFrameElement.h" #include "nsIDOMHTMLIFrameElement.h" diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 0b643df7bf8..8f8ed7ed399 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -93,7 +93,8 @@ #include "nsIAnonymousContentCreator.h" #include "nsIFrameManager.h" #include "nsIAttributeContent.h" -#include "nsIPref.h" +#include "nsIPrefBranch.h" +#include "nsIPrefService.h" #include "nsLegendFrame.h" #include "nsIContentIterator.h" #include "nsBoxLayoutState.h" @@ -4231,10 +4232,10 @@ nsCSSFrameConstructor::HasGfxScrollbars() #endif // Get the Prefs if (!mGotGfxPrefs) { - nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID)); - if (pref) { + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool hasGfxScroll = PR_FALSE; // use a temp since we have a PRPackedBool - pref->GetBoolPref("nglayout.widget.gfxscrollbars", &hasGfxScroll); + prefBranch->GetBoolPref("nglayout.widget.gfxscrollbars", &hasGfxScroll); mHasGfxScrollbars = hasGfxScroll; mGotGfxPrefs = PR_TRUE; } else { @@ -4251,10 +4252,10 @@ PRBool nsCSSFrameConstructor::UseXBLForms() { if (!mGotXBLFormPrefs) { - nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID)); - if (pref) { + nsCOMPtr prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefBranch) { PRBool useXBLForms = PR_FALSE; // use a temp since we have a PRPackedBool - pref->GetBoolPref("nglayout.debug.enable_xbl_forms", &useXBLForms); + prefBranch->GetBoolPref("nglayout.debug.enable_xbl_forms", &useXBLForms); mUseXBLForms = useXBLForms; mGotXBLFormPrefs = PR_TRUE; }