1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-15 02:27:38 +00:00

LibWeb: Switch to using AK::is and AK::downcast

This commit is contained in:
Andreas Kling 2020-07-26 17:16:18 +02:00
parent fe6474e692
commit 71556e39a4
73 changed files with 249 additions and 433 deletions

View file

@ -125,7 +125,7 @@ void Frame::scroll_to_anchor(const String& fragment)
auto candidates = document()->get_elements_by_name(fragment);
for (auto* candidate : candidates) {
if (is<HTMLAnchorElement>(*candidate)) {
element = to<HTMLAnchorElement>(candidate);
element = downcast<HTMLAnchorElement>(candidate);
break;
}
}
@ -138,7 +138,7 @@ void Frame::scroll_to_anchor(const String& fragment)
Gfx::FloatRect float_rect { layout_node.box_type_agnostic_position(), { (float)viewport_rect().width(), (float)viewport_rect().height() } };
if (is<LayoutBox>(layout_node)) {
auto& layout_box = to<LayoutBox>(layout_node);
auto& layout_box = downcast<LayoutBox>(layout_node);
auto padding_box = layout_box.box_model().padding_box(layout_box);
float_rect.move_by(-padding_box.left, -padding_box.top);
}