From 318031c74b5ef7809fb01dd3e0c12131e738f76a Mon Sep 17 00:00:00 2001 From: Francis Dominic Fajardo Date: Tue, 22 Jul 2025 14:31:47 +0800 Subject: [PATCH] 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. --- layout/style/RuleCascadeData.cpp | 6 ++++++ layout/style/RuleCascadeData.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/layout/style/RuleCascadeData.cpp b/layout/style/RuleCascadeData.cpp index 3a78e3e84e..7165a3967d 100644 --- a/layout/style/RuleCascadeData.cpp +++ b/layout/style/RuleCascadeData.cpp @@ -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 } diff --git a/layout/style/RuleCascadeData.h b/layout/style/RuleCascadeData.h index 1a8b4efd07..bccb60d577 100644 --- a/layout/style/RuleCascadeData.h +++ b/layout/style/RuleCascadeData.h @@ -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 mPreLayers; +#ifdef DEBUG nsTArray mPostLayers; +#endif nsDataHashtable mLayers; CascadeLayer* CreateNamedChildLayer(const nsTArray& aPath);