mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Replace usages of dynamic_cast with as and as_if
This commit is contained in:
parent
d31aec25e8
commit
aadd563592
Notes:
github-actions[bot]
2025-08-22 18:27:13 +00:00
Author: https://github.com/tcl3
Commit: aadd563592
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5953
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/trflynn89
22 changed files with 72 additions and 91 deletions
|
|
@ -1485,9 +1485,8 @@ Messages::WebDriverClient::IsElementEnabledResponse WebDriverConnection::is_elem
|
|||
bool enabled = !current_browsing_context().active_document()->is_xml_document();
|
||||
|
||||
// 6. Set enabled to false if a form control is disabled.
|
||||
if (enabled && is<Web::HTML::FormAssociatedElement>(*element)) {
|
||||
auto& form_associated_element = dynamic_cast<Web::HTML::FormAssociatedElement&>(*element);
|
||||
enabled = form_associated_element.enabled();
|
||||
if (auto* form_associated_element = as_if<Web::HTML::FormAssociatedElement>(*element); form_associated_element && enabled) {
|
||||
enabled = form_associated_element->enabled();
|
||||
}
|
||||
|
||||
// 7. Return success with data enabled.
|
||||
|
|
@ -1757,8 +1756,7 @@ Web::WebDriver::Response WebDriverConnection::element_clear_impl(StringView elem
|
|||
|
||||
// https://w3c.github.io/webdriver/#dfn-clear-a-resettable-element
|
||||
auto clear_resettable_element = [&](Web::DOM::Element& element) {
|
||||
VERIFY(is<Web::HTML::FormAssociatedElement>(element));
|
||||
auto& form_associated_element = dynamic_cast<Web::HTML::FormAssociatedElement&>(element);
|
||||
auto& form_associated_element = as<Web::HTML::FormAssociatedElement>(element);
|
||||
|
||||
// 1. Let empty be the result of the first matching condition:
|
||||
auto empty = [&]() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue