mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37: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:
parent
7c3b6b10e4
commit
865f524d5b
116 changed files with 5 additions and 494 deletions
|
@ -81,7 +81,3 @@ void BlockBox::for_each_fragment(Callback callback) const
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::BlockBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_block(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -124,7 +124,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::Box)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_box(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -45,7 +45,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::BreakNode)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_break(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -55,7 +55,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::ButtonBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_button(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -47,7 +47,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::CanvasBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_canvas(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -54,7 +54,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::CheckBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_check_box(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -49,7 +49,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::FrameBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_frame(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -56,7 +56,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::ImageBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_image(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -61,7 +61,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::InitialContainingBlockBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_initial_containing_block(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -45,7 +45,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::InlineNode)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_inline_node(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -48,7 +48,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::ListItemBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_list_item(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -271,7 +271,3 @@ inline NodeWithStyle* Node::parent()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::NodeWithStyle)
|
||||
static bool is_type(const Web::Layout::Node& node) { return node.has_style(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -76,7 +76,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::ReplacedBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_replaced(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -41,7 +41,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::TableBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_table(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -47,7 +47,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::TableCellBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_table_cell(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -41,7 +41,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::TableRowBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_table_row(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -43,7 +43,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::TableRowGroupBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_table_row_group(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -63,7 +63,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::TextNode)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_text(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
@ -51,7 +51,3 @@ private:
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::Layout::WidgetBox)
|
||||
static bool is_type(const Web::Layout::Node& layout_node) { return layout_node.is_widget(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue