AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpers

Now that we have RTTI in userspace, we can do away with all this manual
hackery and use dynamic_cast.

We keep the is<T> and downcast<T> helpers since they still provide good
readability improvements. Note that unlike dynamic_cast<T>, downcast<T>
does not fail in a recoverable way, but will assert if the object being
casted is not a T.
This commit is contained in:
Andreas Kling 2021-01-01 15:33:30 +01:00
parent 7c3b6b10e4
commit 865f524d5b
Notes: sideshowbarker 2024-07-19 00:16:23 +09:00
116 changed files with 5 additions and 494 deletions

View file

@ -30,30 +30,16 @@
namespace AK { namespace AK {
template<typename OutputType, typename InputType, bool is_base_type = IsBaseOf<OutputType, InputType>::value>
struct TypeTraits {
static bool has_type(InputType&)
{
static_assert(IsVoid<OutputType>::value, "No TypeTraits for this type");
return false;
}
};
template<typename OutputType, typename InputType> template<typename OutputType, typename InputType>
struct TypeTraits<OutputType, InputType, true> { inline bool is(InputType& input)
static bool has_type(InputType&) { return true; } {
}; return dynamic_cast<CopyConst<InputType, OutputType>*>(&input);
}
template<typename OutputType, typename InputType> template<typename OutputType, typename InputType>
inline bool is(InputType* input) inline bool is(InputType* input)
{ {
return input && TypeTraits<const OutputType, const InputType>::has_type(*input); return input && is<OutputType>(*input);
}
template<typename OutputType, typename InputType>
inline bool is(InputType& input)
{
return TypeTraits<const OutputType, const InputType>::has_type(input);
} }
template<typename OutputType, typename InputType> template<typename OutputType, typename InputType>
@ -72,22 +58,7 @@ inline CopyConst<InputType, OutputType>& downcast(InputType& input)
return static_cast<CopyConst<InputType, OutputType>&>(input); return static_cast<CopyConst<InputType, OutputType>&>(input);
} }
#define AK_BEGIN_TYPE_TRAITS(ClassName) \
namespace AK { \
template<typename InputType> \
class TypeTraits<const ClassName, InputType, false> { \
public: \
static bool has_type(InputType& input) { return is_type(input); } \
\
private:
#define AK_END_TYPE_TRAITS() \
} \
; \
}
} }
using AK::downcast; using AK::downcast;
using AK::is; using AK::is;
using AK::TypeTraits;

View file

@ -166,7 +166,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Spreadsheet::SpreadsheetView)
static bool is_type(const Core::Object& object) { return !strcmp(object.class_name(), "SpreadsheetView"); }
AK_END_TYPE_TRAITS()

View file

@ -58,7 +58,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(HackStudio::EditorWrapper)
static bool is_type(const Core::Object& object) { return !strcmp(object.class_name(), "EditorWrapper"); }
AK_END_TYPE_TRAITS()

View file

@ -87,7 +87,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(GUI::AbstractButton)
static bool is_type(const Core::Object& object) { return is<GUI::Widget>(object) && downcast<GUI::Widget>(object).is_abstract_button(); }
AK_END_TYPE_TRAITS()

View file

@ -172,7 +172,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(GUI::Action)
static bool is_type(const Core::Object& object) { return object.is_action(); }
AK_END_TYPE_TRAITS()

View file

@ -53,7 +53,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(GUI::RadioButton)
static bool is_type(const Core::Object& object) { return is<GUI::Widget>(object) && downcast<GUI::Widget>(object).is_radio_button(); }
AK_END_TYPE_TRAITS()

View file

@ -399,7 +399,3 @@ inline const Widget* Widget::parent_widget() const
return nullptr; return nullptr;
} }
} }
AK_BEGIN_TYPE_TRAITS(GUI::Widget)
static bool is_type(const Core::Object& object) { return object.is_widget(); }
AK_END_TYPE_TRAITS()

View file

@ -267,7 +267,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(GUI::Window)
static bool is_type(const Core::Object& object) { return object.is_window(); }
AK_END_TYPE_TRAITS()

View file

