mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1406727. r=froydnj
This commit is contained in:
parent
ba94f2d107
commit
aab0cbe92c
@ -227,7 +227,6 @@ struct RangePaintInfo {
|
||||
RangePaintInfo(nsRange* aRange, nsIFrame* aFrame)
|
||||
: mRange(aRange)
|
||||
, mBuilder(aFrame, nsDisplayListBuilderMode::PAINTING, false)
|
||||
, mList(&mBuilder)
|
||||
{
|
||||
MOZ_COUNT_CTOR(RangePaintInfo);
|
||||
mBuilder.BeginFrame();
|
||||
@ -4794,7 +4793,7 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
|
||||
// part of the selection. Then, append the wrapper to the top of the list.
|
||||
// Otherwise, just delete the item and don't append it.
|
||||
nsRect surfaceRect;
|
||||
nsDisplayList tmpList(aBuilder);
|
||||
nsDisplayList tmpList;
|
||||
|
||||
nsDisplayItem* i;
|
||||
while ((i = aList->RemoveBottom())) {
|
||||
|
@ -3020,7 +3020,7 @@ nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame,
|
||||
nsDisplayListBuilderMode::TRANSFORM_COMPUTATION,
|
||||
false/*don't build caret*/);
|
||||
builder.BeginFrame();
|
||||
nsDisplayList list(&builder);
|
||||
nsDisplayList list;
|
||||
nsDisplayTransform* item =
|
||||
new (&builder) nsDisplayTransform(&builder, aFrame, &list, nsRect());
|
||||
|
||||
@ -3303,7 +3303,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
|
||||
nsDisplayListBuilderMode::EVENT_DELIVERY,
|
||||
false);
|
||||
builder.BeginFrame();
|
||||
nsDisplayList list(&builder);
|
||||
nsDisplayList list;
|
||||
|
||||
if (aFlags & IGNORE_PAINT_SUPPRESSION) {
|
||||
builder.IgnorePaintSuppression();
|
||||
@ -3684,7 +3684,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
|
||||
} else {
|
||||
nonRetainedBuilder.emplace(aFrame, aBuilderMode, buildCaret);
|
||||
builderPtr = nonRetainedBuilder.ptr();
|
||||
nonRetainedList.emplace(builderPtr);
|
||||
nonRetainedList.emplace();
|
||||
listPtr = nonRetainedList.ptr();
|
||||
}
|
||||
nsDisplayListBuilder& builder = *builderPtr;
|
||||
@ -3863,6 +3863,8 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
builder.Check();
|
||||
|
||||
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_BUILD_DISPLAYLIST_TIME,
|
||||
startBuildDisplayList);
|
||||
|
||||
@ -3942,6 +3944,8 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
|
||||
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_RASTERIZE_TIME,
|
||||
paintStart);
|
||||
|
||||
builder.Check();
|
||||
|
||||
if (gfxPrefs::GfxLoggingPaintedPixelCountEnabled()) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
float rasterizeTime = (now - paintStart).ToMilliseconds();
|
||||
@ -4047,6 +4051,8 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
builder.Check();
|
||||
|
||||
{
|
||||
AUTO_PROFILER_TRACING("Paint", "DisplayListResources");
|
||||
|
||||
|
@ -111,8 +111,8 @@ public:
|
||||
void AddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const;
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool DebugContains(void* aPtr) {
|
||||
return mPool.DebugContains(aPtr);
|
||||
void Check() {
|
||||
mPool.Check();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -106,7 +106,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
eventClipState->ClipContainingBlockDescendants(rect, hasRadii ? radii : nullptr);
|
||||
}
|
||||
|
||||
nsDisplayList onTop(aBuilder);
|
||||
nsDisplayList onTop;
|
||||
if (IsVisibleForPainting(aBuilder)) {
|
||||
mRenderer.DisplayButton(aBuilder, aLists.BorderBackground(), &onTop);
|
||||
}
|
||||
|
@ -326,7 +326,6 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
|
||||
, mBuilder(aBuilder)
|
||||
, mBlock(aBlockFrame)
|
||||
, mScrollableFrame(nsLayoutUtils::GetScrollableFrameFor(aBlockFrame))
|
||||
, mMarkerList(aBuilder)
|
||||
, mBlockSize(aBlockFrame->GetSize())
|
||||
, mBlockWM(aBlockFrame->GetWritingMode())
|
||||
, mAdjustForPixelSnapping(false)
|
||||
@ -755,7 +754,7 @@ TextOverflow::PruneDisplayListContents(nsDisplayList* aList,
|
||||
const FrameHashtable& aFramesToHide,
|
||||
const LogicalRect& aInsideMarkersArea)
|
||||
{
|
||||
nsDisplayList saved(mBuilder);
|
||||
nsDisplayList saved;
|
||||
nsDisplayItem* item;
|
||||
while ((item = aList->RemoveBottom())) {
|
||||
nsIFrame* itemFrame = item->Frame();
|
||||
|
@ -66,7 +66,7 @@ ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
BuildDisplayListForChild(aBuilder, kid, aLists);
|
||||
}
|
||||
|
||||
nsDisplayList topLayerList(aBuilder);
|
||||
nsDisplayList topLayerList;
|
||||
BuildDisplayListForTopLayer(aBuilder, &topLayerList);
|
||||
if (!topLayerList.IsEmpty()) {
|
||||
// Wrap the whole top layer in a single item with maximum z-index,
|
||||
@ -130,7 +130,7 @@ BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
|
||||
buildingForChild(aBuilder, aFrame, visible, dirty,
|
||||
aBuilder->IsAtRootOfPseudoStackingContext());
|
||||
|
||||
nsDisplayList list(aBuilder);
|
||||
nsDisplayList list;
|
||||
aFrame->BuildDisplayListForStackingContext(aBuilder, &list);
|
||||
aList->AppendToTop(&list);
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
|
||||
|
||||
const ActiveScrolledRoot* thisItemASR = asr;
|
||||
nsDisplayList thisItemList(aBuilder);
|
||||
nsDisplayList thisItemList;
|
||||
nsDisplayBackgroundImage::InitData bgData =
|
||||
nsDisplayBackgroundImage::GetInitData(aBuilder, this, i, bgRect, bg,
|
||||
nsDisplayBackgroundImage::LayerizeFixed::ALWAYS_LAYERIZE_FIXED_BACKGROUND);
|
||||
|
@ -2828,7 +2828,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
bool usingSVGEffects = usingFilter || usingMask;
|
||||
|
||||
nsRect visibleRectOutsideSVGEffects = visibleRect;
|
||||
nsDisplayList hoistedScrollInfoItemsStorage(aBuilder);
|
||||
nsDisplayList hoistedScrollInfoItemsStorage;
|
||||
if (usingSVGEffects) {
|
||||
dirtyRect =
|
||||
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
|
||||
@ -3049,7 +3049,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
// element itself.
|
||||
set.PositionedDescendants()->SortByZOrder();
|
||||
|
||||
nsDisplayList resultList(aBuilder);
|
||||
nsDisplayList resultList;
|
||||
// Now follow the rules of http://www.w3.org/TR/CSS21/zindex.html
|
||||
// 1,2: backgrounds and borders
|
||||
resultList.AppendToTop(set.BorderBackground());
|
||||
@ -3200,8 +3200,8 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
if (isTransformed && extend3DContext) {
|
||||
// Install dummy nsDisplayTransform as a leaf containing
|
||||
// descendants not participating this 3D rendering context.
|
||||
nsDisplayList nonparticipants(aBuilder);
|
||||
nsDisplayList participants(aBuilder);
|
||||
nsDisplayList nonparticipants;
|
||||
nsDisplayList participants;
|
||||
int index = 1;
|
||||
|
||||
while (nsDisplayItem* item = resultList.RemoveBottom()) {
|
||||
@ -3638,8 +3638,8 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
||||
awayFromCommonPath = true;
|
||||
}
|
||||
|
||||
nsDisplayList list(aBuilder);
|
||||
nsDisplayList extraPositionedDescendants(aBuilder);
|
||||
nsDisplayList list;
|
||||
nsDisplayList extraPositionedDescendants;
|
||||
const ActiveScrolledRoot* wrapListASR = aBuilder->CurrentActiveScrolledRoot();
|
||||
bool canSkipWrapList = false;
|
||||
if (isStackingContext) {
|
||||
|
@ -407,7 +407,7 @@ PruneDisplayListForExtraPage(nsDisplayListBuilder* aBuilder,
|
||||
nsPageFrame* aPage, nsIFrame* aExtraPage,
|
||||
nsDisplayList* aList)
|
||||
{
|
||||
nsDisplayList newList(aBuilder);
|
||||
nsDisplayList newList;
|
||||
|
||||
while (true) {
|
||||
nsDisplayItem* i = aList->RemoveBottom();
|
||||
@ -443,7 +443,7 @@ BuildDisplayListForExtraPage(nsDisplayListBuilder* aBuilder,
|
||||
if (!aExtraPage->HasAnyStateBits(NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
|
||||
return;
|
||||
}
|
||||
nsDisplayList list(aBuilder);
|
||||
nsDisplayList list;
|
||||
aExtraPage->BuildDisplayListForStackingContext(aBuilder, &list);
|
||||
PruneDisplayListForExtraPage(aBuilder, aPage, aExtraPage, &list);
|
||||
aList->AppendToTop(&list);
|
||||
@ -538,7 +538,7 @@ nsPageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
clipRect += aBuilder->ToReferenceFrame(child);
|
||||
|
||||
nsDisplayList content(aBuilder);
|
||||
nsDisplayList content;
|
||||
{
|
||||
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
|
||||
|
||||
|
@ -830,7 +830,7 @@ nsSimplePageSequenceFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
{
|
||||
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
||||
|
||||
nsDisplayList content(aBuilder);
|
||||
nsDisplayList content;
|
||||
|
||||
{
|
||||
// Clear clip state while we construct the children of the
|
||||
|
@ -312,11 +312,11 @@ WrapBackgroundColorInOwnLayer(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList)
|
||||
{
|
||||
nsDisplayList tempItems(aBuilder);
|
||||
nsDisplayList tempItems;
|
||||
nsDisplayItem* item;
|
||||
while ((item = aList->RemoveBottom()) != nullptr) {
|
||||
if (item->GetType() == DisplayItemType::TYPE_BACKGROUND_COLOR) {
|
||||
nsDisplayList tmpList(aBuilder);
|
||||
nsDisplayList tmpList;
|
||||
tmpList.AppendToTop(item);
|
||||
item = new (aBuilder) nsDisplayOwnLayer(aBuilder, aFrame, &tmpList, aBuilder->CurrentActiveScrolledRoot());
|
||||
}
|
||||
@ -472,7 +472,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
mPreviousCaret = aBuilder->GetCaretFrame();
|
||||
}
|
||||
|
||||
nsDisplayList childItems(aBuilder);
|
||||
nsDisplayList childItems;
|
||||
|
||||
{
|
||||
DisplayListClipState::AutoSaveRestore nestedClipState(aBuilder);
|
||||
|
@ -86,7 +86,7 @@ void
|
||||
RetainedDisplayListBuilder::PreProcessDisplayList(nsDisplayList* aList,
|
||||
AnimatedGeometryRoot* aAGR)
|
||||
{
|
||||
nsDisplayList saved(&mBuilder);
|
||||
nsDisplayList saved;
|
||||
while (nsDisplayItem* i = aList->RemoveBottom()) {
|
||||
if (i->HasDeletedFrame() || !i->CanBeReused()) {
|
||||
i->Destroy(&mBuilder);
|
||||
@ -353,7 +353,7 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
||||
nsDisplayList* aOutList,
|
||||
Maybe<const ActiveScrolledRoot*>& aOutContainerASR)
|
||||
{
|
||||
nsDisplayList merged(&mBuilder);
|
||||
nsDisplayList merged;
|
||||
const auto UseItem = [&](nsDisplayItem* aItem) {
|
||||
const ActiveScrolledRoot* itemClipASR =
|
||||
aItem->GetClipChain() ? aItem->GetClipChain()->mASR : nullptr;
|
||||
@ -433,7 +433,7 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
||||
// Recurse into the child list (without a matching new list) to
|
||||
// ensure that we find and remove any invalidated items.
|
||||
if (old->GetChildren()) {
|
||||
nsDisplayList empty(&mBuilder);
|
||||
nsDisplayList empty;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
MergeDisplayLists(&empty, old->GetChildren(),
|
||||
old->GetChildren(), containerASRForChildren);
|
||||
@ -490,7 +490,7 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
|
||||
// with modified or deleted children will be correctly handled.
|
||||
// Passing an empty new display list as an argument skips the merging
|
||||
// loop above and jumps back here.
|
||||
nsDisplayList empty(&mBuilder);
|
||||
nsDisplayList empty;
|
||||
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
|
||||
|
||||
MergeDisplayLists(&empty, old->GetChildren(),
|
||||
@ -822,7 +822,7 @@ RetainedDisplayListBuilder::AttemptPartialUpdate(nscolor aBackstop)
|
||||
|
||||
PreProcessDisplayList(&mList, modifiedAGR);
|
||||
|
||||
nsDisplayList modifiedDL(&mBuilder);
|
||||
nsDisplayList modifiedDL;
|
||||
if (!modifiedDirty.IsEmpty() || !framesWithProps.IsEmpty()) {
|
||||
mBuilder.SetDirtyRect(modifiedDirty);
|
||||
mBuilder.SetPartialUpdate(true);
|
||||
|
@ -15,7 +15,6 @@ struct RetainedDisplayListBuilder {
|
||||
nsDisplayListBuilderMode aMode,
|
||||
bool aBuildCaret)
|
||||
: mBuilder(aReferenceFrame, aMode, aBuildCaret, true)
|
||||
, mList(&mBuilder)
|
||||
{}
|
||||
~RetainedDisplayListBuilder()
|
||||
{
|
||||
|
@ -2611,7 +2611,6 @@ nsDisplayItem* nsDisplayList::RemoveBottom() {
|
||||
nsDisplayItem* item = mSentinel.mAbove;
|
||||
if (!item)
|
||||
return nullptr;
|
||||
MOZ_DIAGNOSTIC_ASSERT(item->mSentinel == 0xDEADBEEFDEADBEEF);
|
||||
mSentinel.mAbove = item->mAbove;
|
||||
if (item == mTop) {
|
||||
// must have been the only item
|
||||
@ -2623,10 +2622,8 @@ nsDisplayItem* nsDisplayList::RemoveBottom() {
|
||||
}
|
||||
|
||||
void nsDisplayList::DeleteAll(nsDisplayListBuilder* aBuilder) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBuilder == mBuilder);
|
||||
nsDisplayItem* item;
|
||||
while ((item = RemoveBottom()) != nullptr) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aBuilder->DebugContains(item));
|
||||
item->Destroy(aBuilder);
|
||||
}
|
||||
}
|
||||
@ -3515,7 +3512,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
||||
// An auxiliary list is necessary in case we have background blending; if that
|
||||
// is the case, background items need to be wrapped by a blend container to
|
||||
// isolate blending to the background
|
||||
nsDisplayList bgItemList(aBuilder);
|
||||
nsDisplayList bgItemList;
|
||||
// Even if we don't actually have a background color to paint, we may still need
|
||||
// to create an item for hit testing.
|
||||
if ((drawBackgroundColor && color != NS_RGBA(0,0,0,0)) ||
|
||||
@ -3605,7 +3602,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
||||
layer, bgRect, willPaintBorder);
|
||||
}
|
||||
|
||||
nsDisplayList thisItemList(aBuilder);
|
||||
nsDisplayList thisItemList;
|
||||
nsDisplayBackgroundImage::InitData bgData =
|
||||
nsDisplayBackgroundImage::GetInitData(aBuilder, aFrame, i, bgOriginRect, bg,
|
||||
LayerizeFixed::DO_NOT_LAYERIZE_FIXED_BACKGROUND_IF_AVOIDING_COMPONENT_ALPHA_LAYERS);
|
||||
@ -5922,7 +5919,6 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aClearClipChain)
|
||||
: nsDisplayItem(aBuilder, aFrame, aActiveScrolledRoot)
|
||||
, mList(aBuilder)
|
||||
, mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot())
|
||||
, mOverrideZIndex(0)
|
||||
, mHasZIndexOverride(false)
|
||||
@ -5966,7 +5962,6 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, nsDisplayItem* aItem)
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
, mList(aBuilder)
|
||||
, mOverrideZIndex(0)
|
||||
, mHasZIndexOverride(false)
|
||||
{
|
||||
@ -6185,7 +6180,7 @@ WrapDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
static nsresult
|
||||
WrapEachDisplayItem(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayList* aList, nsDisplayWrapper* aWrapper) {
|
||||
nsDisplayList newList(aBuilder);
|
||||
nsDisplayList newList;
|
||||
nsDisplayItem* item;
|
||||
while ((item = aList->RemoveBottom())) {
|
||||
item = aWrapper->WrapItem(aBuilder, item);
|
||||
@ -7075,7 +7070,7 @@ nsDisplayFixedPosition::CreateForFixedBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayBackgroundImage* aImage,
|
||||
uint32_t aIndex)
|
||||
{
|
||||
nsDisplayList temp(aBuilder);
|
||||
nsDisplayList temp;
|
||||
temp.AppendToTop(aImage);
|
||||
|
||||
return new (aBuilder) nsDisplayFixedPosition(aBuilder, aFrame, &temp, aIndex + 1);
|
||||
@ -7188,7 +7183,7 @@ nsDisplayTableFixedPosition::CreateForFixedBackground(nsDisplayListBuilder* aBui
|
||||
uint32_t aIndex,
|
||||
nsIFrame* aAncestorFrame)
|
||||
{
|
||||
nsDisplayList temp(aBuilder);
|
||||
nsDisplayList temp;
|
||||
temp.AppendToTop(aImage);
|
||||
|
||||
return new (aBuilder) nsDisplayTableFixedPosition(aBuilder, aFrame, &temp, aIndex + 1, aAncestorFrame);
|
||||
|
@ -674,11 +674,11 @@ public:
|
||||
|
||||
void RecomputeCurrentAnimatedGeometryRoot();
|
||||
|
||||
void Check() {
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool DebugContains(void* aPtr) {
|
||||
return mPool.DebugContains(aPtr);
|
||||
}
|
||||
mPool.Check();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if merging and flattening of display lists should be
|
||||
@ -1832,7 +1832,6 @@ class nsDisplayItemLink {
|
||||
protected:
|
||||
nsDisplayItemLink() : mAbove(nullptr) {}
|
||||
nsDisplayItemLink(const nsDisplayItemLink&) : mAbove(nullptr) {}
|
||||
uint64_t mSentinel = 0xDEADBEEFDEADBEEF;
|
||||
nsDisplayItem* mAbove;
|
||||
|
||||
friend class nsDisplayList;
|
||||
@ -2706,9 +2705,8 @@ public:
|
||||
/**
|
||||
* Create an empty list.
|
||||
*/
|
||||
explicit nsDisplayList(nsDisplayListBuilder* aBuilder)
|
||||
: mBuilder(aBuilder)
|
||||
, mLength(0)
|
||||
nsDisplayList()
|
||||
: mLength(0)
|
||||
, mIsOpaque(false)
|
||||
, mForceTransparentSurface(false)
|
||||
{
|
||||
@ -2728,7 +2726,6 @@ public:
|
||||
void AppendToTop(nsDisplayItem* aItem) {
|
||||
NS_ASSERTION(aItem, "No item to append!");
|
||||
NS_ASSERTION(!aItem->mAbove, "Already in a list!");
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBuilder->DebugContains(aItem));
|
||||
mTop->mAbove = aItem;
|
||||
mTop = aItem;
|
||||
mLength++;
|
||||
@ -2761,7 +2758,6 @@ public:
|
||||
void AppendToBottom(nsDisplayItem* aItem) {
|
||||
NS_ASSERTION(aItem, "No item to append!");
|
||||
NS_ASSERTION(!aItem->mAbove, "Already in a list!");
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBuilder->DebugContains(aItem));
|
||||
aItem->mAbove = mSentinel.mAbove;
|
||||
mSentinel.mAbove = aItem;
|
||||
if (mTop == &mSentinel) {
|
||||
@ -2774,7 +2770,6 @@ public:
|
||||
* Removes all items from aList and appends them to the top of this list
|
||||
*/
|
||||
void AppendToTop(nsDisplayList* aList) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBuilder == aList->mBuilder);
|
||||
if (aList->mSentinel.mAbove) {
|
||||
mTop->mAbove = aList->mSentinel.mAbove;
|
||||
mTop = aList->mTop;
|
||||
@ -2789,7 +2784,6 @@ public:
|
||||
* Removes all items from aList and prepends them to the bottom of this list
|
||||
*/
|
||||
void AppendToBottom(nsDisplayList* aList) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mBuilder == aList->mBuilder);
|
||||
if (aList->mSentinel.mAbove) {
|
||||
aList->mTop->mAbove = mSentinel.mAbove;
|
||||
mSentinel.mAbove = aList->mSentinel.mAbove;
|
||||
@ -3003,8 +2997,6 @@ public:
|
||||
mForceTransparentSurface = true;
|
||||
}
|
||||
|
||||
nsDisplayListBuilder* mBuilder;
|
||||
|
||||
void RestoreState() {
|
||||
mIsOpaque = false;
|
||||
mForceTransparentSurface = false;
|
||||
@ -3129,24 +3121,10 @@ protected:
|
||||
struct nsDisplayListCollection : public nsDisplayListSet {
|
||||
explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder) :
|
||||
nsDisplayListSet(&mLists[0], &mLists[1], &mLists[2], &mLists[3], &mLists[4],
|
||||
&mLists[5]),
|
||||
mLists{ nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder) }
|
||||
{}
|
||||
&mLists[5]) {}
|
||||
explicit nsDisplayListCollection(nsDisplayListBuilder* aBuilder, nsDisplayList* aBorderBackground) :
|
||||
nsDisplayListSet(aBorderBackground, &mLists[1], &mLists[2], &mLists[3], &mLists[4],
|
||||
&mLists[5]),
|
||||
mLists{ nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder),
|
||||
nsDisplayList(aBuilder) }
|
||||
{}
|
||||
&mLists[5]) {}
|
||||
|
||||
/**
|
||||
* Sort all lists by content order.
|
||||
@ -4573,7 +4551,6 @@ public:
|
||||
nsDisplayItem* aItem);
|
||||
nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
, mList(aBuilder)
|
||||
, mFrameActiveScrolledRoot(aBuilder->CurrentActiveScrolledRoot())
|
||||
, mOverrideZIndex(0)
|
||||
, mHasZIndexOverride(false)
|
||||
@ -4590,7 +4567,6 @@ public:
|
||||
nsDisplayWrapList(const nsDisplayWrapList& aOther) = delete;
|
||||
nsDisplayWrapList(nsDisplayListBuilder* aBuilder, const nsDisplayWrapList& aOther)
|
||||
: nsDisplayItem(aBuilder, aOther)
|
||||
, mList(aOther.mList.mBuilder)
|
||||
, mListPtr(&mList)
|
||||
, mFrameActiveScrolledRoot(aOther.mFrameActiveScrolledRoot)
|
||||
, mMergedFrames(aOther.mMergedFrames)
|
||||
|
@ -783,7 +783,7 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
NS_SVGDisplayListHitTestingEnabled()) ||
|
||||
(!aBuilder->IsForEventDelivery() &&
|
||||
NS_SVGDisplayListPaintingEnabled())) {
|
||||
nsDisplayList newList(aBuilder);
|
||||
nsDisplayList newList;
|
||||
nsDisplayListSet set(&newList, &newList, &newList,
|
||||
&newList, &newList, &newList);
|
||||
BuildDisplayListForNonBlockChildren(aBuilder, set);
|
||||
|
@ -1356,7 +1356,7 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// and merge them into a single Content() list. This can cause us
|
||||
// to violate CSS stacking order, but forceLayer is a magic
|
||||
// XUL-only extension anyway.
|
||||
nsDisplayList masterList(aBuilder);
|
||||
nsDisplayList masterList;
|
||||
masterList.AppendToTop(tempLists.BorderBackground());
|
||||
masterList.AppendToTop(tempLists.BlockBorderBackgrounds());
|
||||
masterList.AppendToTop(tempLists.Floats());
|
||||
|
@ -344,7 +344,7 @@ nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox
|
||||
clip(aBuilder, this, clipFlags);
|
||||
|
||||
nsDisplayList list(aBuilder);
|
||||
nsDisplayList list;
|
||||
list.AppendNewToTop(
|
||||
new (aBuilder) nsDisplayXULImage(aBuilder, this));
|
||||
|
||||
|
@ -446,7 +446,7 @@ nsSliderFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
// This is a bit of a hack. Collect up all descendant display items
|
||||
// and merge them into a single Content() list.
|
||||
nsDisplayList masterList(aBuilder);
|
||||
nsDisplayList masterList;
|
||||
masterList.AppendToTop(tempLists.BorderBackground());
|
||||
masterList.AppendToTop(tempLists.BlockBorderBackgrounds());
|
||||
masterList.AppendToTop(tempLists.Floats());
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/MemoryChecking.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/OperatorNewExtensions.h"
|
||||
#include "mozilla/Poison.h"
|
||||
#include "mozilla/TemplateLib.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
@ -125,20 +126,11 @@ public:
|
||||
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool DebugContains(void* aPtr)
|
||||
void Check()
|
||||
{
|
||||
for (auto arena = mHead.next; arena; arena = arena->next) {
|
||||
if (arena->DebugContains(aPtr)) {
|
||||
return true;
|
||||
}
|
||||
arena->canary.Check();
|
||||
}
|
||||
std::stringstream log;
|
||||
log << "Failed to find pointer " << aPtr << " within arena blocks: ";
|
||||
for (ArenaChunk* arena = mHead.next; arena; arena = arena->next) {
|
||||
log << "(" << reinterpret_cast<uintptr_t>(arena + 1) << ", " << arena->header.offset << "), ";
|
||||
}
|
||||
MOZ_CRASH_UNSAFE_OOL(log.str().c_str());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -165,6 +157,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
CorruptionCanary canary;
|
||||
ArenaHeader header;
|
||||
ArenaChunk* next;
|
||||
|
||||
@ -186,15 +179,6 @@ private:
|
||||
size_t Available() const {
|
||||
return header.tail - header.offset;
|
||||
}
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
bool DebugContains(void* aPtr)
|
||||
{
|
||||
uintptr_t ptr = reinterpret_cast<uintptr_t>(aPtr);
|
||||
return ptr >= reinterpret_cast<uintptr_t>(this + 1) &&
|
||||
ptr < header.offset;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -240,7 +240,7 @@ TEST(ArenaAllocator, Clear)
|
||||
// Tests that the Clear function works as expected. The best proxy for
|
||||
// checking if a clear is successful is to measure the size. If it's empty we
|
||||
// expect the size to be 0.
|
||||
static const size_t kArenaSize = 64;
|
||||
static const size_t kArenaSize = 128;
|
||||
ArenaAllocator<kArenaSize> a;
|
||||
|
||||
// Clearing an empty arena should work.
|
||||
|
Loading…
Reference in New Issue
Block a user