1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

AK: Rename downcast<T> => verify_cast<T>

This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
This commit is contained in:
Andreas Kling 2021-06-24 19:53:42 +02:00
parent 6215a9c2cb
commit ee3a73ddbb
61 changed files with 262 additions and 262 deletions

View file

@ -147,22 +147,22 @@ void Widget::child_event(Core::ChildEvent& event)
if (event.type() == Event::ChildAdded) {
if (event.child() && is<Widget>(*event.child()) && layout()) {
if (event.insertion_before_child() && is<Widget>(event.insertion_before_child()))
layout()->insert_widget_before(downcast<Widget>(*event.child()), downcast<Widget>(*event.insertion_before_child()));
layout()->insert_widget_before(verify_cast<Widget>(*event.child()), verify_cast<Widget>(*event.insertion_before_child()));
else
layout()->add_widget(downcast<Widget>(*event.child()));
layout()->add_widget(verify_cast<Widget>(*event.child()));
}
if (window() && event.child() && is<Widget>(*event.child()))
window()->did_add_widget({}, downcast<Widget>(*event.child()));
window()->did_add_widget({}, verify_cast<Widget>(*event.child()));
}
if (event.type() == Event::ChildRemoved) {
if (layout()) {
if (event.child() && is<Widget>(*event.child()))
layout()->remove_widget(downcast<Widget>(*event.child()));
layout()->remove_widget(verify_cast<Widget>(*event.child()));
else
invalidate_layout();
}
if (window() && event.child() && is<Widget>(*event.child()))
window()->did_remove_widget({}, downcast<Widget>(*event.child()));
window()->did_remove_widget({}, verify_cast<Widget>(*event.child()));
update();
}
return Core::Object::child_event(event);
@ -563,7 +563,7 @@ Widget* Widget::child_at(const Gfx::IntPoint& point) const
for (int i = children().size() - 1; i >= 0; --i) {
if (!is<Widget>(children()[i]))
continue;
auto& child = downcast<Widget>(children()[i]);
auto& child = verify_cast<Widget>(children()[i]);
if (!child.is_visible())
continue;
if (child.content_rect().contains(point))