1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +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

@ -44,7 +44,3 @@ private:
};
}
AK_BEGIN_TYPE_TRAITS(Web::SVG::SVGElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_svg_element(); }
AK_END_TYPE_TRAITS()

View file

@ -55,7 +55,3 @@ private:
};
}
AK_BEGIN_TYPE_TRAITS(Web::SVG::SVGGraphicsElement)
static bool is_type(const Web::DOM::Node& node) { return is<Web::SVG::SVGElement>(node) && downcast<Web::SVG::SVGElement>(node).is_graphics_element(); }
AK_END_TYPE_TRAITS()

View file

@ -122,7 +122,3 @@ private:
};
}
AK_BEGIN_TYPE_TRAITS(Web::SVG::SVGPathElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_svg_element() && downcast<Web::SVG::SVGElement>(node).local_name() == Web::SVG::TagNames::path; }
AK_END_TYPE_TRAITS()

View file

@ -47,7 +47,3 @@ private:
};
}
AK_BEGIN_TYPE_TRAITS(Web::SVG::SVGSVGElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_svg_element() && downcast<Web::SVG::SVGElement>(node).local_name() == Web::SVG::TagNames::svg; }
AK_END_TYPE_TRAITS()