Skip to content

Truly independent web browser

LibWeb: Root the paragraphs and texts SpellCheckController walks

Shannon Booth36835c8fd14a
diff --git a/Libraries/LibWeb/Editing/SpellCheckController.cpp b/Libraries/LibWeb/Editing/SpellCheckController.cpp
index c1db3522f85..1b28261b49e 100644
--- a/Libraries/LibWeb/Editing/SpellCheckController.cpp
+++ b/Libraries/LibWeb/Editing/SpellCheckController.cpp
@@ -303,7 +303,7 @@ Vector<GC::Weak<DOM::Text>> SpellCheckController::paragraphs_of(DOM::Node& edita
paragraphs.append(*text);
return paragraphs;
}
- HashTable<DOM::Text const*> covered;
+ GC::RootHashTable<DOM::Text const*> covered;
editable.for_each_in_inclusive_subtree_of_type<DOM::Text>([&](DOM::Text& text) {
if (covered.contains(&text))
return TraversalDecision::Continue;
@@ -548,7 +548,7 @@ void SpellCheckController::did_focus(GC::Ptr<DOM::Node> node)
void SpellCheckController::did_change_checking_state(DOM::Element& element)
{
// If checking is disabled, the user agent should not indicate spelling or grammar errors for that text.
- Vector<GC::Ref<DOM::Text>> unchecked;
+ GC::RootVector<GC::Ref<DOM::Text>> unchecked;
m_document->spelling_markers().for_each_marked_text([&](DOM::Text& text, auto) {
if (element.is_shadow_including_inclusive_ancestor_of(text) && !text_is_checkable(text))
unchecked.append(text);
diff --git a/Libraries/LibWeb/Editing/SpellCheckController.h b/Libraries/LibWeb/Editing/SpellCheckController.h
index 2c1e0b436f5..1d233dcfa71 100644
--- a/Libraries/LibWeb/Editing/SpellCheckController.h
+++ b/Libraries/LibWeb/Editing/SpellCheckController.h
@@ -10,6 +10,7 @@
#include <AK/Optional.h>
#include <AK/Utf16String.h>
#include <AK/Vector.h>
+#include <LibGC/ConservativeVector.h>
#include <LibGC/Ptr.h>
#include <LibGC/Weak.h>
#include <LibWeb/Forward.h>
@@ -55,7 +56,7 @@ private:
size_t node_end { 0 };
bool checked { false };
};
- using Paragraph = Vector<ParagraphPiece>;
+ using Paragraph = GC::ConservativeVector<ParagraphPiece>;
struct RequestPiece {
GC::Weak<DOM::Text> text;