From 0c6a6d4457c86625ba69320aea5958232a7ae612 Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Sat, 28 Dec 2024 19:46:14 +0900 Subject: [PATCH] =?UTF-8?q?LibWeb:=20Normalize=20getter=20name=20for=20ref?= =?UTF-8?q?lected=20=E2=80=9CElement=3F=E2=80=9D=20IDL=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change updates the bindings generator for the case defined at https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes:element; that is, the case “If a reflected IDL attribute has the type T?, where T is either Element or an interface that inherits from Element”. The change “normalizes” the generator behavior for that case — such that the generated code expects a getter with a name of the form used in other cases; e.g., popover_target_element(). Otherwise, without this change, the generator expects a name of the form get_popover_target_element() for that case. --- Libraries/LibWeb/HTML/PopoverInvokerElement.h | 2 +- .../CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/HTML/PopoverInvokerElement.h b/Libraries/LibWeb/HTML/PopoverInvokerElement.h index 6cd95d0bcef..839fa170023 100644 --- a/Libraries/LibWeb/HTML/PopoverInvokerElement.h +++ b/Libraries/LibWeb/HTML/PopoverInvokerElement.h @@ -17,7 +17,7 @@ class PopoverInvokerElement { public: PopoverInvokerElement() { } - GC::Ptr get_popover_target_element() { return m_popover_target_element; } + GC::Ptr popover_target_element() { return m_popover_target_element; } void set_popover_target_element(GC::Ptr value) { m_popover_target_element = value; } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index a9c6c236c97..93bc006d880 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -3821,7 +3821,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.getter_callback@) // 1. If reflectedTarget's explicitly set attr-element is a descendant of any of element's shadow-including ancestors, then return reflectedTarget's explicitly set attr-element. // 2. Return null. attribute_generator.append(R"~~~( - auto const explicitly_set_attr = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->get_@attribute.cpp_name@(); })); + auto const explicitly_set_attr = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->@attribute.cpp_name@(); })); if (explicitly_set_attr) { if (&impl->shadow_including_root() == &explicitly_set_attr->shadow_including_root()) { retval = explicitly_set_attr;