mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibWeb: Port the FormAssociatedElement value to UTF-16
This porting effort makes it pretty clear we will want a UTF-16-aware GenericLexer. But for now, we can actually make ASCII assumptions about what we are parsing, and act accordingly.
This commit is contained in:
parent
e7b08cf291
commit
c8888609f4
Notes:
github-actions[bot]
2025-07-28 10:26:29 +00:00
Author: https://github.com/trflynn89
Commit: c8888609f4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5610
30 changed files with 444 additions and 333 deletions
|
@ -144,7 +144,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
|
|||
if (auto* select_element = dynamic_cast<HTML::HTMLSelectElement*>(control.ptr())) {
|
||||
for (auto const& option_element : select_element->list_of_options()) {
|
||||
if (option_element->selected() && !option_element->disabled()) {
|
||||
entry_list.append(TRY(create_entry(realm, name.to_string(), option_element->value())));
|
||||
entry_list.append(TRY(create_entry(realm, name.to_string(), option_element->value().to_utf8_but_should_be_ported_to_utf16())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,11 +153,11 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
|
|||
// 1. If the field element has a value attribute specified, then let value be the value of that attribute; otherwise, let value be the string "on".
|
||||
auto value = checkbox_or_radio_element->value();
|
||||
if (value.is_empty())
|
||||
value = "on"_string;
|
||||
value = "on"_utf16;
|
||||
|
||||
// 2. Create an entry with name and value, and append it to entry list.
|
||||
auto checkbox_or_radio_element_name = checkbox_or_radio_element->name();
|
||||
entry_list.append(TRY(create_entry(realm, checkbox_or_radio_element_name->to_string(), value)));
|
||||
entry_list.append(TRY(create_entry(realm, checkbox_or_radio_element_name->to_string(), value.to_utf8_but_should_be_ported_to_utf16())));
|
||||
}
|
||||
// 8. Otherwise, if the field element is an input element whose type attribute is in the File Upload state, then:
|
||||
else if (auto* file_element = dynamic_cast<HTML::HTMLInputElement*>(control.ptr()); file_element && file_element->type_state() == HTMLInputElement::TypeAttributeState::FileUpload) {
|
||||
|
@ -186,7 +186,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
|
|||
}
|
||||
// 10. Otherwise, create an entry with name and the value of the field element, and append it to entry list.
|
||||
else {
|
||||
entry_list.append(TRY(create_entry(realm, name.to_string(), control_as_form_associated_element->value())));
|
||||
entry_list.append(TRY(create_entry(realm, name.to_string(), control_as_form_associated_element->value().to_utf8_but_should_be_ported_to_utf16())));
|
||||
}
|
||||
|
||||
// 11. If the element has a dirname attribute, and that attribute's value is not the empty string, then:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue