From 497e3d5ec02a6c043b359b6f50fcd750ba8f6ade Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Mon, 28 Dec 2015 14:42:09 -0800 Subject: [PATCH] Bug 1234676 part 3: Remove some now-unneeded local RefPtr variables. r=heycam --- layout/style/nsComputedDOMStyle.cpp | 48 ++++++----------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 938d062989ed..1c8fcb36df8a 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -2574,14 +2574,9 @@ nsComputedDOMStyle::GetGridTemplateColumnsRows(const nsStyleGridTemplate& aTrack AppendGridLineNames(valueList, aTrackList.mRepeatAutoLineNameListBefore); } - // XXXdholbert The |tmpTrackSize| RefPtr variable below can go away once - // we fix bug 1234676 and can make GetGridTrackSize return an - // already_AddRefed value. - RefPtr tmpTrackSize = + valueList->AppendCSSValue( GetGridTrackSize(aTrackList.mMinTrackSizingFunctions[i], - aTrackList.mMaxTrackSizingFunctions[i]); - - valueList->AppendCSSValue(tmpTrackSize.forget()); + aTrackList.mMaxTrackSizingFunctions[i])); if (!aTrackList.mRepeatAutoLineNameListAfter.IsEmpty()) { AppendGridLineNames(valueList, aTrackList.mRepeatAutoLineNameListAfter); } @@ -2589,13 +2584,9 @@ nsComputedDOMStyle::GetGridTemplateColumnsRows(const nsStyleGridTemplate& aTrack end->SetString(NS_LITERAL_STRING(")")); valueList->AppendCSSValue(end.forget()); } else { - // XXXdholbert The |tmpTrackSize| RefPtr variable below can go away once - // we fix bug 1234676 and make GetGridTrackSize return an - // already_AddRefed value. - RefPtr tmpTrackSize = + valueList->AppendCSSValue( GetGridTrackSize(aTrackList.mMinTrackSizingFunctions[i], - aTrackList.mMaxTrackSizingFunctions[i]); - valueList->AppendCSSValue(tmpTrackSize.forget()); + aTrackList.mMaxTrackSizingFunctions[i])); } } } @@ -3483,19 +3474,12 @@ nsComputedDOMStyle::CreateTextAlignValue(uint8_t aAlign, bool aAlignTrue, return val.forget(); } - // XXXdholbert Really we should store |val| in a RefPtr right away, and our - // return-type should be already_AddRefed. See bug 1234676. For now, we only - // put it in a RefPtr (for the benefit of AppendCSSValue) after we know we're - // not returning it directly. - RefPtr refcountedVal = val; - val = nullptr; // (to avoid accidental reuse/misuse) - RefPtr first = new nsROCSSPrimitiveValue; first->SetIdent(eCSSKeyword_true); RefPtr valueList = GetROCSSValueList(false); valueList->AppendCSSValue(first.forget()); - valueList->AppendCSSValue(refcountedVal.forget()); + valueList->AppendCSSValue(val.forget()); return valueList.forget(); } @@ -3553,17 +3537,12 @@ nsComputedDOMStyle::DoGetTextDecoration() RefPtr valueList = GetROCSSValueList(false); - // XXXdholbert The |tmp| RefPtr variable below can go away once we fix bug - // 1234676 and make the DoGet* functions return an already_AddRefed value. - RefPtr tmp = DoGetTextDecorationLine(); - valueList->AppendCSSValue(tmp.forget()); + valueList->AppendCSSValue(DoGetTextDecorationLine()); if (!isInitialStyle) { - tmp = DoGetTextDecorationStyle(); - valueList->AppendCSSValue(tmp.forget()); + valueList->AppendCSSValue(DoGetTextDecorationStyle()); } if (!isForegroundColor) { - tmp = DoGetTextDecorationColor(); - valueList->AppendCSSValue(tmp.forget()); + valueList->AppendCSSValue(DoGetTextDecorationColor()); } return valueList.forget(); @@ -5421,17 +5400,10 @@ nsComputedDOMStyle::GetSVGPaintFor(bool aFill) RefPtr valueList = GetROCSSValueList(false); RefPtr fallback = new nsROCSSPrimitiveValue; - // XXXdholbert Really we should store |val| in a RefPtr right away, and - // our return-type should be already_AddRefed. See bug 1234676. For now, - // we only put it in a RefPtr (for the benefit of AppendCSSValue) after - // we know we're not returning it directly. - RefPtr refcountedVal = val; - val = nullptr; // (to avoid accidental reuse/misuse) - - refcountedVal->SetURI(paint->mPaint.mPaintServer); + val->SetURI(paint->mPaint.mPaintServer); SetToRGBAColor(fallback, paint->mFallbackColor); - valueList->AppendCSSValue(refcountedVal.forget()); + valueList->AppendCSSValue(val.forget()); valueList->AppendCSSValue(fallback.forget()); return valueList.forget(); }