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
|
|
@ -28,10 +28,10 @@ WebIDL::ExceptionOr<GC::Ref<FormData>> FormData::construct_impl(JS::Realm& realm
|
|||
// 1. If submitter is non-null, then:
|
||||
if (submitter) {
|
||||
// 1. If submitter is not a submit button, then throw a TypeError.
|
||||
if (!is<HTML::FormAssociatedElement>(*submitter)) {
|
||||
auto form_associated_element = as_if<HTML::FormAssociatedElement>(*submitter);
|
||||
if (!form_associated_element) {
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Submitter is not associated with a form."sv };
|
||||
}
|
||||
auto* form_associated_element = dynamic_cast<HTML::FormAssociatedElement*>(submitter.ptr());
|
||||
|
||||
if (!form_associated_element->is_submit_button()) {
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Submitter is not a valid submit button."sv };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue