Bug 1797186. Rework ClipManager::PopOverrideForASR. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D160123
This commit is contained in:
Timothy Nikkel 2022-10-24 21:45:57 +00:00
parent 81c86f9a79
commit c4dfda1c19

View File

@ -124,19 +124,26 @@ void ClipManager::PopOverrideForASR(const ActiveScrolledRoot* aASR) {
MOZ_ASSERT(space.isSome());
auto it = mASROverride.find(*space);
CLIP_LOG("Popping %p override %zu -> %s\n", aASR, space->id,
ToString(it->second.top().id).c_str());
it->second.pop();
if (it == mASROverride.end()) {
MOZ_ASSERT_UNREACHABLE("Push/PopOverrideForASR should be balanced");
} else {
CLIP_LOG("Popping %p override %zu -> %s\n", aASR, space->id,
ToString(it->second.top().id).c_str());
it->second.pop();
}
if (!mItemClipStack.empty()) {
auto& top = mItemClipStack.top();
if (top.mASR == aASR) {
top.mScrollId = it->second.empty() ? *space : it->second.top();
top.mScrollId = (it == mASROverride.end() || it->second.empty())
? *space
: it->second.top();
}
}
if (it->second.empty()) {
if (it != mASROverride.end() && it->second.empty()) {
mASROverride.erase(it);
}
}