Issue #2828 - Part 13: Exclude strong layers-related code from release builds

I'll be leaving this in here for future use. CSSWG hasn't defined how this will be exposed to CSSOM yet. The parser bits are also not yet implemented.
This commit is contained in:
Francis Dominic Fajardo 2025-07-22 14:31:47 +08:00 committed by roytam1
commit 318031c74b
2 changed files with 10 additions and 0 deletions

View file

@ -1622,7 +1622,9 @@ CascadeLayer::CascadeLayer(nsPresContext* aPresContext,
nsMediaQueryResultCacheKey& aCacheKey)
: mPresContext(aPresContext)
, mIsAnonymous(true)
#ifdef DEBUG
, mIsStrong(false)
#endif
, mRulesAdded(false)
#ifdef DEBUG
, mParent(aParent)
@ -1655,7 +1657,9 @@ CascadeLayer::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
// don't count them. Their ownership is managed by the rule processor
// to which they are eventually attached (see nsCSSRuleProcessor).
n += mPreLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
#ifdef DEBUG
n += mPostLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
#endif
n += mLayers.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = mLayers.ConstIter(); !iter.Done(); iter.Next()) {
// We don't own the CascadeLayer objects so we don't count them. We
@ -1779,9 +1783,11 @@ CascadeLayer::EnumerateAllLayers(nsLayerEnumFunc aFunc, void* aData)
(*aFunc)(this, aData);
#ifdef DEBUG
if (mPostLayers.Length() > 0) {
for (CascadeLayer* post : mPostLayers) {
post->EnumerateAllLayers(aFunc, aData);
}
}
#endif
}

View file

@ -341,7 +341,9 @@ struct CascadeLayer
nsPresContext* mPresContext;
nsString mName;
bool mIsAnonymous;
#ifdef DEBUG
bool mIsStrong;
#endif
bool mRulesAdded;
RuleCascadeData* mData;
@ -357,7 +359,9 @@ struct CascadeLayer
CascadeLayer* mParent;
#endif
nsTArray<CascadeLayer*> mPreLayers;
#ifdef DEBUG
nsTArray<CascadeLayer*> mPostLayers;
#endif
nsDataHashtable<nsStringHashKey, CascadeLayer*> mLayers;
CascadeLayer* CreateNamedChildLayer(const nsTArray<nsString>& aPath);