mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 23:37:31 +09:00
Iterate the frame property list once to collect which child list properties we have
Look into optimizing out the hashtable lookups from nsContainerFrame
This commit is contained in:
parent
f88da927a6
commit
3829b269ce
2 changed files with 80 additions and 36 deletions
|
|
@ -160,6 +160,11 @@ public:
|
|||
MOZ_ASSERT(mProperties.Length() == 0, "forgot to delete properties");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we have no properties, otherwise return false.
|
||||
*/
|
||||
bool IsEmpty() const { return mProperties.IsEmpty(); }
|
||||
|
||||
/**
|
||||
* Set a property value. This requires a linear search through
|
||||
* the properties of the frame. Any existing value for the property
|
||||
|
|
@ -241,6 +246,28 @@ public:
|
|||
{
|
||||
DeleteInternal(aProperty, aFrame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call @aFunction for each property or until @aFunction returns false.
|
||||
*/
|
||||
template<class F>
|
||||
void ForEach(F aFunction) const
|
||||
{
|
||||
#ifdef DEBUG
|
||||
size_t len = mProperties.Length();
|
||||
#endif
|
||||
for (const auto& prop : mProperties) {
|
||||
bool shouldContinue = aFunction(prop.mProperty, prop.mValue);
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(len == mProperties.Length(),
|
||||
"frame property list was modified by ForEach callback!");
|
||||
#endif
|
||||
if (!shouldContinue) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove and destroy all property values for the frame.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue