mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
5608bc4eaf
HTMLObjectElement will need to be both a FormAssociatedElement and a
BrowsingContextContainer. Currently, both of these classes inherit from
HTMLElement. This can work in C++, but is generally frowned upon, and
doesn't play particularly well with the rest of LibWeb.
Instead, we can essentially revert commit 3bb5c62
to remove HTMLElement
from FormAssociatedElement's hierarchy. This means that objects such as
HTMLObjectElement individually inherit from FormAssociatedElement and
HTMLElement now.
Some caveats are:
* FormAssociatedElement still needs to know when the HTMLElement is
inserted into and removed from the DOM. This hook is automatically
injected via a macro now, while still allowing classes like
HTMLInputElement to also know when the element is inserted.
* Casting from a DOM::Element to a FormAssociatedElement is now a
sideways cast, rather than directly following an inheritance chain.
This means static_cast cannot be used here; but we can safely use
dynamic_cast since the only 2 instances of this already use RTTI to
verify the cast.
39 lines
1,006 B
C++
39 lines
1,006 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class HTMLFieldSetElement final
|
|
: public HTMLElement
|
|
, public FormAssociatedElement {
|
|
FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLFieldSetElement)
|
|
|
|
public:
|
|
using WrapperType = Bindings::HTMLFieldSetElementWrapper;
|
|
|
|
HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName);
|
|
virtual ~HTMLFieldSetElement() override;
|
|
|
|
const String& type() const
|
|
{
|
|
static String fieldset = "fieldset";
|
|
return fieldset;
|
|
}
|
|
|
|
// ^FormAssociatedElement
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
|
virtual bool is_listed() const override { return true; }
|
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
|
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
|
};
|
|
|
|
}
|