mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
Issue #2828 - Part 5: Implement child rule processors
This commit is contained in:
parent
aab9cdf9bd
commit
e05d4d8306
16 changed files with 632 additions and 155 deletions
|
|
@ -1188,6 +1188,13 @@ RuleCascadeData::HasAttributeDependentStyle(
|
|||
AttributeEnumData* aEnumData,
|
||||
mozilla::RestyleHintData& aRestyleHintDataResult)
|
||||
{
|
||||
// Since we get both before and after notifications for attributes, we
|
||||
// don't have to ignore aData->mAttribute while matching. Just check
|
||||
// whether we have selectors relevant to aData->mAttribute that we
|
||||
// match. If this is the before change notification, that will catch
|
||||
// rules we might stop matching; if the after change notification, the
|
||||
// ones we might have started matching.
|
||||
|
||||
if (aData->mAttribute == nsGkAtoms::id) {
|
||||
nsIAtom* id = aData->mElement->GetID();
|
||||
if (id) {
|
||||
|
|
@ -1475,10 +1482,10 @@ size_t
|
|||
ResolvedRuleCascades::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mOrderedData.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (RuleCascadeData* data : mOrderedData) {
|
||||
n += data->SizeOfIncludingThis(aMallocSizeOf);
|
||||
for (uint32_t i = 0; i < mProcessors.Length(); i++) {
|
||||
n += mProcessors[i]->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
n += mProcessors.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -1553,7 +1560,6 @@ CascadeEnumData::CascadeEnumData(nsPresContext* aPresContext,
|
|||
#ifdef DEBUG
|
||||
CascadeEnumData* aParent,
|
||||
#endif
|
||||
nsAutoPtr<ResolvedRuleCascades>& aContainer,
|
||||
bool aIsWeak,
|
||||
nsTArray<css::DocumentRule*>& aDocumentRules,
|
||||
nsDocumentRuleResultCacheKey& aDocumentKey,
|
||||
|
|
@ -1569,7 +1575,6 @@ CascadeEnumData::CascadeEnumData(nsPresContext* aPresContext,
|
|||
, mParent(aParent)
|
||||
, mIsRoot(false)
|
||||
#endif
|
||||
, mContainer(aContainer)
|
||||
, mDocumentRules(aDocumentRules)
|
||||
, mDocumentCacheKey(aDocumentKey)
|
||||
, mSheetType(aSheetType)
|
||||
|
|
@ -1581,14 +1586,12 @@ CascadeEnumData::CascadeEnumData(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
CascadeEnumData::CascadeEnumData(nsPresContext* aPresContext,
|
||||
nsAutoPtr<ResolvedRuleCascades>& aContainer,
|
||||
nsTArray<css::DocumentRule*>& aDocumentRules,
|
||||
nsDocumentRuleResultCacheKey& aDocumentKey,
|
||||
SheetType aSheetType,
|
||||
bool aMustGatherDocumentRules,
|
||||
nsMediaQueryResultCacheKey& aCacheKey)
|
||||
: mPresContext(aPresContext)
|
||||
, mContainer(aContainer)
|
||||
, mIsAnonymous(false)
|
||||
, mIsWeak(false)
|
||||
, mWasFlattened(false)
|
||||
|
|
@ -1608,6 +1611,7 @@ CascadeEnumData::CascadeEnumData(nsPresContext* aPresContext,
|
|||
|
||||
CascadeEnumData::~CascadeEnumData()
|
||||
{
|
||||
delete mData;
|
||||
PL_FinishArenaPool(&mArena);
|
||||
}
|
||||
|
||||
|
|
@ -1628,7 +1632,6 @@ CascadeEnumData::CreateNamedChildLayer(const nsTArray<nsString>& aPath)
|
|||
#ifdef DEBUG
|
||||
this,
|
||||
#endif
|
||||
mContainer,
|
||||
false,
|
||||
mDocumentRules,
|
||||
mDocumentCacheKey,
|
||||
|
|
@ -1659,7 +1662,6 @@ CascadeEnumData::CreateAnonymousChildLayer()
|
|||
#ifdef DEBUG
|
||||
this,
|
||||
#endif
|
||||
mContainer,
|
||||
false,
|
||||
mDocumentRules,
|
||||
mDocumentCacheKey,
|
||||
|
|
@ -1751,7 +1753,7 @@ CascadeEnumData::AddRules()
|
|||
}
|
||||
|
||||
void
|
||||
CascadeEnumData::Flatten()
|
||||
CascadeEnumData::EnumerateAllLayers(nsLayerEnumFunc aFunc, void* aData)
|
||||
{
|
||||
if (mWasFlattened) {
|
||||
return;
|
||||
|
|
@ -1759,16 +1761,15 @@ CascadeEnumData::Flatten()
|
|||
|
||||
if (mPreLayers.Length() > 0) {
|
||||
for (CascadeEnumData* pre : mPreLayers) {
|
||||
pre->Flatten();
|
||||
pre->EnumerateAllLayers(aFunc, aData);
|
||||
}
|
||||
}
|
||||
|
||||
mContainer->mOrderedData.AppendElement(mData);
|
||||
AddRules();
|
||||
(*aFunc)(this, aData);
|
||||
|
||||
if (mPostLayers.Length() > 0) {
|
||||
for (CascadeEnumData* post : mPostLayers) {
|
||||
post->Flatten();
|
||||
post->EnumerateAllLayers(aFunc, aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue