From 275b85f68e79f01e994ffdeaa77b7eb79150aaca Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 01/22] Fix implementation of rules for auto margins on absolutely positioned elements; honor auto margins when only one margin is auto, even when the auto margin gets a negative value. (Bug 419100) r=roc Needed to help CSS 2.1 meet Proposed Recommendation entrance criteria. --- layout/generic/nsHTMLReflowState.cpp | 89 ++++++++++++------- ...-non-replaced-width-offset-margin-ref.html | 28 ++---- ...spos-replaced-width-offset-margin-ref.html | 46 ++++------ 3 files changed, 81 insertions(+), 82 deletions(-) diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index b16ef3f64a94..5a01849eace0 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -1313,32 +1313,50 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext, PRBool marginRightIsAuto = eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit(); - if (availMarginSpace < 0 || - (!marginLeftIsAuto && !marginRightIsAuto)) { - // We're over-constrained so use the direction of the containing block - // to dictate which value to ignore. (And note that the spec says to ignore - // 'left' or 'right' rather than 'margin-left' or 'margin-right'.) - if (cbrs && - NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) { - // Ignore the specified value for 'left'. - mComputedOffsets.left += availMarginSpace; - } else { - // Ignore the specified value for 'right'. - mComputedOffsets.right += availMarginSpace; - } - } else if (marginLeftIsAuto) { + if (marginLeftIsAuto) { if (marginRightIsAuto) { - // Both 'margin-left' and 'margin-right' are 'auto', so they get - // equal values - mComputedMargin.left = availMarginSpace / 2; - mComputedMargin.right = availMarginSpace - mComputedMargin.left; + if (availMarginSpace < 0) { + // Note that this case is different from the neither-'auto' + // case below, where the spec says to ignore 'left'/'right'. + if (cbrs && + NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) { + // Ignore the specified value for 'margin-left'. + mComputedMargin.left = availMarginSpace; + } else { + // Ignore the specified value for 'margin-right'. + mComputedMargin.right = availMarginSpace; + } + } else { + // Both 'margin-left' and 'margin-right' are 'auto', so they get + // equal values + mComputedMargin.left = availMarginSpace / 2; + mComputedMargin.right = availMarginSpace - mComputedMargin.left; + } } else { // Just 'margin-left' is 'auto' mComputedMargin.left = availMarginSpace; } } else { - // Just 'margin-right' is 'auto' - mComputedMargin.right = availMarginSpace; + if (marginRightIsAuto) { + // Just 'margin-right' is 'auto' + mComputedMargin.right = availMarginSpace; + } else { + // We're over-constrained so use the direction of the containing + // block to dictate which value to ignore. (And note that the + // spec says to ignore 'left' or 'right' rather than + // 'margin-left' or 'margin-right'.) + // Note that this case is different from the both-'auto' case + // above, where the spec says to ignore + // 'margin-left'/'margin-right'. + if (cbrs && + NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) { + // Ignore the specified value for 'left'. + mComputedOffsets.left += availMarginSpace; + } else { + // Ignore the specified value for 'right'. + mComputedOffsets.right += availMarginSpace; + } + } } } @@ -1392,24 +1410,31 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext, PRBool marginBottomIsAuto = eStyleUnit_Auto == mStyleMargin->mMargin.GetBottomUnit(); - if (availMarginSpace < 0 || (!marginTopIsAuto && !marginBottomIsAuto)) { - // We're over-constrained so ignore the specified value for - // 'bottom'. (And note that the spec says to ignore 'bottom' - // rather than 'margin-bottom'.) - mComputedOffsets.bottom += availMarginSpace; - } else if (marginTopIsAuto) { + if (marginTopIsAuto) { if (marginBottomIsAuto) { - // Both 'margin-top' and 'margin-bottom' are 'auto', so they get - // equal values - mComputedMargin.top = availMarginSpace / 2; - mComputedMargin.bottom = availMarginSpace - mComputedMargin.top; + if (availMarginSpace < 0) { + // FIXME: Note that the spec doesn't actually say we should do this! + mComputedMargin.bottom = availMarginSpace; + } else { + // Both 'margin-top' and 'margin-bottom' are 'auto', so they get + // equal values + mComputedMargin.top = availMarginSpace / 2; + mComputedMargin.bottom = availMarginSpace - mComputedMargin.top; + } } else { // Just 'margin-top' is 'auto' mComputedMargin.top = availMarginSpace; } } else { - // Just 'margin-bottom' is 'auto' - mComputedMargin.bottom = availMarginSpace; + if (marginBottomIsAuto) { + // Just 'margin-bottom' is 'auto' + mComputedMargin.bottom = availMarginSpace; + } else { + // We're over-constrained so ignore the specified value for + // 'bottom'. (And note that the spec says to ignore 'bottom' + // rather than 'margin-bottom'.) + mComputedOffsets.bottom += availMarginSpace; + } } } } diff --git a/layout/reftests/box-properties/abspos-non-replaced-width-offset-margin-ref.html b/layout/reftests/box-properties/abspos-non-replaced-width-offset-margin-ref.html index 54b5f56d5213..ce3348a26a17 100644 --- a/layout/reftests/box-properties/abspos-non-replaced-width-offset-margin-ref.html +++ b/layout/reftests/box-properties/abspos-non-replaced-width-offset-margin-ref.html @@ -11,16 +11,6 @@ div { height: 1px; background: navy; } - - @@ -354,14 +344,13 @@ Differences between CSS 2.1 and this reference:
- -
-
-
-
+
+
+
+
@@ -391,15 +380,14 @@ Differences between CSS 2.1 and this reference:
-
-
-
-
-
+
+
+
+
diff --git a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-ref.html b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-ref.html index 5da4d03d57e9..6427df2f3da2 100644 --- a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-ref.html +++ b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-ref.html @@ -12,16 +12,6 @@ div { height: 1px; background: blue; - - @@ -61,14 +51,13 @@ Differences between CSS 2.1 and this reference:
- -
-
-
-
+
+
+
+
@@ -98,15 +87,14 @@ Differences between CSS 2.1 and this reference:
-
-
-
-
-
+
+
+
+
@@ -504,14 +492,13 @@ Differences between CSS 2.1 and this reference:
- -
-
-
-
+
+
+
+
@@ -541,15 +528,14 @@ Differences between CSS 2.1 and this reference:
-
-
-
-
-
+
+
+
+
From c1f0fe176fe737dd4be806c227fa12d06d7b1aac Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 02/22] Add missing UngetToken() for invalid contents of @charset rule. (Bug 604172) r=bzbarsky Needed to help CSS 2.1 meet Proposed Recommendation entrance criteria. --- layout/style/nsCSSParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index f3914aa94955..019373f8d4f8 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1528,6 +1528,7 @@ CSSParserImpl::ParseCharsetRule(RuleAppendFunc aAppendFunc, } if (eCSSToken_String != mToken.mType) { + UngetToken(); REPORT_UNEXPECTED_TOKEN(PECharsetRuleNotString); return PR_FALSE; } From 471f66cce03f5219d660f202554d552fc83e5f30 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 03/22] Make GatherMedia() stop at block or semicolon in invalid cases. (Bug 604172) r=bzbarsky Needed to help CSS 2.1 meet Proposed Recommendation entrance criteria. --- layout/style/nsCSSParser.cpp | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 019373f8d4f8..007c445a132a 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -323,8 +323,8 @@ protected: PRBool ParseImportRule(RuleAppendFunc aAppendFunc, void* aProcessData); PRBool GatherURL(nsString& aURL); PRBool GatherMedia(nsMediaList* aMedia, - PRUnichar aStopSymbol); - PRBool ParseMediaQuery(PRUnichar aStopSymbol, nsMediaQuery **aQuery, + PRBool aInAtRule); + PRBool ParseMediaQuery(PRBool aInAtRule, nsMediaQuery **aQuery, PRBool *aParsedSomething, PRBool *aHitStop); PRBool ParseMediaQueryExpression(nsMediaQuery* aQuery); void ProcessImport(const nsString& aURLSpec, @@ -1178,7 +1178,7 @@ CSSParserImpl::ParseMediaList(const nsSubstring& aBuffer, // to a media query. (The main substative difference is the relative // precedence of commas and paretheses.) - if (!GatherMedia(aMediaList, PRUnichar(0))) { + if (!GatherMedia(aMediaList, PR_FALSE)) { aMediaList->Clear(); aMediaList->SetNonEmpty(); // don't match anything if (!mHTMLMediaMode) { @@ -1568,7 +1568,7 @@ CSSParserImpl::GatherURL(nsString& aURL) } PRBool -CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, +CSSParserImpl::ParseMediaQuery(PRBool aInAtRule, nsMediaQuery **aQuery, PRBool *aParsedSomething, PRBool *aHitStop) @@ -1583,7 +1583,7 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, if (!GetToken(PR_TRUE)) { *aHitStop = PR_TRUE; // expected termination by EOF - if (aStopSymbol == PRUnichar(0)) + if (!aInAtRule) return PR_TRUE; // unexpected termination by EOF @@ -1591,8 +1591,8 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, return PR_TRUE; } - if (eCSSToken_Symbol == mToken.mType && - mToken.mSymbol == aStopSymbol) { + if (eCSSToken_Symbol == mToken.mType && aInAtRule && + (mToken.mSymbol == ';' || mToken.mSymbol == '{')) { *aHitStop = PR_TRUE; UngetToken(); return PR_TRUE; @@ -1649,7 +1649,7 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, if (!GetToken(PR_TRUE)) { *aHitStop = PR_TRUE; // expected termination by EOF - if (aStopSymbol == PRUnichar(0)) + if (!aInAtRule) break; // unexpected termination by EOF @@ -1657,8 +1657,8 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, break; } - if (eCSSToken_Symbol == mToken.mType && - mToken.mSymbol == aStopSymbol) { + if (eCSSToken_Symbol == mToken.mType && aInAtRule && + (mToken.mSymbol == ';' || mToken.mSymbol == '{')) { *aHitStop = PR_TRUE; UngetToken(); break; @@ -1686,22 +1686,27 @@ CSSParserImpl::ParseMediaQuery(PRUnichar aStopSymbol, // (out-of-memory). PRBool CSSParserImpl::GatherMedia(nsMediaList* aMedia, - PRUnichar aStopSymbol) + PRBool aInAtRule) { for (;;) { nsAutoPtr query; PRBool parsedSomething, hitStop; - if (!ParseMediaQuery(aStopSymbol, getter_Transfers(query), + if (!ParseMediaQuery(aInAtRule, getter_Transfers(query), &parsedSomething, &hitStop)) { NS_ASSERTION(!hitStop, "should return true when hit stop"); if (NS_FAILED(mScanner.GetLowLevelError())) { return PR_FALSE; } - const PRUnichar stopChars[] = - { PRUnichar(','), aStopSymbol /* may be null */, PRUnichar(0) }; - SkipUntilOneOf(stopChars); + if (aInAtRule) { + const PRUnichar stopChars[] = + { PRUnichar(','), PRUnichar('{'), PRUnichar(';'), PRUnichar(0) }; + SkipUntilOneOf(stopChars); + } else { + SkipUntil(','); + } // Rely on SkipUntilOneOf leaving mToken around as the last token read. - if (mToken.mType == eCSSToken_Symbol && mToken.mSymbol == aStopSymbol) { + if (mToken.mType == eCSSToken_Symbol && aInAtRule && + (mToken.mSymbol == '{' || mToken.mSymbol == ';')) { UngetToken(); hitStop = PR_TRUE; } @@ -1884,7 +1889,7 @@ CSSParserImpl::ParseImportRule(RuleAppendFunc aAppendFunc, void* aData) } if (!ExpectSymbol(';', PR_TRUE)) { - if (!GatherMedia(media, ';') || + if (!GatherMedia(media, PR_TRUE) || !ExpectSymbol(';', PR_TRUE)) { REPORT_UNEXPECTED_TOKEN(PEImportUnexpected); // don't advance section, simply ignore invalid @import @@ -1993,7 +1998,7 @@ CSSParserImpl::ParseMediaRule(RuleAppendFunc aAppendFunc, void* aData) return PR_FALSE; } - if (GatherMedia(media, '{')) { + if (GatherMedia(media, PR_TRUE)) { // XXXbz this could use better error reporting throughout the method nsRefPtr rule(new nsCSSMediaRule()); // Append first, so when we do SetMedia() the rule From 81285a506b115a1c8d352c4bc5df80ab1100f3e2 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 04/22] Fix skipping of @-rules that are inside blocks to conform to new rule in CSS 2.1, which says that we must look for end-of-outer-block in addition to a semicolon or a block. (Bug 604175) r=bzbarsky This fixes http://test.csswg.org/suites/css2.1/20110111/html4/at-rule-013.htm Needed to help CSS 2.1 meet Proposed Recommendation entrance criteria. --- .../reftests/css-parsing/at-rule-013-ref.html | 25 +++++++ layout/reftests/css-parsing/at-rule-013.html | 68 +++++++++++++++++++ layout/reftests/css-parsing/reftest.list | 1 + layout/style/nsCSSParser.cpp | 21 ++++-- 4 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 layout/reftests/css-parsing/at-rule-013-ref.html create mode 100644 layout/reftests/css-parsing/at-rule-013.html diff --git a/layout/reftests/css-parsing/at-rule-013-ref.html b/layout/reftests/css-parsing/at-rule-013-ref.html new file mode 100644 index 000000000000..3f2b640bd519 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-013-ref.html @@ -0,0 +1,25 @@ + + + + + CSS Test: Ignoring at-rules inside @media blocks + + + + +

This sentence must be green.

+

This sentence must be green.

+

This sentence must be green.

+

This sentence must be green.

+ + diff --git a/layout/reftests/css-parsing/at-rule-013.html b/layout/reftests/css-parsing/at-rule-013.html new file mode 100644 index 000000000000..fa8981f05056 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-013.html @@ -0,0 +1,68 @@ + + + + + CSS Test: Ignoring at-rules inside @media blocks + + + + + + + + +

This sentence must be green.

+

This sentence must be green.

+

This sentence must be green.

+

This sentence must be green.

+ + diff --git a/layout/reftests/css-parsing/reftest.list b/layout/reftests/css-parsing/reftest.list index 0bfb2191674f..6b0b75160544 100644 --- a/layout/reftests/css-parsing/reftest.list +++ b/layout/reftests/css-parsing/reftest.list @@ -1,2 +1,3 @@ +== at-rule-013.html at-rule-013-ref.html == invalid-url-handling.xhtml invalid-url-handling-ref.xhtml == pseudo-elements-1.html pseudo-elements-1-ref.html diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 007c445a132a..4fb0dac4b531 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -310,7 +310,7 @@ protected: void SkipUntil(PRUnichar aStopSymbol); void SkipUntilOneOf(const PRUnichar* aStopSymbolChars); void SkipRuleSet(PRBool aInsideBraces); - PRBool SkipAtRule(); + PRBool SkipAtRule(PRBool aInsideBlock); PRBool SkipDeclaration(PRBool aCheckForBraces); PRBool PushGroup(nsICSSGroupRule* aRule); @@ -1434,7 +1434,7 @@ CSSParserImpl::NextIdent() } PRBool -CSSParserImpl::SkipAtRule() +CSSParserImpl::SkipAtRule(PRBool aInsideBlock) { for (;;) { if (!GetToken(PR_TRUE)) { @@ -1446,6 +1446,11 @@ CSSParserImpl::SkipAtRule() if (symbol == ';') { break; } + if (aInsideBlock && symbol == '}') { + // The closing } doesn't belong to us. + UngetToken(); + break; + } if (symbol == '{') { SkipUntil('}'); break; @@ -1465,6 +1470,12 @@ PRBool CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc, void* aData) { + // If we ever allow nested at-rules, we need to be very careful about + // the error handling rules in the CSS spec. In particular, we need + // to pass in to ParseAtRule whether we're inside a block, we need to + // ensure that all the individual at-rule parsing functions terminate + // immediately when they hit a '}', and then we need to pass whether + // we're inside a block to SkipAtRule below. nsCSSSection newSection; PRBool (CSSParserImpl::*parseFunc)(RuleAppendFunc, void*); @@ -1505,13 +1516,13 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc, OUTPUT_ERROR(); } // Skip over unsupported at rule, don't advance section - return SkipAtRule(); + return SkipAtRule(PR_FALSE); } if (!(this->*parseFunc)(aAppendFunc, aData)) { // Skip over invalid at rule, don't advance section OUTPUT_ERROR(); - return SkipAtRule(); + return SkipAtRule(PR_FALSE); } mSection = newSection; @@ -1972,7 +1983,7 @@ CSSParserImpl::ParseGroupRule(nsICSSGroupRule* aRule, break; } if (eCSSToken_AtKeyword == mToken.mType) { - SkipAtRule(); // group rules cannot contain @rules + SkipAtRule(PR_TRUE); // group rules cannot contain @rules continue; } UngetToken(); From 16edf76c281432a1552d1fae9121839fc8d8a825 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 05/22] Remove unused (and unnecessarily slow) method gfxAlphaBoxBlur::PremultiplyAlpha. (Bug 633369) r=roc --- gfx/thebes/gfxBlur.cpp | 13 ------------- gfx/thebes/gfxBlur.h | 5 ----- 2 files changed, 18 deletions(-) diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp index ff573996f140..dd9e4376150d 100644 --- a/gfx/thebes/gfxBlur.cpp +++ b/gfx/thebes/gfxBlur.cpp @@ -117,19 +117,6 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect, return mContext; } -void -gfxAlphaBoxBlur::PremultiplyAlpha(gfxFloat alpha) -{ - if (!mImageSurface) - return; - - unsigned char* data = mImageSurface->Data(); - PRInt32 length = mImageSurface->GetDataSize(); - - for (PRInt32 i=0; i(data[i] * alpha); -} - /** * Box blur involves looking at one pixel, and setting its value to the average * of its neighbouring pixels. diff --git a/gfx/thebes/gfxBlur.h b/gfx/thebes/gfxBlur.h index e1f3d37ebc8d..060ce128389a 100644 --- a/gfx/thebes/gfxBlur.h +++ b/gfx/thebes/gfxBlur.h @@ -103,11 +103,6 @@ public: return mContext; } - /** - * Premultiplies the image by the given alpha. - */ - void PremultiplyAlpha(gfxFloat alpha); - /** * Does the actual blurring/spreading and mask applying. Users of this * object must have drawn whatever they want to be blurred onto the internal From 008e6b6207d6927cf6393a95f8690d8f64abf973 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 06/22] Remove tracking of which font families are quirky, since we no longer use the information. (Bug 636040) r=jdaggett --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 1 - gfx/src/nsFont.cpp | 5 ----- gfx/src/nsFont.h | 4 ---- gfx/src/thebes/nsThebesDeviceContext.cpp | 1 - gfx/src/thebes/nsThebesFontMetrics.cpp | 1 - gfx/thebes/gfxFont.cpp | 7 +++---- gfx/thebes/gfxFont.h | 10 ++-------- gfx/thebes/gfxPangoFonts.cpp | 2 +- layout/style/nsRuleNode.cpp | 6 ------ layout/style/nsStyleStruct.cpp | 1 - layout/svg/base/src/nsSVGGlyphFrame.cpp | 1 - 11 files changed, 6 insertions(+), 33 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index b86c565e2759..f687297730e3 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2320,7 +2320,6 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font) language, fontStyle->mFont.sizeAdjust, fontStyle->mFont.systemFont, - fontStyle->mFont.familyNameQuirks, printerFont, fontStyle->mFont.featureSettings, fontStyle->mFont.languageOverride); diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index 405b33accf3b..3b749e314337 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -52,7 +52,6 @@ nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant, style = aStyle; systemFont = PR_FALSE; variant = aVariant; - familyNameQuirks = PR_FALSE; weight = aWeight; stretch = aStretch; decorations = aDecoration; @@ -76,7 +75,6 @@ nsFont::nsFont(const nsString& aName, PRUint8 aStyle, PRUint8 aVariant, style = aStyle; systemFont = PR_FALSE; variant = aVariant; - familyNameQuirks = PR_FALSE; weight = aWeight; stretch = aStretch; decorations = aDecoration; @@ -96,7 +94,6 @@ nsFont::nsFont(const nsFont& aOther) style = aOther.style; systemFont = aOther.systemFont; variant = aOther.variant; - familyNameQuirks = aOther.familyNameQuirks; weight = aOther.weight; stretch = aOther.stretch; decorations = aOther.decorations; @@ -118,7 +115,6 @@ PRBool nsFont::BaseEquals(const nsFont& aOther) const { if ((style == aOther.style) && (systemFont == aOther.systemFont) && - (familyNameQuirks == aOther.familyNameQuirks) && (weight == aOther.weight) && (stretch == aOther.stretch) && (size == aOther.size) && @@ -147,7 +143,6 @@ nsFont& nsFont::operator=(const nsFont& aOther) style = aOther.style; systemFont = aOther.systemFont; variant = aOther.variant; - familyNameQuirks = aOther.familyNameQuirks; weight = aOther.weight; stretch = aOther.stretch; decorations = aOther.decorations; diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h index 0bddb98ad7d8..5a3568e621c0 100644 --- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -78,10 +78,6 @@ struct NS_GFX nsFont { // The variant of the font (normal, small-caps) PRUint8 variant; - // True if the character set quirks (for treatment of "Symbol", - // "Wingdings", etc.) should be applied. - PRUint8 familyNameQuirks; - // The weight of the font; see gfxFontConstants.h. PRUint16 weight; diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index 2dc92f1de768..4de719fdf31f 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -831,7 +831,6 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const aFont->style = fontStyle.style; aFont->systemFont = fontStyle.systemFont; aFont->variant = NS_FONT_VARIANT_NORMAL; - aFont->familyNameQuirks = fontStyle.familyNameQuirks; aFont->weight = fontStyle.weight; aFont->stretch = fontStyle.stretch; aFont->decorations = NS_FONT_DECORATION_NONE; diff --git a/gfx/src/thebes/nsThebesFontMetrics.cpp b/gfx/src/thebes/nsThebesFontMetrics.cpp index b237997fe21a..6dfda868b145 100644 --- a/gfx/src/thebes/nsThebesFontMetrics.cpp +++ b/gfx/src/thebes/nsThebesFontMetrics.cpp @@ -82,7 +82,6 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage, mFontStyle = new gfxFontStyle(aFont.style, aFont.weight, aFont.stretch, size, aLanguage, aFont.sizeAdjust, aFont.systemFont, - aFont.familyNameQuirks, printerFont, aFont.featureSettings, aFont.languageOverride); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 00e44a743b20..e0a241f52bcf 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2860,7 +2860,7 @@ gfxFontStyle::ParseFontLanguageOverride(const nsString& aLangTag) gfxFontStyle::gfxFontStyle() : style(FONT_STYLE_NORMAL), systemFont(PR_TRUE), printerFont(PR_FALSE), - familyNameQuirks(PR_FALSE), weight(FONT_WEIGHT_NORMAL), + weight(FONT_WEIGHT_NORMAL), stretch(NS_FONT_STRETCH_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE), sizeAdjust(0.0f), language(gfxAtoms::x_western), @@ -2871,12 +2871,11 @@ gfxFontStyle::gfxFontStyle() : gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, gfxFloat aSize, nsIAtom *aLanguage, float aSizeAdjust, PRPackedBool aSystemFont, - PRPackedBool aFamilyNameQuirks, PRPackedBool aPrinterFont, const nsString& aFeatureSettings, const nsString& aLanguageOverride): style(aStyle), systemFont(aSystemFont), printerFont(aPrinterFont), - familyNameQuirks(aFamilyNameQuirks), weight(aWeight), stretch(aStretch), + weight(aWeight), stretch(aStretch), size(aSize), sizeAdjust(aSizeAdjust), language(aLanguage), languageOverride(ParseFontLanguageOverride(aLanguageOverride)) @@ -2904,7 +2903,7 @@ gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) : style(aStyle.style), systemFont(aStyle.systemFont), printerFont(aStyle.printerFont), - familyNameQuirks(aStyle.familyNameQuirks), weight(aStyle.weight), + weight(aStyle.weight), stretch(aStyle.stretch), size(aStyle.size), sizeAdjust(aStyle.sizeAdjust), language(aStyle.language), diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 91dcb6e26767..763d9dd5ab6a 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -111,7 +111,6 @@ struct THEBES_API gfxFontStyle { gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch, gfxFloat aSize, nsIAtom *aLanguage, float aSizeAdjust, PRPackedBool aSystemFont, - PRPackedBool aFamilyNameQuirks, PRPackedBool aPrinterFont, const nsString& aFeatureSettings, const nsString& aLanguageOverride); @@ -128,10 +127,6 @@ struct THEBES_API gfxFontStyle { // Say that this font is used for print or print preview. PRPackedBool printerFont : 1; - // True if the character set quirks (for treatment of "Symbol", - // "Wingdings", etc.) should be applied. - PRPackedBool familyNameQuirks : 1; - // The weight of the font: 100, 200, ... 900. PRUint16 weight; @@ -177,8 +172,8 @@ struct THEBES_API gfxFontStyle { } PLDHashNumber Hash() const { - return ((style + (systemFont << 7) + (familyNameQuirks << 8) + - (weight << 9)) + PRUint32(size*1000) + PRUint32(sizeAdjust*1000)) ^ + return ((style + (systemFont << 7) + + (weight << 8)) + PRUint32(size*1000) + PRUint32(sizeAdjust*1000)) ^ nsISupportsHashKey::HashKey(language); } @@ -189,7 +184,6 @@ struct THEBES_API gfxFontStyle { (style == other.style) && (systemFont == other.systemFont) && (printerFont == other.printerFont) && - (familyNameQuirks == other.familyNameQuirks) && (weight == other.weight) && (stretch == other.stretch) && (language == other.language) && diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp index 86fbd9a3870d..77eea6539d96 100644 --- a/gfx/thebes/gfxPangoFonts.cpp +++ b/gfx/thebes/gfxPangoFonts.cpp @@ -2346,7 +2346,7 @@ gfxFcFont::GetOrMakeFont(FcPattern *aRequestedPattern, FcPattern *aFontPattern) // FIXME: Pass a real stretch based on renderPattern! gfxFontStyle fontStyle(style, weight, NS_FONT_STRETCH_NORMAL, size, language, 0.0, - PR_TRUE, PR_FALSE, PR_FALSE, + PR_TRUE, PR_FALSE, NS_LITERAL_STRING(""), NS_LITERAL_STRING("")); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index c6c84b2540e9..4f020b5ea922 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -2944,9 +2944,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, // defaultVariableFont.name should always be "serif" or "sans-serif". aFont->mFont.name.Append(defaultVariableFont->name); } - aFont->mFont.familyNameQuirks = - (aPresContext->CompatibilityMode() == eCompatibility_NavQuirks && - aFontData.mFamilyFromHTML); aFont->mFont.systemFont = PR_FALSE; // Technically this is redundant with the code below, but it's good // to have since we'll still want it once we get rid of @@ -2955,20 +2952,17 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, } else if (eCSSUnit_System_Font == aFontData.mFamily.GetUnit()) { aFont->mFont.name = systemFont.name; - aFont->mFont.familyNameQuirks = PR_FALSE; aFont->mFont.systemFont = PR_TRUE; aFont->mGenericID = kGenericFont_NONE; } else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) { aCanStoreInRuleTree = PR_FALSE; aFont->mFont.name = aParentFont->mFont.name; - aFont->mFont.familyNameQuirks = aParentFont->mFont.familyNameQuirks; aFont->mFont.systemFont = aParentFont->mFont.systemFont; aFont->mGenericID = aParentFont->mGenericID; } else if (eCSSUnit_Initial == aFontData.mFamily.GetUnit()) { aFont->mFont.name = defaultVariableFont->name; - aFont->mFont.familyNameQuirks = PR_FALSE; aFont->mFont.systemFont = defaultVariableFont->systemFont; aFont->mGenericID = kGenericFont_NONE; } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 35cde98dc8ab..a6c281954b6e 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -208,7 +208,6 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont& (aFont1.sizeAdjust == aFont2.sizeAdjust) && (aFont1.style == aFont2.style) && (aFont1.variant == aFont2.variant) && - (aFont1.familyNameQuirks == aFont2.familyNameQuirks) && (aFont1.weight == aFont2.weight) && (aFont1.stretch == aFont2.stretch) && (aFont1.name == aFont2.name) && diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index efe0a06dcb8b..fa669121fdde 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -1602,7 +1602,6 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale, gfxFontStyle fontStyle(font.style, font.weight, font.stretch, textRunSize, mStyleContext->GetStyleVisibility()->mLanguage, font.sizeAdjust, font.systemFont, - font.familyNameQuirks, printerFont, font.featureSettings, font.languageOverride); From df337812687d39dfd43d8f4527e2989b2796fc1c Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 07/22] Remove tracking of whether the font family comes from HTML, since we no longer use the information. (Bug 636040) r=jdaggett --- content/html/content/src/nsHTMLFontElement.cpp | 1 - content/mathml/content/src/nsMathMLElement.cpp | 1 - layout/style/nsCSSDataBlock.cpp | 4 ---- layout/style/nsCSSStruct.h | 1 - 4 files changed, 7 deletions(-) diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 149ea5ceda74..1f964703ddda 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -194,7 +194,6 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes, if (value && value->Type() == nsAttrValue::eString && !value->IsEmptyString()) { font.mFamily.SetStringValue(value->GetStringValue(), eCSSUnit_Families); - font.mFamilyFromHTML = PR_TRUE; } } diff --git a/content/mathml/content/src/nsMathMLElement.cpp b/content/mathml/content/src/nsMathMLElement.cpp index 3b66e302b2f2..889a84367abb 100644 --- a/content/mathml/content/src/nsMathMLElement.cpp +++ b/content/mathml/content/src/nsMathMLElement.cpp @@ -403,7 +403,6 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, aData->mFontData->mFamily.GetUnit() == eCSSUnit_Null) { aData->mFontData->mFamily.SetStringValue(value->GetStringValue(), eCSSUnit_Families); - aData->mFontData->mFamilyFromHTML = PR_FALSE; } } diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 2d8f89d238b0..0926ef6056d0 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -190,10 +190,6 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const TryToStartImageLoad(*val, doc, iProp); } *target = *val; - if (iProp == eCSSProperty_font_family) { - // XXX Are there other things like this? - aRuleData->mFontData->mFamilyFromHTML = PR_FALSE; - } if (nsCSSProps::PropHasFlags(iProp, CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED) && ShouldIgnoreColors(aRuleData)) diff --git a/layout/style/nsCSSStruct.h b/layout/style/nsCSSStruct.h index 804eddb852a5..3873015d5174 100644 --- a/layout/style/nsCSSStruct.h +++ b/layout/style/nsCSSStruct.h @@ -140,7 +140,6 @@ private: }; struct nsRuleDataFont : public nsCSSFont { - PRBool mFamilyFromHTML; // Is the family from an HTML FONT element nsRuleDataFont() {} private: nsRuleDataFont(const nsRuleDataFont& aOther); // NOT IMPLEMENTED From 0187cc37f7b1f90f1fa143541e12637019704575 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 08/22] Fix nsXULScrollFrame parameter names that are named incorrectly and fix inconsistencies between .h and .cpp. (Bug 636307) r=ehsan --- layout/generic/nsGfxScrollFrame.cpp | 20 ++++++++++---------- layout/generic/nsGfxScrollFrame.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 602db5fdbce9..8fc93f9f56fe 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2518,12 +2518,12 @@ nsGfxScrollFrameInner::AsyncScrollPortEvent::Run() } PRBool -nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnTop) +nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnBottom) { if (!mInner.mHScrollbarBox) return PR_TRUE; - return AddRemoveScrollbar(aState, aOnTop, PR_TRUE, PR_TRUE); + return AddRemoveScrollbar(aState, aOnBottom, PR_TRUE, PR_TRUE); } PRBool @@ -2536,13 +2536,13 @@ nsXULScrollFrame::AddVerticalScrollbar(nsBoxLayoutState& aState, PRBool aOnRight } void -nsXULScrollFrame::RemoveHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnTop) +nsXULScrollFrame::RemoveHorizontalScrollbar(nsBoxLayoutState& aState, PRBool aOnBottom) { // removing a scrollbar should always fit #ifdef DEBUG PRBool result = #endif - AddRemoveScrollbar(aState, aOnTop, PR_TRUE, PR_FALSE); + AddRemoveScrollbar(aState, aOnBottom, PR_TRUE, PR_FALSE); NS_ASSERTION(result, "Removing horizontal scrollbar failed to fit??"); } @@ -2559,7 +2559,7 @@ nsXULScrollFrame::RemoveVerticalScrollbar(nsBoxLayoutState& aState, PRBool aOnRi PRBool nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, - PRBool aOnTop, PRBool aHorizontal, PRBool aAdd) + PRBool aOnRightOrBottom, PRBool aHorizontal, PRBool aAdd) { if (aHorizontal) { if (mInner.mNeverHasHorizontalScrollbar || !mInner.mHScrollbarBox) @@ -2574,7 +2574,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, PRBool fit = AddRemoveScrollbar(hasHorizontalScrollbar, mInner.mScrollPort.y, mInner.mScrollPort.height, - hSize.height, aOnTop, aAdd); + hSize.height, aOnRightOrBottom, aAdd); mInner.mHasHorizontalScrollbar = hasHorizontalScrollbar; // because mHasHorizontalScrollbar is a PRPackedBool if (!fit) mInner.SetScrollbarVisibility(mInner.mHScrollbarBox, !aAdd); @@ -2593,7 +2593,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, PRBool fit = AddRemoveScrollbar(hasVerticalScrollbar, mInner.mScrollPort.x, mInner.mScrollPort.width, - vSize.width, aOnTop, aAdd); + vSize.width, aOnRightOrBottom, aAdd); mInner.mHasVerticalScrollbar = hasVerticalScrollbar; // because mHasVerticalScrollbar is a PRPackedBool if (!fit) mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, !aAdd); @@ -2605,7 +2605,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, PRBool nsXULScrollFrame::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY, nscoord& aSize, nscoord aSbSize, - PRBool aRightOrBottom, PRBool aAdd) + PRBool aOnRightOrBottom, PRBool aAdd) { nscoord size = aSize; nscoord xy = aXY; @@ -2613,11 +2613,11 @@ nsXULScrollFrame::AddRemoveScrollbar(PRBool& aHasScrollbar, nscoord& aXY, if (size != NS_INTRINSICSIZE) { if (aAdd) { size -= aSbSize; - if (!aRightOrBottom && size >= 0) + if (!aOnRightOrBottom && size >= 0) xy += aSbSize; } else { size += aSbSize; - if (!aRightOrBottom) + if (!aOnRightOrBottom) xy -= aSbSize; } } diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 46f26d34376a..c23c62a07322 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -645,7 +645,7 @@ public: PRBool aAdd); PRBool AddRemoveScrollbar(nsBoxLayoutState& aState, - PRBool aOnTop, + PRBool aOnRightOrBottom, PRBool aHorizontal, PRBool aAdd); From a9e4fb06580558f978957f0547c1ef948a92d483 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 09/22] Correctly handle non-repeating radial gradients in which all stops are at the same position. (Bug 635222) r=roc --- layout/base/nsCSSRendering.cpp | 29 ++++++++++++------- .../linear-onestopposition-1-ref.html | 12 ++++++++ .../linear-onestopposition-1-ref2.html | 21 ++++++++++++++ .../linear-onestopposition-1.html | 12 ++++++++ .../reftests/css-gradients/orange-square.html | 12 ++++++++ .../radial-onestopposition-1-ref.html | 12 ++++++++ .../radial-onestopposition-1.html | 12 ++++++++ layout/reftests/css-gradients/reftest.list | 6 ++++ .../repeating-linear-onestopposition-1.html | 12 ++++++++ .../repeating-radial-onestopposition-1.html | 12 ++++++++ 10 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 layout/reftests/css-gradients/linear-onestopposition-1-ref.html create mode 100644 layout/reftests/css-gradients/linear-onestopposition-1-ref2.html create mode 100644 layout/reftests/css-gradients/linear-onestopposition-1.html create mode 100644 layout/reftests/css-gradients/orange-square.html create mode 100644 layout/reftests/css-gradients/radial-onestopposition-1-ref.html create mode 100644 layout/reftests/css-gradients/radial-onestopposition-1.html create mode 100644 layout/reftests/css-gradients/repeating-linear-onestopposition-1.html create mode 100644 layout/reftests/css-gradients/repeating-radial-onestopposition-1.html diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index f3e724a30edf..a8ebbfe39046 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -2074,14 +2074,17 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, // multiplying by stopScale. double stopScale; double stopDelta = lastStop - firstStop; - if (stopDelta < 1e-6 || lineLength < 1e-6 || - (aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR && - (radiusX < 1e-6 || radiusY < 1e-6))) { + PRBool zeroRadius = aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR && + (radiusX < 1e-6 || radiusY < 1e-6); + if (stopDelta < 1e-6 || lineLength < 1e-6 || zeroRadius) { // Stops are all at the same place. Map all stops to 0.0. - // For radial gradients we need to fill with the last stop color, - // so just set both radii to 0. + // For repeating radial gradients, or for any radial gradients with + // a zero radius, we need to fill with the last stop color, so just set + // both radii to 0. stopScale = 0.0; - radiusX = radiusY = 0.0; + if (aGradient->mRepeating || zeroRadius) { + radiusX = radiusY = 0.0; + } lastStop = firstStop; } else { stopScale = 1.0/stopDelta; @@ -2115,6 +2118,11 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, // So our radii are based on radiusX. double innerRadius = radiusX*firstStop; double outerRadius = radiusX*lastStop; + if (stopScale == 0.0) { + // Stops are all at the same place. See above (except we now have + // the inside vs. outside of an ellipse). + outerRadius = innerRadius + 1; + } gradientPattern = new gfxPattern(lineStart.x, lineStart.y, innerRadius, lineStart.x, lineStart.y, outerRadius); if (gradientPattern && radiusX != radiusY) { @@ -2135,12 +2143,11 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, // Now set normalized color stops in pattern. if (stopScale == 0.0) { - // Non-repeating linear gradient with all stops in same place -> just add + // Non-repeating gradient with all stops in same place -> just add // first stop and last stop, both at position 0. - // Repeating or radial gradient with all stops in the same place -> just - // paint the last stop color. - if (!aGradient->mRepeating && - aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) { + // Repeating gradient with all stops in the same place, or radial + // gradient with radius of 0 -> just paint the last stop color. + if (!aGradient->mRepeating && !zeroRadius) { gradientPattern->AddColorStop(0.0, stops[0].mColor); } gradientPattern->AddColorStop(0.0, stops[stops.Length() - 1].mColor); diff --git a/layout/reftests/css-gradients/linear-onestopposition-1-ref.html b/layout/reftests/css-gradients/linear-onestopposition-1-ref.html new file mode 100644 index 000000000000..c26a7de8dc0a --- /dev/null +++ b/layout/reftests/css-gradients/linear-onestopposition-1-ref.html @@ -0,0 +1,12 @@ + +Test for -moz-linear-gradient() with all stops at the same position + +
diff --git a/layout/reftests/css-gradients/linear-onestopposition-1-ref2.html b/layout/reftests/css-gradients/linear-onestopposition-1-ref2.html new file mode 100644 index 000000000000..f35a8b46043f --- /dev/null +++ b/layout/reftests/css-gradients/linear-onestopposition-1-ref2.html @@ -0,0 +1,21 @@ + +Test for -moz-linear-gradient() with all stops at the same position + +
+
diff --git a/layout/reftests/css-gradients/linear-onestopposition-1.html b/layout/reftests/css-gradients/linear-onestopposition-1.html new file mode 100644 index 000000000000..70dc8fb63780 --- /dev/null +++ b/layout/reftests/css-gradients/linear-onestopposition-1.html @@ -0,0 +1,12 @@ + +Test for -moz-linear-gradient() with all stops at the same position + +
diff --git a/layout/reftests/css-gradients/orange-square.html b/layout/reftests/css-gradients/orange-square.html new file mode 100644 index 000000000000..aa70b29fa6f8 --- /dev/null +++ b/layout/reftests/css-gradients/orange-square.html @@ -0,0 +1,12 @@ + +orange square + +
diff --git a/layout/reftests/css-gradients/radial-onestopposition-1-ref.html b/layout/reftests/css-gradients/radial-onestopposition-1-ref.html new file mode 100644 index 000000000000..5406861d2b2d --- /dev/null +++ b/layout/reftests/css-gradients/radial-onestopposition-1-ref.html @@ -0,0 +1,12 @@ + +Test for -moz-radial-gradient() with all stops at the same position + +
diff --git a/layout/reftests/css-gradients/radial-onestopposition-1.html b/layout/reftests/css-gradients/radial-onestopposition-1.html new file mode 100644 index 000000000000..8476147a4eb4 --- /dev/null +++ b/layout/reftests/css-gradients/radial-onestopposition-1.html @@ -0,0 +1,12 @@ + +Test for -moz-radial-gradient() with all stops at the same position + +
diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index f02d8760a217..fd7545e9bfdc 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -88,3 +88,9 @@ fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607 == height-dependence-1.html height-dependence-1-ref.html fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # bug 535007 == height-dependence-3.html height-dependence-3-ref.html + +== linear-onestopposition-1.html linear-onestopposition-1-ref.html +== linear-onestopposition-1.html linear-onestopposition-1-ref2.html +== radial-onestopposition-1.html radial-onestopposition-1-ref.html +== repeating-linear-onestopposition-1.html orange-square.html +== repeating-radial-onestopposition-1.html orange-square.html diff --git a/layout/reftests/css-gradients/repeating-linear-onestopposition-1.html b/layout/reftests/css-gradients/repeating-linear-onestopposition-1.html new file mode 100644 index 000000000000..a61dc828c935 --- /dev/null +++ b/layout/reftests/css-gradients/repeating-linear-onestopposition-1.html @@ -0,0 +1,12 @@ + +Test for -moz-repeating-linear-gradient() with all stops at the same position + +
diff --git a/layout/reftests/css-gradients/repeating-radial-onestopposition-1.html b/layout/reftests/css-gradients/repeating-radial-onestopposition-1.html new file mode 100644 index 000000000000..a9cfb2aaa44f --- /dev/null +++ b/layout/reftests/css-gradients/repeating-radial-onestopposition-1.html @@ -0,0 +1,12 @@ + +Test for -moz-repeating-radial-gradient() with all stops at the same position + +
From f2adcfab27001d85fa42ca91956a53be1afc8e69 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 13:18:42 -0800 Subject: [PATCH 10/22] -moz-box-ordinal-group should not accept 0, since the code that uses the property ignores values of 0. (Bug 636034) r=bzbarsky --- layout/style/nsCSSParser.cpp | 2 +- layout/style/test/property_database.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 4fb0dac4b531..4e22754e6999 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -5694,7 +5694,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, return ParseVariant(aValue, VARIANT_HK, nsCSSProps::kBoxPackKTable); case eCSSProperty_box_ordinal_group: - return ParseNonNegativeVariant(aValue, VARIANT_HI, nsnull); + return ParsePositiveNonZeroVariant(aValue, VARIANT_HI, nsnull); #ifdef MOZ_SVG case eCSSProperty_clip_path: return ParseVariant(aValue, VARIANT_HUO, nsnull); diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 8ca9c5403a18..bc10986c7e95 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -369,8 +369,8 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, initial_values: [ "1" ], - other_values: [ "0", "100" ], - invalid_values: [ "1.0", "-1", "-1000" ] + other_values: [ "2", "100" ], + invalid_values: [ "1.0", "-1", "-1000", "0" ] }, "-moz-box-orient": { domProp: "MozBoxOrient", From c28b2df00f8b72996e3ac9c628abe1a9491eef20 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 18:58:37 -0800 Subject: [PATCH 11/22] Mark new test as failing on Mac due to rounding difference. (Bug 635222) --- layout/reftests/css-gradients/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index fd7545e9bfdc..8d388e7475dc 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -91,6 +91,6 @@ fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # == linear-onestopposition-1.html linear-onestopposition-1-ref.html == linear-onestopposition-1.html linear-onestopposition-1-ref2.html -== radial-onestopposition-1.html radial-onestopposition-1-ref.html +fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664 == repeating-linear-onestopposition-1.html orange-square.html == repeating-radial-onestopposition-1.html orange-square.html From a27268afcb43d512e269f23373ad180254ab57ba Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 3 Mar 2011 21:42:31 -0800 Subject: [PATCH 12/22] Mark new test as failing on Windows due to rounding difference. (Bug 635222) --- layout/reftests/css-gradients/reftest.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index 8d388e7475dc..bfb2b7eb1908 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -89,8 +89,8 @@ fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607 fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # bug 535007 == height-dependence-3.html height-dependence-3-ref.html -== linear-onestopposition-1.html linear-onestopposition-1-ref.html +fails-if(winWidget) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664 == linear-onestopposition-1.html linear-onestopposition-1-ref2.html -fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664 +fails-if(winWidget) fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664 == repeating-linear-onestopposition-1.html orange-square.html == repeating-radial-onestopposition-1.html orange-square.html From 7e0fe6f82302e86edb85d17a61a626cdf56de8f4 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Mar 2011 10:27:02 -0500 Subject: [PATCH 13/22] Bug 614733. Do exponential backoff on throttled refresh drivers. r=dbaron --- layout/base/nsRefreshDriver.cpp | 42 +++++++++++++++++++++++---------- layout/base/nsRefreshDriver.h | 7 ++++++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 5aea3c2f6a6d..ee83b41ceb34 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -60,23 +60,31 @@ using mozilla::TimeStamp; // Compute the interval to use for the refresh driver timer, in // milliseconds -static PRInt32 -GetRefreshTimerInterval(bool aThrottled) +PRInt32 +nsRefreshDriver::GetRefreshTimerInterval() const { const char* prefName = - aThrottled ? "layout.throttled_frame_rate" : "layout.frame_rate"; + mThrottled ? "layout.throttled_frame_rate" : "layout.frame_rate"; PRInt32 rate = nsContentUtils::GetIntPref(prefName, -1); if (rate <= 0) { // TODO: get the rate from the platform - rate = aThrottled ? DEFAULT_THROTTLED_FRAME_RATE : DEFAULT_FRAME_RATE; + rate = mThrottled ? DEFAULT_THROTTLED_FRAME_RATE : DEFAULT_FRAME_RATE; } NS_ASSERTION(rate > 0, "Must have positive rate here"); - return NSToIntRound(1000.0/rate); + PRInt32 interval = NSToIntRound(1000.0/rate); + if (mThrottled) { + interval = NS_MAX(interval, mLastTimerInterval * 2); + } + mLastTimerInterval = interval; + return interval; } -static PRInt32 -GetRefreshTimerType() +PRInt32 +nsRefreshDriver::GetRefreshTimerType() const { + if (mThrottled) { + return nsITimer::TYPE_ONE_SHOT; + } PRBool precise = nsContentUtils::GetBoolPref("layout.frame_rate.precise", PR_FALSE); return precise ? (PRInt32)nsITimer::TYPE_REPEATING_PRECISE @@ -150,7 +158,7 @@ nsRefreshDriver::EnsureTimerStarted() } nsresult rv = mTimer->InitWithCallback(this, - GetRefreshTimerInterval(mThrottled), + GetRefreshTimerInterval(), GetRefreshTimerType()); if (NS_FAILED(rv)) { mTimer = nsnull; @@ -330,6 +338,16 @@ nsRefreshDriver::Notify(nsITimer * /* unused */) } } + if (mThrottled) { + // Stop the timer now and restart it here. Stopping is ok because either + // it's already one-shot, and it just fired, and all we need to do is null + // it out, or it's repeating and we need to reset it to be one-shot. Note + // that the EnsureTimerStarted() call here is ok because EnsureTimerStarted + // makes sure to not start the timer if it shouldn't be started. + StopTimer(); + EnsureTimerStarted(); + } + return NS_OK; } @@ -358,10 +376,10 @@ nsRefreshDriver::SetThrottled(bool aThrottled) if (aThrottled != mThrottled) { mThrottled = aThrottled; if (mTimer) { - // Stopping and restarting the timer would update our most recent refresh - // time, which isn't quite right. Luckily, we can just reschedule the - // timer. - mTimer->SetDelay(GetRefreshTimerInterval(mThrottled)); + // We want to switch our timer type here, so just stop and + // restart the timer. + StopTimer(); + EnsureTimerStarted(); } } } diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index 3369c90c122b..0711c64ff818 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -218,6 +218,9 @@ private: // Trigger a refresh immediately, if haven't been disconnected or frozen. void DoRefresh(); + PRInt32 GetRefreshTimerInterval() const; + PRInt32 GetRefreshTimerType() const; + nsCOMPtr mTimer; mozilla::TimeStamp mMostRecentRefresh; // only valid when mTimer non-null PRInt64 mMostRecentRefreshEpochTime; // same thing as mMostRecentRefresh, @@ -237,6 +240,10 @@ private: nsTArray mBeforePaintTargets; // nsTArray on purpose, because we want to be able to swap. nsTArray mAnimationFrameListenerDocs; + + // This is the last interval we used for our timer. May be 0 if we + // haven't computed a timer interval yet. + mutable PRInt32 mLastTimerInterval; }; #endif /* !defined(nsRefreshDriver_h_) */ From 12a6879b47f5a119c096a93443793c995e85086d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Mar 2011 10:27:02 -0500 Subject: [PATCH 14/22] Bug 632907. Use Element more in the frame constructor. r=roc --- layout/base/nsCSSFrameConstructor.cpp | 119 +++++++++++++------------- layout/base/nsCSSFrameConstructor.h | 42 ++++----- 2 files changed, 82 insertions(+), 79 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 2c5dbdfd6132..0792a7a31e62 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3434,7 +3434,7 @@ nsCSSFrameConstructor::ConstructTextFrame(const FrameConstructionData* aData, /* static */ const nsCSSFrameConstructor::FrameConstructionData* nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt, - nsIContent* aContent, + Element* aElement, nsStyleContext* aStyleContext, const FrameConstructionDataByInt* aDataPtr, PRUint32 aDataLength) @@ -3446,7 +3446,7 @@ nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt, if (curData->mInt == aInt) { const FrameConstructionData* data = &curData->mData; if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) { - return data->mFunc.mDataGetter(aContent, aStyleContext); + return data->mFunc.mDataGetter(aElement, aStyleContext); } return data; @@ -3459,7 +3459,7 @@ nsCSSFrameConstructor::FindDataByInt(PRInt32 aInt, /* static */ const nsCSSFrameConstructor::FrameConstructionData* nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag, - nsIContent* aContent, + Element* aElement, nsStyleContext* aStyleContext, const FrameConstructionDataByTag* aDataPtr, PRUint32 aDataLength) @@ -3471,7 +3471,7 @@ nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag, if (*curData->mTag == aTag) { const FrameConstructionData* data = &curData->mData; if (data->mBits & FCDATA_FUNC_IS_DATA_GETTER) { - return data->mFunc.mDataGetter(aContent, aStyleContext); + return data->mFunc.mDataGetter(aElement, aStyleContext); } return data; @@ -3497,7 +3497,7 @@ nsCSSFrameConstructor::FindDataByTag(nsIAtom* aTag, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent, +nsCSSFrameConstructor::FindHTMLData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsIFrame* aParentFrame, @@ -3520,9 +3520,8 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent, (aParentFrame->GetType() != nsGkAtoms::fieldSetFrame && aParentFrame->GetStyleContext()->GetPseudo() != nsCSSAnonBoxes::fieldsetContent) || - !aContent->GetParent() || - !aContent->GetParent()->IsHTML() || - aContent->GetParent()->Tag() != nsGkAtoms::fieldset || + !aElement->GetParent() || + !aElement->GetParent()->IsHTML(nsGkAtoms::fieldset) || aStyleContext->GetStyleDisplay()->IsFloating() || aStyleContext->GetStyleDisplay()->IsAbsolutelyPositioned())) { // is only special inside fieldset, check both the frame tree @@ -3565,16 +3564,16 @@ nsCSSFrameConstructor::FindHTMLData(nsIContent* aContent, SIMPLE_TAG_CREATE(isindex, NS_NewIsIndexFrame) }; - return FindDataByTag(aTag, aContent, aStyleContext, sHTMLData, + return FindDataByTag(aTag, aElement, aStyleContext, sHTMLData, NS_ARRAY_LENGTH(sHTMLData)); } /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindImgData(nsIContent* aContent, +nsCSSFrameConstructor::FindImgData(Element* aElement, nsStyleContext* aStyleContext) { - if (!nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) { + if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyleContext)) { return nsnull; } @@ -3584,10 +3583,10 @@ nsCSSFrameConstructor::FindImgData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindImgControlData(nsIContent* aContent, +nsCSSFrameConstructor::FindImgControlData(Element* aElement, nsStyleContext* aStyleContext) { - if (!nsImageFrame::ShouldCreateImageFrameFor(aContent, aStyleContext)) { + if (!nsImageFrame::ShouldCreateImageFrameFor(aElement, aStyleContext)) { return nsnull; } @@ -3598,7 +3597,7 @@ nsCSSFrameConstructor::FindImgControlData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindInputData(nsIContent* aContent, +nsCSSFrameConstructor::FindInputData(Element* aElement, nsStyleContext* aStyleContext) { static const FrameConstructionDataByInt sInputData[] = { @@ -3623,28 +3622,28 @@ nsCSSFrameConstructor::FindInputData(nsIContent* aContent, // display (in practice, none). }; - nsCOMPtr control = do_QueryInterface(aContent); + nsCOMPtr control = do_QueryInterface(aElement); NS_ASSERTION(control, "input doesn't implement nsIFormControl?"); - return FindDataByInt(control->GetType(), aContent, aStyleContext, + return FindDataByInt(control->GetType(), aElement, aStyleContext, sInputData, NS_ARRAY_LENGTH(sInputData)); } /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindObjectData(nsIContent* aContent, +nsCSSFrameConstructor::FindObjectData(Element* aElement, nsStyleContext* aStyleContext) { // GetDisplayedType isn't necessarily nsIObjectLoadingContent::TYPE_NULL for // cases when the object is broken/suppressed/etc (e.g. a broken image), but // we want to treat those cases as TYPE_NULL PRUint32 type; - if (aContent->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | + if (aElement->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED | NS_EVENT_STATE_SUPPRESSED)) { type = nsIObjectLoadingContent::TYPE_NULL; } else { - nsCOMPtr objContent(do_QueryInterface(aContent)); + nsCOMPtr objContent(do_QueryInterface(aElement)); NS_ASSERTION(objContent, "applet, embed and object must implement " "nsIObjectLoadingContent!"); @@ -3664,7 +3663,7 @@ nsCSSFrameConstructor::FindObjectData(nsIContent* aContent, // Nothing for TYPE_NULL so we'll construct frames by display there }; - return FindDataByInt((PRInt32)type, aContent, aStyleContext, + return FindDataByInt((PRInt32)type, aElement, aStyleContext, sObjectData, NS_ARRAY_LENGTH(sObjectData)); } @@ -4008,7 +4007,7 @@ nsIFrame* NS_NewGridBoxFrame(nsIPresShell* aPresShell, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULTagData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULTagData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsStyleContext* aStyleContext) @@ -4056,17 +4055,17 @@ nsCSSFrameConstructor::FindXULTagData(nsIContent* aContent, SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame) }; - return FindDataByTag(aTag, aContent, aStyleContext, sXULTagData, + return FindDataByTag(aTag, aElement, aStyleContext, sXULTagData, NS_ARRAY_LENGTH(sXULTagData)); } #ifdef MOZ_XUL /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindPopupGroupData(nsIContent* aContent, +nsCSSFrameConstructor::FindPopupGroupData(Element* aElement, nsStyleContext* /* unused */) { - if (!aContent->IsRootOfNativeAnonymousSubtree()) { + if (!aElement->IsRootOfNativeAnonymousSubtree()) { return nsnull; } @@ -4081,10 +4080,10 @@ nsCSSFrameConstructor::sXULTextBoxData = SIMPLE_XUL_FCDATA(NS_NewTextBoxFrame); /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULLabelData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULLabelData(Element* aElement, nsStyleContext* /* unused */) { - if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { + if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { return &sXULTextBoxData; } @@ -4104,10 +4103,10 @@ NS_NewXULDescriptionFrame(nsIPresShell* aPresShell, nsStyleContext *aContext) /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULDescriptionData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULDescriptionData(Element* aElement, nsStyleContext* /* unused */) { - if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { + if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) { return &sXULTextBoxData; } @@ -4119,7 +4118,7 @@ nsCSSFrameConstructor::FindXULDescriptionData(nsIContent* aContent, #ifdef XP_MACOSX /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULMenubarData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULMenubarData(Element* aElement, nsStyleContext* aStyleContext) { nsCOMPtr container = @@ -4150,7 +4149,7 @@ nsCSSFrameConstructor::FindXULMenubarData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULListBoxBodyData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULListBoxBodyData(Element* aElement, nsStyleContext* aStyleContext) { if (aStyleContext->GetStyleDisplay()->mDisplay != @@ -4165,7 +4164,7 @@ nsCSSFrameConstructor::FindXULListBoxBodyData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindXULListItemData(nsIContent* aContent, +nsCSSFrameConstructor::FindXULListItemData(Element* aElement, nsStyleContext* aStyleContext) { if (aStyleContext->GetStyleDisplay()->mDisplay != @@ -4183,7 +4182,7 @@ nsCSSFrameConstructor::FindXULListItemData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay, - nsIContent* aContent, + Element* aElement, nsStyleContext* aStyleContext) { static const FrameConstructionDataByInt sXULDisplayData[] = { @@ -4207,7 +4206,7 @@ nsCSSFrameConstructor::FindXULDisplayData(const nsStyleDisplay* aDisplay, }; // Processing by display here: - return FindDataByInt(aDisplay->mDisplay, aContent, aStyleContext, + return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext, sXULDisplayData, NS_ARRAY_LENGTH(sXULDisplayData)); } @@ -4327,7 +4326,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState, const nsCSSFrameConstructor::FrameConstructionData* nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, - nsIContent* aContent, + Element* aElement, nsStyleContext* aStyleContext) { PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); @@ -4346,10 +4345,9 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, // XXXbz is this the right place to do this? If this code moves, // make this function static. PRBool propagatedScrollToViewport = PR_FALSE; - if (aContent->NodeInfo()->Equals(nsGkAtoms::body) && - aContent->IsHTML()) { + if (aElement->IsHTML(nsGkAtoms::body)) { propagatedScrollToViewport = - PropagateScrollToViewport() == aContent; + PropagateScrollToViewport() == aElement; } NS_ASSERTION(!propagatedScrollToViewport || @@ -4369,7 +4367,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, // anonymous stuff. if (mPresShell->GetPresContext()->IsPaginated() && aDisplay->IsBlockOutside() && - !aContent->IsInNativeAnonymousSubtree()) { + !aElement->IsInNativeAnonymousSubtree()) { static const FrameConstructionData sForcedNonScrollableBlockData = FULL_CTOR_FCDATA(FCDATA_FORCED_NON_SCROLLABLE_BLOCK, &nsCSSFrameConstructor::ConstructNonScrollableBlock); @@ -4444,7 +4442,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, &nsCSSFrameConstructor::ConstructTableCell) } }; - return FindDataByInt(aDisplay->mDisplay, aContent, aStyleContext, + return FindDataByInt(aDisplay->mDisplay, aElement, aStyleContext, sDisplayData, NS_ARRAY_LENGTH(sDisplayData)); } @@ -4654,7 +4652,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent, +nsCSSFrameConstructor::FindMathMLData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsStyleContext* aStyleContext) @@ -4715,7 +4713,7 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent, SIMPLE_MATHML_CREATE(semantics_, NS_NewMathMLsemanticsFrame) }; - return FindDataByTag(aTag, aContent, aStyleContext, sMathMLData, + return FindDataByTag(aTag, aElement, aStyleContext, sMathMLData, NS_ARRAY_LENGTH(sMathMLData)); } #endif // MOZ_MATHML @@ -4731,7 +4729,7 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent, /* static */ const nsCSSFrameConstructor::FrameConstructionData* -nsCSSFrameConstructor::FindSVGData(nsIContent* aContent, +nsCSSFrameConstructor::FindSVGData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsIFrame* aParentFrame, @@ -4789,7 +4787,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent, } // We don't need frames for animation elements - if (aContent->IsNodeOfType(nsINode::eANIMATION)) { + if (aElement->IsNodeOfType(nsINode::eANIMATION)) { return &sSuppressData; } @@ -4807,7 +4805,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent, return &sOuterSVGData; } - if (!nsSVGFeatures::PassesConditionalProcessingTests(aContent)) { + if (!nsSVGFeatures::PassesConditionalProcessingTests(aElement)) { // Elements with failing conditional processing attributes never get // rendered. Note that this is not where we select which frame in a // to render! That happens in nsSVGSwitchFrame::PaintSVG. @@ -4892,7 +4890,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent, }; const FrameConstructionData* data = - FindDataByTag(aTag, aContent, aStyleContext, sSVGData, + FindDataByTag(aTag, aElement, aStyleContext, sSVGData, NS_ARRAY_LENGTH(sSVGData)); if (!data) { @@ -5091,6 +5089,10 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState PRUint32 aFlags, FrameConstructionItemList& aItems) { + NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT) || + aContent->IsElement(), + "Shouldn't get anything else here!"); + // The following code allows the user to specify the base tag // of an element using XBL. XUL and HTML objects (like boxes, menus, etc.) // can then be extended arbitrarily. @@ -5144,7 +5146,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState return; } - PRBool isText = aContent->IsNodeOfType(nsINode::eTEXT); + PRBool isText = !aContent->IsElement(); // never create frames for non-option/optgroup kids of . @@ -5181,46 +5183,48 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState return; } } else { + Element* element = aContent->AsElement(); + // Don't create frames for non-SVG element children of SVG elements. if (aNameSpaceID != kNameSpaceID_SVG && aParentFrame && aParentFrame->IsFrameOfType(nsIFrame::eSVG) && !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject) ) { - SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, + SetAsUndisplayedContent(aState.mFrameManager, element, styleContext, isGeneratedContent); return; } - data = FindHTMLData(aContent, aTag, aNameSpaceID, aParentFrame, + data = FindHTMLData(element, aTag, aNameSpaceID, aParentFrame, styleContext); if (!data) { - data = FindXULTagData(aContent, aTag, aNameSpaceID, styleContext); + data = FindXULTagData(element, aTag, aNameSpaceID, styleContext); } #ifdef MOZ_MATHML if (!data) { - data = FindMathMLData(aContent, aTag, aNameSpaceID, styleContext); + data = FindMathMLData(element, aTag, aNameSpaceID, styleContext); } #endif if (!data) { - data = FindSVGData(aContent, aTag, aNameSpaceID, aParentFrame, + data = FindSVGData(element, aTag, aNameSpaceID, aParentFrame, styleContext); } // Now check for XUL display types if (!data) { - data = FindXULDisplayData(display, aContent, styleContext); + data = FindXULDisplayData(display, element, styleContext); } // And general display types if (!data) { - data = FindDisplayData(display, aContent, styleContext); + data = FindDisplayData(display, element, styleContext); } NS_ASSERTION(data, "Should have frame construction data now"); if (data->mBits & FCDATA_SUPPRESS_FRAME) { - SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, + SetAsUndisplayedContent(aState.mFrameManager, element, styleContext, isGeneratedContent); return; } @@ -5231,7 +5235,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState aParentFrame->GetType() != nsGkAtoms::menuFrame)) { if (!aState.mPopupItems.containingBlock && !aState.mHavePendingPopupgroup) { - SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext, + SetAsUndisplayedContent(aState.mFrameManager, element, styleContext, isGeneratedContent); return; } @@ -8879,8 +8883,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame, // have to look at insertionElement here... if (aMultiple && !*aMultiple) { nsIContent* content = insertionElement ? insertionElement : container; - if (content->IsHTML() && - content->Tag() == nsGkAtoms::fieldset) { + if (content->IsHTML(nsGkAtoms::fieldset)) { *aMultiple = PR_TRUE; } } @@ -10942,7 +10945,7 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState, for (ChildIterator::Init(parentContent, &iter, &last); iter != last; ++iter) { - // Manually check for comments/PIs, since we do't have a frame to pass to + // Manually check for comments/PIs, since we don't have a frame to pass to // AddFrameConstructionItems. We know our parent is a non-replaced inline, // so there is no need to do the NeedFrameFor check. nsIContent* content = *iter; diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 5573c5681fcb..1f9789762aee 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -623,7 +623,7 @@ private: */ struct FrameConstructionData; typedef const FrameConstructionData* - (* FrameConstructionDataGetter)(nsIContent*, nsStyleContext*); + (* FrameConstructionDataGetter)(Element*, nsStyleContext*); /* A constructor function that's used for complicated construction tasks. This is expected to create the new frame, initialize it, add whatever @@ -787,7 +787,7 @@ private: match or if the matching integer has a FrameConstructionDataGetter that returns null. */ static const FrameConstructionData* - FindDataByInt(PRInt32 aInt, nsIContent* aContent, + FindDataByInt(PRInt32 aInt, Element* aElement, nsStyleContext* aStyleContext, const FrameConstructionDataByInt* aDataPtr, PRUint32 aDataLength); @@ -798,7 +798,7 @@ private: match or if the matching tag has a FrameConstructionDataGetter that returns null. */ static const FrameConstructionData* - FindDataByTag(nsIAtom* aTag, nsIContent* aContent, + FindDataByTag(nsIAtom* aTag, Element* aElement, nsStyleContext* aStyleContext, const FrameConstructionDataByTag* aDataPtr, PRUint32 aDataLength); @@ -1194,24 +1194,24 @@ private: nsStyleContext* aMainStyleContext, FrameConstructionItemList& aItems); - // Function to find FrameConstructionData for aContent. Will return - // null if aContent is not HTML. + // Function to find FrameConstructionData for aElement. Will return + // null if aElement is not HTML. // aParentFrame might be null. If it is, that means it was an // inline frame. - static const FrameConstructionData* FindHTMLData(nsIContent* aContent, + static const FrameConstructionData* FindHTMLData(Element* aContent, nsIAtom* aTag, PRInt32 aNameSpaceID, nsIFrame* aParentFrame, nsStyleContext* aStyleContext); // HTML data-finding helper functions static const FrameConstructionData* - FindImgData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindImgData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* - FindImgControlData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindImgControlData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* - FindInputData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindInputData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* - FindObjectData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindObjectData(Element* aElement, nsStyleContext* aStyleContext); /* Construct a frame from the given FrameConstructionItem. This function will handle adding the frame to frame lists, processing children, setting @@ -1289,7 +1289,7 @@ private: // Function to find FrameConstructionData for aContent. Will return // null if aContent is not MathML. - static const FrameConstructionData* FindMathMLData(nsIContent* aContent, + static const FrameConstructionData* FindMathMLData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsStyleContext* aStyleContext); @@ -1297,28 +1297,28 @@ private: // Function to find FrameConstructionData for aContent. Will return // null if aContent is not XUL. - static const FrameConstructionData* FindXULTagData(nsIContent* aContent, + static const FrameConstructionData* FindXULTagData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsStyleContext* aStyleContext); // XUL data-finding helper functions and structures #ifdef MOZ_XUL static const FrameConstructionData* - FindPopupGroupData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindPopupGroupData(Element* aElement, nsStyleContext* aStyleContext); // sXULTextBoxData used for both labels and descriptions static const FrameConstructionData sXULTextBoxData; static const FrameConstructionData* - FindXULLabelData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindXULLabelData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* - FindXULDescriptionData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindXULDescriptionData(Element* aElement, nsStyleContext* aStyleContext); #ifdef XP_MACOSX static const FrameConstructionData* - FindXULMenubarData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindXULMenubarData(Element* aElement, nsStyleContext* aStyleContext); #endif /* XP_MACOSX */ static const FrameConstructionData* - FindXULListBoxBodyData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindXULListBoxBodyData(Element* aElement, nsStyleContext* aStyleContext); static const FrameConstructionData* - FindXULListItemData(nsIContent* aContent, nsStyleContext* aStyleContext); + FindXULListItemData(Element* aElement, nsStyleContext* aStyleContext); #endif /* MOZ_XUL */ // Function to find FrameConstructionData for aContent using one of the XUL @@ -1328,12 +1328,12 @@ private: // constructed by tag. static const FrameConstructionData* FindXULDisplayData(const nsStyleDisplay* aDisplay, - nsIContent* aContent, + Element* aElement, nsStyleContext* aStyleContext); // SVG - rods #ifdef MOZ_SVG - static const FrameConstructionData* FindSVGData(nsIContent* aContent, + static const FrameConstructionData* FindSVGData(Element* aElement, nsIAtom* aTag, PRInt32 aNameSpaceID, nsIFrame* aParentFrame, @@ -1350,7 +1350,7 @@ private: /* Not static because it does PropagateScrollToViewport. If this changes, make this static */ const FrameConstructionData* - FindDisplayData(const nsStyleDisplay* aDisplay, nsIContent* aContent, + FindDisplayData(const nsStyleDisplay* aDisplay, Element* aElement, nsStyleContext* aStyleContext); /** From c79bd4569e5214d2074fcfd4d6439a2413dd7d6e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Mar 2011 10:27:02 -0500 Subject: [PATCH 15/22] Bug 621841. Clear restyle flags in frameset kids when we process them. r=dbaron --- layout/generic/crashtests/621841-1.html | 20 ++++++++++++++++++++ layout/generic/crashtests/crashtests.list | 1 + layout/generic/nsFrameSetFrame.cpp | 15 ++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 layout/generic/crashtests/621841-1.html diff --git a/layout/generic/crashtests/621841-1.html b/layout/generic/crashtests/621841-1.html new file mode 100644 index 000000000000..f6c9b6eafc65 --- /dev/null +++ b/layout/generic/crashtests/621841-1.html @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index f8a224451829..5bb8e3b30077 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -352,3 +352,4 @@ load 603510-1.html load 604314-1.html load 604843.html load 605340.html +load 621841-1.html diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 36c45ba7c217..7bf057e17ebb 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -365,15 +365,24 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent, for (PRUint32 childX = 0; childX < numChildren; childX++) { if (mChildCount == numCells) { // we have more or than cells - // Clear the lazy bits in the remaining children. + // Clear the lazy bits in the remaining children. Also clear + // the restyle flags, like nsCSSFrameConstructor::ProcessChildren does. for (PRUint32 i = childX; i < numChildren; i++) { - mContent->GetChildAt(i)->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | - NODE_NEEDS_FRAME); + nsIContent *child = mContent->GetChildAt(i); + child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME); + if (child->IsElement()) { + child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS); + } } break; } nsIContent *child = mContent->GetChildAt(childX); child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME); + // Also clear the restyle flags in the child like + // nsCSSFrameConstructor::ProcessChildren does. + if (child->IsElement()) { + child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS); + } // IMPORTANT: This must match the conditions in // nsCSSFrameConstructor::ContentAppended/Inserted/Removed From f777ddac6cca72f4f019f5fdaf87fa30e8c6b236 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Mar 2011 10:27:02 -0500 Subject: [PATCH 16/22] Bug 616137. Skip to the nearest ']' when parsing an attr selector fails. r=dbaron --- .../css-parsing/invalid-attr-1-ref.html | 15 +++++++++++ .../reftests/css-parsing/invalid-attr-1.html | 25 +++++++++++++++++++ layout/reftests/css-parsing/reftest.list | 1 + layout/style/nsCSSParser.cpp | 7 ++++++ 4 files changed, 48 insertions(+) create mode 100644 layout/reftests/css-parsing/invalid-attr-1-ref.html create mode 100644 layout/reftests/css-parsing/invalid-attr-1.html diff --git a/layout/reftests/css-parsing/invalid-attr-1-ref.html b/layout/reftests/css-parsing/invalid-attr-1-ref.html new file mode 100644 index 000000000000..fce005c4605a --- /dev/null +++ b/layout/reftests/css-parsing/invalid-attr-1-ref.html @@ -0,0 +1,15 @@ + + + + + + + +

This text should be green.

+
This text should be green.

+ + diff --git a/layout/reftests/css-parsing/invalid-attr-1.html b/layout/reftests/css-parsing/invalid-attr-1.html new file mode 100644 index 000000000000..b418575bba8a --- /dev/null +++ b/layout/reftests/css-parsing/invalid-attr-1.html @@ -0,0 +1,25 @@ + + + + + + + +

This text should be green.

+
This text should be green.

+ + diff --git a/layout/reftests/css-parsing/reftest.list b/layout/reftests/css-parsing/reftest.list index 6b0b75160544..987ea7b94c80 100644 --- a/layout/reftests/css-parsing/reftest.list +++ b/layout/reftests/css-parsing/reftest.list @@ -1,3 +1,4 @@ == at-rule-013.html at-rule-013-ref.html == invalid-url-handling.xhtml invalid-url-handling-ref.xhtml == pseudo-elements-1.html pseudo-elements-1-ref.html +== invalid-attr-1.html invalid-attr-1-ref.html diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 4e22754e6999..09a34d74cedf 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -3232,6 +3232,10 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask, } else if (mToken.IsSymbol('[')) { // [attribute parsingStatus = ParseAttributeSelector(aDataMask, *newSel); + if (eSelectorParsingStatus_Error == parsingStatus) { + // Skip forward to the matching ']' + SkipUntil(']'); + } } else { // then it should be a type element or universal selector @@ -3490,6 +3494,9 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList, } else if (mToken.IsSymbol('[')) { // [attribute parsingStatus = ParseAttributeSelector(dataMask, *selector); + if (eSelectorParsingStatus_Error == parsingStatus) { + SkipUntil(']'); + } } else { // not a selector token, we're done parsingStatus = eSelectorParsingStatus_Done; From 7fa27f9cb9fc349cd0500ef8f946fb391592974d Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Fri, 4 Mar 2011 07:46:28 -0800 Subject: [PATCH 17/22] Condition should be d2d rather than winWidget. (Bug 635222) --- layout/reftests/css-gradients/reftest.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index bfb2b7eb1908..0e51d73b8dc4 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -89,8 +89,8 @@ fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607 fails-if(cocoaWidget) == height-dependence-2.html height-dependence-2-ref.html # bug 535007 == height-dependence-3.html height-dependence-3-ref.html -fails-if(winWidget) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664 +fails-if(d2d) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664 == linear-onestopposition-1.html linear-onestopposition-1-ref2.html -fails-if(winWidget) fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664 +fails-if(d2d) fails-if(cocoaWidget) == radial-onestopposition-1.html radial-onestopposition-1-ref.html # bug 638664 == repeating-linear-onestopposition-1.html orange-square.html == repeating-radial-onestopposition-1.html orange-square.html From 163123815efd6a9f4a1c82bdd617d961db58596e Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 4 Mar 2011 12:28:56 -0500 Subject: [PATCH 18/22] Bug 585867 part 1. Remove OOM checks on the return value of GetROCSSPrimitiveValue and GetROCSSValueList. r=bzbarsky --- layout/style/nsComputedDOMStyle.cpp | 387 ++++++---------------------- 1 file changed, 78 insertions(+), 309 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 4b03661780da..9e1e31ec1b6d 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -618,7 +618,6 @@ nsresult nsComputedDOMStyle::DoGetBinding(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleDisplay* display = GetStyleDisplay(); @@ -636,7 +635,6 @@ nsresult nsComputedDOMStyle::DoGetClear(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mBreakType, nsCSSProps::kClearKTable)); @@ -649,7 +647,6 @@ nsresult nsComputedDOMStyle::DoGetCssFloat(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mFloats, nsCSSProps::kFloatKTable)); @@ -668,7 +665,6 @@ nsresult nsComputedDOMStyle::DoGetStackSizing(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(GetStyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit : eCSSKeyword_ignore); @@ -691,35 +687,23 @@ nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nsROCSSPrimitiveValue *blue = GetROCSSPrimitiveValue(); nsROCSSPrimitiveValue *alpha = GetROCSSPrimitiveValue(); - if (red && green && blue && alpha) { - PRUint8 a = NS_GET_A(aColor); - nsDOMCSSRGBColor *rgbColor = - new nsDOMCSSRGBColor(red, green, blue, alpha, a < 255); + PRUint8 a = NS_GET_A(aColor); + nsDOMCSSRGBColor *rgbColor = + new nsDOMCSSRGBColor(red, green, blue, alpha, a < 255); - if (rgbColor) { - red->SetNumber(NS_GET_R(aColor)); - green->SetNumber(NS_GET_G(aColor)); - blue->SetNumber(NS_GET_B(aColor)); - alpha->SetNumber(nsStyleUtil::ColorComponentToFloat(a)); + red->SetNumber(NS_GET_R(aColor)); + green->SetNumber(NS_GET_G(aColor)); + blue->SetNumber(NS_GET_B(aColor)); + alpha->SetNumber(nsStyleUtil::ColorComponentToFloat(a)); - aValue->SetColor(rgbColor); - return NS_OK; - } - } - - delete red; - delete green; - delete blue; - delete alpha; - - return NS_ERROR_OUT_OF_MEMORY; + aValue->SetColor(rgbColor); + return NS_OK; } nsresult nsComputedDOMStyle::DoGetColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleColor* color = GetStyleColor(); @@ -737,7 +721,6 @@ nsresult nsComputedDOMStyle::DoGetOpacity(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleDisplay()->mOpacity); @@ -749,7 +732,6 @@ nsresult nsComputedDOMStyle::DoGetColumnCount(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleColumn* column = GetStyleColumn(); @@ -767,7 +749,6 @@ nsresult nsComputedDOMStyle::DoGetColumnWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); // XXX fix the auto case. When we actually have a column frame, I think // we should return the computed column width. @@ -781,7 +762,6 @@ nsresult nsComputedDOMStyle::DoGetColumnGap(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleColumn* column = GetStyleColumn(); if (column->mColumnGap.GetUnit() == eStyleUnit_Normal) { @@ -798,8 +778,6 @@ nsresult nsComputedDOMStyle::DoGetColumnRuleWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; val->SetAppUnits(GetStyleColumn()->GetComputedColumnRuleWidth()); NS_ADDREF(*aValue = val); @@ -810,8 +788,6 @@ nsresult nsComputedDOMStyle::DoGetColumnRuleStyle(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleColumn()->mColumnRuleStyle, @@ -825,8 +801,6 @@ nsresult nsComputedDOMStyle::DoGetColumnRuleColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; const nsStyleColumn* column = GetStyleColumn(); nscolor ruleColor; @@ -848,7 +822,6 @@ nsComputedDOMStyle::DoGetContent(nsIDOMCSSValue** aValue) if (content->ContentCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = val); return NS_OK; @@ -857,18 +830,16 @@ nsComputedDOMStyle::DoGetContent(nsIDOMCSSValue** aValue) if (content->ContentCount() == 1 && content->ContentAt(0).mType == eStyleContentType_AltContent) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword__moz_alt_content); NS_ADDREF(*aValue = val); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = content->ContentCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!val || !valueList->AppendCSSValue(val)) { + if (!valueList->AppendCSSValue(val)) { delete valueList; delete val; return NS_ERROR_OUT_OF_MEMORY; @@ -968,25 +939,23 @@ nsComputedDOMStyle::DoGetCounterIncrement(nsIDOMCSSValue** aValue) if (content->CounterIncrementCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = val); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue(); - if (!name || !valueList->AppendCSSValue(name)) { + if (!valueList->AppendCSSValue(name)) { delete valueList; delete name; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue(); - if (!value || !valueList->AppendCSSValue(value)) { + if (!valueList->AppendCSSValue(value)) { delete valueList; delete value; return NS_ERROR_OUT_OF_MEMORY; @@ -1014,8 +983,6 @@ nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue) */ nsRefPtr width = GetROCSSPrimitiveValue(); nsRefPtr height = GetROCSSPrimitiveValue(); - if (!width || !height) - return NS_ERROR_OUT_OF_MEMORY; /* Now, get the values. */ const nsStyleDisplay* display = GetStyleDisplay(); @@ -1026,8 +993,6 @@ nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue) /* Store things as a value list, fail if we can't get one. */ nsRefPtr valueList = GetROCSSValueList(PR_FALSE); - if (!valueList) - return NS_ERROR_OUT_OF_MEMORY; /* Chain on width and height, fail if we can't. */ if (!valueList->AppendCSSValue(width)) @@ -1056,8 +1021,6 @@ nsComputedDOMStyle::DoGetMozTransform(nsIDOMCSSValue **aValue) */ if (!display->HasTransform()) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; /* Set it to "none." */ val->SetIdent(eCSSKeyword_none); @@ -1111,9 +1074,6 @@ nsComputedDOMStyle::DoGetMozTransform(nsIDOMCSSValue **aValue) /* Create a value to hold our result. */ nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!val) - return NS_ERROR_OUT_OF_MEMORY; - val->SetString(resultString); NS_ADDREF(*aValue = val); return NS_OK; @@ -1126,25 +1086,23 @@ nsComputedDOMStyle::DoGetCounterReset(nsIDOMCSSValue** aValue) if (content->CounterResetCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = val); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue(); - if (!name || !valueList->AppendCSSValue(name)) { + if (!valueList->AppendCSSValue(name)) { delete valueList; delete name; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue(); - if (!value || !valueList->AppendCSSValue(value)) { + if (!valueList->AppendCSSValue(value)) { delete valueList; delete value; return NS_ERROR_OUT_OF_MEMORY; @@ -1168,25 +1126,23 @@ nsComputedDOMStyle::DoGetQuotes(nsIDOMCSSValue** aValue) if (quotes->QuotesCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = val); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = quotes->QuotesCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* openVal = GetROCSSPrimitiveValue(); - if (!openVal || !valueList->AppendCSSValue(openVal)) { + if (!valueList->AppendCSSValue(openVal)) { delete valueList; delete openVal; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue* closeVal = GetROCSSPrimitiveValue(); - if (!closeVal || !valueList->AppendCSSValue(closeVal)) { + if (!valueList->AppendCSSValue(closeVal)) { delete valueList; delete closeVal; return NS_ERROR_OUT_OF_MEMORY; @@ -1208,7 +1164,6 @@ nsresult nsComputedDOMStyle::DoGetFontFamily(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleFont* font = GetStyleFont(); @@ -1242,7 +1197,6 @@ nsresult nsComputedDOMStyle::DoGetFontSize(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); // Note: GetStyleFont()->mSize is the 'computed size'; // GetStyleFont()->mFont.size is the 'actual size' @@ -1256,7 +1210,6 @@ nsresult nsComputedDOMStyle::DoGetFontSizeAdjust(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleFont *font = GetStyleFont(); @@ -1274,7 +1227,6 @@ nsresult nsComputedDOMStyle::DoGetFontStretch(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.stretch, nsCSSProps::kFontStretchKTable)); @@ -1287,7 +1239,6 @@ nsresult nsComputedDOMStyle::DoGetFontStyle(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.style, nsCSSProps::kFontStyleKTable)); @@ -1300,7 +1251,6 @@ nsresult nsComputedDOMStyle::DoGetFontWeight(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleFont* font = GetStyleFont(); @@ -1325,7 +1275,6 @@ nsresult nsComputedDOMStyle::DoGetFontVariant(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.variant, @@ -1339,7 +1288,6 @@ nsresult nsComputedDOMStyle::DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleFont* font = GetStyleFont(); if (font->mFont.featureSettings.IsEmpty()) { @@ -1356,7 +1304,6 @@ nsresult nsComputedDOMStyle::DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleFont* font = GetStyleFont(); if (font->mFont.languageOverride.IsEmpty()) { @@ -1378,11 +1325,10 @@ nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMembe const nsStyleBackground* bg = GetStyleBackground(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = bg->*aCount; i < i_end; ++i) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val || !valueList->AppendCSSValue(val)) { + if (!valueList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -1417,7 +1363,6 @@ nsresult nsComputedDOMStyle::DoGetBackgroundColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleBackground* color = GetStyleBackground(); nsresult rv = SetToRGBAColor(val, color->mBackgroundColor); @@ -1491,8 +1436,6 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, PRBool needSep = PR_FALSE; nsAutoString tokenString; nsROCSSPrimitiveValue *tmpVal = GetROCSSPrimitiveValue(); - if (!tmpVal) - return NS_ERROR_OUT_OF_MEMORY; if (aGradient->mBgPosX.mUnit != eStyleUnit_None) { AppendCSSGradientLength(aGradient->mBgPosX, tmpVal, aString); @@ -1572,11 +1515,10 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, nsString& aString) { nsDOMCSSValueList* valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); // nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue(); - if (!valURI || !valueList->AppendCSSValue(valURI)) { + if (!valueList->AppendCSSValue(valURI)) { delete valURI; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -1586,7 +1528,7 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, // , , , NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *valSide = GetROCSSPrimitiveValue(); - if (!valSide || !valueList->AppendCSSValue(valSide)) { + if (!valueList->AppendCSSValue(valSide)) { delete valSide; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -1663,11 +1605,10 @@ nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue) const nsStyleBackground* bg = GetStyleBackground(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = bg->mImageCount; i < i_end; ++i) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val || !valueList->AppendCSSValue(val)) { + if (!valueList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -1689,7 +1630,6 @@ nsresult nsComputedDOMStyle::DoGetBackgroundInlinePolicy(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleBackground()->mBackgroundInlinePolicy, @@ -1714,25 +1654,24 @@ nsComputedDOMStyle::DoGetBackgroundPosition(nsIDOMCSSValue** aValue) const nsStyleBackground* bg = GetStyleBackground(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = bg->mPositionCount; i < i_end; ++i) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!itemList || !valueList->AppendCSSValue(itemList)) { + if (!valueList->AppendCSSValue(itemList)) { delete valueList; delete itemList; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!valX || !itemList->AppendCSSValue(valX)) { + if (!itemList->AppendCSSValue(valX)) { delete valueList; delete valX; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!valY || !itemList->AppendCSSValue(valY)) { + if (!itemList->AppendCSSValue(valY)) { delete valueList; delete valY; return NS_ERROR_OUT_OF_MEMORY; @@ -1784,7 +1723,6 @@ nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) const nsStyleBackground* bg = GetStyleBackground(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0, i_end = bg->mSizeCount; i < i_end; ++i) { const nsStyleBackground::Size &size = bg->mLayers[i].mSize; @@ -1798,7 +1736,7 @@ nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) ? eCSSKeyword_contain : eCSSKeyword_cover; nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!val || !valueList->AppendCSSValue(val)) { + if (!valueList->AppendCSSValue(val)) { delete valueList; delete val; return NS_ERROR_OUT_OF_MEMORY; @@ -1808,21 +1746,20 @@ nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) } default: { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!itemList || !valueList->AppendCSSValue(itemList)) { + if (!valueList->AppendCSSValue(itemList)) { delete valueList; delete itemList; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue* valX = GetROCSSPrimitiveValue(); - if (!valX || !itemList->AppendCSSValue(valX)) { + if (!itemList->AppendCSSValue(valX)) { delete valueList; delete valX; return NS_ERROR_OUT_OF_MEMORY; } - nsROCSSPrimitiveValue* valY = GetROCSSPrimitiveValue(); - if (!valY || !itemList->AppendCSSValue(valY)) { + if (!itemList->AppendCSSValue(valY)) { delete valueList; delete valY; return NS_ERROR_OUT_OF_MEMORY; @@ -1919,7 +1856,6 @@ nsresult nsComputedDOMStyle::DoGetBorderCollapse(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mBorderCollapse, @@ -1933,13 +1869,8 @@ nsresult nsComputedDOMStyle::DoGetBorderSpacing(nsIDOMCSSValue** aValue) { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); nsROCSSPrimitiveValue* xSpacing = GetROCSSPrimitiveValue(); - if (!xSpacing) { - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } if (!valueList->AppendCSSValue(xSpacing)) { delete valueList; delete xSpacing; @@ -1947,10 +1878,6 @@ nsComputedDOMStyle::DoGetBorderSpacing(nsIDOMCSSValue** aValue) } nsROCSSPrimitiveValue* ySpacing = GetROCSSPrimitiveValue(); - if (!ySpacing) { - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } if (!valueList->AppendCSSValue(ySpacing)) { delete valueList; delete ySpacing; @@ -1969,7 +1896,6 @@ nsresult nsComputedDOMStyle::DoGetCaptionSide(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mCaptionSide, @@ -1983,7 +1909,6 @@ nsresult nsComputedDOMStyle::DoGetEmptyCells(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mEmptyCells, @@ -1997,7 +1922,6 @@ nsresult nsComputedDOMStyle::DoGetTableLayout(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTable()->mLayoutStrategy, @@ -2186,7 +2110,6 @@ nsresult nsComputedDOMStyle::DoGetMarkerOffset(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleContent()->mMarkerOffset, PR_FALSE); @@ -2207,7 +2130,6 @@ nsresult nsComputedDOMStyle::DoGetOutlineWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleOutline* outline = GetStyleOutline(); @@ -2233,7 +2155,6 @@ nsresult nsComputedDOMStyle::DoGetOutlineStyle(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleOutline()->GetOutlineStyle(), @@ -2247,7 +2168,6 @@ nsresult nsComputedDOMStyle::DoGetOutlineOffset(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetAppUnits(GetStyleOutline()->mOutlineOffset); @@ -2287,7 +2207,6 @@ nsresult nsComputedDOMStyle::DoGetOutlineColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nscolor color; #ifdef GFX_HAS_INVERT @@ -2343,7 +2262,6 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, // for compatibility, return a single value if X and Y are equal if (radiusX == radiusY) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, radiusX, PR_TRUE); @@ -2351,17 +2269,16 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, return NS_OK; } else { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!valX || !valueList->AppendCSSValue(valX)) { + if (!valueList->AppendCSSValue(valX)) { delete valX; delete valueList; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!valY || !valueList->AppendCSSValue(valY)) { + if (!valueList->AppendCSSValue(valY)) { delete valY; // valX deleted by valueList destructor delete valueList; @@ -2413,13 +2330,12 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (nsCSSShadowItem *item = aArray->ShadowAt(0), *item_end = item + aArray->Length(); item < item_end; ++item) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!itemList || !valueList->AppendCSSValue(itemList)) { + if (!valueList->AppendCSSValue(itemList)) { delete itemList; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2427,7 +2343,7 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, // Color is either the specified shadow color or the foreground color nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val || !itemList->AppendCSSValue(val)) { + if (!itemList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2443,7 +2359,7 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, // Set the offsets, blur radius, and spread if available for (PRUint32 i = 0; i < shadowValuesLength; ++i) { val = GetROCSSPrimitiveValue(); - if (!val || !itemList->AppendCSSValue(val)) { + if (!itemList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2454,7 +2370,7 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, if (item->mInset && aIsBoxShadow) { // This is an inset box-shadow val = GetROCSSPrimitiveValue(); - if (!val || !itemList->AppendCSSValue(val)) { + if (!itemList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2481,7 +2397,6 @@ nsresult nsComputedDOMStyle::DoGetZIndex(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mZIndex, PR_FALSE); @@ -2493,7 +2408,6 @@ nsresult nsComputedDOMStyle::DoGetListStyleImage(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleList* list = GetStyleList(); @@ -2515,7 +2429,6 @@ nsresult nsComputedDOMStyle::DoGetListStylePosition(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStylePosition, @@ -2529,7 +2442,6 @@ nsresult nsComputedDOMStyle::DoGetListStyleType(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStyleType, @@ -2543,11 +2455,9 @@ nsresult nsComputedDOMStyle::DoGetImageRegion(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleList* list = GetStyleList(); - nsresult rv = NS_OK; nsROCSSPrimitiveValue *topVal = nsnull; nsROCSSPrimitiveValue *rightVal = nsnull; nsROCSSPrimitiveValue *bottomVal = nsnull; @@ -2560,31 +2470,13 @@ nsComputedDOMStyle::DoGetImageRegion(nsIDOMCSSValue** aValue) rightVal = GetROCSSPrimitiveValue(); bottomVal = GetROCSSPrimitiveValue(); leftVal = GetROCSSPrimitiveValue(); - if (topVal && rightVal && bottomVal && leftVal) { - nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, - bottomVal, leftVal); - if (domRect) { - topVal->SetAppUnits(list->mImageRegion.y); - rightVal->SetAppUnits(list->mImageRegion.width + list->mImageRegion.x); - bottomVal->SetAppUnits(list->mImageRegion.height + list->mImageRegion.y); - leftVal->SetAppUnits(list->mImageRegion.x); - val->SetRect(domRect); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - - if (NS_FAILED(rv)) { - delete topVal; - delete rightVal; - delete bottomVal; - delete leftVal; - delete val; - - return rv; + nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, + bottomVal, leftVal); + topVal->SetAppUnits(list->mImageRegion.y); + rightVal->SetAppUnits(list->mImageRegion.width + list->mImageRegion.x); + bottomVal->SetAppUnits(list->mImageRegion.height + list->mImageRegion.y); + leftVal->SetAppUnits(list->mImageRegion.x); + val->SetRect(domRect); } NS_ADDREF(*aValue = val); @@ -2595,7 +2487,6 @@ nsresult nsComputedDOMStyle::DoGetLineHeight(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nscoord lineHeight; if (GetLineHeightCoord(lineHeight)) { @@ -2613,7 +2504,6 @@ nsresult nsComputedDOMStyle::DoGetVerticalAlign(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign, PR_FALSE, &nsComputedDOMStyle::GetLineHeightCoord, @@ -2627,7 +2517,6 @@ nsresult nsComputedDOMStyle::DoGetTextAlign(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextAlign, @@ -2641,7 +2530,6 @@ nsresult nsComputedDOMStyle::DoGetTextDecoration(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); PRInt32 intValue = GetStyleTextReset()->mTextDecoration; @@ -2668,7 +2556,6 @@ nsresult nsComputedDOMStyle::DoGetTextIndent(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleText()->mTextIndent, PR_FALSE, &nsComputedDOMStyle::GetCBContentWidth); @@ -2689,7 +2576,6 @@ nsresult nsComputedDOMStyle::DoGetTextTransform(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextTransform, @@ -2703,7 +2589,6 @@ nsresult nsComputedDOMStyle::DoGetMozTabSize(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleText()->mTabSize); @@ -2715,7 +2600,6 @@ nsresult nsComputedDOMStyle::DoGetLetterSpacing(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleText()->mLetterSpacing, PR_FALSE); @@ -2727,7 +2611,6 @@ nsresult nsComputedDOMStyle::DoGetWordSpacing(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetAppUnits(GetStyleText()->mWordSpacing); @@ -2739,7 +2622,6 @@ nsresult nsComputedDOMStyle::DoGetWhiteSpace(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWhiteSpace, @@ -2753,7 +2635,6 @@ nsresult nsComputedDOMStyle::DoGetWindowShadow(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mWindowShadow, @@ -2768,7 +2649,6 @@ nsresult nsComputedDOMStyle::DoGetWordWrap(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWordWrap, @@ -2782,7 +2662,6 @@ nsresult nsComputedDOMStyle::DoGetPointerEvents(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mPointerEvents, @@ -2795,7 +2674,6 @@ nsresult nsComputedDOMStyle::DoGetVisibility(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mVisible, nsCSSProps::kVisibilityKTable)); @@ -2808,7 +2686,6 @@ nsresult nsComputedDOMStyle::DoGetDirection(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mDirection, @@ -2822,7 +2699,6 @@ nsresult nsComputedDOMStyle::DoGetUnicodeBidi(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mUnicodeBidi, @@ -2836,7 +2712,6 @@ nsresult nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); const nsStyleUserInterface *ui = GetStyleUserInterface(); @@ -2844,7 +2719,7 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) *item_end = ui->mCursorArray + ui->mCursorArrayLength; item < item_end; ++item) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!itemList || !valueList->AppendCSSValue(itemList)) { + if (!valueList->AppendCSSValue(itemList)) { delete itemList; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2854,7 +2729,7 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) item->GetImage()->GetURI(getter_AddRefs(uri)); nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val || !itemList->AppendCSSValue(val)) { + if (!itemList->AppendCSSValue(val)) { delete val; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2863,14 +2738,14 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) if (item->mHaveHotspot) { nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!valX || !itemList->AppendCSSValue(valX)) { + if (!itemList->AppendCSSValue(valX)) { delete valX; delete valueList; return NS_ERROR_OUT_OF_MEMORY; } nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!valY || !itemList->AppendCSSValue(valY)) { + if (!itemList->AppendCSSValue(valY)) { delete valY; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -2882,11 +2757,6 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) } nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!val) { - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } - val->SetIdent(nsCSSProps::ValueToKeywordEnum(ui->mCursor, nsCSSProps::kCursorKTable)); if (!valueList->AppendCSSValue(val)) { @@ -2903,7 +2773,6 @@ nsresult nsComputedDOMStyle::DoGetAppearance(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mAppearance, nsCSSProps::kAppearanceKTable)); @@ -2917,7 +2786,6 @@ nsresult nsComputedDOMStyle::DoGetBoxAlign(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxAlign, nsCSSProps::kBoxAlignKTable)); @@ -2930,7 +2798,6 @@ nsresult nsComputedDOMStyle::DoGetBoxDirection(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxDirection, @@ -2944,7 +2811,6 @@ nsresult nsComputedDOMStyle::DoGetBoxFlex(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleXUL()->mBoxFlex); @@ -2956,7 +2822,6 @@ nsresult nsComputedDOMStyle::DoGetBoxOrdinalGroup(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleXUL()->mBoxOrdinal); @@ -2968,7 +2833,6 @@ nsresult nsComputedDOMStyle::DoGetBoxOrient(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxOrient, @@ -2982,7 +2846,6 @@ nsresult nsComputedDOMStyle::DoGetBoxPack(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxPack, nsCSSProps::kBoxPackKTable)); @@ -2995,7 +2858,6 @@ nsresult nsComputedDOMStyle::DoGetBoxSizing(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStylePosition()->mBoxSizing, @@ -3013,18 +2875,16 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // none if (!border->GetBorderImage()) { nsROCSSPrimitiveValue *valNone = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(valNone, NS_ERROR_OUT_OF_MEMORY); valNone->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = valNone); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); // uri nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue(); - if (!valURI || !valueList->AppendCSSValue(valURI)) { + if (!valueList->AppendCSSValue(valURI)) { delete valURI; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3036,7 +2896,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // four split numbers NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *valSplit = GetROCSSPrimitiveValue(); - if (!valSplit || !valueList->AppendCSSValue(valSplit)) { + if (!valueList->AppendCSSValue(valSplit)) { delete valSplit; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3047,7 +2907,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // copy of border-width if (border->mHaveBorderImageWidth) { nsROCSSPrimitiveValue *slash = GetROCSSPrimitiveValue(); - if (!slash || !valueList->AppendCSSValue(slash)) { + if (!valueList->AppendCSSValue(slash)) { delete slash; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3055,7 +2915,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) slash->SetString(NS_LITERAL_STRING("/")); NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *borderWidth = GetROCSSPrimitiveValue(); - if (!borderWidth || !valueList->AppendCSSValue(borderWidth)) { + if (!valueList->AppendCSSValue(borderWidth)) { delete borderWidth; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3067,7 +2927,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // first keyword nsROCSSPrimitiveValue *keyword = GetROCSSPrimitiveValue(); - if (!keyword || !valueList->AppendCSSValue(keyword)) { + if (!valueList->AppendCSSValue(keyword)) { delete keyword; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3078,7 +2938,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // second keyword nsROCSSPrimitiveValue *keyword2 = GetROCSSPrimitiveValue(); - if (!keyword2 || !valueList->AppendCSSValue(keyword2)) { + if (!valueList->AppendCSSValue(keyword2)) { delete keyword2; delete valueList; return NS_ERROR_OUT_OF_MEMORY; @@ -3095,7 +2955,6 @@ nsresult nsComputedDOMStyle::DoGetFloatEdge(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mFloatEdge, @@ -3109,7 +2968,6 @@ nsresult nsComputedDOMStyle::DoGetForceBrokenImageIcon(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleUIReset()->mForceBrokenImageIcon); @@ -3121,7 +2979,6 @@ nsresult nsComputedDOMStyle::DoGetIMEMode(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mIMEMode, @@ -3135,7 +2992,6 @@ nsresult nsComputedDOMStyle::DoGetUserFocus(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserFocus, @@ -3149,7 +3005,6 @@ nsresult nsComputedDOMStyle::DoGetUserInput(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserInput, @@ -3163,7 +3018,6 @@ nsresult nsComputedDOMStyle::DoGetUserModify(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserModify, @@ -3177,7 +3031,6 @@ nsresult nsComputedDOMStyle::DoGetUserSelect(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mUserSelect, @@ -3191,7 +3044,6 @@ nsresult nsComputedDOMStyle::DoGetDisplay(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mDisplay, nsCSSProps::kDisplayKTable)); @@ -3204,7 +3056,6 @@ nsresult nsComputedDOMStyle::DoGetPosition(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mPosition, nsCSSProps::kPositionKTable)); @@ -3217,11 +3068,9 @@ nsresult nsComputedDOMStyle::DoGetClip(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleDisplay* display = GetStyleDisplay(); - nsresult rv = NS_OK; nsROCSSPrimitiveValue *topVal = nsnull; nsROCSSPrimitiveValue *rightVal = nsnull; nsROCSSPrimitiveValue *bottomVal = nsnull; @@ -3234,51 +3083,32 @@ nsComputedDOMStyle::DoGetClip(nsIDOMCSSValue** aValue) rightVal = GetROCSSPrimitiveValue(); bottomVal = GetROCSSPrimitiveValue(); leftVal = GetROCSSPrimitiveValue(); - if (topVal && rightVal && bottomVal && leftVal) { - nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, - bottomVal, leftVal); - if (domRect) { - if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) { - topVal->SetIdent(eCSSKeyword_auto); - } else { - topVal->SetAppUnits(display->mClip.y); - } - - if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) { - rightVal->SetIdent(eCSSKeyword_auto); - } else { - rightVal->SetAppUnits(display->mClip.width + display->mClip.x); - } - - if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) { - bottomVal->SetIdent(eCSSKeyword_auto); - } else { - bottomVal->SetAppUnits(display->mClip.height + display->mClip.y); - } - - if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) { - leftVal->SetIdent(eCSSKeyword_auto); - } else { - leftVal->SetAppUnits(display->mClip.x); - } - - val->SetRect(domRect); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } + nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, + bottomVal, leftVal); + if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) { + topVal->SetIdent(eCSSKeyword_auto); } else { - rv = NS_ERROR_OUT_OF_MEMORY; + topVal->SetAppUnits(display->mClip.y); } - } - if (NS_FAILED(rv)) { - delete topVal; - delete rightVal; - delete bottomVal; - delete leftVal; - delete val; + if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) { + rightVal->SetIdent(eCSSKeyword_auto); + } else { + rightVal->SetAppUnits(display->mClip.width + display->mClip.x); + } - return rv; + if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) { + bottomVal->SetIdent(eCSSKeyword_auto); + } else { + bottomVal->SetAppUnits(display->mClip.height + display->mClip.y); + } + + if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) { + leftVal->SetIdent(eCSSKeyword_auto); + } else { + leftVal->SetAppUnits(display->mClip.x); + } + val->SetRect(domRect); } NS_ADDREF(*aValue = val); @@ -3298,7 +3128,6 @@ nsComputedDOMStyle::DoGetOverflow(nsIDOMCSSValue** aValue) } nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX, nsCSSProps::kOverflowKTable)); @@ -3311,7 +3140,6 @@ nsresult nsComputedDOMStyle::DoGetOverflowX(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowX, @@ -3325,7 +3153,6 @@ nsresult nsComputedDOMStyle::DoGetOverflowY(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowY, @@ -3339,7 +3166,6 @@ nsresult nsComputedDOMStyle::DoGetResize(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mResize, nsCSSProps::kResizeKTable)); @@ -3353,7 +3179,6 @@ nsresult nsComputedDOMStyle::DoGetPageBreakAfter(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleDisplay *display = GetStyleDisplay(); @@ -3371,7 +3196,6 @@ nsresult nsComputedDOMStyle::DoGetPageBreakBefore(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleDisplay *display = GetStyleDisplay(); @@ -3389,7 +3213,6 @@ nsresult nsComputedDOMStyle::DoGetHeight(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); PRBool calcHeight = PR_FALSE; @@ -3431,7 +3254,6 @@ nsresult nsComputedDOMStyle::DoGetWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); PRBool calcWidth = PR_FALSE; @@ -3473,7 +3295,6 @@ nsresult nsComputedDOMStyle::DoGetMaxHeight(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mMaxHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); @@ -3486,7 +3307,6 @@ nsresult nsComputedDOMStyle::DoGetMaxWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mMaxWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, @@ -3500,7 +3320,6 @@ nsresult nsComputedDOMStyle::DoGetMinHeight(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mMinHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); @@ -3513,7 +3332,6 @@ nsresult nsComputedDOMStyle::DoGetMinWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mMinWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, @@ -3602,7 +3420,6 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nsIFrame* container = GetContainingBlockFor(mOuterFrame); if (container) { @@ -3668,7 +3485,6 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStylePosition* positionData = GetStylePosition(); PRInt32 sign = 1; @@ -3702,7 +3518,6 @@ nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** a { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide), PR_FALSE); @@ -3714,7 +3529,6 @@ nsresult nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); if (!mInnerFrame) { SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide), PR_TRUE); @@ -3769,15 +3583,10 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, nsBorderColors* borderColors = border->mBorderColors[aSide]; if (borderColors) { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); do { nsROCSSPrimitiveValue *primitive = GetROCSSPrimitiveValue(); - if (!primitive) { - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } nsresult rv = SetToRGBAColor(primitive, borderColors->mColor); if (NS_FAILED(rv)) { delete valueList; @@ -3801,7 +3610,6 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, } nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); @@ -3813,7 +3621,6 @@ nsresult nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nscoord width; if (mInnerFrame) { @@ -3832,7 +3639,6 @@ nsresult nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nscolor color; PRBool foreground; @@ -3855,7 +3661,6 @@ nsresult nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); if (!mInnerFrame) { SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide), PR_FALSE); @@ -3873,7 +3678,6 @@ nsresult nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->GetBorderStyle(aSide), @@ -4104,7 +3908,6 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVG* svg = GetStyleSVG(); const nsStyleSVGPaint* paint = nsnull; @@ -4134,7 +3937,6 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, case eStyleSVGPaintType_Server: { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); if (!valueList->AppendCSSValue(val)) { delete valueList; @@ -4143,7 +3945,7 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, } nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue(); - if (!fallback || !valueList->AppendCSSValue(fallback)) { + if (!valueList->AppendCSSValue(fallback)) { delete valueList; delete fallback; return NS_ERROR_OUT_OF_MEMORY; @@ -4181,7 +3983,6 @@ nsresult nsComputedDOMStyle::DoGetMarkerEnd(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVG* svg = GetStyleSVG(); @@ -4198,7 +3999,6 @@ nsresult nsComputedDOMStyle::DoGetMarkerMid(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVG* svg = GetStyleSVG(); @@ -4215,7 +4015,6 @@ nsresult nsComputedDOMStyle::DoGetMarkerStart(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVG* svg = GetStyleSVG(); @@ -4235,18 +4034,16 @@ nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue) if (!svg->mStrokeDasharrayLength || !svg->mStrokeDasharray) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(eCSSKeyword_none); NS_ADDREF(*aValue = val); return NS_OK; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); for (PRUint32 i = 0; i < svg->mStrokeDasharrayLength; i++) { nsROCSSPrimitiveValue* dash = GetROCSSPrimitiveValue(); - if (!dash || !valueList->AppendCSSValue(dash)) { + if (!valueList->AppendCSSValue(dash)) { delete valueList; delete dash; return NS_ERROR_OUT_OF_MEMORY; @@ -4263,7 +4060,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeDashoffset(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset, PR_FALSE); @@ -4275,7 +4071,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeWidth(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); SetValueToCoord(val, GetStyleSVG()->mStrokeWidth, PR_TRUE); @@ -4287,7 +4082,6 @@ nsresult nsComputedDOMStyle::DoGetFillOpacity(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleSVG()->mFillOpacity); @@ -4299,7 +4093,6 @@ nsresult nsComputedDOMStyle::DoGetFloodOpacity(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleSVGReset()->mFloodOpacity); @@ -4311,7 +4104,6 @@ nsresult nsComputedDOMStyle::DoGetStopOpacity(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleSVGReset()->mStopOpacity); @@ -4323,7 +4115,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeMiterlimit(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleSVG()->mStrokeMiterlimit); @@ -4335,7 +4126,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeOpacity(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetNumber(GetStyleSVG()->mStrokeOpacity); @@ -4347,7 +4137,6 @@ nsresult nsComputedDOMStyle::DoGetClipRule(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleSVG()->mClipRule, nsCSSProps::kFillRuleKTable)); @@ -4360,7 +4149,6 @@ nsresult nsComputedDOMStyle::DoGetFillRule(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleSVG()->mFillRule, nsCSSProps::kFillRuleKTable)); @@ -4373,7 +4161,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeLinecap(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinecap, @@ -4387,7 +4174,6 @@ nsresult nsComputedDOMStyle::DoGetStrokeLinejoin(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinejoin, @@ -4401,7 +4187,6 @@ nsresult nsComputedDOMStyle::DoGetTextAnchor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextAnchor, @@ -4415,7 +4200,6 @@ nsresult nsComputedDOMStyle::DoGetColorInterpolation(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolation, @@ -4429,7 +4213,6 @@ nsresult nsComputedDOMStyle::DoGetColorInterpolationFilters(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolationFilters, @@ -4443,7 +4226,6 @@ nsresult nsComputedDOMStyle::DoGetDominantBaseline(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVGReset()->mDominantBaseline, @@ -4457,7 +4239,6 @@ nsresult nsComputedDOMStyle::DoGetImageRendering(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mImageRendering, @@ -4471,7 +4252,6 @@ nsresult nsComputedDOMStyle::DoGetShapeRendering(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mShapeRendering, @@ -4485,7 +4265,6 @@ nsresult nsComputedDOMStyle::DoGetTextRendering(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextRendering, @@ -4499,7 +4278,6 @@ nsresult nsComputedDOMStyle::DoGetFloodColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor); if (NS_FAILED(rv)) { @@ -4515,7 +4293,6 @@ nsresult nsComputedDOMStyle::DoGetLightingColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor); if (NS_FAILED(rv)) { @@ -4531,7 +4308,6 @@ nsresult nsComputedDOMStyle::DoGetStopColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor); if (NS_FAILED(rv)) { @@ -4547,7 +4323,6 @@ nsresult nsComputedDOMStyle::DoGetClipPath(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVGReset* svg = GetStyleSVGReset(); @@ -4564,7 +4339,6 @@ nsresult nsComputedDOMStyle::DoGetFilter(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVGReset* svg = GetStyleSVGReset(); @@ -4581,7 +4355,6 @@ nsresult nsComputedDOMStyle::DoGetMask(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); const nsStyleSVGReset* svg = GetStyleSVGReset(); @@ -4600,7 +4373,6 @@ nsComputedDOMStyle::DoGetTransitionDelay(nsIDOMCSSValue** aValue) const nsStyleDisplay* display = GetStyleDisplay(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); NS_ABORT_IF_FALSE(display->mTransitionDelayCount > 0, "first item must be explicit"); @@ -4608,7 +4380,7 @@ nsComputedDOMStyle::DoGetTransitionDelay(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* delay = GetROCSSPrimitiveValue(); - if (!delay || !valueList->AppendCSSValue(delay)) { + if (!valueList->AppendCSSValue(delay)) { delete valueList; delete delay; return NS_ERROR_OUT_OF_MEMORY; @@ -4626,7 +4398,6 @@ nsComputedDOMStyle::DoGetTransitionDuration(nsIDOMCSSValue** aValue) const nsStyleDisplay* display = GetStyleDisplay(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); NS_ABORT_IF_FALSE(display->mTransitionDurationCount > 0, "first item must be explicit"); @@ -4634,7 +4405,7 @@ nsComputedDOMStyle::DoGetTransitionDuration(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* duration = GetROCSSPrimitiveValue(); - if (!duration || !valueList->AppendCSSValue(duration)) { + if (!valueList->AppendCSSValue(duration)) { delete valueList; delete duration; return NS_ERROR_OUT_OF_MEMORY; @@ -4653,7 +4424,6 @@ nsComputedDOMStyle::DoGetTransitionProperty(nsIDOMCSSValue** aValue) const nsStyleDisplay* display = GetStyleDisplay(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); NS_ABORT_IF_FALSE(display->mTransitionPropertyCount > 0, "first item must be explicit"); @@ -4661,7 +4431,7 @@ nsComputedDOMStyle::DoGetTransitionProperty(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* property = GetROCSSPrimitiveValue(); - if (!property || !valueList->AppendCSSValue(property)) { + if (!valueList->AppendCSSValue(property)) { delete valueList; delete property; return NS_ERROR_OUT_OF_MEMORY; @@ -4692,7 +4462,6 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue) const nsStyleDisplay* display = GetStyleDisplay(); nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); - NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); NS_ABORT_IF_FALSE(display->mTransitionTimingFunctionCount > 0, "first item must be explicit"); @@ -4700,7 +4469,7 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* timingFunction = GetROCSSPrimitiveValue(); - if (!timingFunction || !valueList->AppendCSSValue(timingFunction)) { + if (!valueList->AppendCSSValue(timingFunction)) { delete valueList; delete timingFunction; return NS_ERROR_OUT_OF_MEMORY; From 6d62c4f0518c910a9eebeb397a309a89f1342c3f Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 4 Mar 2011 12:28:57 -0500 Subject: [PATCH 19/22] Bug 585867 part 2. Make SetToRGBAColor return void. r=bzbarsky --- layout/style/nsComputedDOMStyle.cpp | 79 +++++------------------------ layout/style/nsComputedDOMStyle.h | 2 +- 2 files changed, 14 insertions(+), 67 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 9e1e31ec1b6d..97c29819353a 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -673,13 +673,13 @@ nsComputedDOMStyle::DoGetStackSizing(nsIDOMCSSValue** aValue) return NS_OK; } -nsresult +void nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor) { if (NS_GET_A(aColor) == 0) { aValue->SetIdent(eCSSKeyword_transparent); - return NS_OK; + return; } nsROCSSPrimitiveValue *red = GetROCSSPrimitiveValue(); @@ -697,7 +697,6 @@ nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, alpha->SetNumber(nsStyleUtil::ColorComponentToFloat(a)); aValue->SetColor(rgbColor); - return NS_OK; } nsresult @@ -707,12 +706,7 @@ nsComputedDOMStyle::DoGetColor(nsIDOMCSSValue** aValue) const nsStyleColor* color = GetStyleColor(); - nsresult rv = SetToRGBAColor(val, color->mColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, color->mColor); NS_ADDREF(*aValue = val); return NS_OK; } @@ -1365,12 +1359,7 @@ nsComputedDOMStyle::DoGetBackgroundColor(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); const nsStyleBackground* color = GetStyleBackground(); - nsresult rv = SetToRGBAColor(val, color->mBackgroundColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, color->mBackgroundColor); NS_ADDREF(*aValue = val); return NS_OK; } @@ -1488,11 +1477,7 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, if (needSep) { aString.AppendLiteral(", "); } - nsresult rv = SetToRGBAColor(tmpVal, aGradient->mStops[i].mColor); - if (NS_FAILED(rv)) { - delete tmpVal; - return NS_ERROR_OUT_OF_MEMORY; - } + SetToRGBAColor(tmpVal, aGradient->mStops[i].mColor); tmpVal->GetCssText(tokenString); aString.Append(tokenString); @@ -2216,12 +2201,7 @@ nsComputedDOMStyle::DoGetOutlineColor(nsIDOMCSSValue** aValue) color = GetStyleColor()->mColor; #endif - nsresult rv = SetToRGBAColor(val, color); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, color); NS_ADDREF(*aValue = val); return NS_OK; } @@ -3587,12 +3567,7 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, do { nsROCSSPrimitiveValue *primitive = GetROCSSPrimitiveValue(); - nsresult rv = SetToRGBAColor(primitive, borderColors->mColor); - if (NS_FAILED(rv)) { - delete valueList; - delete primitive; - return rv; - } + SetToRGBAColor(primitive, borderColors->mColor); PRBool success = valueList->AppendCSSValue(primitive); if (!success) { @@ -3647,12 +3622,7 @@ nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** color = GetStyleColor()->mColor; } - nsresult rv = SetToRGBAColor(val, color); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, color); NS_ADDREF(*aValue = val); return NS_OK; } @@ -3927,11 +3897,7 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, } case eStyleSVGPaintType_Color: { - nsresult rv = SetToRGBAColor(val, paint->mPaint.mColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } + SetToRGBAColor(val, paint->mPaint.mColor); break; } case eStyleSVGPaintType_Server: @@ -3952,11 +3918,7 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, } val->SetURI(paint->mPaint.mPaintServer); - nsresult rv = SetToRGBAColor(fallback, paint->mFallbackColor); - if (NS_FAILED(rv)) { - delete valueList; - return rv; - } + SetToRGBAColor(fallback, paint->mFallbackColor); NS_ADDREF(*aValue = valueList); return NS_OK; @@ -4279,12 +4241,7 @@ nsComputedDOMStyle::DoGetFloodColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor); NS_ADDREF(*aValue = val); return NS_OK; } @@ -4294,12 +4251,7 @@ nsComputedDOMStyle::DoGetLightingColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor); NS_ADDREF(*aValue = val); return NS_OK; } @@ -4309,12 +4261,7 @@ nsComputedDOMStyle::DoGetStopColor(nsIDOMCSSValue** aValue) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor); - if (NS_FAILED(rv)) { - delete val; - return rv; - } - + SetToRGBAColor(val, GetStyleSVGReset()->mStopColor); NS_ADDREF(*aValue = val); return NS_OK; } diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index f9177d879426..961b9c47da7d 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -403,7 +403,7 @@ private: nsROCSSPrimitiveValue* GetROCSSPrimitiveValue(); nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited); - nsresult SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); + void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); nsresult SetValueToStyleImage(const nsStyleImage& aStyleImage, nsROCSSPrimitiveValue* aValue); From c4ca67ca7424e8f2ab3fcc7cdf49e9531ce29640 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 4 Mar 2011 12:28:57 -0500 Subject: [PATCH 20/22] Bug 585867 part 3. Make AppendCSSValue infallible. r=bzbarsky --- layout/style/nsComputedDOMStyle.cpp | 280 +++++----------------------- layout/style/nsDOMCSSValueList.cpp | 8 +- layout/style/nsDOMCSSValueList.h | 8 +- 3 files changed, 54 insertions(+), 242 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 97c29819353a..82a09b08e2ee 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -833,11 +833,7 @@ nsComputedDOMStyle::DoGetContent(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = content->ContentCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(val)) { - delete valueList; - delete val; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); const nsStyleContentData &data = content->ContentAt(i); switch (data.mType) { @@ -942,18 +938,10 @@ nsComputedDOMStyle::DoGetCounterIncrement(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(name)) { - delete valueList; - delete name; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(name); nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(value)) { - delete valueList; - delete value; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(value); const nsStyleCounterData *data = content->GetCounterIncrementAt(i); nsAutoString escaped; @@ -989,10 +977,8 @@ nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue) nsRefPtr valueList = GetROCSSValueList(PR_FALSE); /* Chain on width and height, fail if we can't. */ - if (!valueList->AppendCSSValue(width)) - return NS_ERROR_OUT_OF_MEMORY; - if (!valueList->AppendCSSValue(height)) - return NS_ERROR_OUT_OF_MEMORY; + valueList->AppendCSSValue(width); + valueList->AppendCSSValue(height); valueList.forget(aValue); return NS_OK; @@ -1089,18 +1075,10 @@ nsComputedDOMStyle::DoGetCounterReset(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(name)) { - delete valueList; - delete name; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(name); nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(value)) { - delete valueList; - delete value; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(value); const nsStyleCounterData *data = content->GetCounterResetAt(i); nsAutoString escaped; @@ -1129,18 +1107,10 @@ nsComputedDOMStyle::DoGetQuotes(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = quotes->QuotesCount(); i < i_end; ++i) { nsROCSSPrimitiveValue* openVal = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(openVal)) { - delete valueList; - delete openVal; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(openVal); nsROCSSPrimitiveValue* closeVal = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(closeVal)) { - delete valueList; - delete closeVal; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(closeVal); nsString s; nsStyleUtil::AppendEscapedCSSString(*quotes->OpenQuoteAt(i), s); @@ -1322,11 +1292,7 @@ nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMembe for (PRUint32 i = 0, i_end = bg->*aCount; i < i_end; ++i) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); val->SetIdent(nsCSSProps::ValueToKeywordEnum(bg->mLayers[i].*aMember, aTable)); } @@ -1503,21 +1469,13 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, // nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valURI)) { - delete valURI; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valURI); valURI->SetURI(aURI); // , , , NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *valSide = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valSide)) { - delete valSide; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valSide); SetValueToCoord(valSide, aCropRect.Get(side), PR_FALSE); } @@ -1593,11 +1551,7 @@ nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = bg->mImageCount; i < i_end; ++i) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); const nsStyleImage& image = bg->mLayers[i].mImage; nsresult rv = SetValueToStyleImage(image, val); @@ -1642,25 +1596,13 @@ nsComputedDOMStyle::DoGetBackgroundPosition(nsIDOMCSSValue** aValue) for (PRUint32 i = 0, i_end = bg->mPositionCount; i < i_end; ++i) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!valueList->AppendCSSValue(itemList)) { - delete valueList; - delete itemList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(itemList); nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valX)) { - delete valueList; - delete valX; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(valX); nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valY)) { - delete valueList; - delete valY; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(valY); const nsStyleBackground::Position &pos = bg->mLayers[i].mPosition; @@ -1721,34 +1663,18 @@ nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) ? eCSSKeyword_contain : eCSSKeyword_cover; nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(val)) { - delete valueList; - delete val; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); val->SetIdent(keyword); break; } default: { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!valueList->AppendCSSValue(itemList)) { - delete valueList; - delete itemList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(itemList); nsROCSSPrimitiveValue* valX = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valX)) { - delete valueList; - delete valX; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(valX); nsROCSSPrimitiveValue* valY = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valY)) { - delete valueList; - delete valY; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(valY); if (size.mWidthType == nsStyleBackground::Size::eAuto) { valX->SetIdent(eCSSKeyword_auto); @@ -1856,18 +1782,10 @@ nsComputedDOMStyle::DoGetBorderSpacing(nsIDOMCSSValue** aValue) nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); nsROCSSPrimitiveValue* xSpacing = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(xSpacing)) { - delete valueList; - delete xSpacing; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(xSpacing); nsROCSSPrimitiveValue* ySpacing = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(ySpacing)) { - delete valueList; - delete ySpacing; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(ySpacing); const nsStyleTableBorder *border = GetStyleTableBorder(); xSpacing->SetAppUnits(border->mBorderSpacingX); @@ -2251,19 +2169,10 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valX)) { - delete valX; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valX); nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valY)) { - delete valY; - // valX deleted by valueList destructor - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valY); SetValueToCoord(valX, radiusX, PR_TRUE); SetValueToCoord(valY, radiusY, PR_TRUE); @@ -2315,19 +2224,11 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, *item_end = item + aArray->Length(); item < item_end; ++item) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!valueList->AppendCSSValue(itemList)) { - delete itemList; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(itemList); // Color is either the specified shadow color or the foreground color nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(val); nscolor shadowColor; if (item->mHasColor) { shadowColor = item->mColor; @@ -2339,22 +2240,14 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, // Set the offsets, blur radius, and spread if available for (PRUint32 i = 0; i < shadowValuesLength; ++i) { val = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(val); val->SetAppUnits(item->*(shadowValues[i])); } if (item->mInset && aIsBoxShadow) { // This is an inset box-shadow val = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(val); val->SetIdent( nsCSSProps::ValueToKeywordEnum(NS_STYLE_BOX_SHADOW_INSET, nsCSSProps::kBoxShadowTypeKTable)); @@ -2699,37 +2592,20 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) *item_end = ui->mCursorArray + ui->mCursorArrayLength; item < item_end; ++item) { nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE); - if (!valueList->AppendCSSValue(itemList)) { - delete itemList; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(itemList); nsCOMPtr uri; item->GetImage()->GetURI(getter_AddRefs(uri)); nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(val)) { - delete val; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(val); val->SetURI(uri); if (item->mHaveHotspot) { nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valX)) { - delete valX; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } - + itemList->AppendCSSValue(valX); nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - if (!itemList->AppendCSSValue(valY)) { - delete valY; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + itemList->AppendCSSValue(valY); valX->SetNumber(item->mHotspotX); valY->SetNumber(item->mHotspotY); @@ -2739,11 +2615,7 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(nsCSSProps::ValueToKeywordEnum(ui->mCursor, nsCSSProps::kCursorKTable)); - if (!valueList->AppendCSSValue(val)) { - delete valueList; - delete val; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); NS_ADDREF(*aValue = valueList); return NS_OK; @@ -2864,11 +2736,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // uri nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valURI)) { - delete valURI; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valURI); nsCOMPtr uri; border->GetBorderImage()->GetURI(getter_AddRefs(uri)); valURI->SetURI(uri); @@ -2876,30 +2744,18 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // four split numbers NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *valSplit = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(valSplit)) { - delete valSplit; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(valSplit); SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), PR_TRUE); } // copy of border-width if (border->mHaveBorderImageWidth) { nsROCSSPrimitiveValue *slash = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(slash)) { - delete slash; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(slash); slash->SetString(NS_LITERAL_STRING("/")); NS_FOR_CSS_SIDES(side) { nsROCSSPrimitiveValue *borderWidth = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(borderWidth)) { - delete borderWidth; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(borderWidth); nscoord width = GetStyleBorder()->mBorderImageWidth.side(side); borderWidth->SetAppUnits(width); } @@ -2907,22 +2763,14 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) // first keyword nsROCSSPrimitiveValue *keyword = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(keyword)) { - delete keyword; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(keyword); keyword->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mBorderImageHFill, nsCSSProps::kBorderImageKTable)); // second keyword nsROCSSPrimitiveValue *keyword2 = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(keyword2)) { - delete keyword2; - delete valueList; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(keyword2); keyword2->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mBorderImageVFill, nsCSSProps::kBorderImageKTable)); @@ -3569,13 +3417,7 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, SetToRGBAColor(primitive, borderColors->mColor); - PRBool success = valueList->AppendCSSValue(primitive); - if (!success) { - delete valueList; - delete primitive; - - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(primitive); borderColors = borderColors->mNext; } while (borderColors); @@ -3904,18 +3746,10 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - if (!valueList->AppendCSSValue(val)) { - delete valueList; - delete val; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(val); nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(fallback)) { - delete valueList; - delete fallback; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(fallback); val->SetURI(paint->mPaint.mPaintServer); SetToRGBAColor(fallback, paint->mFallbackColor); @@ -4005,11 +3839,7 @@ nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue) for (PRUint32 i = 0; i < svg->mStrokeDasharrayLength; i++) { nsROCSSPrimitiveValue* dash = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(dash)) { - delete valueList; - delete dash; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(dash); SetValueToCoord(dash, svg->mStrokeDasharray[i], PR_TRUE); } @@ -4327,11 +4157,7 @@ nsComputedDOMStyle::DoGetTransitionDelay(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* delay = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(delay)) { - delete valueList; - delete delay; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(delay); delay->SetTime((float)transition->GetDelay() / (float)PR_MSEC_PER_SEC); } while (++i < display->mTransitionDelayCount); @@ -4352,11 +4178,7 @@ nsComputedDOMStyle::DoGetTransitionDuration(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* duration = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(duration)) { - delete valueList; - delete duration; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(duration); duration->SetTime((float)transition->GetDuration() / (float)PR_MSEC_PER_SEC); } while (++i < display->mTransitionDurationCount); @@ -4378,11 +4200,7 @@ nsComputedDOMStyle::DoGetTransitionProperty(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* property = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(property)) { - delete valueList; - delete property; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(property); nsCSSProperty cssprop = transition->GetProperty(); if (cssprop == eCSSPropertyExtra_all_properties) property->SetIdent(eCSSKeyword_all); @@ -4416,11 +4234,7 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue) do { const nsTransition *transition = &display->mTransitions[i]; nsROCSSPrimitiveValue* timingFunction = GetROCSSPrimitiveValue(); - if (!valueList->AppendCSSValue(timingFunction)) { - delete valueList; - delete timingFunction; - return NS_ERROR_OUT_OF_MEMORY; - } + valueList->AppendCSSValue(timingFunction); // set the value from the cubic-bezier control points // (We could try to regenerate the keywords if we want.) diff --git a/layout/style/nsDOMCSSValueList.cpp b/layout/style/nsDOMCSSValueList.cpp index 2cc2961352ac..1b50e1beda4d 100644 --- a/layout/style/nsDOMCSSValueList.cpp +++ b/layout/style/nsDOMCSSValueList.cpp @@ -65,10 +65,10 @@ NS_INTERFACE_MAP_BEGIN(nsDOMCSSValueList) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSValueList) NS_INTERFACE_MAP_END -PRBool +void nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue) { - return mCSSValues.AppendObject(aValue); + mCSSValues.AppendElement(aValue); } // nsIDOMCSSValueList @@ -76,7 +76,7 @@ nsDOMCSSValueList::AppendCSSValue(nsIDOMCSSValue* aValue) NS_IMETHODIMP nsDOMCSSValueList::GetLength(PRUint32* aLength) { - *aLength = mCSSValues.Count(); + *aLength = mCSSValues.Length(); return NS_OK; } @@ -98,7 +98,7 @@ nsDOMCSSValueList::GetCssText(nsAString& aCssText) { aCssText.Truncate(); - PRUint32 count = mCSSValues.Count(); + PRUint32 count = mCSSValues.Length(); nsAutoString separator; if (mCommaDelimited) { diff --git a/layout/style/nsDOMCSSValueList.h b/layout/style/nsDOMCSSValueList.h index 96abb6125159..d5697aa77405 100644 --- a/layout/style/nsDOMCSSValueList.h +++ b/layout/style/nsDOMCSSValueList.h @@ -63,14 +63,12 @@ public: /** * Adds a value to this list. - * @retval PR_TRUE Adding the value succeeded - * @retval PR_FALSE The value could not be added (Out of memory) */ - PRBool AppendCSSValue(nsIDOMCSSValue* aValue); + void AppendCSSValue(nsIDOMCSSValue* aValue); nsIDOMCSSValue* GetItemAt(PRUint32 aIndex) { - return mCSSValues.SafeObjectAt(aIndex); + return mCSSValues.SafeElementAt(aIndex, nsnull); } static nsDOMCSSValueList* FromSupports(nsISupports* aSupports) @@ -97,7 +95,7 @@ private: PRPackedBool mReadonly; // Are we read-only? - nsCOMArray mCSSValues; + InfallibleTArray > mCSSValues; }; From 84d57dbce19c6aa2056ae1af293037d659c41a17 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 4 Mar 2011 12:28:57 -0500 Subject: [PATCH 21/22] Bug 585867 part 4. Make SetValueToStyleImage return void. r=bzbarsky --- layout/style/nsComputedDOMStyle.cpp | 26 ++++++++------------------ layout/style/nsComputedDOMStyle.h | 14 +++++++------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 82a09b08e2ee..2432419b814d 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1372,7 +1372,7 @@ AppendCSSGradientLength(const nsStyleCoord& aValue, aString.Append(tokenString); } -nsresult +void nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, nsAString& aString) { @@ -1456,11 +1456,10 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, delete tmpVal; aString.AppendLiteral(")"); - return NS_OK; } // -moz-image-rect(, , , , ) -nsresult +void nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, const nsStyleSides& aCropRect, nsString& aString) @@ -1486,10 +1485,9 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI, aString = NS_LITERAL_STRING("-moz-image-rect(") + argumentString + NS_LITERAL_STRING(")"); - return NS_OK; } -nsresult +void nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage, nsROCSSPrimitiveValue* aValue) { @@ -1503,8 +1501,7 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage, const nsStyleSides* cropRect = aStyleImage.GetCropRect(); if (cropRect) { nsAutoString imageRectString; - nsresult rv = GetImageRectString(uri, *cropRect, imageRectString); - NS_ENSURE_SUCCESS(rv, rv); + GetImageRectString(uri, *cropRect, imageRectString); aValue->SetString(imageRectString); } else { aValue->SetURI(uri); @@ -1514,9 +1511,8 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage, case eStyleImageType_Gradient: { nsAutoString gradientString; - nsresult rv = GetCSSGradientString(aStyleImage.GetGradientData(), - gradientString); - NS_ENSURE_SUCCESS(rv, rv); + GetCSSGradientString(aStyleImage.GetGradientData(), + gradientString); aValue->SetString(gradientString); break; } @@ -1536,10 +1532,8 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage, break; default: NS_NOTREACHED("unexpected image type"); - return NS_ERROR_UNEXPECTED; + break; } - - return NS_OK; } nsresult @@ -1554,11 +1548,7 @@ nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue) valueList->AppendCSSValue(val); const nsStyleImage& image = bg->mLayers[i].mImage; - nsresult rv = SetValueToStyleImage(image, val); - if (NS_FAILED(rv)) { - delete valueList; - return rv; - } + SetValueToStyleImage(image, val); } NS_ADDREF(*aValue = valueList); diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 961b9c47da7d..03df6056e18a 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -162,11 +162,11 @@ private: const PRInt32 aTable[], nsIDOMCSSValue** aResult); - nsresult GetCSSGradientString(const nsStyleGradient* aGradient, - nsAString& aString); - nsresult GetImageRectString(nsIURI* aURI, - const nsStyleSides& aCropRect, - nsString& aString); + void GetCSSGradientString(const nsStyleGradient* aGradient, + nsAString& aString); + void GetImageRectString(nsIURI* aURI, + const nsStyleSides& aCropRect, + nsString& aString); /* Properties queryable as CSSValues. * To avoid a name conflict with nsIDOM*CSS2Properties, these are all @@ -404,8 +404,8 @@ private: nsROCSSPrimitiveValue* GetROCSSPrimitiveValue(); nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited); void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); - nsresult SetValueToStyleImage(const nsStyleImage& aStyleImage, - nsROCSSPrimitiveValue* aValue); + void SetValueToStyleImage(const nsStyleImage& aStyleImage, + nsROCSSPrimitiveValue* aValue); /** * A method to get a percentage base for a percentage value. Returns PR_TRUE From 2819c13fc2e55d828d3bd40c35a095a6a90b187f Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 4 Mar 2011 12:28:57 -0500 Subject: [PATCH 22/22] Bug 585867 part 5. Remove outparam and AddRef from all property getters. r=bzbarsky --- layout/style/nsComputedDOMStyle.cpp | 1637 +++++++++++---------------- layout/style/nsComputedDOMStyle.h | 401 +++---- 2 files changed, 840 insertions(+), 1198 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 2432419b814d..0dc4d8174373 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -551,11 +551,8 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, } // Call our pointer-to-member-function. - nsresult rv = (this->*(propEntry->mGetter))(aReturn); - - if (NS_FAILED(rv)) { - *aReturn = nsnull; - } + *aReturn = (this->*(propEntry->mGetter))(); + NS_IF_ADDREF(*aReturn); // property getter gives us an object with refcount of 0 mOuterFrame = nsnull; mInnerFrame = nsnull; @@ -565,7 +562,7 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, // whenever a frame is not available. mStyleContextHolder = nsnull; - return rv; + return NS_OK; } @@ -614,8 +611,8 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsAString& aReturn) // Property getters... -nsresult -nsComputedDOMStyle::DoGetBinding(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBinding() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -627,50 +624,40 @@ nsComputedDOMStyle::DoGetBinding(nsIDOMCSSValue** aValue) val->SetIdent(eCSSKeyword_none); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetClear(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetClear() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mBreakType, nsCSSProps::kClearKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetCssFloat(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetCssFloat() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mFloats, nsCSSProps::kFloatKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBottom(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBottom() { - return GetOffsetWidthFor(NS_SIDE_BOTTOM, aValue); + return GetOffsetWidthFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetStackSizing(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStackSizing() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(GetStyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit : eCSSKeyword_ignore); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } void @@ -699,31 +686,24 @@ nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, aValue->SetColor(rgbColor); } -nsresult -nsComputedDOMStyle::DoGetColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - - const nsStyleColor* color = GetStyleColor(); - - SetToRGBAColor(val, color->mColor); - NS_ADDREF(*aValue = val); - return NS_OK; + SetToRGBAColor(val, GetStyleColor()->mColor); + return val; } -nsresult -nsComputedDOMStyle::DoGetOpacity(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOpacity() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleDisplay()->mOpacity); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnCount(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnCount() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -735,25 +715,22 @@ nsComputedDOMStyle::DoGetColumnCount(nsIDOMCSSValue** aValue) val->SetNumber(column->mColumnCount); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnWidth() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); // XXX fix the auto case. When we actually have a column frame, I think // we should return the computed column width. SetValueToCoord(val, GetStyleColumn()->mColumnWidth, PR_TRUE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnGap(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnGap() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -764,35 +741,29 @@ nsComputedDOMStyle::DoGetColumnGap(nsIDOMCSSValue** aValue) SetValueToCoord(val, GetStyleColumn()->mColumnGap, PR_TRUE); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnRuleWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnRuleWidth() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetAppUnits(GetStyleColumn()->GetComputedColumnRuleWidth()); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnRuleStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnRuleStyle() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleColumn()->mColumnRuleStyle, nsCSSProps::kBorderStyleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColumnRuleColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColumnRuleColor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -805,28 +776,25 @@ nsComputedDOMStyle::DoGetColumnRuleColor(nsIDOMCSSValue** aValue) } SetToRGBAColor(val, ruleColor); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetContent(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetContent() { const nsStyleContent *content = GetStyleContent(); if (content->ContentCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } if (content->ContentCount() == 1 && content->ContentAt(0).mType == eStyleContentType_AltContent) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword__moz_alt_content); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -918,20 +886,18 @@ nsComputedDOMStyle::DoGetContent(nsIDOMCSSValue** aValue) } } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetCounterIncrement(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetCounterIncrement() { const nsStyleContent *content = GetStyleContent(); if (content->CounterIncrementCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -950,46 +916,44 @@ nsComputedDOMStyle::DoGetCounterIncrement(nsIDOMCSSValue** aValue) value->SetNumber(data->mValue); // XXX This should really be integer } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } /* Convert the stored representation into a list of two values and then hand * it back. */ -nsresult -nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozTransformOrigin() { /* We need to build up a list of two values. We'll call them * width and height. */ - nsRefPtr width = GetROCSSPrimitiveValue(); - nsRefPtr height = GetROCSSPrimitiveValue(); + + /* Store things as a value list */ + nsDOMCSSValueList* valueList = GetROCSSValueList(PR_FALSE); /* Now, get the values. */ const nsStyleDisplay* display = GetStyleDisplay(); + + nsROCSSPrimitiveValue* width = GetROCSSPrimitiveValue(); SetValueToCoord(width, display->mTransformOrigin[0], PR_FALSE, &nsComputedDOMStyle::GetFrameBoundsWidthForTransform); + valueList->AppendCSSValue(width); + + nsROCSSPrimitiveValue* height = GetROCSSPrimitiveValue(); SetValueToCoord(height, display->mTransformOrigin[1], PR_FALSE, &nsComputedDOMStyle::GetFrameBoundsHeightForTransform); - - /* Store things as a value list, fail if we can't get one. */ - nsRefPtr valueList = GetROCSSValueList(PR_FALSE); - - /* Chain on width and height, fail if we can't. */ - valueList->AppendCSSValue(width); valueList->AppendCSSValue(height); - valueList.forget(aValue); - return NS_OK; + return valueList; } /* If the property is "none", hand back "none" wrapped in a value. * Otherwise, compute the aggregate transform matrix and hands it back in a * "matrix" wrapper. */ -nsresult -nsComputedDOMStyle::DoGetMozTransform(nsIDOMCSSValue **aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozTransform() { static const PRInt32 NUM_FLOATS = 4; @@ -1004,8 +968,7 @@ nsComputedDOMStyle::DoGetMozTransform(nsIDOMCSSValue **aValue) /* Set it to "none." */ val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } /* Otherwise, we need to compute the current value of the transform matrix, @@ -1055,20 +1018,18 @@ nsComputedDOMStyle::DoGetMozTransform(nsIDOMCSSValue **aValue) nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); val->SetString(resultString); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetCounterReset(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetCounterReset() { const nsStyleContent *content = GetStyleContent(); if (content->CounterResetCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -1087,20 +1048,18 @@ nsComputedDOMStyle::DoGetCounterReset(nsIDOMCSSValue** aValue) value->SetNumber(data->mValue); // XXX This should really be integer } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetQuotes(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetQuotes() { const nsStyleQuotes *quotes = GetStyleQuotes(); if (quotes->QuotesCount() == 0) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -1120,12 +1079,11 @@ nsComputedDOMStyle::DoGetQuotes(nsIDOMCSSValue** aValue) closeVal->SetString(s); } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetFontFamily(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontFamily() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -1153,25 +1111,22 @@ nsComputedDOMStyle::DoGetFontFamily(nsIDOMCSSValue** aValue) val->SetString(fontName); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontSize(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontSize() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); // Note: GetStyleFont()->mSize is the 'computed size'; // GetStyleFont()->mFont.size is the 'actual size' val->SetAppUnits(GetStyleFont()->mSize); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontSizeAdjust(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontSizeAdjust() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -1183,36 +1138,31 @@ nsComputedDOMStyle::DoGetFontSizeAdjust(nsIDOMCSSValue** aValue) val->SetIdent(eCSSKeyword_none); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontStretch(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontStretch() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.stretch, nsCSSProps::kFontStretchKTable)); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontStyle() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.style, nsCSSProps::kFontStyleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontWeight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontWeight() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -1231,25 +1181,21 @@ nsComputedDOMStyle::DoGetFontWeight(nsIDOMCSSValue** aValue) val->SetIdent(eCSSKeyword_bolder); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFontVariant(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFontVariant() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.variant, nsCSSProps::kFontVariantKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozFontFeatureSettings() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -1261,11 +1207,11 @@ nsComputedDOMStyle::DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue) nsStyleUtil::AppendEscapedCSSString(font->mFont.featureSettings, str); val->SetString(str); } - return CallQueryInterface(val, aValue); + return val; } -nsresult -nsComputedDOMStyle::DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozFontLanguageOverride() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -1277,14 +1223,13 @@ nsComputedDOMStyle::DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue) nsStyleUtil::AppendEscapedCSSString(font->mFont.languageOverride, str); val->SetString(str); } - return CallQueryInterface(val, aValue); + return val; } -nsresult +nsIDOMCSSValue* nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember, PRUint32 nsStyleBackground::* aCount, - const PRInt32 aTable[], - nsIDOMCSSValue** aResult) + const PRInt32 aTable[]) { const nsStyleBackground* bg = GetStyleBackground(); @@ -1297,37 +1242,31 @@ nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMembe aTable)); } - NS_ADDREF(*aResult = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetBackgroundAttachment(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundAttachment() { return GetBackgroundList(&nsStyleBackground::Layer::mAttachment, &nsStyleBackground::mAttachmentCount, - nsCSSProps::kBackgroundAttachmentKTable, - aValue); + nsCSSProps::kBackgroundAttachmentKTable); } -nsresult -nsComputedDOMStyle::DoGetBackgroundClip(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundClip() { return GetBackgroundList(&nsStyleBackground::Layer::mClip, &nsStyleBackground::mClipCount, - nsCSSProps::kBackgroundOriginKTable, - aValue); + nsCSSProps::kBackgroundOriginKTable); } -nsresult -nsComputedDOMStyle::DoGetBackgroundColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundColor() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - - const nsStyleBackground* color = GetStyleBackground(); - SetToRGBAColor(val, color->mBackgroundColor); - NS_ADDREF(*aValue = val); - return NS_OK; + SetToRGBAColor(val, GetStyleBackground()->mBackgroundColor); + return val; } @@ -1536,8 +1475,8 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage, } } -nsresult -nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundImage() { const nsStyleBackground* bg = GetStyleBackground(); @@ -1551,34 +1490,29 @@ nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue) SetValueToStyleImage(image, val); } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetBackgroundInlinePolicy(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundInlinePolicy() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleBackground()->mBackgroundInlinePolicy, nsCSSProps::kBackgroundInlinePolicyKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBackgroundOrigin(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundOrigin() { return GetBackgroundList(&nsStyleBackground::Layer::mOrigin, &nsStyleBackground::mOriginCount, - nsCSSProps::kBackgroundOriginKTable, - aValue); + nsCSSProps::kBackgroundOriginKTable); } -nsresult -nsComputedDOMStyle::DoGetBackgroundPosition(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundPosition() { const nsStyleBackground* bg = GetStyleBackground(); @@ -1621,21 +1555,19 @@ nsComputedDOMStyle::DoGetBackgroundPosition(nsIDOMCSSValue** aValue) } } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetBackgroundRepeat(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBackgroundRepeat() { return GetBackgroundList(&nsStyleBackground::Layer::mRepeat, &nsStyleBackground::mRepeatCount, - nsCSSProps::kBackgroundRepeatKTable, - aValue); + nsCSSProps::kBackgroundRepeatKTable); } -nsresult -nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozBackgroundSize() { const nsStyleBackground* bg = GetStyleBackground(); @@ -1716,58 +1648,52 @@ nsComputedDOMStyle::DoGetMozBackgroundSize(nsIDOMCSSValue** aValue) } } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetPadding(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPadding() { // return null per spec. - *aValue = nsnull; - - return NS_OK; + return nsnull; } -nsresult -nsComputedDOMStyle::DoGetPaddingTop(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPaddingTop() { - return GetPaddingWidthFor(NS_SIDE_TOP, aValue); + return GetPaddingWidthFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetPaddingBottom(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPaddingBottom() { - return GetPaddingWidthFor(NS_SIDE_BOTTOM, aValue); + return GetPaddingWidthFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetPaddingLeft(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPaddingLeft() { - return GetPaddingWidthFor(NS_SIDE_LEFT, aValue); + return GetPaddingWidthFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetPaddingRight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPaddingRight() { - return GetPaddingWidthFor(NS_SIDE_RIGHT, aValue); + return GetPaddingWidthFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetBorderCollapse(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderCollapse() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mBorderCollapse, nsCSSProps::kBorderCollapseKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBorderSpacing(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderSpacing() { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -1781,246 +1707,226 @@ nsComputedDOMStyle::DoGetBorderSpacing(nsIDOMCSSValue** aValue) xSpacing->SetAppUnits(border->mBorderSpacingX); ySpacing->SetAppUnits(border->mBorderSpacingY); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetCaptionSide(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetCaptionSide() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mCaptionSide, nsCSSProps::kCaptionSideKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetEmptyCells(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetEmptyCells() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mEmptyCells, nsCSSProps::kEmptyCellsKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTableLayout(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTableLayout() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTable()->mLayoutStrategy, nsCSSProps::kTableLayoutKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBorderStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderStyle() { // return null per spec. - *aValue = nsnull; - - return NS_OK; + return nsnull; } -nsresult -nsComputedDOMStyle::DoGetBorderTopStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopStyle() { - return GetBorderStyleFor(NS_SIDE_TOP, aValue); + return GetBorderStyleFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomStyle() { - return GetBorderStyleFor(NS_SIDE_BOTTOM, aValue); + return GetBorderStyleFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetBorderLeftStyle(nsIDOMCSSValue** aValue) + +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderLeftStyle() { - return GetBorderStyleFor(NS_SIDE_LEFT, aValue); + return GetBorderStyleFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetBorderRightStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderRightStyle() { - return GetBorderStyleFor(NS_SIDE_RIGHT, aValue); + return GetBorderStyleFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomColors(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomColors() { - return GetBorderColorsFor(NS_SIDE_BOTTOM, aValue); + return GetBorderColorsFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetBorderLeftColors(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderLeftColors() { - return GetBorderColorsFor(NS_SIDE_LEFT, aValue); + return GetBorderColorsFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetBorderRightColors(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderRightColors() { - return GetBorderColorsFor(NS_SIDE_RIGHT, aValue); + return GetBorderColorsFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetBorderTopColors(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopColors() { - return GetBorderColorsFor(NS_SIDE_TOP, aValue); + return GetBorderColorsFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomLeftRadius(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomLeftRadius() { return GetEllipseRadii(GetStyleBorder()->mBorderRadius, - NS_CORNER_BOTTOM_LEFT, PR_TRUE, aValue); + NS_CORNER_BOTTOM_LEFT, PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomRightRadius(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomRightRadius() { return GetEllipseRadii(GetStyleBorder()->mBorderRadius, - NS_CORNER_BOTTOM_RIGHT, PR_TRUE, aValue); + NS_CORNER_BOTTOM_RIGHT, PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetBorderTopLeftRadius(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopLeftRadius() { return GetEllipseRadii(GetStyleBorder()->mBorderRadius, - NS_CORNER_TOP_LEFT, PR_TRUE, aValue); + NS_CORNER_TOP_LEFT, PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetBorderTopRightRadius(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopRightRadius() { return GetEllipseRadii(GetStyleBorder()->mBorderRadius, - NS_CORNER_TOP_RIGHT, PR_TRUE, aValue); + NS_CORNER_TOP_RIGHT, PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetBorderWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderWidth() { // return null per spec. - *aValue = nsnull; - - return NS_OK; + return nsnull; } -nsresult -nsComputedDOMStyle::DoGetBorderTopWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopWidth() { - return GetBorderWidthFor(NS_SIDE_TOP, aValue); + return GetBorderWidthFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomWidth() { - return GetBorderWidthFor(NS_SIDE_BOTTOM, aValue); + return GetBorderWidthFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetBorderLeftWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderLeftWidth() { - return GetBorderWidthFor(NS_SIDE_LEFT, aValue); + return GetBorderWidthFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetBorderRightWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderRightWidth() { - return GetBorderWidthFor(NS_SIDE_RIGHT, aValue); + return GetBorderWidthFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetBorderTopColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderTopColor() { - return GetBorderColorFor(NS_SIDE_TOP, aValue); + return GetBorderColorFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetBorderBottomColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderBottomColor() { - return GetBorderColorFor(NS_SIDE_BOTTOM, aValue); + return GetBorderColorFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetBorderLeftColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderLeftColor() { - return GetBorderColorFor(NS_SIDE_LEFT, aValue); + return GetBorderColorFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetBorderRightColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderRightColor() { - return GetBorderColorFor(NS_SIDE_RIGHT, aValue); + return GetBorderColorFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetMarginWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarginWidth() { // return null per spec. - *aValue = nsnull; - - return NS_OK; + return nsnull; } -nsresult -nsComputedDOMStyle::DoGetMarginTopWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarginTopWidth() { - return GetMarginWidthFor(NS_SIDE_TOP, aValue); + return GetMarginWidthFor(NS_SIDE_TOP); } -nsresult -nsComputedDOMStyle::DoGetMarginBottomWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarginBottomWidth() { - return GetMarginWidthFor(NS_SIDE_BOTTOM, aValue); + return GetMarginWidthFor(NS_SIDE_BOTTOM); } -nsresult -nsComputedDOMStyle::DoGetMarginLeftWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarginLeftWidth() { - return GetMarginWidthFor(NS_SIDE_LEFT, aValue); + return GetMarginWidthFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetMarginRightWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarginRightWidth() { - return GetMarginWidthFor(NS_SIDE_RIGHT, aValue); + return GetMarginWidthFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetMarkerOffset(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarkerOffset() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleContent()->mMarkerOffset, PR_FALSE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOutline(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutline() { // return null per spec. - *aValue = nsnull; - - return NS_OK; + return nsnull; } -nsresult -nsComputedDOMStyle::DoGetOutlineWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineWidth() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -2040,64 +1946,57 @@ nsComputedDOMStyle::DoGetOutlineWidth(nsIDOMCSSValue** aValue) } val->SetAppUnits(width); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOutlineStyle(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineStyle() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleOutline()->GetOutlineStyle(), nsCSSProps::kOutlineStyleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOutlineOffset(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineOffset() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetAppUnits(GetStyleOutline()->mOutlineOffset); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOutlineRadiusBottomLeft(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineRadiusBottomLeft() { return GetEllipseRadii(GetStyleOutline()->mOutlineRadius, - NS_CORNER_BOTTOM_LEFT, PR_FALSE, aValue); + NS_CORNER_BOTTOM_LEFT, PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetOutlineRadiusBottomRight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineRadiusBottomRight() { return GetEllipseRadii(GetStyleOutline()->mOutlineRadius, - NS_CORNER_BOTTOM_RIGHT, PR_FALSE, aValue); + NS_CORNER_BOTTOM_RIGHT, PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetOutlineRadiusTopLeft(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineRadiusTopLeft() { return GetEllipseRadii(GetStyleOutline()->mOutlineRadius, - NS_CORNER_TOP_LEFT, PR_FALSE, aValue); + NS_CORNER_TOP_LEFT, PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetOutlineRadiusTopRight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineRadiusTopRight() { return GetEllipseRadii(GetStyleOutline()->mOutlineRadius, - NS_CORNER_TOP_RIGHT, PR_FALSE, aValue); + NS_CORNER_TOP_RIGHT, PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetOutlineColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOutlineColor() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -2110,15 +2009,13 @@ nsComputedDOMStyle::DoGetOutlineColor(nsIDOMCSSValue** aValue) #endif SetToRGBAColor(val, color); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult +nsIDOMCSSValue* nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, PRUint8 aFullCorner, - PRBool aIsBorder, // else outline - nsIDOMCSSValue** aValue) + PRBool aIsBorder) // else outline { nsStyleCoord radiusX, radiusY; if (mInnerFrame && aIsBorder) { @@ -2153,36 +2050,32 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius, SetValueToCoord(val, radiusX, PR_TRUE); - NS_ADDREF(*aValue = val); - return NS_OK; - } else { - nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); - - nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); - valueList->AppendCSSValue(valX); - - nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); - valueList->AppendCSSValue(valY); - - SetValueToCoord(valX, radiusX, PR_TRUE); - SetValueToCoord(valY, radiusY, PR_TRUE); - - NS_ADDREF(*aValue = valueList); - return NS_OK; + return val; } + + nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); + + nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue(); + valueList->AppendCSSValue(valX); + + nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue(); + valueList->AppendCSSValue(valY); + + SetValueToCoord(valX, radiusX, PR_TRUE); + SetValueToCoord(valY, radiusY, PR_TRUE); + + return valueList; } -nsresult +nsIDOMCSSValue* nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, const nscolor& aDefaultColor, - PRBool aIsBoxShadow, - nsIDOMCSSValue** aValue) + PRBool aIsBoxShadow) { if (!aArray) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } static nscoord nsCSSShadowItem::* const shadowValuesNoSpread[] = { @@ -2244,31 +2137,27 @@ nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray, } } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetBoxShadow(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxShadow() { return GetCSSShadowArray(GetStyleBorder()->mBoxShadow, GetStyleColor()->mColor, - PR_TRUE, aValue); + PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetZIndex(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetZIndex() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mZIndex, PR_FALSE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetListStyleImage(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetListStyleImage() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -2284,55 +2173,44 @@ nsComputedDOMStyle::DoGetListStyleImage(nsIDOMCSSValue** aValue) val->SetURI(uri); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetListStylePosition(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetListStylePosition() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStylePosition, nsCSSProps::kListStylePositionKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetListStyleType(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetListStyleType() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStyleType, nsCSSProps::kListStyleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetImageRegion(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetImageRegion() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); const nsStyleList* list = GetStyleList(); - nsROCSSPrimitiveValue *topVal = nsnull; - nsROCSSPrimitiveValue *rightVal = nsnull; - nsROCSSPrimitiveValue *bottomVal = nsnull; - nsROCSSPrimitiveValue *leftVal = nsnull; if (list->mImageRegion.width <= 0 || list->mImageRegion.height <= 0) { val->SetIdent(eCSSKeyword_auto); } else { // create the cssvalues for the sides, stick them in the rect object - topVal = GetROCSSPrimitiveValue(); - rightVal = GetROCSSPrimitiveValue(); - bottomVal = GetROCSSPrimitiveValue(); - leftVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *topVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *rightVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *bottomVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *leftVal = GetROCSSPrimitiveValue(); nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, bottomVal, leftVal); topVal->SetAppUnits(list->mImageRegion.y); @@ -2342,12 +2220,11 @@ nsComputedDOMStyle::DoGetImageRegion(nsIDOMCSSValue** aValue) val->SetRect(domRect); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetLineHeight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetLineHeight() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -2359,38 +2236,31 @@ nsComputedDOMStyle::DoGetLineHeight(nsIDOMCSSValue** aValue) nsnull, nsCSSProps::kLineHeightKTable); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetVerticalAlign(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetVerticalAlign() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign, PR_FALSE, &nsComputedDOMStyle::GetLineHeightCoord, nsCSSProps::kVerticalAlignKTable); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextAlign(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextAlign() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextAlign, nsCSSProps::kTextAlignKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextDecoration(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextDecoration() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -2411,168 +2281,132 @@ nsComputedDOMStyle::DoGetTextDecoration(nsIDOMCSSValue** aValue) val->SetString(decorationString); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextIndent(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextIndent() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleText()->mTextIndent, PR_FALSE, &nsComputedDOMStyle::GetCBContentWidth); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextShadow(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextShadow() { return GetCSSShadowArray(GetStyleText()->mTextShadow, GetStyleColor()->mColor, - PR_FALSE, aValue); + PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetTextTransform(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextTransform() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextTransform, nsCSSProps::kTextTransformKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMozTabSize(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMozTabSize() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleText()->mTabSize); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetLetterSpacing(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetLetterSpacing() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleText()->mLetterSpacing, PR_FALSE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetWordSpacing(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetWordSpacing() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetAppUnits(GetStyleText()->mWordSpacing); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetWhiteSpace(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetWhiteSpace() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWhiteSpace, nsCSSProps::kWhitespaceKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetWindowShadow(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetWindowShadow() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mWindowShadow, nsCSSProps::kWindowShadowKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetWordWrap(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetWordWrap() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWordWrap, nsCSSProps::kWordwrapKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetPointerEvents(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPointerEvents() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mPointerEvents, nsCSSProps::kPointerEventsKTable)); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetVisibility(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetVisibility() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mVisible, nsCSSProps::kVisibilityKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetDirection(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetDirection() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mDirection, nsCSSProps::kDirectionKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetUnicodeBidi(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetUnicodeBidi() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mUnicodeBidi, nsCSSProps::kUnicodeBidiKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetCursor() { nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); @@ -2606,111 +2440,85 @@ nsComputedDOMStyle::DoGetCursor(nsIDOMCSSValue** aValue) val->SetIdent(nsCSSProps::ValueToKeywordEnum(ui->mCursor, nsCSSProps::kCursorKTable)); valueList->AppendCSSValue(val); - - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetAppearance(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetAppearance() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mAppearance, nsCSSProps::kAppearanceKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxAlign(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxAlign() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxAlign, nsCSSProps::kBoxAlignKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxDirection(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxDirection() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxDirection, nsCSSProps::kBoxDirectionKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxFlex(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxFlex() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleXUL()->mBoxFlex); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxOrdinalGroup(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxOrdinalGroup() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleXUL()->mBoxOrdinal); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxOrient(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxOrient() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxOrient, nsCSSProps::kBoxOrientKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxPack(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxPack() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxPack, nsCSSProps::kBoxPackKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBoxSizing(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBoxSizing() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStylePosition()->mBoxSizing, nsCSSProps::kBoxSizingKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetBorderImage() { const nsStyleBorder* border = GetStyleBorder(); @@ -2718,8 +2526,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) if (!border->GetBorderImage()) { nsROCSSPrimitiveValue *valNone = GetROCSSPrimitiveValue(); valNone->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = valNone); - return NS_OK; + return valNone; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); @@ -2765,142 +2572,110 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue) nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mBorderImageVFill, nsCSSProps::kBorderImageKTable)); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetFloatEdge(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFloatEdge() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mFloatEdge, nsCSSProps::kFloatEdgeKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetForceBrokenImageIcon(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetForceBrokenImageIcon() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleUIReset()->mForceBrokenImageIcon); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetIMEMode(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetIMEMode() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mIMEMode, nsCSSProps::kIMEModeKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetUserFocus(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetUserFocus() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserFocus, nsCSSProps::kUserFocusKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetUserInput(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetUserInput() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserInput, nsCSSProps::kUserInputKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetUserModify(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetUserModify() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserModify, nsCSSProps::kUserModifyKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetUserSelect(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetUserSelect() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mUserSelect, nsCSSProps::kUserSelectKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetDisplay(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetDisplay() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mDisplay, nsCSSProps::kDisplayKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetPosition(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPosition() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mPosition, nsCSSProps::kPositionKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetClip(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetClip() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); const nsStyleDisplay* display = GetStyleDisplay(); - nsROCSSPrimitiveValue *topVal = nsnull; - nsROCSSPrimitiveValue *rightVal = nsnull; - nsROCSSPrimitiveValue *bottomVal = nsnull; - nsROCSSPrimitiveValue *leftVal = nsnull; if (display->mClipFlags == NS_STYLE_CLIP_AUTO) { val->SetIdent(eCSSKeyword_auto); } else { // create the cssvalues for the sides, stick them in the rect object - topVal = GetROCSSPrimitiveValue(); - rightVal = GetROCSSPrimitiveValue(); - bottomVal = GetROCSSPrimitiveValue(); - leftVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *topVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *rightVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *bottomVal = GetROCSSPrimitiveValue(); + nsROCSSPrimitiveValue *leftVal = GetROCSSPrimitiveValue(); nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal, bottomVal, leftVal); if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) { @@ -2929,72 +2704,58 @@ nsComputedDOMStyle::DoGetClip(nsIDOMCSSValue** aValue) val->SetRect(domRect); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOverflow(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOverflow() { const nsStyleDisplay* display = GetStyleDisplay(); if (display->mOverflowX != display->mOverflowY) { // No value to return. We can't express this combination of // values as a shorthand. - *aValue = nsnull; - return NS_OK; + return nsnull; } nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX, nsCSSProps::kOverflowKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOverflowX(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOverflowX() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowX, nsCSSProps::kOverflowSubKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetOverflowY(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetOverflowY() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowY, nsCSSProps::kOverflowSubKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetResize(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetResize() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mResize, nsCSSProps::kResizeKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetPageBreakAfter(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPageBreakAfter() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3006,12 +2767,11 @@ nsComputedDOMStyle::DoGetPageBreakAfter(nsIDOMCSSValue** aValue) val->SetIdent(eCSSKeyword_auto); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetPageBreakBefore(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetPageBreakBefore() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3023,12 +2783,11 @@ nsComputedDOMStyle::DoGetPageBreakBefore(nsIDOMCSSValue** aValue) val->SetIdent(eCSSKeyword_auto); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetHeight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetHeight() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3064,12 +2823,11 @@ nsComputedDOMStyle::DoGetHeight(nsIDOMCSSValue** aValue) minHeight, maxHeight); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetWidth() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3105,76 +2863,63 @@ nsComputedDOMStyle::DoGetWidth(nsIDOMCSSValue** aValue) nsCSSProps::kWidthKTable, minWidth, maxWidth); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMaxHeight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMaxHeight() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mMaxHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMaxWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMaxWidth() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mMaxWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, nsCSSProps::kWidthKTable); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMinHeight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMinHeight() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mMinHeight, PR_TRUE, &nsComputedDOMStyle::GetCBContentHeight); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMinWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMinWidth() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mMinWidth, PR_TRUE, &nsComputedDOMStyle::GetCBContentWidth, nsCSSProps::kWidthKTable); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetLeft(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetLeft() { - return GetOffsetWidthFor(NS_SIDE_LEFT, aValue); + return GetOffsetWidthFor(NS_SIDE_LEFT); } -nsresult -nsComputedDOMStyle::DoGetRight(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetRight() { - return GetOffsetWidthFor(NS_SIDE_RIGHT, aValue); + return GetOffsetWidthFor(NS_SIDE_RIGHT); } -nsresult -nsComputedDOMStyle::DoGetTop(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTop() { - return GetOffsetWidthFor(NS_SIDE_TOP, aValue); + return GetOffsetWidthFor(NS_SIDE_TOP); } nsROCSSPrimitiveValue* @@ -3197,9 +2942,8 @@ nsComputedDOMStyle::GetROCSSValueList(PRBool aCommaDelimited) return valueList; } -nsresult -nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide, - nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide) { const nsStyleDisplay* display = GetStyleDisplay(); @@ -3213,29 +2957,22 @@ nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide, position = NS_STYLE_POSITION_STATIC; } - nsresult rv = NS_OK; switch (position) { case NS_STYLE_POSITION_STATIC: - rv = GetStaticOffset(aSide, aValue); - break; + return GetStaticOffset(aSide); case NS_STYLE_POSITION_RELATIVE: - rv = GetRelativeOffset(aSide, aValue); - break; + return GetRelativeOffset(aSide); case NS_STYLE_POSITION_ABSOLUTE: case NS_STYLE_POSITION_FIXED: - rv = GetAbsoluteOffset(aSide, aValue); - break; + return GetAbsoluteOffset(aSide); default: NS_ERROR("Invalid position"); - break; + return nsnull; } - - return rv; } -nsresult -nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide, - nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3291,16 +3028,14 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide, val->SetAppUnits(0); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)); #define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3) -nsresult -nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide, - nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); @@ -3326,25 +3061,20 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide, } val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, PR_FALSE)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide) { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide), PR_FALSE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3356,8 +3086,7 @@ nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue* val->SetAppUnits(mInnerFrame->GetUsedPadding().side(aSide)); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } PRBool @@ -3391,9 +3120,8 @@ nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord) return PR_TRUE; } -nsresult -nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, - nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide) { const nsStyleBorder *border = GetStyleBorder(); @@ -3411,21 +3139,17 @@ nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, borderColors = borderColors->mNext; } while (borderColors); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } } nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(eCSSKeyword_none); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3438,12 +3162,11 @@ nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** } val->SetAppUnits(width); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3455,12 +3178,11 @@ nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** } SetToRGBAColor(val, color); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3472,21 +3194,17 @@ nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** val->SetAppUnits(mInnerFrame->GetUsedMargin().side(aSide)); } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->GetBorderStyle(aSide), nsCSSProps::kBorderStyleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } void @@ -3705,9 +3423,8 @@ nsComputedDOMStyle::GetFrameBoundsHeightForTransform(nscoord& aHeight) return PR_TRUE; } -nsresult -nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, - nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3722,51 +3439,47 @@ nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill, nsAutoString paintString; switch (paint->mType) { - case eStyleSVGPaintType_None: - { - val->SetIdent(eCSSKeyword_none); - break; - } - case eStyleSVGPaintType_Color: - { - SetToRGBAColor(val, paint->mPaint.mColor); - break; - } - case eStyleSVGPaintType_Server: - { - nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); + case eStyleSVGPaintType_None: + { + val->SetIdent(eCSSKeyword_none); + break; + } + case eStyleSVGPaintType_Color: + { + SetToRGBAColor(val, paint->mPaint.mColor); + break; + } + case eStyleSVGPaintType_Server: + { + nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE); + valueList->AppendCSSValue(val); - valueList->AppendCSSValue(val); + nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue(); + valueList->AppendCSSValue(fallback); - nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue(); - valueList->AppendCSSValue(fallback); - - val->SetURI(paint->mPaint.mPaintServer); - SetToRGBAColor(fallback, paint->mFallbackColor); - - NS_ADDREF(*aValue = valueList); - return NS_OK; - } + val->SetURI(paint->mPaint.mPaintServer); + SetToRGBAColor(fallback, paint->mFallbackColor); + return valueList; + } } - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFill(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFill() { - return GetSVGPaintFor(PR_TRUE, aValue); + return GetSVGPaintFor(PR_TRUE); } -nsresult -nsComputedDOMStyle::DoGetStroke(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStroke() { - return GetSVGPaintFor(PR_FALSE, aValue); + return GetSVGPaintFor(PR_FALSE); } -nsresult -nsComputedDOMStyle::DoGetMarkerEnd(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarkerEnd() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3777,12 +3490,11 @@ nsComputedDOMStyle::DoGetMarkerEnd(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMarkerMid(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarkerMid() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3793,12 +3505,11 @@ nsComputedDOMStyle::DoGetMarkerMid(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMarkerStart(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMarkerStart() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -3809,20 +3520,18 @@ nsComputedDOMStyle::DoGetMarkerStart(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeDasharray() { const nsStyleSVG* svg = GetStyleSVG(); if (!svg->mStrokeDasharrayLength || !svg->mStrokeDasharray) { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); @@ -3834,260 +3543,199 @@ nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue) SetValueToCoord(dash, svg->mStrokeDasharray[i], PR_TRUE); } - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetStrokeDashoffset(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeDashoffset() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset, PR_FALSE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeWidth(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeWidth() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); - SetValueToCoord(val, GetStyleSVG()->mStrokeWidth, PR_TRUE); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFillOpacity(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFillOpacity() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleSVG()->mFillOpacity); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFloodOpacity(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFloodOpacity() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleSVGReset()->mFloodOpacity); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStopOpacity(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStopOpacity() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleSVGReset()->mStopOpacity); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeMiterlimit(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeMiterlimit() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleSVG()->mStrokeMiterlimit); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeOpacity(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeOpacity() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetNumber(GetStyleSVG()->mStrokeOpacity); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetClipRule(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetClipRule() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleSVG()->mClipRule, nsCSSProps::kFillRuleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFillRule(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFillRule() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent(nsCSSProps::ValueToKeywordEnum( GetStyleSVG()->mFillRule, nsCSSProps::kFillRuleKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeLinecap(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeLinecap() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinecap, nsCSSProps::kStrokeLinecapKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStrokeLinejoin(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStrokeLinejoin() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinejoin, nsCSSProps::kStrokeLinejoinKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextAnchor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextAnchor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextAnchor, nsCSSProps::kTextAnchorKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColorInterpolation(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColorInterpolation() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolation, nsCSSProps::kColorInterpolationKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetColorInterpolationFilters(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetColorInterpolationFilters() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolationFilters, nsCSSProps::kColorInterpolationKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetDominantBaseline(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetDominantBaseline() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVGReset()->mDominantBaseline, nsCSSProps::kDominantBaselineKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetImageRendering(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetImageRendering() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mImageRendering, nsCSSProps::kImageRenderingKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetShapeRendering(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetShapeRendering() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mShapeRendering, nsCSSProps::kShapeRenderingKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTextRendering(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTextRendering() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - val->SetIdent( nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextRendering, nsCSSProps::kTextRenderingKTable)); - - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFloodColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFloodColor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetLightingColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetLightingColor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetStopColor(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetStopColor() { nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - SetToRGBAColor(val, GetStyleSVGReset()->mStopColor); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetClipPath(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetClipPath() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -4098,12 +3746,11 @@ nsComputedDOMStyle::DoGetClipPath(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetFilter(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetFilter() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -4114,12 +3761,11 @@ nsComputedDOMStyle::DoGetFilter(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetMask(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetMask() { nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue(); @@ -4130,12 +3776,11 @@ nsComputedDOMStyle::DoGetMask(nsIDOMCSSValue** aValue) else val->SetIdent(eCSSKeyword_none); - NS_ADDREF(*aValue = val); - return NS_OK; + return val; } -nsresult -nsComputedDOMStyle::DoGetTransitionDelay(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTransitionDelay() { const nsStyleDisplay* display = GetStyleDisplay(); @@ -4151,12 +3796,11 @@ nsComputedDOMStyle::DoGetTransitionDelay(nsIDOMCSSValue** aValue) delay->SetTime((float)transition->GetDelay() / (float)PR_MSEC_PER_SEC); } while (++i < display->mTransitionDelayCount); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetTransitionDuration(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTransitionDuration() { const nsStyleDisplay* display = GetStyleDisplay(); @@ -4173,12 +3817,11 @@ nsComputedDOMStyle::DoGetTransitionDuration(nsIDOMCSSValue** aValue) duration->SetTime((float)transition->GetDuration() / (float)PR_MSEC_PER_SEC); } while (++i < display->mTransitionDurationCount); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetTransitionProperty(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTransitionProperty() { const nsStyleDisplay* display = GetStyleDisplay(); @@ -4207,12 +3850,11 @@ nsComputedDOMStyle::DoGetTransitionProperty(nsIDOMCSSValue** aValue) property->SetString(nsCSSProps::GetStringValue(cssprop)); } while (++i < display->mTransitionPropertyCount); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } -nsresult -nsComputedDOMStyle::DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue) +nsIDOMCSSValue* +nsComputedDOMStyle::DoGetTransitionTimingFunction() { const nsStyleDisplay* display = GetStyleDisplay(); @@ -4234,8 +3876,7 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue) tf.mX1, tf.mY1, tf.mX2, tf.mY2)); } while (++i < display->mTransitionTimingFunctionCount); - NS_ADDREF(*aValue = valueList); - return NS_OK; + return valueList; } #define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \ diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 03df6056e18a..d1333f8aec6a 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -123,44 +123,45 @@ private: #include "nsStyleStructList.h" #undef STYLE_STRUCT - nsresult GetEllipseRadii(const nsStyleCorners& aRadius, - PRUint8 aFullCorner, - PRBool aIsBorder, // else outline - nsIDOMCSSValue** aValue); + // All of the property getters below return a pointer to a refcounted object + // that has just been created, but the refcount is still 0. Caller must take + // ownership. - nsresult GetOffsetWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetEllipseRadii(const nsStyleCorners& aRadius, + PRUint8 aFullCorner, + PRBool aIsBorder); // else outline - nsresult GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetOffsetWidthFor(mozilla::css::Side aSide); - nsresult GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetAbsoluteOffset(mozilla::css::Side aSide); - nsresult GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetRelativeOffset(mozilla::css::Side aSide); - nsresult GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetStaticOffset(mozilla::css::Side aSide); - nsresult GetBorderColorsFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetPaddingWidthFor(mozilla::css::Side aSide); - nsresult GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetBorderColorsFor(mozilla::css::Side aSide); - nsresult GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetBorderStyleFor(mozilla::css::Side aSide); - nsresult GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetBorderWidthFor(mozilla::css::Side aSide); - nsresult GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetBorderColorFor(mozilla::css::Side aSide); - nsresult GetSVGPaintFor(PRBool aFill, nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetMarginWidthFor(mozilla::css::Side aSide); + + nsIDOMCSSValue* GetSVGPaintFor(PRBool aFill); PRBool GetLineHeightCoord(nscoord& aCoord); - nsresult GetCSSShadowArray(nsCSSShadowArray* aArray, - const nscolor& aDefaultColor, - PRBool aIsBoxShadow, - nsIDOMCSSValue** aValue); + nsIDOMCSSValue* GetCSSShadowArray(nsCSSShadowArray* aArray, + const nscolor& aDefaultColor, + PRBool aIsBoxShadow); - nsresult GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember, - PRUint32 nsStyleBackground::* aCount, - const PRInt32 aTable[], - nsIDOMCSSValue** aResult); + nsIDOMCSSValue* GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember, + PRUint32 nsStyleBackground::* aCount, + const PRInt32 aTable[]); void GetCSSGradientString(const nsStyleGradient* aGradient, nsAString& aString); @@ -173,233 +174,233 @@ private: * DoGetXXX instead of GetXXX. */ - nsresult DoGetAppearance(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetAppearance(); /* Box properties */ - nsresult DoGetBoxAlign(nsIDOMCSSValue** aValue); - nsresult DoGetBoxDirection(nsIDOMCSSValue** aValue); - nsresult DoGetBoxFlex(nsIDOMCSSValue** aValue); - nsresult DoGetBoxOrdinalGroup(nsIDOMCSSValue** aValue); - nsresult DoGetBoxOrient(nsIDOMCSSValue** aValue); - nsresult DoGetBoxPack(nsIDOMCSSValue** aValue); - nsresult DoGetBoxSizing(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetBoxAlign(); + nsIDOMCSSValue* DoGetBoxDirection(); + nsIDOMCSSValue* DoGetBoxFlex(); + nsIDOMCSSValue* DoGetBoxOrdinalGroup(); + nsIDOMCSSValue* DoGetBoxOrient(); + nsIDOMCSSValue* DoGetBoxPack(); + nsIDOMCSSValue* DoGetBoxSizing(); - nsresult DoGetWidth(nsIDOMCSSValue** aValue); - nsresult DoGetHeight(nsIDOMCSSValue** aValue); - nsresult DoGetMaxHeight(nsIDOMCSSValue** aValue); - nsresult DoGetMaxWidth(nsIDOMCSSValue** aValue); - nsresult DoGetMinHeight(nsIDOMCSSValue** aValue); - nsresult DoGetMinWidth(nsIDOMCSSValue** aValue); - nsresult DoGetLeft(nsIDOMCSSValue** aValue); - nsresult DoGetTop(nsIDOMCSSValue** aValue); - nsresult DoGetRight(nsIDOMCSSValue** aValue); - nsresult DoGetBottom(nsIDOMCSSValue** aValue); - nsresult DoGetStackSizing(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetWidth(); + nsIDOMCSSValue* DoGetHeight(); + nsIDOMCSSValue* DoGetMaxHeight(); + nsIDOMCSSValue* DoGetMaxWidth(); + nsIDOMCSSValue* DoGetMinHeight(); + nsIDOMCSSValue* DoGetMinWidth(); + nsIDOMCSSValue* DoGetLeft(); + nsIDOMCSSValue* DoGetTop(); + nsIDOMCSSValue* DoGetRight(); + nsIDOMCSSValue* DoGetBottom(); + nsIDOMCSSValue* DoGetStackSizing(); /* Font properties */ - nsresult DoGetColor(nsIDOMCSSValue** aValue); - nsresult DoGetFontFamily(nsIDOMCSSValue** aValue); - nsresult DoGetMozFontFeatureSettings(nsIDOMCSSValue** aValue); - nsresult DoGetMozFontLanguageOverride(nsIDOMCSSValue** aValue); - nsresult DoGetFontSize(nsIDOMCSSValue** aValue); - nsresult DoGetFontSizeAdjust(nsIDOMCSSValue** aValue); - nsresult DoGetFontStretch(nsIDOMCSSValue** aValue); - nsresult DoGetFontStyle(nsIDOMCSSValue** aValue); - nsresult DoGetFontWeight(nsIDOMCSSValue** aValue); - nsresult DoGetFontVariant(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetColor(); + nsIDOMCSSValue* DoGetFontFamily(); + nsIDOMCSSValue* DoGetMozFontFeatureSettings(); + nsIDOMCSSValue* DoGetMozFontLanguageOverride(); + nsIDOMCSSValue* DoGetFontSize(); + nsIDOMCSSValue* DoGetFontSizeAdjust(); + nsIDOMCSSValue* DoGetFontStretch(); + nsIDOMCSSValue* DoGetFontStyle(); + nsIDOMCSSValue* DoGetFontWeight(); + nsIDOMCSSValue* DoGetFontVariant(); /* Background properties */ - nsresult DoGetBackgroundAttachment(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundColor(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundImage(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundPosition(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundRepeat(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundClip(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundInlinePolicy(nsIDOMCSSValue** aValue); - nsresult DoGetBackgroundOrigin(nsIDOMCSSValue** aValue); - nsresult DoGetMozBackgroundSize(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetBackgroundAttachment(); + nsIDOMCSSValue* DoGetBackgroundColor(); + nsIDOMCSSValue* DoGetBackgroundImage(); + nsIDOMCSSValue* DoGetBackgroundPosition(); + nsIDOMCSSValue* DoGetBackgroundRepeat(); + nsIDOMCSSValue* DoGetBackgroundClip(); + nsIDOMCSSValue* DoGetBackgroundInlinePolicy(); + nsIDOMCSSValue* DoGetBackgroundOrigin(); + nsIDOMCSSValue* DoGetMozBackgroundSize(); /* Padding properties */ - nsresult DoGetPadding(nsIDOMCSSValue** aValue); - nsresult DoGetPaddingTop(nsIDOMCSSValue** aValue); - nsresult DoGetPaddingBottom(nsIDOMCSSValue** aValue); - nsresult DoGetPaddingLeft(nsIDOMCSSValue** aValue); - nsresult DoGetPaddingRight(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetPadding(); + nsIDOMCSSValue* DoGetPaddingTop(); + nsIDOMCSSValue* DoGetPaddingBottom(); + nsIDOMCSSValue* DoGetPaddingLeft(); + nsIDOMCSSValue* DoGetPaddingRight(); /* Table Properties */ - nsresult DoGetBorderCollapse(nsIDOMCSSValue** aValue); - nsresult DoGetBorderSpacing(nsIDOMCSSValue** aValue); - nsresult DoGetCaptionSide(nsIDOMCSSValue** aValue); - nsresult DoGetEmptyCells(nsIDOMCSSValue** aValue); - nsresult DoGetTableLayout(nsIDOMCSSValue** aValue); - nsresult DoGetVerticalAlign(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetBorderCollapse(); + nsIDOMCSSValue* DoGetBorderSpacing(); + nsIDOMCSSValue* DoGetCaptionSide(); + nsIDOMCSSValue* DoGetEmptyCells(); + nsIDOMCSSValue* DoGetTableLayout(); + nsIDOMCSSValue* DoGetVerticalAlign(); /* Border Properties */ - nsresult DoGetBorderStyle(nsIDOMCSSValue** aValue); - nsresult DoGetBorderWidth(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopStyle(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomStyle(nsIDOMCSSValue** aValue); - nsresult DoGetBorderLeftStyle(nsIDOMCSSValue** aValue); - nsresult DoGetBorderRightStyle(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopWidth(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomWidth(nsIDOMCSSValue** aValue); - nsresult DoGetBorderLeftWidth(nsIDOMCSSValue** aValue); - nsresult DoGetBorderRightWidth(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopColor(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomColor(nsIDOMCSSValue** aValue); - nsresult DoGetBorderLeftColor(nsIDOMCSSValue** aValue); - nsresult DoGetBorderRightColor(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomColors(nsIDOMCSSValue** aValue); - nsresult DoGetBorderLeftColors(nsIDOMCSSValue** aValue); - nsresult DoGetBorderRightColors(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopColors(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomLeftRadius(nsIDOMCSSValue** aValue); - nsresult DoGetBorderBottomRightRadius(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopLeftRadius(nsIDOMCSSValue** aValue); - nsresult DoGetBorderTopRightRadius(nsIDOMCSSValue** aValue); - nsresult DoGetFloatEdge(nsIDOMCSSValue** aValue); - nsresult DoGetBorderImage(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetBorderStyle(); + nsIDOMCSSValue* DoGetBorderWidth(); + nsIDOMCSSValue* DoGetBorderTopStyle(); + nsIDOMCSSValue* DoGetBorderBottomStyle(); + nsIDOMCSSValue* DoGetBorderLeftStyle(); + nsIDOMCSSValue* DoGetBorderRightStyle(); + nsIDOMCSSValue* DoGetBorderTopWidth(); + nsIDOMCSSValue* DoGetBorderBottomWidth(); + nsIDOMCSSValue* DoGetBorderLeftWidth(); + nsIDOMCSSValue* DoGetBorderRightWidth(); + nsIDOMCSSValue* DoGetBorderTopColor(); + nsIDOMCSSValue* DoGetBorderBottomColor(); + nsIDOMCSSValue* DoGetBorderLeftColor(); + nsIDOMCSSValue* DoGetBorderRightColor(); + nsIDOMCSSValue* DoGetBorderBottomColors(); + nsIDOMCSSValue* DoGetBorderLeftColors(); + nsIDOMCSSValue* DoGetBorderRightColors(); + nsIDOMCSSValue* DoGetBorderTopColors(); + nsIDOMCSSValue* DoGetBorderBottomLeftRadius(); + nsIDOMCSSValue* DoGetBorderBottomRightRadius(); + nsIDOMCSSValue* DoGetBorderTopLeftRadius(); + nsIDOMCSSValue* DoGetBorderTopRightRadius(); + nsIDOMCSSValue* DoGetFloatEdge(); + nsIDOMCSSValue* DoGetBorderImage(); /* Box Shadow */ - nsresult DoGetBoxShadow(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetBoxShadow(); /* Window Shadow */ - nsresult DoGetWindowShadow(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetWindowShadow(); /* Margin Properties */ - nsresult DoGetMarginWidth(nsIDOMCSSValue** aValue); - nsresult DoGetMarginTopWidth(nsIDOMCSSValue** aValue); - nsresult DoGetMarginBottomWidth(nsIDOMCSSValue** aValue); - nsresult DoGetMarginLeftWidth(nsIDOMCSSValue** aValue); - nsresult DoGetMarginRightWidth(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetMarginWidth(); + nsIDOMCSSValue* DoGetMarginTopWidth(); + nsIDOMCSSValue* DoGetMarginBottomWidth(); + nsIDOMCSSValue* DoGetMarginLeftWidth(); + nsIDOMCSSValue* DoGetMarginRightWidth(); /* Outline Properties */ - nsresult DoGetOutline(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineWidth(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineStyle(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineColor(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineOffset(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineRadiusBottomLeft(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineRadiusBottomRight(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineRadiusTopLeft(nsIDOMCSSValue** aValue); - nsresult DoGetOutlineRadiusTopRight(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetOutline(); + nsIDOMCSSValue* DoGetOutlineWidth(); + nsIDOMCSSValue* DoGetOutlineStyle(); + nsIDOMCSSValue* DoGetOutlineColor(); + nsIDOMCSSValue* DoGetOutlineOffset(); + nsIDOMCSSValue* DoGetOutlineRadiusBottomLeft(); + nsIDOMCSSValue* DoGetOutlineRadiusBottomRight(); + nsIDOMCSSValue* DoGetOutlineRadiusTopLeft(); + nsIDOMCSSValue* DoGetOutlineRadiusTopRight(); /* Content Properties */ - nsresult DoGetContent(nsIDOMCSSValue** aValue); - nsresult DoGetCounterIncrement(nsIDOMCSSValue** aValue); - nsresult DoGetCounterReset(nsIDOMCSSValue** aValue); - nsresult DoGetMarkerOffset(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetContent(); + nsIDOMCSSValue* DoGetCounterIncrement(); + nsIDOMCSSValue* DoGetCounterReset(); + nsIDOMCSSValue* DoGetMarkerOffset(); /* Quotes Properties */ - nsresult DoGetQuotes(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetQuotes(); /* z-index */ - nsresult DoGetZIndex(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetZIndex(); /* List properties */ - nsresult DoGetListStyleImage(nsIDOMCSSValue** aValue); - nsresult DoGetListStylePosition(nsIDOMCSSValue** aValue); - nsresult DoGetListStyleType(nsIDOMCSSValue** aValue); - nsresult DoGetImageRegion(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetListStyleImage(); + nsIDOMCSSValue* DoGetListStylePosition(); + nsIDOMCSSValue* DoGetListStyleType(); + nsIDOMCSSValue* DoGetImageRegion(); /* Text Properties */ - nsresult DoGetLineHeight(nsIDOMCSSValue** aValue); - nsresult DoGetTextAlign(nsIDOMCSSValue** aValue); - nsresult DoGetTextDecoration(nsIDOMCSSValue** aValue); - nsresult DoGetTextIndent(nsIDOMCSSValue** aValue); - nsresult DoGetTextTransform(nsIDOMCSSValue** aValue); - nsresult DoGetTextShadow(nsIDOMCSSValue** aValue); - nsresult DoGetLetterSpacing(nsIDOMCSSValue** aValue); - nsresult DoGetWordSpacing(nsIDOMCSSValue** aValue); - nsresult DoGetWhiteSpace(nsIDOMCSSValue** aValue); - nsresult DoGetWordWrap(nsIDOMCSSValue** aValue); - nsresult DoGetMozTabSize(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetLineHeight(); + nsIDOMCSSValue* DoGetTextAlign(); + nsIDOMCSSValue* DoGetTextDecoration(); + nsIDOMCSSValue* DoGetTextIndent(); + nsIDOMCSSValue* DoGetTextTransform(); + nsIDOMCSSValue* DoGetTextShadow(); + nsIDOMCSSValue* DoGetLetterSpacing(); + nsIDOMCSSValue* DoGetWordSpacing(); + nsIDOMCSSValue* DoGetWhiteSpace(); + nsIDOMCSSValue* DoGetWordWrap(); + nsIDOMCSSValue* DoGetMozTabSize(); /* Visibility properties */ - nsresult DoGetOpacity(nsIDOMCSSValue** aValue); - nsresult DoGetPointerEvents(nsIDOMCSSValue** aValue); - nsresult DoGetVisibility(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetOpacity(); + nsIDOMCSSValue* DoGetPointerEvents(); + nsIDOMCSSValue* DoGetVisibility(); /* Direction properties */ - nsresult DoGetDirection(nsIDOMCSSValue** aValue); - nsresult DoGetUnicodeBidi(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetDirection(); + nsIDOMCSSValue* DoGetUnicodeBidi(); /* Display properties */ - nsresult DoGetBinding(nsIDOMCSSValue** aValue); - nsresult DoGetClear(nsIDOMCSSValue** aValue); - nsresult DoGetCssFloat(nsIDOMCSSValue** aValue); - nsresult DoGetDisplay(nsIDOMCSSValue** aValue); - nsresult DoGetPosition(nsIDOMCSSValue** aValue); - nsresult DoGetClip(nsIDOMCSSValue** aValue); - nsresult DoGetOverflow(nsIDOMCSSValue** aValue); - nsresult DoGetOverflowX(nsIDOMCSSValue** aValue); - nsresult DoGetOverflowY(nsIDOMCSSValue** aValue); - nsresult DoGetResize(nsIDOMCSSValue** aValue); - nsresult DoGetPageBreakAfter(nsIDOMCSSValue** aValue); - nsresult DoGetPageBreakBefore(nsIDOMCSSValue** aValue); - nsresult DoGetMozTransform(nsIDOMCSSValue** aValue); - nsresult DoGetMozTransformOrigin(nsIDOMCSSValue **aValue); + nsIDOMCSSValue* DoGetBinding(); + nsIDOMCSSValue* DoGetClear(); + nsIDOMCSSValue* DoGetCssFloat(); + nsIDOMCSSValue* DoGetDisplay(); + nsIDOMCSSValue* DoGetPosition(); + nsIDOMCSSValue* DoGetClip(); + nsIDOMCSSValue* DoGetOverflow(); + nsIDOMCSSValue* DoGetOverflowX(); + nsIDOMCSSValue* DoGetOverflowY(); + nsIDOMCSSValue* DoGetResize(); + nsIDOMCSSValue* DoGetPageBreakAfter(); + nsIDOMCSSValue* DoGetPageBreakBefore(); + nsIDOMCSSValue* DoGetMozTransform(); + nsIDOMCSSValue* DoGetMozTransformOrigin(); /* User interface properties */ - nsresult DoGetCursor(nsIDOMCSSValue** aValue); - nsresult DoGetForceBrokenImageIcon(nsIDOMCSSValue** aValue); - nsresult DoGetIMEMode(nsIDOMCSSValue** aValue); - nsresult DoGetUserFocus(nsIDOMCSSValue** aValue); - nsresult DoGetUserInput(nsIDOMCSSValue** aValue); - nsresult DoGetUserModify(nsIDOMCSSValue** aValue); - nsresult DoGetUserSelect(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetCursor(); + nsIDOMCSSValue* DoGetForceBrokenImageIcon(); + nsIDOMCSSValue* DoGetIMEMode(); + nsIDOMCSSValue* DoGetUserFocus(); + nsIDOMCSSValue* DoGetUserInput(); + nsIDOMCSSValue* DoGetUserModify(); + nsIDOMCSSValue* DoGetUserSelect(); /* Column properties */ - nsresult DoGetColumnCount(nsIDOMCSSValue** aValue); - nsresult DoGetColumnWidth(nsIDOMCSSValue** aValue); - nsresult DoGetColumnGap(nsIDOMCSSValue** aValue); - nsresult DoGetColumnRuleWidth(nsIDOMCSSValue** aValue); - nsresult DoGetColumnRuleStyle(nsIDOMCSSValue** aValue); - nsresult DoGetColumnRuleColor(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetColumnCount(); + nsIDOMCSSValue* DoGetColumnWidth(); + nsIDOMCSSValue* DoGetColumnGap(); + nsIDOMCSSValue* DoGetColumnRuleWidth(); + nsIDOMCSSValue* DoGetColumnRuleStyle(); + nsIDOMCSSValue* DoGetColumnRuleColor(); /* CSS Transitions */ - nsresult DoGetTransitionProperty(nsIDOMCSSValue** aValue); - nsresult DoGetTransitionDuration(nsIDOMCSSValue** aValue); - nsresult DoGetTransitionDelay(nsIDOMCSSValue** aValue); - nsresult DoGetTransitionTimingFunction(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetTransitionProperty(); + nsIDOMCSSValue* DoGetTransitionDuration(); + nsIDOMCSSValue* DoGetTransitionDelay(); + nsIDOMCSSValue* DoGetTransitionTimingFunction(); /* SVG properties */ - nsresult DoGetFill(nsIDOMCSSValue** aValue); - nsresult DoGetStroke(nsIDOMCSSValue** aValue); - nsresult DoGetMarkerEnd(nsIDOMCSSValue** aValue); - nsresult DoGetMarkerMid(nsIDOMCSSValue** aValue); - nsresult DoGetMarkerStart(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeDasharray(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetFill(); + nsIDOMCSSValue* DoGetStroke(); + nsIDOMCSSValue* DoGetMarkerEnd(); + nsIDOMCSSValue* DoGetMarkerMid(); + nsIDOMCSSValue* DoGetMarkerStart(); + nsIDOMCSSValue* DoGetStrokeDasharray(); - nsresult DoGetStrokeDashoffset(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeWidth(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetStrokeDashoffset(); + nsIDOMCSSValue* DoGetStrokeWidth(); - nsresult DoGetFillOpacity(nsIDOMCSSValue** aValue); - nsresult DoGetFloodOpacity(nsIDOMCSSValue** aValue); - nsresult DoGetStopOpacity(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeMiterlimit(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeOpacity(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetFillOpacity(); + nsIDOMCSSValue* DoGetFloodOpacity(); + nsIDOMCSSValue* DoGetStopOpacity(); + nsIDOMCSSValue* DoGetStrokeMiterlimit(); + nsIDOMCSSValue* DoGetStrokeOpacity(); - nsresult DoGetClipRule(nsIDOMCSSValue** aValue); - nsresult DoGetFillRule(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeLinecap(nsIDOMCSSValue** aValue); - nsresult DoGetStrokeLinejoin(nsIDOMCSSValue** aValue); - nsresult DoGetTextAnchor(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetClipRule(); + nsIDOMCSSValue* DoGetFillRule(); + nsIDOMCSSValue* DoGetStrokeLinecap(); + nsIDOMCSSValue* DoGetStrokeLinejoin(); + nsIDOMCSSValue* DoGetTextAnchor(); - nsresult DoGetColorInterpolation(nsIDOMCSSValue** aValue); - nsresult DoGetColorInterpolationFilters(nsIDOMCSSValue** aValue); - nsresult DoGetDominantBaseline(nsIDOMCSSValue** aValue); - nsresult DoGetImageRendering(nsIDOMCSSValue** aValue); - nsresult DoGetShapeRendering(nsIDOMCSSValue** aValue); - nsresult DoGetTextRendering(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetColorInterpolation(); + nsIDOMCSSValue* DoGetColorInterpolationFilters(); + nsIDOMCSSValue* DoGetDominantBaseline(); + nsIDOMCSSValue* DoGetImageRendering(); + nsIDOMCSSValue* DoGetShapeRendering(); + nsIDOMCSSValue* DoGetTextRendering(); - nsresult DoGetFloodColor(nsIDOMCSSValue** aValue); - nsresult DoGetLightingColor(nsIDOMCSSValue** aValue); - nsresult DoGetStopColor(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetFloodColor(); + nsIDOMCSSValue* DoGetLightingColor(); + nsIDOMCSSValue* DoGetStopColor(); - nsresult DoGetClipPath(nsIDOMCSSValue** aValue); - nsresult DoGetFilter(nsIDOMCSSValue** aValue); - nsresult DoGetMask(nsIDOMCSSValue** aValue); + nsIDOMCSSValue* DoGetClipPath(); + nsIDOMCSSValue* DoGetFilter(); + nsIDOMCSSValue* DoGetMask(); nsROCSSPrimitiveValue* GetROCSSPrimitiveValue(); nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited); @@ -456,7 +457,7 @@ private: struct ComputedStyleMapEntry { // Create a pointer-to-member-function type. - typedef nsresult (nsComputedDOMStyle::*ComputeMethod)(nsIDOMCSSValue**); + typedef nsIDOMCSSValue* (nsComputedDOMStyle::*ComputeMethod)(); nsCSSProperty mProperty; ComputeMethod mGetter;