Bug 1843848. Add some diagnostic asserts related to ASRs. r=mstange

Depends on D183742

Differential Revision: https://phabricator.services.mozilla.com/D183743
This commit is contained in:
Timothy Nikkel 2023-07-21 01:29:47 +00:00
Родитель 5267cbd117
Коммит a8658cf650
4 изменённых файлов: 11 добавлений и 5 удалений

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

@ -400,6 +400,9 @@ Maybe<wr::WrClipChainId> ClipManager::DefineClipChain(
// in WR, and put their IDs into |clipIds|.
for (const DisplayItemClipChain* chain = aChain; chain;
chain = chain->mParent) {
MOZ_DIAGNOSTIC_ASSERT(chain->mOnStack || !chain->mASR ||
chain->mASR->mScrollableFrame);
if (!chain->mClip.HasClip()) {
// This item in the chain is a no-op, skip over it
continue;

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

@ -69,7 +69,7 @@ struct DisplayItemClipChain {
mASR(aASR),
mParent(aParent),
mNextClipChainToDestroy(aNextClipChainToDestroy)
#ifdef DEBUG
#if defined(DEBUG) || defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
,
mOnStack(true)
#endif
@ -79,7 +79,7 @@ struct DisplayItemClipChain {
DisplayItemClipChain()
: mASR(nullptr),
mNextClipChainToDestroy(nullptr)
#ifdef DEBUG
#if defined(DEBUG) || defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
,
mOnStack(true)
#endif
@ -91,7 +91,7 @@ struct DisplayItemClipChain {
RefPtr<const DisplayItemClipChain> mParent;
uint32_t mRefCount = 0;
DisplayItemClipChain* mNextClipChainToDestroy;
#ifdef DEBUG
#if defined(DEBUG) || defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
bool mOnStack;
#endif
};

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

@ -362,6 +362,9 @@ static Maybe<const ActiveScrolledRoot*> SelectContainerASR(
const ActiveScrolledRoot* itemClipASR =
aClipChain ? aClipChain->mASR : nullptr;
MOZ_DIAGNOSTIC_ASSERT(!aClipChain || aClipChain->mOnStack || !itemClipASR ||
itemClipASR->mScrollableFrame);
const ActiveScrolledRoot* finiteBoundsASR =
ActiveScrolledRoot::PickDescendant(itemClipASR, aItemASR);

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

@ -1428,12 +1428,12 @@ ActiveScrolledRoot* nsDisplayListBuilder::AllocateActiveScrolledRoot(
const DisplayItemClipChain* nsDisplayListBuilder::AllocateDisplayItemClipChain(
const DisplayItemClip& aClip, const ActiveScrolledRoot* aASR,
const DisplayItemClipChain* aParent) {
MOZ_ASSERT(!(aParent && aParent->mOnStack));
MOZ_DIAGNOSTIC_ASSERT(!(aParent && aParent->mOnStack));
void* p = Allocate(sizeof(DisplayItemClipChain),
DisplayListArenaObjectId::CLIPCHAIN);
DisplayItemClipChain* c = new (KnownNotNull, p)
DisplayItemClipChain(aClip, aASR, aParent, mFirstClipChainToDestroy);
#ifdef DEBUG
#if defined(DEBUG) || defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
c->mOnStack = false;
#endif
auto result = mClipDeduplicator.insert(c);