Bug 1492894 - part 3 - eliminate already_AddRefed variables in layout/; r=emilio

We need to disallow these to fix our static analysis, which should have
already been disallowing them.
This commit is contained in:
Nathan Froyd 2018-09-21 16:45:49 -04:00
Родитель b500bde65b
Коммит e068edea43
3 изменённых файлов: 16 добавлений и 21 удалений

Просмотреть файл

@ -2505,10 +2505,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
nullptr, extraRef, true);
nullptr, do_AddRef(computedStyle), true);
nsFrameItems frameItems;
contentFrame = static_cast<nsContainerFrame*>(
@ -2555,10 +2553,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootTableData, aDocElement,
nullptr, extraRef, true);
nullptr, do_AddRef(computedStyle), true);
nsFrameItems frameItems;
// if the document is a table then just populate it.
@ -5527,10 +5523,10 @@ nsCSSFrameConstructor::FindElementTagData(const Element& aElement,
}
nsCSSFrameConstructor::XBLBindingLoadInfo::XBLBindingLoadInfo(
already_AddRefed<ComputedStyle> aStyle,
already_AddRefed<ComputedStyle>&& aStyle,
mozilla::UniquePtr<PendingBinding> aPendingBinding,
nsAtom* aTag)
: mStyle(aStyle)
: mStyle(std::move(aStyle))
, mPendingBinding(std::move(aPendingBinding))
, mTag(aTag)
{
@ -9284,7 +9280,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
: nsCSSAnonBoxes::anonymousGridItem();
ComputedStyle* parentStyle = aParentFrame->Style();
nsIContent* parentContent = aParentFrame->GetContent();
already_AddRefed<ComputedStyle> wrapperStyle =
RefPtr<ComputedStyle> wrapperStyle =
mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(pseudoType,
parentStyle);
@ -9300,7 +9296,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
parentContent,
// no pending binding
nullptr,
wrapperStyle,
wrapperStyle.forget(),
true);
newItem->mIsAllInline =
@ -9786,7 +9782,7 @@ nsCSSFrameConstructor::WrapItemsInPseudoParent(nsIContent* aParentContent,
pseudoType = nsCSSAnonBoxes::inlineTable();
}
already_AddRefed<ComputedStyle> wrapperStyle;
RefPtr<ComputedStyle> wrapperStyle;
if (pseudoData.mFCData.mBits & FCDATA_IS_WRAPPER_ANON_BOX) {
wrapperStyle =
mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle(pseudoType,
@ -9802,7 +9798,7 @@ nsCSSFrameConstructor::WrapItemsInPseudoParent(nsIContent* aParentContent,
aParentContent,
// no pending binding
nullptr,
wrapperStyle,
wrapperStyle.forget(),
true);
const nsStyleDisplay* disp = newItem->mComputedStyle->StyleDisplay();
@ -9857,7 +9853,7 @@ nsCSSFrameConstructor::CreateNeededPseudoSiblings(
const PseudoParentData& pseudoData =
sPseudoParentData[eTypeRubyBaseContainer];
already_AddRefed<ComputedStyle> pseudoStyle = mPresShell->StyleSet()->
RefPtr<ComputedStyle> pseudoStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(*pseudoData.mPseudoType,
aParentFrame->Style());
FrameConstructionItem* newItem =
@ -9866,7 +9862,7 @@ nsCSSFrameConstructor::CreateNeededPseudoSiblings(
aParentFrame->GetContent(),
// no pending binding
nullptr,
pseudoStyle,
pseudoStyle.forget(),
true);
newItem->mIsAllInline = true;
newItem->mChildItems.SetParentHasNoXBLChildren(true);

Просмотреть файл

@ -798,7 +798,7 @@ private:
XBLBindingLoadInfo(nsIContent&, ComputedStyle&);
// For the case we actually load an XBL binding.
XBLBindingLoadInfo(already_AddRefed<ComputedStyle> aStyle,
XBLBindingLoadInfo(already_AddRefed<ComputedStyle>&& aStyle,
mozilla::UniquePtr<PendingBinding> aPendingBinding,
nsAtom* aTag);
@ -901,7 +901,7 @@ private:
{
FrameConstructionItem* item =
new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aPendingBinding, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
mItems.insertBack(item);
++mItemCount;
@ -919,7 +919,7 @@ private:
{
FrameConstructionItem* item =
new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aPendingBinding, std::move(aComputedStyle),
aSuppressWhiteSpaceOptimizations);
mItems.insertFront(item);
++mItemCount;
@ -1147,10 +1147,10 @@ private:
FrameConstructionItem(const FrameConstructionData* aFCData,
nsIContent* aContent,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>& aComputedStyle,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations)
: mFCData(aFCData), mContent(aContent),
mPendingBinding(aPendingBinding), mComputedStyle(aComputedStyle),
mPendingBinding(aPendingBinding), mComputedStyle(std::move(aComputedStyle)),
mSuppressWhiteSpaceOptimizations(aSuppressWhiteSpaceOptimizations),
mIsText(false), mIsGeneratedContent(false),
mIsAnonymousContentCreatorContent(false),

Просмотреть файл

@ -2384,8 +2384,7 @@ Gecko_CSSValue_SetFontWeight(nsCSSValueBorrowedMut aCSSValue,
void
Gecko_nsStyleFont_SetLang(nsStyleFont* aFont, nsAtom* aAtom)
{
already_AddRefed<nsAtom> atom = already_AddRefed<nsAtom>(aAtom);
aFont->mLanguage = atom;
aFont->mLanguage = dont_AddRef(aAtom);
aFont->mExplicitLanguage = true;
}