зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1283273 - Change nsAutoPtr to UniquePtr in classes within layout/generic. r=dholbert
This commit is contained in:
Родитель
bc0a1bc5f8
Коммит
7fc51f7d9e
|
@ -6,7 +6,7 @@
|
|||
#ifndef MATHMLTEXTRUNFACTORY_H_
|
||||
#define MATHMLTEXTRUNFACTORY_H_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTextRunTransformations.h"
|
||||
|
||||
/**
|
||||
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
class MathMLTextRunFactory : public nsTransformingTextRunFactory {
|
||||
public:
|
||||
MathMLTextRunFactory(nsTransformingTextRunFactory* aInnerTransformingTextRunFactory,
|
||||
MathMLTextRunFactory(UniquePtr<nsTransformingTextRunFactory> aInnerTransformingTextRunFactory,
|
||||
uint32_t aFlags, uint8_t aSSTYScriptLevel,
|
||||
float aFontInflation)
|
||||
: mInnerTransformingTextRunFactory(aInnerTransformingTextRunFactory),
|
||||
: mInnerTransformingTextRunFactory(Move(aInnerTransformingTextRunFactory)),
|
||||
mFlags(aFlags),
|
||||
mFontInflation(aFontInflation),
|
||||
mSSTYScriptLevel(aSSTYScriptLevel) {}
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
nsAutoPtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
|
||||
UniquePtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
|
||||
uint32_t mFlags;
|
||||
float mFontInflation;
|
||||
uint8_t mSSTYScriptLevel;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
|
@ -37,7 +38,6 @@
|
|||
#include "prenv.h"
|
||||
#include "plstr.h"
|
||||
#include "nsError.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include <algorithm>
|
||||
#ifdef ACCESSIBILITY
|
||||
|
@ -4759,7 +4759,7 @@ nsBlockFrame::DrainOverflowLines()
|
|||
bool
|
||||
nsBlockFrame::DrainSelfOverflowList()
|
||||
{
|
||||
nsAutoPtr<FrameLines> ourOverflowLines(RemoveOverflowLines());
|
||||
UniquePtr<FrameLines> ourOverflowLines(RemoveOverflowLines());
|
||||
if (!ourOverflowLines) {
|
||||
return false;
|
||||
}
|
||||
|
@ -6535,7 +6535,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
aBuilder->MarkFramesForDisplayList(this, mFloats, aDirtyRect);
|
||||
|
||||
// Prepare for text-overflow processing.
|
||||
nsAutoPtr<TextOverflow> textOverflow(
|
||||
UniquePtr<TextOverflow> textOverflow(
|
||||
TextOverflow::WillProcessLines(aBuilder, this));
|
||||
|
||||
// We'll collect our lines' display items here, & then append this to aLists.
|
||||
|
@ -6564,7 +6564,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
break;
|
||||
}
|
||||
DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
|
||||
linesDisplayListCollection, this, textOverflow);
|
||||
linesDisplayListCollection, this, textOverflow.get());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -6577,7 +6577,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
++line) {
|
||||
nsRect lineArea = line->GetVisualOverflowArea();
|
||||
DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
|
||||
linesDisplayListCollection, this, textOverflow);
|
||||
linesDisplayListCollection, this, textOverflow.get());
|
||||
if (!lineArea.IsEmpty()) {
|
||||
if (lineArea.y < lastY
|
||||
|| lineArea.YMost() < lastYMost) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
/* rendering object for CSS "display: flex" */
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
|
@ -1177,7 +1177,7 @@ nsFlexContainerFrame::IsHorizontal()
|
|||
return axisTracker.IsMainAxisHorizontal();
|
||||
}
|
||||
|
||||
FlexItem*
|
||||
UniquePtr<FlexItem>
|
||||
nsFlexContainerFrame::GenerateFlexItemForChild(
|
||||
nsPresContext* aPresContext,
|
||||
nsIFrame* aChildFrame,
|
||||
|
@ -1287,12 +1287,12 @@ nsFlexContainerFrame::GenerateFlexItemForChild(
|
|||
}
|
||||
|
||||
// Construct the flex item!
|
||||
FlexItem* item = new FlexItem(childRS,
|
||||
flexGrow, flexShrink, flexBaseSize,
|
||||
mainMinSize, mainMaxSize,
|
||||
tentativeCrossSize,
|
||||
crossMinSize, crossMaxSize,
|
||||
aAxisTracker);
|
||||
auto item = MakeUnique<FlexItem>(childRS,
|
||||
flexGrow, flexShrink, flexBaseSize,
|
||||
mainMinSize, mainMaxSize,
|
||||
tentativeCrossSize,
|
||||
crossMinSize, crossMaxSize,
|
||||
aAxisTracker);
|
||||
|
||||
// If we're inflexible, we can just freeze to our hypothetical main-size
|
||||
// up-front. Similarly, if we're a fixed-size widget, we only have one
|
||||
|
@ -3431,13 +3431,13 @@ nsFlexContainerFrame::GenerateFlexLines(
|
|||
curLine = AddNewFlexLineToList(aLines, shouldInsertAtFront);
|
||||
}
|
||||
|
||||
nsAutoPtr<FlexItem> item;
|
||||
UniquePtr<FlexItem> item;
|
||||
if (nextStrutIdx < aStruts.Length() &&
|
||||
aStruts[nextStrutIdx].mItemIdx == itemIdxInContainer) {
|
||||
|
||||
// Use the simplified "strut" FlexItem constructor:
|
||||
item = new FlexItem(childFrame, aStruts[nextStrutIdx].mStrutCrossSize,
|
||||
aReflowState.GetWritingMode());
|
||||
item = MakeUnique<FlexItem>(childFrame, aStruts[nextStrutIdx].mStrutCrossSize,
|
||||
aReflowState.GetWritingMode());
|
||||
nextStrutIdx++;
|
||||
} else {
|
||||
item = GenerateFlexItemForChild(aPresContext, childFrame,
|
||||
|
@ -3460,7 +3460,7 @@ nsFlexContainerFrame::GenerateFlexLines(
|
|||
|
||||
// Add item to current flex line (and update the line's bookkeeping about
|
||||
// how large its items collectively are).
|
||||
curLine->AddItem(item.forget(), shouldInsertAtFront,
|
||||
curLine->AddItem(item.release(), shouldInsertAtFront,
|
||||
itemInnerHypotheticalMainSize,
|
||||
itemOuterHypotheticalMainSize);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define nsFlexContainerFrame_h___
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
template <class T> class LinkedList;
|
||||
|
@ -136,7 +137,7 @@ protected:
|
|||
* returned FlexItem will be ready to participate in the "Resolve the
|
||||
* Flexible Lengths" step of the Flex Layout Algorithm.)
|
||||
*/
|
||||
FlexItem* GenerateFlexItemForChild(nsPresContext* aPresContext,
|
||||
mozilla::UniquePtr<FlexItem> GenerateFlexItemForChild(nsPresContext* aPresContext,
|
||||
nsIFrame* aChildFrame,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
const FlexboxAxisTracker& aAxisTracker);
|
||||
|
|
|
@ -1537,9 +1537,9 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
{
|
||||
RefPtr<ClientLayerManager> lm = aBuilder->GetWidgetLayerManager()->AsClientLayerManager();
|
||||
if (!mDidCompositeObserver || !mDidCompositeObserver->IsValid(lm)) {
|
||||
mDidCompositeObserver = new PluginFrameDidCompositeObserver(mInstanceOwner, lm);
|
||||
mDidCompositeObserver = MakeUnique<PluginFrameDidCompositeObserver>(mInstanceOwner, lm);
|
||||
}
|
||||
lm->AddDidCompositeObserver(mDidCompositeObserver);
|
||||
lm->AddDidCompositeObserver(mDidCompositeObserver.get());
|
||||
}
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
} else if (aItem->GetType() == nsDisplayItem::TYPE_PLUGIN_VIDEO) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsRegion.h"
|
||||
|
@ -336,7 +336,7 @@ private:
|
|||
// updates.
|
||||
RefPtr<nsRootPresContext> mRootPresContextRegisteredWith;
|
||||
|
||||
nsAutoPtr<PluginFrameDidCompositeObserver> mDidCompositeObserver;
|
||||
mozilla::UniquePtr<PluginFrameDidCompositeObserver> mDidCompositeObserver;
|
||||
|
||||
// Tracks windowed plugin visibility during scroll operations. See
|
||||
// SetScrollVisibility.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
@ -71,12 +72,12 @@
|
|||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
#endif
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
|
||||
|
@ -195,7 +196,7 @@ private:
|
|||
* list when the frame is deleted, unregistering the observers.
|
||||
*/
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(TextFrameGlyphObservers,
|
||||
nsTArray<nsAutoPtr<GlyphObserver>>)
|
||||
nsTArray<UniquePtr<GlyphObserver>>)
|
||||
|
||||
static const nsFrameState TEXT_REFLOW_FLAGS =
|
||||
TEXT_FIRST_LETTER |
|
||||
|
@ -738,8 +739,8 @@ CreateObserverForAnimatedGlyphs(nsTextFrame* aFrame, const nsTArray<gfxFont*>& a
|
|||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsAutoPtr<GlyphObserver> >* observers =
|
||||
new nsTArray<nsAutoPtr<GlyphObserver> >();
|
||||
nsTArray<UniquePtr<GlyphObserver>>* observers =
|
||||
new nsTArray<UniquePtr<GlyphObserver>>();
|
||||
for (uint32_t i = 0, count = aFonts.Length(); i < count; ++i) {
|
||||
observers->AppendElement(new GlyphObserver(aFonts[i], aFrame));
|
||||
}
|
||||
|
@ -955,7 +956,7 @@ public:
|
|||
private:
|
||||
AutoTArray<MappedFlow,10> mMappedFlows;
|
||||
AutoTArray<nsTextFrame*,50> mLineBreakBeforeFrames;
|
||||
AutoTArray<nsAutoPtr<BreakSink>,10> mBreakSinks;
|
||||
AutoTArray<UniquePtr<BreakSink>,10> mBreakSinks;
|
||||
AutoTArray<UniquePtr<gfxTextRun>,5> mTextRunsToDelete;
|
||||
nsLineBreaker mLineBreaker;
|
||||
gfxTextRun* mCurrentFramesAllSameTextRun;
|
||||
|
@ -2114,15 +2115,15 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
}
|
||||
|
||||
// Setup factory chain
|
||||
nsAutoPtr<nsTransformingTextRunFactory> transformingFactory;
|
||||
UniquePtr<nsTransformingTextRunFactory> transformingFactory;
|
||||
if (anyTextTransformStyle) {
|
||||
transformingFactory =
|
||||
new nsCaseTransformTextRunFactory(transformingFactory.forget());
|
||||
MakeUnique<nsCaseTransformTextRunFactory>(Move(transformingFactory));
|
||||
}
|
||||
if (anyMathMLStyling) {
|
||||
transformingFactory =
|
||||
new MathMLTextRunFactory(transformingFactory.forget(), mathFlags,
|
||||
sstyScriptLevel, fontInflation);
|
||||
MakeUnique<MathMLTextRunFactory>(Move(transformingFactory), mathFlags,
|
||||
sstyScriptLevel, fontInflation);
|
||||
}
|
||||
nsTArray<RefPtr<nsTransformedCharStyle>> styles;
|
||||
if (transformingFactory) {
|
||||
|
@ -2172,7 +2173,9 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
Move(styles), true);
|
||||
if (textRun) {
|
||||
// ownership of the factory has passed to the textrun
|
||||
transformingFactory.forget();
|
||||
// TODO: bug 1285316: clean up ownership transfer from the factory to
|
||||
// the textrun
|
||||
Unused << transformingFactory.release();
|
||||
}
|
||||
} else {
|
||||
textRun = fontGroup->MakeTextRun(text, transformedLength, ¶ms,
|
||||
|
@ -2187,7 +2190,9 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
|||
Move(styles), true);
|
||||
if (textRun) {
|
||||
// ownership of the factory has passed to the textrun
|
||||
transformingFactory.forget();
|
||||
// TODO: bug 1285316: clean up ownership transfer from the factory to
|
||||
// the textrun
|
||||
Unused << transformingFactory.release();
|
||||
}
|
||||
} else {
|
||||
textRun = fontGroup->MakeTextRun(text, transformedLength, ¶ms,
|
||||
|
@ -2389,8 +2394,8 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
|||
iterNext.AdvanceOriginal(mappedFlow->GetContentEnd() -
|
||||
mappedFlow->mStartFrame->GetContentOffset());
|
||||
|
||||
nsAutoPtr<BreakSink>* breakSink =
|
||||
mBreakSinks.AppendElement(new BreakSink(aTextRun, mDrawTarget, offset));
|
||||
UniquePtr<BreakSink>* breakSink =
|
||||
mBreakSinks.AppendElement(MakeUnique<BreakSink>(aTextRun, mDrawTarget, offset));
|
||||
if (!breakSink || !*breakSink)
|
||||
return;
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "gfxTextRun.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleContext.h"
|
||||
|
||||
class nsTransformedTextRun;
|
||||
|
@ -78,9 +78,9 @@ public:
|
|||
// via the fontgroup.
|
||||
|
||||
// Takes ownership of aInnerTransformTextRunFactory
|
||||
explicit nsCaseTransformTextRunFactory(nsTransformingTextRunFactory* aInnerTransformingTextRunFactory,
|
||||
explicit nsCaseTransformTextRunFactory(UniquePtr<nsTransformingTextRunFactory> aInnerTransformingTextRunFactory,
|
||||
bool aAllUppercase = false)
|
||||
: mInnerTransformingTextRunFactory(aInnerTransformingTextRunFactory),
|
||||
: mInnerTransformingTextRunFactory(Move(aInnerTransformingTextRunFactory)),
|
||||
mAllUppercase(aAllUppercase) {}
|
||||
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun,
|
||||
|
@ -108,8 +108,8 @@ public:
|
|||
nsTArray<RefPtr<nsTransformedCharStyle>>* aStyleArray = nullptr);
|
||||
|
||||
protected:
|
||||
nsAutoPtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
|
||||
bool mAllUppercase;
|
||||
mozilla::UniquePtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
|
||||
bool mAllUppercase;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче