AK+Everywhere: Rename verify_cast to as

Follow-up to fc20e61e72.
This commit is contained in:
Timothy Flynn 2025-01-21 09:12:05 -05:00 committed by Tim Flynn
parent a0b44ff5e7
commit 85b424464a
Notes: github-actions[bot] 2025-01-21 16:49:39 +00:00
191 changed files with 574 additions and 574 deletions

View file

@ -24,7 +24,7 @@ EventLoopThreadData& EventLoopThreadData::the()
static ALooperEventLoopImplementation& current_impl()
{
return verify_cast<ALooperEventLoopImplementation>(Core::EventLoop::current().impl());
return as<ALooperEventLoopImplementation>(Core::EventLoop::current().impl());
}
static int looper_callback(int fd, int events, void* data);

View file

@ -131,7 +131,7 @@ Web::DragEvent ns_event_to_drag_event(Web::DragEvent::Type type, id<NSDraggingIn
Vector<URL::URL> drag_event_url_list(Web::DragEvent const& event)
{
auto& chrome_data = verify_cast<DragData>(*event.chrome_data);
auto& chrome_data = as<DragData>(*event.chrome_data);
return move(chrome_data.urls);
}
@ -322,7 +322,7 @@ Web::KeyEvent ns_event_to_key_event(Web::KeyEvent::Type type, NSEvent* event)
NSEvent* key_event_to_ns_event(Web::KeyEvent const& event)
{
auto& chrome_data = verify_cast<KeyData>(*event.chrome_data);
auto& chrome_data = as<KeyData>(*event.chrome_data);
return chrome_data.take_event();
}

View file

@ -59,7 +59,7 @@ public:
{
if (!isVisible())
return;
auto* browser_window = verify_cast<BrowserWindow>(parentWidget());
auto* browser_window = as<BrowserWindow>(parentWidget());
if (!browser_window)
return;
auto* current_tab = browser_window->current_tab();
@ -626,7 +626,7 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
m_settings_dialog->setFocus();
});
QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) {
auto* tab = verify_cast<Tab>(m_tabs_container->widget(index));
auto* tab = as<Tab>(m_tabs_container->widget(index));
if (tab)
setWindowTitle(QString("%1 - Ladybird").arg(tab->title()));
@ -915,7 +915,7 @@ void BrowserWindow::create_close_button_for_tab(Tab* tab)
void BrowserWindow::tab_audio_play_state_changed(int index, Web::HTML::AudioPlayState play_state)
{
auto* tab = verify_cast<Tab>(m_tabs_container->widget(index));
auto* tab = as<Tab>(m_tabs_container->widget(index));
auto position = audio_button_position_for_tab(index);
switch (play_state) {
@ -939,7 +939,7 @@ void BrowserWindow::tab_audio_play_state_changed(int index, Web::HTML::AudioPlay
break;
case Web::HTML::AudioPlayState::Playing:
auto* button = m_tabs_container->tabBar()->tabButton(index, position);
verify_cast<TabBarButton>(button)->setIcon(icon_for_page_mute_state(*tab));
as<TabBarButton>(button)->setIcon(icon_for_page_mute_state(*tab));
button->setToolTip(tool_tip_for_page_mute_state(*tab));
break;
}
@ -952,7 +952,7 @@ void BrowserWindow::tab_audio_play_state_changed(int index, Web::HTML::AudioPlay
void BrowserWindow::tab_navigation_buttons_state_changed(int index)
{
auto* tab = verify_cast<Tab>(m_tabs_container->widget(index));
auto* tab = as<Tab>(m_tabs_container->widget(index));
tab->update_navigation_buttons_state();
}

View file

@ -160,7 +160,7 @@ private:
void for_each_tab(Callback&& callback)
{
for (int i = 0; i < m_tabs_container->count(); ++i) {
auto& tab = verify_cast<Tab>(*m_tabs_container->widget(i));
auto& tab = as<Tab>(*m_tabs_container->widget(i));
callback(tab);
}
}

View file

@ -40,8 +40,8 @@ QSize TabBar::tabSizeHint(int index) const
void TabBar::contextMenuEvent(QContextMenuEvent* event)
{
auto* tab_widget = verify_cast<QTabWidget>(this->parent());
auto* tab = verify_cast<Tab>(tab_widget->widget(tabAt(event->pos())));
auto* tab_widget = as<QTabWidget>(this->parent());
auto* tab = as<Tab>(tab_widget->widget(tabAt(event->pos())));
if (tab)
tab->context_menu()->exec(event->globalPos());
}
@ -147,7 +147,7 @@ QRect TabStyle::subElementRect(QStyle::SubElement sub_element, QStyleOption cons
{
// Place our add-tab button (set as the top-right corner widget) directly after the last tab
if (sub_element == QStyle::SE_TabWidgetRightCorner) {
auto* tab_widget = verify_cast<TabWidget>(widget);
auto* tab_widget = as<TabWidget>(widget);
auto tab_bar_size = tab_widget->tabBar()->sizeHint();
auto new_tab_button_size = tab_bar_size.height();
return QRect {

View file

@ -827,7 +827,7 @@ void WebContentView::finish_handling_drag_event(Web::DragEvent const& event)
if (event.type != Web::DragEvent::Type::Drop)
return;
auto const& chrome_data = verify_cast<DragData>(*event.chrome_data);
auto const& chrome_data = as<DragData>(*event.chrome_data);
emit urls_dropped(chrome_data.urls);
}
@ -867,7 +867,7 @@ void WebContentView::enqueue_native_event(Web::KeyEvent::Type type, QKeyEvent co
void WebContentView::finish_handling_key_event(Web::KeyEvent const& key_event)
{
auto& chrome_data = verify_cast<KeyData>(*key_event.chrome_data);
auto& chrome_data = as<KeyData>(*key_event.chrome_data);
auto& event = *chrome_data.event;
switch (key_event.type) {