mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Iterate safely in process_top_layer_removals()
We should not remove from a container while iterating over it, since that may disrupt iteration.
This commit is contained in:
parent
59d46af946
commit
2afe208328
Notes:
github-actions[bot]
2025-05-29 01:48:24 +00:00
Author: https://github.com/awesomekling
Commit: 2afe208328
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4899
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/shannonbooth
1 changed files with 7 additions and 2 deletions
|
@ -6122,13 +6122,18 @@ void Document::process_top_layer_removals()
|
|||
{
|
||||
// 1. For each element el in doc’s pending top layer removals: if el’s computed value of overlay is none, or el is
|
||||
// not rendered, remove el from doc’s top layer and pending top layer removals.
|
||||
GC::RootVector<GC::Ref<Element>> elements_to_remove(heap());
|
||||
for (auto& element : m_top_layer_pending_removals) {
|
||||
// FIXME: Implement overlay property
|
||||
if (true || !element->paintable()) {
|
||||
m_top_layer_elements.remove(element);
|
||||
m_top_layer_pending_removals.remove(element);
|
||||
elements_to_remove.append(element);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& element : elements_to_remove) {
|
||||
m_top_layer_elements.remove(element);
|
||||
m_top_layer_pending_removals.remove(element);
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/popover.html#topmost-auto-popover
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue