1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00: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:
Andreas Kling 2021-01-01 15:33:30 +01:00
parent 7c3b6b10e4
commit 865f524d5b
116 changed files with 5 additions and 494 deletions

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()