@ -86,7 +86,3 @@ private:
} }
} }
AK_BEGIN_TYPE_TRAITS(Web::Bindings::WindowObject)
static bool is_type(const JS::GlobalObject& global) { return String(global.class_name()) == "WindowObject"; }
AK_END_TYPE_TRAITS()

View file

@ -55,7 +55,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::CharacterData)
static bool is_type(const Web::DOM::Node& node) { return node.is_character_data(); }
AK_END_TYPE_TRAITS()

View file

@ -42,7 +42,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Comment)
static bool is_type(const Web::DOM::Node& node) { return node.is_comment(); }
AK_END_TYPE_TRAITS()

View file

@ -291,7 +291,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Document)
static bool is_type(const Web::DOM::Node& node) { return node.is_document(); }
AK_END_TYPE_TRAITS()

View file

@ -54,7 +54,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::DocumentFragment)
static bool is_type(const Web::DOM::Node& node) { return node.is_document_fragment(); }
AK_END_TYPE_TRAITS()

View file

@ -56,7 +56,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::DocumentType)
static bool is_type(const Web::DOM::Node& node) { return node.type() == Web::DOM::NodeType::DOCUMENT_TYPE_NODE; }
AK_END_TYPE_TRAITS()

View file

@ -116,7 +116,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Element)
static bool is_type(const Web::DOM::Node& node) { return node.is_element(); }
AK_END_TYPE_TRAITS()

View file

@ -162,7 +162,3 @@ protected:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Node)
static bool is_type(const Web::DOM::EventTarget& event_target) { return event_target.is_node(); }
AK_END_TYPE_TRAITS()

View file

@ -66,7 +66,3 @@ inline void ParentNode::for_each_child(Callback callback)
} }
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::ParentNode)
static bool is_type(const Web::DOM::Node& node) { return node.is_parent_node(); }
AK_END_TYPE_TRAITS()

View file

@ -59,7 +59,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::ShadowRoot)
static bool is_type(const Web::DOM::Node& node) { return node.is_shadow_root(); }
AK_END_TYPE_TRAITS()

View file

@ -46,7 +46,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Text)
static bool is_type(const Web::DOM::Node& node) { return node.is_text(); }
AK_END_TYPE_TRAITS()

View file

@ -98,7 +98,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::DOM::Window)
static bool is_type(const Web::DOM::EventTarget& event_target) { return event_target.is_window(); }
AK_END_TYPE_TRAITS()

View file

@ -44,7 +44,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLAnchorElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::a; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLAreaElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::area; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLAudioElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::audio; }
AK_END_TYPE_TRAITS()

View file

@ -41,7 +41,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLBRElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::br; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLBaseElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::base; }
AK_END_TYPE_TRAITS()

View file

@ -43,7 +43,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLBlinkElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::blink; }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLBodyElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::body; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLButtonElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::button; }
AK_END_TYPE_TRAITS()

View file

@ -56,7 +56,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLCanvasElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::canvas; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDListElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::dl; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDataElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::data; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDataListElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::datalist; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDetailsElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::details; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDialogElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::dialog; }
AK_END_TYPE_TRAITS()

View file

@ -40,7 +40,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDirectoryElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::dir; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLDivElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::div; }
AK_END_TYPE_TRAITS()

View file

@ -60,7 +60,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element(); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLEmbedElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::embed; }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLFieldSetElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::fieldset; }
AK_END_TYPE_TRAITS()

View file

@ -41,7 +41,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLFontElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::font; }
AK_END_TYPE_TRAITS()

View file

@ -51,7 +51,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLFormElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::form; }
AK_END_TYPE_TRAITS()

View file

@ -40,7 +40,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLFrameElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::frame; }
AK_END_TYPE_TRAITS()

View file

@ -40,7 +40,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLFrameSetElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::frameset; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLHRElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::hr; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLHeadElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::head; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLHeadingElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::h1, Web::HTML::TagNames::h2, Web::HTML::TagNames::h3, Web::HTML::TagNames::h4, Web::HTML::TagNames::h5, Web::HTML::TagNames::h6); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLHtmlElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::html; }
AK_END_TYPE_TRAITS()

