mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187784 (part 9) - Replace nsBaseHashtable::EnumerateRead() calls in layout/ with iterators. r=heycam.
This commit is contained in:
parent
eb017572ca
commit
04f1952afb
@ -275,26 +275,23 @@ nsCounterManager::CounterListFor(const nsSubstring& aCounterName)
|
||||
return counterList;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
RecalcDirtyLists(const nsAString& aKey, nsCounterList* aList, void* aClosure)
|
||||
{
|
||||
if (aList->IsDirty())
|
||||
aList->RecalcAll();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsCounterManager::RecalcAll()
|
||||
{
|
||||
mNames.EnumerateRead(RecalcDirtyLists, nullptr);
|
||||
for (auto iter = mNames.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCounterList* list = iter.UserData();
|
||||
if (list->IsDirty()) {
|
||||
list->RecalcAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
SetCounterStylesDirty(const nsAString& aKey,
|
||||
nsCounterList* aList,
|
||||
void* aClosure)
|
||||
void
|
||||
nsCounterManager::SetAllCounterStylesDirty()
|
||||
{
|
||||
nsCounterNode* first = aList->First();
|
||||
for (auto iter = mNames.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCounterList* list = iter.UserData();
|
||||
nsCounterNode* first = list->First();
|
||||
if (first) {
|
||||
bool changed = false;
|
||||
nsCounterNode* node = first;
|
||||
@ -303,57 +300,40 @@ SetCounterStylesDirty(const nsAString& aKey,
|
||||
node->UseNode()->SetCounterStyleDirty();
|
||||
changed = true;
|
||||
}
|
||||
} while ((node = aList->Next(node)) != first);
|
||||
} while ((node = list->Next(node)) != first);
|
||||
|
||||
if (changed) {
|
||||
aList->SetDirty();
|
||||
list->SetDirty();
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsCounterManager::SetAllCounterStylesDirty()
|
||||
{
|
||||
mNames.EnumerateRead(SetCounterStylesDirty, nullptr);
|
||||
}
|
||||
|
||||
struct DestroyNodesData {
|
||||
explicit DestroyNodesData(nsIFrame *aFrame)
|
||||
: mFrame(aFrame)
|
||||
, mDestroyedAny(false)
|
||||
{
|
||||
}
|
||||
|
||||
nsIFrame *mFrame;
|
||||
bool mDestroyedAny;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
DestroyNodesInList(const nsAString& aKey, nsCounterList* aList, void* aClosure)
|
||||
{
|
||||
DestroyNodesData *data = static_cast<DestroyNodesData*>(aClosure);
|
||||
if (aList->DestroyNodesFor(data->mFrame)) {
|
||||
data->mDestroyedAny = true;
|
||||
aList->SetDirty();
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
bool
|
||||
nsCounterManager::DestroyNodesFor(nsIFrame *aFrame)
|
||||
{
|
||||
DestroyNodesData data(aFrame);
|
||||
mNames.EnumerateRead(DestroyNodesInList, &data);
|
||||
return data.mDestroyedAny;
|
||||
bool destroyedAny = false;
|
||||
for (auto iter = mNames.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCounterList* list = iter.UserData();
|
||||
if (list->DestroyNodesFor(aFrame)) {
|
||||
destroyedAny = true;
|
||||
list->SetDirty();
|
||||
}
|
||||
}
|
||||
return destroyedAny;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static PLDHashOperator
|
||||
DumpList(const nsAString& aKey, nsCounterList* aList, void* aClosure)
|
||||
void
|
||||
nsCounterManager::Dump()
|
||||
{
|
||||
printf("Counter named \"%s\":\n", NS_ConvertUTF16toUTF8(aKey).get());
|
||||
nsCounterNode *node = aList->First();
|
||||
printf("\n\nCounter Manager Lists:\n");
|
||||
for (auto iter = mNames.Iter(); !iter.Done(); iter.Next()) {
|
||||
printf("Counter named \"%s\":\n",
|
||||
NS_ConvertUTF16toUTF8(iter.Key()).get());
|
||||
|
||||
nsCounterList* list = iter.UserData();
|
||||
nsCounterNode* node = list->First();
|
||||
if (node) {
|
||||
int32_t i = 0;
|
||||
do {
|
||||
@ -361,24 +341,18 @@ DumpList(const nsAString& aKey, nsCounterList* aList, void* aClosure)
|
||||
printf(" Node #%d @%p frame=%p index=%d type=%s valAfter=%d\n"
|
||||
" scope-start=%p scope-prev=%p",
|
||||
i++, (void*)node, (void*)node->mPseudoFrame,
|
||||
node->mContentIndex, types[node->mType], node->mValueAfter,
|
||||
(void*)node->mScopeStart, (void*)node->mScopePrev);
|
||||
node->mContentIndex, types[node->mType],
|
||||
node->mValueAfter, (void*)node->mScopeStart,
|
||||
(void*)node->mScopePrev);
|
||||
if (node->mType == nsCounterNode::USE) {
|
||||
nsAutoString text;
|
||||
node->UseNode()->GetText(text);
|
||||
printf(" text=%s", NS_ConvertUTF16toUTF8(text).get());
|
||||
}
|
||||
printf("\n");
|
||||
} while ((node = aList->Next(node)) != aList->First());
|
||||
} while ((node = list->Next(node)) != list->First());
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
nsCounterManager::Dump()
|
||||
{
|
||||
printf("\n\nCounter Manager Lists:\n");
|
||||
mNames.EnumerateRead(DumpList, nullptr);
|
||||
printf("\n\n");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user