mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
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:
parent
7c3b6b10e4
commit
865f524d5b
Notes:
sideshowbarker
2024-07-19 00:16:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/865f524d5b1
@ -30,30 +30,16 @@
|
||||
|
||||
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>
|
||||
struct TypeTraits<OutputType, InputType, true> {
|
||||
static bool has_type(InputType&) { return true; }
|
||||
};
|
||||
inline bool is(InputType& input)
|
||||
{
|
||||
return dynamic_cast<CopyConst<InputType, OutputType>*>(&input);
|
||||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
inline bool is(InputType* input)
|
||||
{
|
||||
return input && TypeTraits<const OutputType, const InputType>::has_type(*input);
|
||||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
inline bool is(InputType& input)
|
||||
{
|
||||
return TypeTraits<const OutputType, const InputType>::has_type(input);
|
||||
return input && is<OutputType>(*input);
|
||||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
@ -72,22 +58,7 @@ inline CopyConst<InputType, OutputType>& downcast(InputType& 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::is;
|
||||
using AK::TypeTraits;
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -399,7 +399,3 @@ inline const Widget* Widget::parent_widget() const
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(GUI::Widget)
|
||||
static bool is_type(const Core::Object& object) { return object.is_widget(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user