View file

@ -58,7 +58,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLIFrameElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::iframe; }
AK_END_TYPE_TRAITS()

View file

@ -59,7 +59,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLImageElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::img; }
AK_END_TYPE_TRAITS()

View file

@ -55,7 +55,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLInputElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::input; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLLIElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::li; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLLabelElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::label; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLLegendElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::legend; }
AK_END_TYPE_TRAITS()

View file

@ -67,7 +67,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLLinkElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::link; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMapElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::map; }
AK_END_TYPE_TRAITS()

View file

@ -40,7 +40,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMarqueeElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::marquee; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMediaElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::audio, Web::HTML::TagNames::video); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMenuElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::menu; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMetaElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::meta; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLMeterElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::meter; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLModElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::ins, Web::HTML::TagNames::del); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLOListElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::ol; }
AK_END_TYPE_TRAITS()

View file

@ -53,7 +53,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLObjectElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_element() && downcast<Web::DOM::Element>(node).local_name() == Web::HTML::TagNames::object; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLOptGroupElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::optgroup; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLOptionElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::option; }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLOutputElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::output; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLParagraphElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::p; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLParamElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::param; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLPictureElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::picture; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLPreElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::pre, Web::HTML::TagNames::listing, Web::HTML::TagNames::xmp); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLProgressElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::progress; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLQuoteElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::blockquote, Web::HTML::TagNames::q); }
AK_END_TYPE_TRAITS()

View file

@ -68,7 +68,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLScriptElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::script; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLSelectElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::select; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLSlotElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::slot; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLSourceElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::source; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLSpanElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::span; }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLStyleElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::style; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableCaptionElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::caption; }
AK_END_TYPE_TRAITS()

View file

@ -42,7 +42,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableCellElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableColElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::colgroup, Web::HTML::TagNames::col); }
AK_END_TYPE_TRAITS()

View file

@ -42,7 +42,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::table; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableRowElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::tr; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTableSectionElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::tbody, Web::HTML::TagNames::thead, Web::HTML::TagNames::tfoot); }
AK_END_TYPE_TRAITS()

View file

@ -48,7 +48,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTemplateElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::template_; }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTextAreaElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::textarea; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTimeElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::time; }
AK_END_TYPE_TRAITS()

View file

@ -42,7 +42,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTitleElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::title; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLTrackElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::track; }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLUListElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::ul; }
AK_END_TYPE_TRAITS()

View file

@ -42,7 +42,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLUnknownElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_unknown_html_element(); }
AK_END_TYPE_TRAITS()

View file

@ -39,7 +39,3 @@ public:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLVideoElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTML::HTMLElement>(node).local_name() == Web::HTML::TagNames::video; }
AK_END_TYPE_TRAITS()

View file

@ -81,7 +81,3 @@ void BlockBox::for_each_fragment(Callback callback) const
} }
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::BlockBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_block(); }
AK_END_TYPE_TRAITS()

View file

@ -124,7 +124,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::Box)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_box(); }
AK_END_TYPE_TRAITS()

View file

@ -45,7 +45,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::BreakNode)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_break(); }
AK_END_TYPE_TRAITS()

View file

@ -55,7 +55,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::ButtonBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_button(); }
AK_END_TYPE_TRAITS()

View file

@ -47,7 +47,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::CanvasBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_canvas(); }
AK_END_TYPE_TRAITS()

View file

@ -54,7 +54,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::CheckBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_check_box(); }
AK_END_TYPE_TRAITS()

View file

@ -49,7 +49,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::FrameBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_frame(); }
AK_END_TYPE_TRAITS()

View file

@ -56,7 +56,3 @@ private:
}; };
} }
AK_BEGIN_TYPE_TRAITS(Web::Layout::ImageBox)
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_image(); }
AK_END_TYPE_TRAITS()

Some files were not shown because too many files have changed in this diff Show more