diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-01 15:33:30 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-01 15:33:30 +0100 |
commit | 865f524d5b1257ec77b2d17b93ec777799b4c4ab (patch) | |
tree | d99597100b4f0f8670aa0edd8ebe67d5ae60a35a /Libraries/LibWeb/DOM | |
parent | 7c3b6b10e4230a24dbe44df4f942d63ee27cac89 (diff) | |
download | serenity-865f524d5b1257ec77b2d17b93ec777799b4c4ab.zip |
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.
Diffstat (limited to 'Libraries/LibWeb/DOM')
-rw-r--r-- | Libraries/LibWeb/DOM/CharacterData.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Comment.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Document.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/DocumentFragment.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/DocumentType.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Element.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Node.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/ParentNode.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/ShadowRoot.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Text.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Window.h | 4 |
11 files changed, 0 insertions, 44 deletions
diff --git a/Libraries/LibWeb/DOM/CharacterData.h b/Libraries/LibWeb/DOM/CharacterData.h index 9204487e27..de09340e41 100644 --- a/Libraries/LibWeb/DOM/CharacterData.h +++ b/Libraries/LibWeb/DOM/CharacterData.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Comment.h b/Libraries/LibWeb/DOM/Comment.h index 855c710ded..4ab3bfbedb 100644 --- a/Libraries/LibWeb/DOM/Comment.h +++ b/Libraries/LibWeb/DOM/Comment.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 8434beeb8e..23615d55a5 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -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() diff --git a/Libraries/LibWeb/DOM/DocumentFragment.h b/Libraries/LibWeb/DOM/DocumentFragment.h index fa5982a134..b5dbc81699 100644 --- a/Libraries/LibWeb/DOM/DocumentFragment.h +++ b/Libraries/LibWeb/DOM/DocumentFragment.h @@ -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() diff --git a/Libraries/LibWeb/DOM/DocumentType.h b/Libraries/LibWeb/DOM/DocumentType.h index 930cd8229a..ffc4d82150 100644 --- a/Libraries/LibWeb/DOM/DocumentType.h +++ b/Libraries/LibWeb/DOM/DocumentType.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index 45b18ef0e2..4f93ce615b 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 7fc2b9bbaa..2b0d36382b 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -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() diff --git a/Libraries/LibWeb/DOM/ParentNode.h b/Libraries/LibWeb/DOM/ParentNode.h index cf8aa6ec86..0fa6e8f1fe 100644 --- a/Libraries/LibWeb/DOM/ParentNode.h +++ b/Libraries/LibWeb/DOM/ParentNode.h @@ -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() diff --git a/Libraries/LibWeb/DOM/ShadowRoot.h b/Libraries/LibWeb/DOM/ShadowRoot.h index 878a2ab477..455b47723d 100644 --- a/Libraries/LibWeb/DOM/ShadowRoot.h +++ b/Libraries/LibWeb/DOM/ShadowRoot.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Text.h b/Libraries/LibWeb/DOM/Text.h index 1b73543974..5ee7595561 100644 --- a/Libraries/LibWeb/DOM/Text.h +++ b/Libraries/LibWeb/DOM/Text.h @@ -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() diff --git a/Libraries/LibWeb/DOM/Window.h b/Libraries/LibWeb/DOM/Window.h index 4339a1dfda..862c2a9720 100644 --- a/Libraries/LibWeb/DOM/Window.h +++ b/Libraries/LibWeb/DOM/Window.h @@ -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() |