LibWeb: Remove impl_is_wrapper() check from WrapperGenerator

This concept no longer applies to GC'd platform objects. The only place
where this was still used can use is_wrappable_type() instead.
This commit is contained in:
Linus Groh 2022-09-21 17:42:00 +01:00
parent 64a1992040
commit daf0a8dd91
Notes: sideshowbarker 2024-07-17 06:44:40 +09:00

View File

@ -59,6 +59,8 @@ static bool is_wrappable_type(Type const& type)
return true;
if (type.name() == "Path2D")
return true;
if (type.name() == "MutationRecord")
return true;
return false;
}
@ -74,106 +76,6 @@ static StringView sequence_storage_type_to_cpp_storage_type_name(SequenceStorage
}
}
static bool impl_is_wrapper(Type const& type)
{
if (type.name() == "StyleSheet"sv)
return true;
if (type.name() == "CSSStyleSheet"sv)
return true;
if (type.name() == "StyleSheetList"sv)
return true;
if (type.name() == "CSSRuleList"sv)
return true;
if (type.name() == "CSSRule"sv)
return true;
if (type.name() == "CSSStyleRule"sv)
return true;
if (type.name() == "CSSFontFaceRule"sv)
return true;
if (type.name() == "CSSConditionRule"sv)
return true;
if (type.name() == "CSSGroupingRule"sv)
return true;
if (type.name() == "CSSMediaRule"sv)
return true;
if (type.name() == "CSSImportRule"sv)
return true;
if (type.name() == "EventTarget"sv)
return true;
if (type.name() == "Node"sv)
return true;
if (type.name() == "ShadowRoot"sv)
return true;
if (type.name() == "DocumentTemporary"sv)
return true;
if (type.name() == "Text"sv)
return true;
if (type.name() == "Document"sv)
return true;
if (type.name() == "DocumentType"sv)
return true;
if (type.name().ends_with("Element"sv))
return true;
if (type.name() == "XMLHttpRequest"sv)
return true;
if (type.name() == "XMLHttpRequestEventTarget"sv)
return true;
if (type.name() == "AbortSignal"sv)
return true;
if (type.name() == "WebSocket"sv)
return true;
if (type.name() == "Worker"sv)
return true;
if (type.name() == "NodeIterator"sv)
return true;
if (type.name() == "TreeWalker"sv)
return true;
if (type.name() == "MediaQueryList"sv)
return true;
if (type.name() == "MessagePort"sv)
return true;
if (type.name() == "NodeFilter"sv)
return true;
if (type.name() == "DOMTokenList"sv)
return true;
if (type.name() == "DOMStringMap"sv)
return true;
if (type.name() == "MutationRecord"sv)
return true;
if (type.name() == "CanvasRenderingContext2D"sv)
return true;
if (type.name() == "WebGLRenderingContext"sv)
return true;
if (type.name() == "Path2D"sv)
return true;
if (type.name() == "Storage"sv)
return true;
if (type.name() == "File"sv)
return true;
if (type.name() == "Blob"sv)
return true;
if (type.name() == "URL"sv)
return true;
if (type.name() == "URLSearchParams"sv)
return true;
if (type.name() == "DOMException"sv)
return true;
return false;
}
CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface);
static String union_type_to_variant(UnionType const& union_type, Interface const& interface)
@ -1529,7 +1431,10 @@ static void generate_wrap_statement(SourceGenerator& generator, String const& va
)~~~");
}
if (impl_is_wrapper(sequence_generic_type.parameters().first())) {
// If the type is a platform object we currently return a Vector<JS::Handle<T>> from the
// C++ implementation, thus allowing us to unwrap the element (a handle) like below.
// This might need to change if we switch to a MarkedVector.
if (is_wrappable_type(sequence_generic_type.parameters().first())) {
scoped_generator.append(R"~~~(
auto* wrapped_element@recursion_depth@ = &(*element@recursion_depth@);
)~~~");