diff --git a/mozilla/content/base/public/nsIStyleRuleProcessor.h b/mozilla/content/base/public/nsIStyleRuleProcessor.h index 46036590754..47f2cf70af6 100644 --- a/mozilla/content/base/public/nsIStyleRuleProcessor.h +++ b/mozilla/content/base/public/nsIStyleRuleProcessor.h @@ -68,9 +68,7 @@ struct RuleProcessorData { ~RuleProcessorData(); void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~RuleProcessorData(); diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp index f93dd309815..24835a9d126 100644 --- a/mozilla/content/base/src/nsRuleNode.cpp +++ b/mozilla/content/base/src/nsRuleNode.cpp @@ -79,9 +79,7 @@ public: } void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); }; void operator delete(void* aPtr) {} // Does nothing. The arena will free us up when the rule tree // dies. @@ -369,9 +367,7 @@ void* nsRuleNode::operator new(size_t sz, nsIPresContext* aPresContext) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresContext->AllocateFromShell(sz, &result); - return result; + return aPresContext->AllocateFromShell(sz); } // Overridden to prevent the global delete from being called, since the memory @@ -1385,8 +1381,9 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex { nsStyleFont* fontData = new (mPresContext) nsStyleFont(mPresContext); - nscoord minimumFontSize = 0; - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize > 0 && !IsChrome(mPresContext)) { fontData->mFont.size = PR_MAX(fontData->mSize, minimumFontSize); } @@ -1976,8 +1973,9 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, parentFont = font; // See if there is a minimum font-size constraint to honor - nscoord minimumFontSize = 0; // unconstrained by default - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize < 0) minimumFontSize = 0; @@ -2114,9 +2112,9 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, textData.mLineHeight.GetUnit() == eCSSUnit_Pixel) { nscoord lh = nsStyleFont::ZoomText(mPresContext, text->mLineHeight.GetCoordValue()); - nscoord minimumFontSize = 0; - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, - minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize > 0 && !IsChrome(mPresContext)) { // If we applied a minimum font size, scale the line height by // the same ratio. (If we *might* have applied a minimum font diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index d38bc73d325..8195d367886 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -1510,9 +1510,7 @@ nsSelection::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aA if (NS_SUCCEEDED(result) && NS_SUCCEEDED(result = frame->PeekOffset(context, &pos)) && pos.mResultContent) { tHint = (HINT)pos.mPreferLeft; - PRBool bidiEnabled = PR_FALSE; - context->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) + if (context->BidiEnabled()) { nsIFrame *theFrame; PRInt32 currentOffset, frameStart, frameEnd; @@ -2596,9 +2594,7 @@ nsSelection::HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& if (NS_SUCCEEDED(result)) { #ifdef VISUALSELECTION - PRBool bidiEnabled = PR_FALSE; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { PRUint8 level; nsPeekOffsetStruct pos; //set data using mLimiter to stop on scroll views. If we have a limiter then we stop peeking diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index d053eb8cec1..ebd72469826 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -859,9 +859,7 @@ void* nsStyleContext::operator new(size_t sz, nsIPresContext* aPresContext) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresContext->AllocateFromShell(sz, &result); - return result; + return aPresContext->AllocateFromShell(sz); } // Overridden to prevent the global delete from being called, since the memory diff --git a/mozilla/content/shared/public/nsRuleNode.h b/mozilla/content/shared/public/nsRuleNode.h index 9f1e11153d3..61b53fe5f5f 100644 --- a/mozilla/content/shared/public/nsRuleNode.h +++ b/mozilla/content/shared/public/nsRuleNode.h @@ -67,9 +67,7 @@ struct nsInheritedStyleData #undef STYLE_STRUCT_RESET void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); }; void ClearInheritedData(PRUint32 aBits) { @@ -126,9 +124,7 @@ struct nsResetStyleData }; void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void ClearInheritedData(PRUint32 aBits) { diff --git a/mozilla/content/shared/public/nsStyleStruct.h b/mozilla/content/shared/public/nsStyleStruct.h index ddcbbeec67a..b6c14c541e6 100644 --- a/mozilla/content/shared/public/nsStyleStruct.h +++ b/mozilla/content/shared/public/nsStyleStruct.h @@ -131,9 +131,7 @@ struct nsStyleColor : public nsStyleStruct { nsChangeHint CalcDifference(const nsStyleColor& aOther) const; void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleColor(); @@ -153,9 +151,7 @@ struct nsStyleBackground : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Background) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleBackground(); @@ -489,9 +485,7 @@ struct nsStyleOutline: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Outline) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleOutline(); @@ -574,9 +568,7 @@ struct nsStyleList : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_List) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleList(); @@ -599,9 +591,7 @@ struct nsStylePosition : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Position) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStylePosition(); @@ -629,9 +619,7 @@ struct nsStyleTextReset : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_TextReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTextReset(); @@ -654,9 +642,7 @@ struct nsStyleText : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Text) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleText(); @@ -688,9 +674,7 @@ struct nsStyleVisibility : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Visibility) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleVisibility(); @@ -721,9 +705,7 @@ struct nsStyleDisplay : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Display) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleDisplay(); @@ -776,9 +758,7 @@ struct nsStyleTable: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Table) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTable(); @@ -802,9 +782,7 @@ struct nsStyleTableBorder: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_TableBorder) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTableBorder(); @@ -897,9 +875,7 @@ struct nsStyleQuotes : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Quotes) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleQuotes(); @@ -969,9 +945,7 @@ struct nsStyleContent: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Content) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleContent(); @@ -1096,9 +1070,7 @@ struct nsStyleUIReset: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UIReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleUIReset(); @@ -1121,9 +1093,7 @@ struct nsStyleUserInterface: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UserInterface) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleUserInterface(); @@ -1147,9 +1117,7 @@ struct nsStyleXUL : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_XUL) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleXUL(); @@ -1187,9 +1155,7 @@ struct nsStyleSVG : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_SVG) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleSVG(); @@ -1223,9 +1189,7 @@ struct nsStyleSVGReset : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_SVGReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleSVGReset(); diff --git a/mozilla/content/shared/src/nsStyleStruct.cpp b/mozilla/content/shared/src/nsStyleStruct.cpp index 5374e0da30c..129de8f2975 100644 --- a/mozilla/content/shared/src/nsStyleStruct.cpp +++ b/mozilla/content/shared/src/nsStyleStruct.cpp @@ -212,10 +212,9 @@ nsStyleFont::nsStyleFont(nsIPresContext* aPresContext) void* nsStyleFont::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -319,10 +318,9 @@ nsStyleMargin::nsStyleMargin(const nsStyleMargin& aSrc) { void* nsStyleMargin::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -377,10 +375,9 @@ nsStylePadding::nsStylePadding(const nsStylePadding& aSrc) { void* nsStylePadding::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -476,10 +473,9 @@ nsStyleBorder::nsStyleBorder(const nsStyleBorder& aSrc) void* nsStyleBorder::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } diff --git a/mozilla/editor/libeditor/text/nsTextEditRulesBidi.cpp b/mozilla/editor/libeditor/text/nsTextEditRulesBidi.cpp index 90ddd558bfd..4bb4eb1e067 100644 --- a/mozilla/editor/libeditor/text/nsTextEditRulesBidi.cpp +++ b/mozilla/editor/libeditor/text/nsTextEditRulesBidi.cpp @@ -68,9 +68,7 @@ nsTextEditRules::CheckBidiLevelForDeletion(nsIDOMNode *aSelNode, if (!context) return NS_ERROR_NULL_POINTER; - PRBool bidiEnabled; - context->GetBidiEnabled(&bidiEnabled); - if (!bidiEnabled) + if (!context->BidiEnabled()) return NS_OK; nsCOMPtr content = do_QueryInterface(aSelNode); diff --git a/mozilla/layout/base/nsCaret.cpp b/mozilla/layout/base/nsCaret.cpp index 7ee0d2e935d..12d2fb0b88e 100644 --- a/mozilla/layout/base/nsCaret.cpp +++ b/mozilla/layout/base/nsCaret.cpp @@ -565,11 +565,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n nsCOMPtr presContext; rv = presShell->GetPresContext(getter_AddRefs(presContext)); - PRBool bidiEnabled = PR_FALSE; - if (presContext) - presContext->GetBidiEnabled(&bidiEnabled); - - if (bidiEnabled) + if (presContext && presContext->BidiEnabled()) { presShell->GetCaretBidiLevel(&bidiLevel); if (bidiLevel & BIDI_LEVEL_UNDEFINED) @@ -1088,7 +1084,7 @@ void nsCaret::GetCaretRectAndInvert() presContext->SetBidiEnabled(bidiEnabled); } else - presContext->GetBidiEnabled(&bidiEnabled); + bidiEnabled = presContext->BidiEnabled(); if (bidiEnabled) { if (bidiLevel != mKeyboardRTL) diff --git a/mozilla/layout/base/nsIPresShell.h b/mozilla/layout/base/nsIPresShell.h index cc89c1c2787..9f7f81dbb41 100644 --- a/mozilla/layout/base/nsIPresShell.h +++ b/mozilla/layout/base/nsIPresShell.h @@ -140,8 +140,8 @@ public: // All frames owned by the shell are allocated from an arena. They are also recycled // using free lists (separate free lists being maintained for each size_t). // Methods for recycling frames. - NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0; - NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0; + virtual void* AllocateFrame(size_t aSize) = 0; + virtual void FreeFrame(size_t aSize, void* aFreeChunk) = 0; // Dynamic stack memory allocation NS_IMETHOD PushStackMemory() = 0; diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index e81eb9a9c85..51822433ec2 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -107,7 +107,7 @@ nsPresContext::PrefChangedCallback(const char* aPrefName, void* instance_data) } #ifdef IBMBIDI -PRBool +static PRBool IsVisualCharset(const nsCAutoString& aCharset) { if (aCharset.EqualsIgnoreCase("ibm864") // Arabic//ahmed @@ -532,21 +532,6 @@ nsPresContext::GetUserPreferences() #endif } -NS_IMETHODIMP -nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) -{ - nsresult rv = NS_OK; - switch (aPrefType) { - case kPresContext_MinimumFontSize: - aValue = mMinimumFontSize; - break; - default: - rv = NS_ERROR_INVALID_ARG; - NS_ERROR("invalid arg"); - } - return rv; -} - void nsPresContext::ClearStyleDataAndReflow() { @@ -831,22 +816,6 @@ nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) return NS_OK; } -NS_IMETHODIMP -nsPresContext::AllocateFromShell(size_t aSize, void** aResult) -{ - if (mShell) - return mShell->AllocateFrame(aSize, aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsPresContext::FreeToShell(size_t aSize, void* aFreeChunk) -{ - if (mShell) - return mShell->FreeFrame(aSize, aFreeChunk); - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) { @@ -1031,24 +1000,23 @@ nsPresContext::IsVisRTL(PRBool& aResult) const return NS_OK; } -NS_IMETHODIMP -nsPresContext::GetBidiEnabled(PRBool* aBidiEnabled) const +PRBool +nsPresContext::BidiEnabled() const { - NS_ENSURE_ARG_POINTER(aBidiEnabled); - *aBidiEnabled = PR_FALSE; + PRBool bidiEnabled = PR_FALSE; NS_ASSERTION(mShell, "PresShell must be set on PresContext before calling nsPresContext::GetBidiEnabled"); if (mShell) { nsCOMPtr doc; mShell->GetDocument(getter_AddRefs(doc) ); NS_ASSERTION(doc, "PresShell has no document in nsPresContext::GetBidiEnabled"); if (doc) { - *aBidiEnabled = doc->GetBidiEnabled(); + bidiEnabled = doc->GetBidiEnabled(); } } - return NS_OK; + return bidiEnabled; } -NS_IMETHODIMP +void nsPresContext::SetBidiEnabled(PRBool aBidiEnabled) const { if (mShell) { @@ -1058,7 +1026,6 @@ nsPresContext::SetBidiEnabled(PRBool aBidiEnabled) const doc->SetBidiEnabled(aBidiEnabled); } } - return NS_OK; } NS_IMETHODIMP @@ -1115,16 +1082,6 @@ nsPresContext::GetBidiCharset(nsACString &aCharSet) const #endif //IBMBIDI -NS_IMETHODIMP -nsPresContext::GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType) -{ - NS_PRECONDITION(aType, "null out param"); - *aType = mLanguageSpecificTransformType; - - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetTheme(nsITheme** aResult) { diff --git a/mozilla/layout/base/nsPresContext.h b/mozilla/layout/base/nsPresContext.h index 3f601d73627..98e41740c95 100644 --- a/mozilla/layout/base/nsPresContext.h +++ b/mozilla/layout/base/nsPresContext.h @@ -83,8 +83,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x0a5d12e0, 0x944e, 0x11d1, \ - {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } +{ 0xfaf7c34a, 0x347c, 0x48f6, \ + {0x81, 0x76, 0xc0, 0xf6, 0xd4, 0xe5, 0x74, 0x2e} } enum nsWidgetType { eWidgetType_Button = 1, @@ -188,8 +188,18 @@ public: virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0; - NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult) = 0; - NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk) = 0; + void* AllocateFromShell(size_t aSize) + { + if (mShell) + return mShell->AllocateFrame(aSize); + return nsnull; + } + + void FreeToShell(size_t aSize, void* aFreeChunk) + { + if (mShell) + mShell->FreeFrame(aSize, aFreeChunk); + } /** * Get the font metrics for a given font. @@ -202,10 +212,7 @@ public: */ virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const = 0; - /** Get a cached boolean pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the boolean pref */ + /** Get a cached boolean pref, by its type */ // * - initially created for bugs 31816, 20760, 22963 PRBool GetCachedBoolPref(PRUint32 aPrefType) const { @@ -225,12 +232,21 @@ public: return PR_FALSE; } - /** Get a cached integer pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the integer pref */ + /** Get a cached integer pref, by its type */ // * - initially created for bugs 30910, 61883, 74186, 84398 - NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0; + PRInt32 GetCachedIntPref(PRUint32 aPrefType) const + { + // If called with a constant parameter, the compiler should optimize + // this switch statement away. + switch (aPrefType) { + case kPresContext_MinimumFontSize: + return mMinimumFontSize; + default: + NS_ERROR("invalid arg passed to GetCachedIntPref"); + } + + return PR_FALSE; + } /** * Access Nav's magic font scaler value @@ -355,8 +371,10 @@ public: * * @param aType returns type, must be non-NULL */ - NS_IMETHOD GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType) = 0; + nsLanguageSpecificTransformType LanguageSpecificTransformType() const + { + return mLanguageSpecificTransformType; + } /** * Set and get methods for controling the background drawing @@ -383,14 +401,14 @@ public: * * @lina 07/12/2000 */ - NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const = 0; + virtual PRBool BidiEnabled() const = 0; /** * Set bidi enabled. This means we should apply the Unicode Bidi Algorithm * * @lina 07/12/2000 */ - NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) const = 0; + virtual void SetBidiEnabled(PRBool aBidiEnabled) const = 0; /** * Set visual or implicit mode into the pres context. @@ -526,7 +544,9 @@ protected: nsILinkHandler* mLinkHandler; // [WEAK] nsILanguageAtom* mLanguage; // [STRONG] + nsLanguageSpecificTransformType mLanguageSpecificTransformType; PRInt32 mFontScaler; + nscoord mMinimumFontSize; nsRect mVisibleArea; @@ -540,10 +560,9 @@ protected: nscolor mFocusBackgroundColor; nscolor mFocusTextColor; - PRUint8 mFocusRingWidth; - nsCompatibility mCompatibilityMode; PRUint16 mImageAnimationMode; + PRUint8 mFocusRingWidth; unsigned mUseDocumentFonts : 1; unsigned mUseDocumentColors : 1; diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index ec6712f8a53..44c5efbd60a 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -578,8 +578,8 @@ public: ~FrameArena(); // Memory management functions - nsresult AllocateFrame(size_t aSize, void** aResult); - nsresult FreeFrame(size_t aSize, void* aPtr); + NS_HIDDEN_(void*) AllocateFrame(size_t aSize); + NS_HIDDEN_(void) FreeFrame(size_t aSize, void* aPtr); private: #if !defined(DEBUG_TRACEMALLOC_FRAMEARENA) @@ -611,11 +611,11 @@ FrameArena::~FrameArena() #endif } -nsresult -FrameArena::AllocateFrame(size_t aSize, void** aResult) +void* +FrameArena::AllocateFrame(size_t aSize) { #if defined(DEBUG_TRACEMALLOC_FRAMEARENA) - *aResult = PR_Malloc(aSize); + return PR_Malloc(aSize); #else void* result = nsnull; @@ -639,12 +639,11 @@ FrameArena::AllocateFrame(size_t aSize, void** aResult) PL_ARENA_ALLOCATE(result, &mPool, aSize); } - *aResult = result; + return result; #endif - return NS_OK; } -nsresult +void FrameArena::FreeFrame(size_t aSize, void* aPtr) { #ifdef DEBUG @@ -673,7 +672,6 @@ FrameArena::FreeFrame(size_t aSize, void* aPtr) } #endif #endif - return NS_OK; } class PresShellViewEventListener : public nsIScrollPositionListener, @@ -1020,8 +1018,8 @@ public: nsCompatibility aCompatMode); NS_IMETHOD Destroy(); - NS_IMETHOD AllocateFrame(size_t aSize, void** aResult); - NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk); + virtual NS_HIDDEN_(void*) AllocateFrame(size_t aSize); + virtual NS_HIDDEN_(void) FreeFrame(size_t aSize, void* aFreeChunk); // Dynamic stack memory allocation NS_IMETHOD PushStackMemory(); @@ -1959,17 +1957,16 @@ PresShell::FreeDynamicStack() } -NS_IMETHODIMP +void PresShell::FreeFrame(size_t aSize, void* aPtr) { mFrameArena.FreeFrame(aSize, aPtr); - return NS_OK; } -NS_IMETHODIMP -PresShell::AllocateFrame(size_t aSize, void** aResult) +void* +PresShell::AllocateFrame(size_t aSize) { - return mFrameArena.AllocateFrame(aSize, aResult); + return mFrameArena.AllocateFrame(aSize); } NS_IMETHODIMP @@ -4886,8 +4883,7 @@ NS_IMETHODIMP PresShell::PostReflowCallback(nsIReflowCallback* aCallback) { nsCallbackEventRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsCallbackEventRequest), &result); + void* result = AllocateFrame(sizeof(nsCallbackEventRequest)); request = (nsCallbackEventRequest*)result; request->callback = aCallback; @@ -4950,8 +4946,7 @@ PresShell::PostDOMEvent(nsIContent* aContent, nsEvent* aEvent) // ok we have a list of events to handle. Queue them up and handle them // after we finish reflow. nsDOMEventRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsDOMEventRequest), &result); + void* result = AllocateFrame(sizeof(nsDOMEventRequest)); request = (nsDOMEventRequest*)result; request->content = aContent; @@ -4986,8 +4981,7 @@ PresShell::PostAttributeChange(nsIContent* aContent, // after we finish reflow. nsAttributeChangeRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsAttributeChangeRequest), &result); + void* result = AllocateFrame(sizeof(nsAttributeChangeRequest)); request = (nsAttributeChangeRequest*)result; request->content = aContent; diff --git a/mozilla/layout/base/public/nsIPresContext.h b/mozilla/layout/base/public/nsIPresContext.h index 3f601d73627..98e41740c95 100644 --- a/mozilla/layout/base/public/nsIPresContext.h +++ b/mozilla/layout/base/public/nsIPresContext.h @@ -83,8 +83,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x0a5d12e0, 0x944e, 0x11d1, \ - {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } +{ 0xfaf7c34a, 0x347c, 0x48f6, \ + {0x81, 0x76, 0xc0, 0xf6, 0xd4, 0xe5, 0x74, 0x2e} } enum nsWidgetType { eWidgetType_Button = 1, @@ -188,8 +188,18 @@ public: virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0; - NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult) = 0; - NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk) = 0; + void* AllocateFromShell(size_t aSize) + { + if (mShell) + return mShell->AllocateFrame(aSize); + return nsnull; + } + + void FreeToShell(size_t aSize, void* aFreeChunk) + { + if (mShell) + mShell->FreeFrame(aSize, aFreeChunk); + } /** * Get the font metrics for a given font. @@ -202,10 +212,7 @@ public: */ virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const = 0; - /** Get a cached boolean pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the boolean pref */ + /** Get a cached boolean pref, by its type */ // * - initially created for bugs 31816, 20760, 22963 PRBool GetCachedBoolPref(PRUint32 aPrefType) const { @@ -225,12 +232,21 @@ public: return PR_FALSE; } - /** Get a cached integer pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the integer pref */ + /** Get a cached integer pref, by its type */ // * - initially created for bugs 30910, 61883, 74186, 84398 - NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0; + PRInt32 GetCachedIntPref(PRUint32 aPrefType) const + { + // If called with a constant parameter, the compiler should optimize + // this switch statement away. + switch (aPrefType) { + case kPresContext_MinimumFontSize: + return mMinimumFontSize; + default: + NS_ERROR("invalid arg passed to GetCachedIntPref"); + } + + return PR_FALSE; + } /** * Access Nav's magic font scaler value @@ -355,8 +371,10 @@ public: * * @param aType returns type, must be non-NULL */ - NS_IMETHOD GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType) = 0; + nsLanguageSpecificTransformType LanguageSpecificTransformType() const + { + return mLanguageSpecificTransformType; + } /** * Set and get methods for controling the background drawing @@ -383,14 +401,14 @@ public: * * @lina 07/12/2000 */ - NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const = 0; + virtual PRBool BidiEnabled() const = 0; /** * Set bidi enabled. This means we should apply the Unicode Bidi Algorithm * * @lina 07/12/2000 */ - NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) const = 0; + virtual void SetBidiEnabled(PRBool aBidiEnabled) const = 0; /** * Set visual or implicit mode into the pres context. @@ -526,7 +544,9 @@ protected: nsILinkHandler* mLinkHandler; // [WEAK] nsILanguageAtom* mLanguage; // [STRONG] + nsLanguageSpecificTransformType mLanguageSpecificTransformType; PRInt32 mFontScaler; + nscoord mMinimumFontSize; nsRect mVisibleArea; @@ -540,10 +560,9 @@ protected: nscolor mFocusBackgroundColor; nscolor mFocusTextColor; - PRUint8 mFocusRingWidth; - nsCompatibility mCompatibilityMode; PRUint16 mImageAnimationMode; + PRUint8 mFocusRingWidth; unsigned mUseDocumentFonts : 1; unsigned mUseDocumentColors : 1; diff --git a/mozilla/layout/base/public/nsIPresShell.h b/mozilla/layout/base/public/nsIPresShell.h index cc89c1c2787..9f7f81dbb41 100644 --- a/mozilla/layout/base/public/nsIPresShell.h +++ b/mozilla/layout/base/public/nsIPresShell.h @@ -140,8 +140,8 @@ public: // All frames owned by the shell are allocated from an arena. They are also recycled // using free lists (separate free lists being maintained for each size_t). // Methods for recycling frames. - NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0; - NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0; + virtual void* AllocateFrame(size_t aSize) = 0; + virtual void FreeFrame(size_t aSize, void* aFreeChunk) = 0; // Dynamic stack memory allocation NS_IMETHOD PushStackMemory() = 0; diff --git a/mozilla/layout/base/public/nsPresContext.h b/mozilla/layout/base/public/nsPresContext.h index 3f601d73627..98e41740c95 100644 --- a/mozilla/layout/base/public/nsPresContext.h +++ b/mozilla/layout/base/public/nsPresContext.h @@ -83,8 +83,8 @@ class nsIRenderingContext; #endif #define NS_IPRESCONTEXT_IID \ -{ 0x0a5d12e0, 0x944e, 0x11d1, \ - {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } +{ 0xfaf7c34a, 0x347c, 0x48f6, \ + {0x81, 0x76, 0xc0, 0xf6, 0xd4, 0xe5, 0x74, 0x2e} } enum nsWidgetType { eWidgetType_Button = 1, @@ -188,8 +188,18 @@ public: virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0; - NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult) = 0; - NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk) = 0; + void* AllocateFromShell(size_t aSize) + { + if (mShell) + return mShell->AllocateFrame(aSize); + return nsnull; + } + + void FreeToShell(size_t aSize, void* aFreeChunk) + { + if (mShell) + mShell->FreeFrame(aSize, aFreeChunk); + } /** * Get the font metrics for a given font. @@ -202,10 +212,7 @@ public: */ virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const = 0; - /** Get a cached boolean pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the boolean pref */ + /** Get a cached boolean pref, by its type */ // * - initially created for bugs 31816, 20760, 22963 PRBool GetCachedBoolPref(PRUint32 aPrefType) const { @@ -225,12 +232,21 @@ public: return PR_FALSE; } - /** Get a cached integer pref, by its type - if the type is not supported, then NS_ERROR_INVALID_ARG is returned - and the aValue argument is undefined, otherwise aValue is set - to the value of the integer pref */ + /** Get a cached integer pref, by its type */ // * - initially created for bugs 30910, 61883, 74186, 84398 - NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) = 0; + PRInt32 GetCachedIntPref(PRUint32 aPrefType) const + { + // If called with a constant parameter, the compiler should optimize + // this switch statement away. + switch (aPrefType) { + case kPresContext_MinimumFontSize: + return mMinimumFontSize; + default: + NS_ERROR("invalid arg passed to GetCachedIntPref"); + } + + return PR_FALSE; + } /** * Access Nav's magic font scaler value @@ -355,8 +371,10 @@ public: * * @param aType returns type, must be non-NULL */ - NS_IMETHOD GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType) = 0; + nsLanguageSpecificTransformType LanguageSpecificTransformType() const + { + return mLanguageSpecificTransformType; + } /** * Set and get methods for controling the background drawing @@ -383,14 +401,14 @@ public: * * @lina 07/12/2000 */ - NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const = 0; + virtual PRBool BidiEnabled() const = 0; /** * Set bidi enabled. This means we should apply the Unicode Bidi Algorithm * * @lina 07/12/2000 */ - NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) const = 0; + virtual void SetBidiEnabled(PRBool aBidiEnabled) const = 0; /** * Set visual or implicit mode into the pres context. @@ -526,7 +544,9 @@ protected: nsILinkHandler* mLinkHandler; // [WEAK] nsILanguageAtom* mLanguage; // [STRONG] + nsLanguageSpecificTransformType mLanguageSpecificTransformType; PRInt32 mFontScaler; + nscoord mMinimumFontSize; nsRect mVisibleArea; @@ -540,10 +560,9 @@ protected: nscolor mFocusBackgroundColor; nscolor mFocusTextColor; - PRUint8 mFocusRingWidth; - nsCompatibility mCompatibilityMode; PRUint16 mImageAnimationMode; + PRUint8 mFocusRingWidth; unsigned mUseDocumentFonts : 1; unsigned mUseDocumentColors : 1; diff --git a/mozilla/layout/base/src/nsCaret.cpp b/mozilla/layout/base/src/nsCaret.cpp index 7ee0d2e935d..12d2fb0b88e 100644 --- a/mozilla/layout/base/src/nsCaret.cpp +++ b/mozilla/layout/base/src/nsCaret.cpp @@ -565,11 +565,7 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n nsCOMPtr presContext; rv = presShell->GetPresContext(getter_AddRefs(presContext)); - PRBool bidiEnabled = PR_FALSE; - if (presContext) - presContext->GetBidiEnabled(&bidiEnabled); - - if (bidiEnabled) + if (presContext && presContext->BidiEnabled()) { presShell->GetCaretBidiLevel(&bidiLevel); if (bidiLevel & BIDI_LEVEL_UNDEFINED) @@ -1088,7 +1084,7 @@ void nsCaret::GetCaretRectAndInvert() presContext->SetBidiEnabled(bidiEnabled); } else - presContext->GetBidiEnabled(&bidiEnabled); + bidiEnabled = presContext->BidiEnabled(); if (bidiEnabled) { if (bidiLevel != mKeyboardRTL) diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index e81eb9a9c85..51822433ec2 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -107,7 +107,7 @@ nsPresContext::PrefChangedCallback(const char* aPrefName, void* instance_data) } #ifdef IBMBIDI -PRBool +static PRBool IsVisualCharset(const nsCAutoString& aCharset) { if (aCharset.EqualsIgnoreCase("ibm864") // Arabic//ahmed @@ -532,21 +532,6 @@ nsPresContext::GetUserPreferences() #endif } -NS_IMETHODIMP -nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue) -{ - nsresult rv = NS_OK; - switch (aPrefType) { - case kPresContext_MinimumFontSize: - aValue = mMinimumFontSize; - break; - default: - rv = NS_ERROR_INVALID_ARG; - NS_ERROR("invalid arg"); - } - return rv; -} - void nsPresContext::ClearStyleDataAndReflow() { @@ -831,22 +816,6 @@ nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) return NS_OK; } -NS_IMETHODIMP -nsPresContext::AllocateFromShell(size_t aSize, void** aResult) -{ - if (mShell) - return mShell->AllocateFrame(aSize, aResult); - return NS_OK; -} - -NS_IMETHODIMP -nsPresContext::FreeToShell(size_t aSize, void* aFreeChunk) -{ - if (mShell) - return mShell->FreeFrame(aSize, aFreeChunk); - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) { @@ -1031,24 +1000,23 @@ nsPresContext::IsVisRTL(PRBool& aResult) const return NS_OK; } -NS_IMETHODIMP -nsPresContext::GetBidiEnabled(PRBool* aBidiEnabled) const +PRBool +nsPresContext::BidiEnabled() const { - NS_ENSURE_ARG_POINTER(aBidiEnabled); - *aBidiEnabled = PR_FALSE; + PRBool bidiEnabled = PR_FALSE; NS_ASSERTION(mShell, "PresShell must be set on PresContext before calling nsPresContext::GetBidiEnabled"); if (mShell) { nsCOMPtr doc; mShell->GetDocument(getter_AddRefs(doc) ); NS_ASSERTION(doc, "PresShell has no document in nsPresContext::GetBidiEnabled"); if (doc) { - *aBidiEnabled = doc->GetBidiEnabled(); + bidiEnabled = doc->GetBidiEnabled(); } } - return NS_OK; + return bidiEnabled; } -NS_IMETHODIMP +void nsPresContext::SetBidiEnabled(PRBool aBidiEnabled) const { if (mShell) { @@ -1058,7 +1026,6 @@ nsPresContext::SetBidiEnabled(PRBool aBidiEnabled) const doc->SetBidiEnabled(aBidiEnabled); } } - return NS_OK; } NS_IMETHODIMP @@ -1115,16 +1082,6 @@ nsPresContext::GetBidiCharset(nsACString &aCharSet) const #endif //IBMBIDI -NS_IMETHODIMP -nsPresContext::GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType) -{ - NS_PRECONDITION(aType, "null out param"); - *aType = mLanguageSpecificTransformType; - - return NS_OK; -} - NS_IMETHODIMP nsPresContext::GetTheme(nsITheme** aResult) { diff --git a/mozilla/layout/base/src/nsPresContext.h b/mozilla/layout/base/src/nsPresContext.h index 18f35791a69..b8aec9bfd0e 100644 --- a/mozilla/layout/base/src/nsPresContext.h +++ b/mozilla/layout/base/src/nsPresContext.h @@ -74,10 +74,7 @@ public: virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult); NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult); - NS_IMETHOD AllocateFromShell(size_t aSize, void** aResult); - NS_IMETHOD FreeToShell(size_t aSize, void* aFreeChunk); virtual const nsFont* GetDefaultFont(PRUint8 aFontID) const; - NS_IMETHOD GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue); virtual nsresult LoadImage(imgIRequest* aImage, nsIFrame* aTargetFrame, @@ -90,8 +87,6 @@ public: virtual void SetPageDim(nsRect* aRect) = 0; NS_IMETHOD GetTwipsToPixelsForFonts(float* aResult) const; NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const; - NS_IMETHOD GetLanguageSpecificTransformType( - nsLanguageSpecificTransformType* aType); #ifdef MOZ_REFLOW_PERF NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame); @@ -104,8 +99,8 @@ public: const PRUnichar* aData); #ifdef IBMBIDI - NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const; - NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) const; + virtual PRBool BidiEnabled() const; + virtual void SetBidiEnabled(PRBool aBidiEnabled) const; NS_IMETHOD GetBidiUtils(nsBidiPresUtils** aBidiUtils); NS_IMETHOD SetBidi(PRUint32 aSource, PRBool aForceReflow = PR_FALSE); NS_IMETHOD GetBidi(PRUint32* aDest) const; @@ -128,7 +123,6 @@ protected: nsCOMPtr mPrefs; nsCOMPtr mLangService; - nsLanguageSpecificTransformType mLanguageSpecificTransformType; nsWeakPtr mContainer; nsFont mDefaultVariableFont; @@ -138,7 +132,6 @@ protected: nsFont mDefaultMonospaceFont; nsFont mDefaultCursiveFont; nsFont mDefaultFantasyFont; - nscoord mMinimumFontSize; nsSupportsHashtable mImageLoaders; diff --git a/mozilla/layout/base/src/nsSpaceManager.cpp b/mozilla/layout/base/src/nsSpaceManager.cpp index b1f2726005f..3c45c324278 100644 --- a/mozilla/layout/base/src/nsSpaceManager.cpp +++ b/mozilla/layout/base/src/nsSpaceManager.cpp @@ -88,9 +88,7 @@ nsSpaceManager::BandList::Clear() PR_STATIC_CALLBACK(void*) PSArenaAllocCB(size_t aSize, void* aClosure) { - void *rv; - NS_STATIC_CAST(nsIPresShell*, aClosure)->AllocateFrame(aSize, &rv); - return rv; + return NS_STATIC_CAST(nsIPresShell*, aClosure)->AllocateFrame(aSize); } // PresShell Arena free callback (for nsIntervalSet use below) diff --git a/mozilla/layout/doc/adding-style-props.html b/mozilla/layout/doc/adding-style-props.html index 57abe8b0d39..568c4a20ddb 100644 --- a/mozilla/layout/doc/adding-style-props.html +++ b/mozilla/layout/doc/adding-style-props.html @@ -296,9 +296,7 @@ Add a data member NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UIReset) void* operator new(size_t sz, nsIPresContext* aContext) { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleUIReset(); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 1cbfa7d4c9c..6cec6d86a5d 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -676,9 +676,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, mState & NS_FRAME_IS_DIRTY || mState & NS_FRAME_HAS_DIRTY_CHILDREN) { #ifdef IBMBIDI if (! mLines.empty()) { - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); if (bidiUtils) { @@ -3960,10 +3958,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef IBMBIDI // XXXldb Why don't we do this earlier? else { - PRBool bidiEnabled; - aState.mPresContext->GetBidiEnabled(&bidiEnabled); - - if (bidiEnabled) { + if (aState.mPresContext->BidiEnabled()) { if (!aState.mPresContext->IsVisualMode()) { nsBidiPresUtils* bidiUtils; aState.mPresContext->GetBidiUtils(&bidiUtils); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 81dc7ad2e4e..159b863a6bc 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -433,8 +433,7 @@ void* nsFrame::operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresShell->AllocateFrame(sz, &result); + void* result = aPresShell->AllocateFrame(sz); if (result) { memset(result, 0, sz); @@ -3186,9 +3185,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, aBlockFrame->GetOffsetFromView(aPresContext, offset,&view); nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates! #ifdef IBMBIDI - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - result = it->FindFrameAt(searchingLine, newDesiredX, bidiEnabled, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); + result = it->FindFrameAt(searchingLine, newDesiredX, aPresContext->BidiEnabled(), &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); #else result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); #endif // IBMBIDI diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 4cbc8e4d158..4ca4a1a0403 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -2514,9 +2514,7 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) // display correctly on native widgets in OSs with Bidi support. // So bail out if the page is not Bidi, or not visual, or if the pref is // set to use visual order on forms in visual pages - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (!bidiEnabled) { + if (!aPresContext->BidiEnabled()) { return PR_FALSE; } diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index ed1fd1c68e7..cbb02eaf94d 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -91,9 +91,7 @@ NS_NewLineBox(nsIPresShell* aPresShell, nsIFrame* aFrame, void* nsLineBox::operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW { - void* result = nsnull; - aPresShell->AllocateFrame(sz, &result); - return result; + return aPresShell->AllocateFrame(sz); } // Overloaded delete operator. Doesn't actually free the memory, because we diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 227bff29ace..7a132b93b43 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -980,11 +980,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, mSpaceManager->Translate(tx, ty); #ifdef IBMBIDI - PRBool bidiEnabled; - mPresContext->GetBidiEnabled(&bidiEnabled); PRInt32 start, end; - if (bidiEnabled) { + if (mPresContext->BidiEnabled()) { if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) { aFrame->GetOffsets(start, end); } diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 8bc6a6087de..a9be00b5442 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -536,9 +536,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, #ifdef IBMBIDI nsresult rv = NS_ERROR_FAILURE; - PRBool isBidiEnabled = PR_FALSE; - aPresContext->GetBidiEnabled(&isBidiEnabled); - if (isBidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index d38bc73d325..8195d367886 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -1510,9 +1510,7 @@ nsSelection::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aA if (NS_SUCCEEDED(result) && NS_SUCCEEDED(result = frame->PeekOffset(context, &pos)) && pos.mResultContent) { tHint = (HINT)pos.mPreferLeft; - PRBool bidiEnabled = PR_FALSE; - context->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) + if (context->BidiEnabled()) { nsIFrame *theFrame; PRInt32 currentOffset, frameStart, frameEnd; @@ -2596,9 +2594,7 @@ nsSelection::HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& if (NS_SUCCEEDED(result)) { #ifdef VISUALSELECTION - PRBool bidiEnabled = PR_FALSE; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { PRUint8 level; nsPeekOffsetStruct pos; //set data using mLimiter to stop on scroll views. If we have a limiter then we stop peeking diff --git a/mozilla/layout/generic/nsSpaceManager.cpp b/mozilla/layout/generic/nsSpaceManager.cpp index b1f2726005f..3c45c324278 100644 --- a/mozilla/layout/generic/nsSpaceManager.cpp +++ b/mozilla/layout/generic/nsSpaceManager.cpp @@ -88,9 +88,7 @@ nsSpaceManager::BandList::Clear() PR_STATIC_CALLBACK(void*) PSArenaAllocCB(size_t aSize, void* aClosure) { - void *rv; - NS_STATIC_CAST(nsIPresShell*, aClosure)->AllocateFrame(aSize, &rv); - return rv; + return NS_STATIC_CAST(nsIPresShell*, aClosure)->AllocateFrame(aSize); } // PresShell Arena free callback (for nsIntervalSet use below) diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 8fb92583b47..c46ea0c86e0 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -1440,8 +1440,7 @@ nsTextFrame::Paint(nsIPresContext* aPresContext, aRenderingContext.GetHints(hints); #ifdef IBMBIDI - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); + PRBool bidiEnabled = aPresContext->BidiEnabled(); #else const PRBool bidiEnabled = PR_FALSE; #endif // IBMBIDI @@ -2234,10 +2233,8 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, #ifdef IBMBIDI PRBool isRightToLeftOnBidiPlatform = PR_FALSE; PRBool isBidiSystem = PR_FALSE; - PRBool bidiEnabled; nsCharType charType = eCharType_LeftToRight; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { isBidiSystem = aPresContext->IsBidiSystem(); GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**) &level,sizeof(level)); GetBidiProperty(aPresContext, nsLayoutAtoms::charType, (void**) &charType,sizeof(charType)); @@ -2931,12 +2928,10 @@ nsTextFrame::PaintTextSlowly(nsIPresContext* aPresContext, if (0 != textLength) { #ifdef IBMBIDI - PRBool bidiEnabled; PRUint8 level = 0; nsCharType charType = eCharType_LeftToRight; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); @@ -5223,9 +5218,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, startingOffset = mContentOffset; } - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsCharType charType = eCharType_LeftToRight; PRUint32 hints = 0; aReflowState.rendContext->GetHints(hints); diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index d49ef1f6843..a14ab33a9a0 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -193,8 +193,8 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, { MOZ_COUNT_CTOR(nsTextTransformer); - aPresContext-> - GetLanguageSpecificTransformType(&mLanguageSpecificTransformType); + mLanguageSpecificTransformType = + aPresContext->LanguageSpecificTransformType(); #ifdef IBMBIDI mPresContext = aPresContext; @@ -236,10 +236,7 @@ nsTextTransformer::Init(nsIFrame* aFrame, * * We do numeric shaping in all Bidi documents. */ - PRBool bidiEnabled; - - mPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (mPresContext->BidiEnabled()) { aFrame->GetBidiProperty(mPresContext, nsLayoutAtoms::charType, (void**)&mCharType, sizeof(mCharType)); if (mCharType == eCharType_RightToLeftArabic) { diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 1cbfa7d4c9c..6cec6d86a5d 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -676,9 +676,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, mState & NS_FRAME_IS_DIRTY || mState & NS_FRAME_HAS_DIRTY_CHILDREN) { #ifdef IBMBIDI if (! mLines.empty()) { - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); if (bidiUtils) { @@ -3960,10 +3958,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef IBMBIDI // XXXldb Why don't we do this earlier? else { - PRBool bidiEnabled; - aState.mPresContext->GetBidiEnabled(&bidiEnabled); - - if (bidiEnabled) { + if (aState.mPresContext->BidiEnabled()) { if (!aState.mPresContext->IsVisualMode()) { nsBidiPresUtils* bidiUtils; aState.mPresContext->GetBidiUtils(&bidiUtils); diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 81dc7ad2e4e..159b863a6bc 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -433,8 +433,7 @@ void* nsFrame::operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresShell->AllocateFrame(sz, &result); + void* result = aPresShell->AllocateFrame(sz); if (result) { memset(result, 0, sz); @@ -3186,9 +3185,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, aBlockFrame->GetOffsetFromView(aPresContext, offset,&view); nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates! #ifdef IBMBIDI - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - result = it->FindFrameAt(searchingLine, newDesiredX, bidiEnabled, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); + result = it->FindFrameAt(searchingLine, newDesiredX, aPresContext->BidiEnabled(), &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); #else result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); #endif // IBMBIDI diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 4cbc8e4d158..4ca4a1a0403 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -2514,9 +2514,7 @@ nsHTMLReflowState::IsBidiFormControl(nsIPresContext* aPresContext) // display correctly on native widgets in OSs with Bidi support. // So bail out if the page is not Bidi, or not visual, or if the pref is // set to use visual order on forms in visual pages - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (!bidiEnabled) { + if (!aPresContext->BidiEnabled()) { return PR_FALSE; } diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index ed1fd1c68e7..cbb02eaf94d 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -91,9 +91,7 @@ NS_NewLineBox(nsIPresShell* aPresShell, nsIFrame* aFrame, void* nsLineBox::operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW { - void* result = nsnull; - aPresShell->AllocateFrame(sz, &result); - return result; + return aPresShell->AllocateFrame(sz); } // Overloaded delete operator. Doesn't actually free the memory, because we diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 227bff29ace..7a132b93b43 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -980,11 +980,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, mSpaceManager->Translate(tx, ty); #ifdef IBMBIDI - PRBool bidiEnabled; - mPresContext->GetBidiEnabled(&bidiEnabled); PRInt32 start, end; - if (bidiEnabled) { + if (mPresContext->BidiEnabled()) { if (aFrame->GetStateBits() & NS_FRAME_IS_BIDI) { aFrame->GetOffsets(start, end); } diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 8bc6a6087de..a9be00b5442 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -536,9 +536,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, #ifdef IBMBIDI nsresult rv = NS_ERROR_FAILURE; - PRBool isBidiEnabled = PR_FALSE; - aPresContext->GetBidiEnabled(&isBidiEnabled); - if (isBidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index ec6712f8a53..44c5efbd60a 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -578,8 +578,8 @@ public: ~FrameArena(); // Memory management functions - nsresult AllocateFrame(size_t aSize, void** aResult); - nsresult FreeFrame(size_t aSize, void* aPtr); + NS_HIDDEN_(void*) AllocateFrame(size_t aSize); + NS_HIDDEN_(void) FreeFrame(size_t aSize, void* aPtr); private: #if !defined(DEBUG_TRACEMALLOC_FRAMEARENA) @@ -611,11 +611,11 @@ FrameArena::~FrameArena() #endif } -nsresult -FrameArena::AllocateFrame(size_t aSize, void** aResult) +void* +FrameArena::AllocateFrame(size_t aSize) { #if defined(DEBUG_TRACEMALLOC_FRAMEARENA) - *aResult = PR_Malloc(aSize); + return PR_Malloc(aSize); #else void* result = nsnull; @@ -639,12 +639,11 @@ FrameArena::AllocateFrame(size_t aSize, void** aResult) PL_ARENA_ALLOCATE(result, &mPool, aSize); } - *aResult = result; + return result; #endif - return NS_OK; } -nsresult +void FrameArena::FreeFrame(size_t aSize, void* aPtr) { #ifdef DEBUG @@ -673,7 +672,6 @@ FrameArena::FreeFrame(size_t aSize, void* aPtr) } #endif #endif - return NS_OK; } class PresShellViewEventListener : public nsIScrollPositionListener, @@ -1020,8 +1018,8 @@ public: nsCompatibility aCompatMode); NS_IMETHOD Destroy(); - NS_IMETHOD AllocateFrame(size_t aSize, void** aResult); - NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk); + virtual NS_HIDDEN_(void*) AllocateFrame(size_t aSize); + virtual NS_HIDDEN_(void) FreeFrame(size_t aSize, void* aFreeChunk); // Dynamic stack memory allocation NS_IMETHOD PushStackMemory(); @@ -1959,17 +1957,16 @@ PresShell::FreeDynamicStack() } -NS_IMETHODIMP +void PresShell::FreeFrame(size_t aSize, void* aPtr) { mFrameArena.FreeFrame(aSize, aPtr); - return NS_OK; } -NS_IMETHODIMP -PresShell::AllocateFrame(size_t aSize, void** aResult) +void* +PresShell::AllocateFrame(size_t aSize) { - return mFrameArena.AllocateFrame(aSize, aResult); + return mFrameArena.AllocateFrame(aSize); } NS_IMETHODIMP @@ -4886,8 +4883,7 @@ NS_IMETHODIMP PresShell::PostReflowCallback(nsIReflowCallback* aCallback) { nsCallbackEventRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsCallbackEventRequest), &result); + void* result = AllocateFrame(sizeof(nsCallbackEventRequest)); request = (nsCallbackEventRequest*)result; request->callback = aCallback; @@ -4950,8 +4946,7 @@ PresShell::PostDOMEvent(nsIContent* aContent, nsEvent* aEvent) // ok we have a list of events to handle. Queue them up and handle them // after we finish reflow. nsDOMEventRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsDOMEventRequest), &result); + void* result = AllocateFrame(sizeof(nsDOMEventRequest)); request = (nsDOMEventRequest*)result; request->content = aContent; @@ -4986,8 +4981,7 @@ PresShell::PostAttributeChange(nsIContent* aContent, // after we finish reflow. nsAttributeChangeRequest* request = nsnull; - void* result = nsnull; - AllocateFrame(sizeof(nsAttributeChangeRequest), &result); + void* result = AllocateFrame(sizeof(nsAttributeChangeRequest)); request = (nsAttributeChangeRequest*)result; request->content = aContent; diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 8fb92583b47..c46ea0c86e0 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -1440,8 +1440,7 @@ nsTextFrame::Paint(nsIPresContext* aPresContext, aRenderingContext.GetHints(hints); #ifdef IBMBIDI - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); + PRBool bidiEnabled = aPresContext->BidiEnabled(); #else const PRBool bidiEnabled = PR_FALSE; #endif // IBMBIDI @@ -2234,10 +2233,8 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, #ifdef IBMBIDI PRBool isRightToLeftOnBidiPlatform = PR_FALSE; PRBool isBidiSystem = PR_FALSE; - PRBool bidiEnabled; nsCharType charType = eCharType_LeftToRight; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { isBidiSystem = aPresContext->IsBidiSystem(); GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void**) &level,sizeof(level)); GetBidiProperty(aPresContext, nsLayoutAtoms::charType, (void**) &charType,sizeof(charType)); @@ -2931,12 +2928,10 @@ nsTextFrame::PaintTextSlowly(nsIPresContext* aPresContext, if (0 != textLength) { #ifdef IBMBIDI - PRBool bidiEnabled; PRUint8 level = 0; nsCharType charType = eCharType_LeftToRight; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsBidiPresUtils* bidiUtils; aPresContext->GetBidiUtils(&bidiUtils); @@ -5223,9 +5218,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, startingOffset = mContentOffset; } - PRBool bidiEnabled; - aPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (aPresContext->BidiEnabled()) { nsCharType charType = eCharType_LeftToRight; PRUint32 hints = 0; aReflowState.rendContext->GetHints(hints); diff --git a/mozilla/layout/html/base/src/nsTextTransformer.cpp b/mozilla/layout/html/base/src/nsTextTransformer.cpp index d49ef1f6843..a14ab33a9a0 100644 --- a/mozilla/layout/html/base/src/nsTextTransformer.cpp +++ b/mozilla/layout/html/base/src/nsTextTransformer.cpp @@ -193,8 +193,8 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, { MOZ_COUNT_CTOR(nsTextTransformer); - aPresContext-> - GetLanguageSpecificTransformType(&mLanguageSpecificTransformType); + mLanguageSpecificTransformType = + aPresContext->LanguageSpecificTransformType(); #ifdef IBMBIDI mPresContext = aPresContext; @@ -236,10 +236,7 @@ nsTextTransformer::Init(nsIFrame* aFrame, * * We do numeric shaping in all Bidi documents. */ - PRBool bidiEnabled; - - mPresContext->GetBidiEnabled(&bidiEnabled); - if (bidiEnabled) { + if (mPresContext->BidiEnabled()) { aFrame->GetBidiProperty(mPresContext, nsLayoutAtoms::charType, (void**)&mCharType, sizeof(mCharType)); if (mCharType == eCharType_RightToLeftArabic) { diff --git a/mozilla/layout/style/nsIStyleRuleProcessor.h b/mozilla/layout/style/nsIStyleRuleProcessor.h index 46036590754..47f2cf70af6 100644 --- a/mozilla/layout/style/nsIStyleRuleProcessor.h +++ b/mozilla/layout/style/nsIStyleRuleProcessor.h @@ -68,9 +68,7 @@ struct RuleProcessorData { ~RuleProcessorData(); void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~RuleProcessorData(); diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index f93dd309815..24835a9d126 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -79,9 +79,7 @@ public: } void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); }; void operator delete(void* aPtr) {} // Does nothing. The arena will free us up when the rule tree // dies. @@ -369,9 +367,7 @@ void* nsRuleNode::operator new(size_t sz, nsIPresContext* aPresContext) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresContext->AllocateFromShell(sz, &result); - return result; + return aPresContext->AllocateFromShell(sz); } // Overridden to prevent the global delete from being called, since the memory @@ -1385,8 +1381,9 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex { nsStyleFont* fontData = new (mPresContext) nsStyleFont(mPresContext); - nscoord minimumFontSize = 0; - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize > 0 && !IsChrome(mPresContext)) { fontData->mFont.size = PR_MAX(fontData->mSize, minimumFontSize); } @@ -1976,8 +1973,9 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, parentFont = font; // See if there is a minimum font-size constraint to honor - nscoord minimumFontSize = 0; // unconstrained by default - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize < 0) minimumFontSize = 0; @@ -2114,9 +2112,9 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, textData.mLineHeight.GetUnit() == eCSSUnit_Pixel) { nscoord lh = nsStyleFont::ZoomText(mPresContext, text->mLineHeight.GetCoordValue()); - nscoord minimumFontSize = 0; - mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize, - minimumFontSize); + nscoord minimumFontSize = + mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize); + if (minimumFontSize > 0 && !IsChrome(mPresContext)) { // If we applied a minimum font size, scale the line height by // the same ratio. (If we *might* have applied a minimum font diff --git a/mozilla/layout/style/nsRuleNode.h b/mozilla/layout/style/nsRuleNode.h index 9f1e11153d3..61b53fe5f5f 100644 --- a/mozilla/layout/style/nsRuleNode.h +++ b/mozilla/layout/style/nsRuleNode.h @@ -67,9 +67,7 @@ struct nsInheritedStyleData #undef STYLE_STRUCT_RESET void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); }; void ClearInheritedData(PRUint32 aBits) { @@ -126,9 +124,7 @@ struct nsResetStyleData }; void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void ClearInheritedData(PRUint32 aBits) { diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index d053eb8cec1..ebd72469826 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -859,9 +859,7 @@ void* nsStyleContext::operator new(size_t sz, nsIPresContext* aPresContext) CPP_THROW_NEW { // Check the recycle list first. - void* result = nsnull; - aPresContext->AllocateFromShell(sz, &result); - return result; + return aPresContext->AllocateFromShell(sz); } // Overridden to prevent the global delete from being called, since the memory diff --git a/mozilla/layout/style/nsStyleStruct.cpp b/mozilla/layout/style/nsStyleStruct.cpp index 5374e0da30c..129de8f2975 100644 --- a/mozilla/layout/style/nsStyleStruct.cpp +++ b/mozilla/layout/style/nsStyleStruct.cpp @@ -212,10 +212,9 @@ nsStyleFont::nsStyleFont(nsIPresContext* aPresContext) void* nsStyleFont::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -319,10 +318,9 @@ nsStyleMargin::nsStyleMargin(const nsStyleMargin& aSrc) { void* nsStyleMargin::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -377,10 +375,9 @@ nsStylePadding::nsStylePadding(const nsStylePadding& aSrc) { void* nsStylePadding::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } @@ -476,10 +473,9 @@ nsStyleBorder::nsStyleBorder(const nsStyleBorder& aSrc) void* nsStyleBorder::operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); + void* result = aContext->AllocateFromShell(sz); if (result) - memset(result, 0, sz); + memset(result, 0, sz); return result; } diff --git a/mozilla/layout/style/nsStyleStruct.h b/mozilla/layout/style/nsStyleStruct.h index ddcbbeec67a..b6c14c541e6 100644 --- a/mozilla/layout/style/nsStyleStruct.h +++ b/mozilla/layout/style/nsStyleStruct.h @@ -131,9 +131,7 @@ struct nsStyleColor : public nsStyleStruct { nsChangeHint CalcDifference(const nsStyleColor& aOther) const; void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleColor(); @@ -153,9 +151,7 @@ struct nsStyleBackground : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Background) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleBackground(); @@ -489,9 +485,7 @@ struct nsStyleOutline: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Outline) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleOutline(); @@ -574,9 +568,7 @@ struct nsStyleList : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_List) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleList(); @@ -599,9 +591,7 @@ struct nsStylePosition : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Position) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStylePosition(); @@ -629,9 +619,7 @@ struct nsStyleTextReset : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_TextReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTextReset(); @@ -654,9 +642,7 @@ struct nsStyleText : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Text) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleText(); @@ -688,9 +674,7 @@ struct nsStyleVisibility : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Visibility) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleVisibility(); @@ -721,9 +705,7 @@ struct nsStyleDisplay : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Display) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleDisplay(); @@ -776,9 +758,7 @@ struct nsStyleTable: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Table) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTable(); @@ -802,9 +782,7 @@ struct nsStyleTableBorder: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_TableBorder) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleTableBorder(); @@ -897,9 +875,7 @@ struct nsStyleQuotes : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Quotes) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleQuotes(); @@ -969,9 +945,7 @@ struct nsStyleContent: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_Content) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleContent(); @@ -1096,9 +1070,7 @@ struct nsStyleUIReset: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UIReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleUIReset(); @@ -1121,9 +1093,7 @@ struct nsStyleUserInterface: public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_UserInterface) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleUserInterface(); @@ -1147,9 +1117,7 @@ struct nsStyleXUL : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_XUL) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleXUL(); @@ -1187,9 +1155,7 @@ struct nsStyleSVG : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_SVG) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleSVG(); @@ -1223,9 +1189,7 @@ struct nsStyleSVGReset : public nsStyleStruct { NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(eStyleStruct_SVGReset) void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW { - void* result = nsnull; - aContext->AllocateFromShell(sz, &result); - return result; + return aContext->AllocateFromShell(sz); } void Destroy(nsIPresContext* aContext) { this->~nsStyleSVGReset(); diff --git a/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp b/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp index 6d7069ba051..180e1f43bf3 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp +++ b/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp @@ -342,8 +342,7 @@ void* nsBoxLayoutState::Allocate(size_t sz, nsIPresShell* aPresShell) { // Check the recycle list first. - void* result = nsnull; - aPresShell->AllocateFrame(sz, &result); + void* result = aPresShell->AllocateFrame(sz); if (result) { memset(result, 0, sz);