1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +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

@ -108,7 +108,7 @@ GUI::Variant LayoutTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole
}
if (role == GUI::ModelRole::Display) {
if (is<Layout::TextNode>(node))
return String::formatted("TextNode: {}", with_whitespace_collapsed(downcast<Layout::TextNode>(node).text_for_rendering()));
return String::formatted("TextNode: {}", with_whitespace_collapsed(verify_cast<Layout::TextNode>(node).text_for_rendering()));
StringBuilder builder;
builder.append(node.class_name());
builder.append(' ');
@ -117,7 +117,7 @@ GUI::Variant LayoutTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole
} else if (!node.dom_node()->is_element()) {
builder.append(node.dom_node()->node_name());
} else {
auto& element = downcast<DOM::Element>(*node.dom_node());
auto& element = verify_cast<DOM::Element>(*node.dom_node());
builder.append('<');
builder.append(element.local_name());
element.for_each_attribute([&](auto& name, auto& value) {