LibWeb: Port the FormAssociatedElement value to UTF-16
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

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:
Timothy Flynn 2025-07-26 12:19:56 -04:00 committed by Andreas Kling
commit c8888609f4
Notes: github-actions[bot] 2025-07-28 10:26:29 +00:00
30 changed files with 444 additions and 333 deletions

View file

@ -74,20 +74,20 @@ void HTMLOutputElement::set_default_value(String const& default_value)
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-value
String HTMLOutputElement::value() const
Utf16String HTMLOutputElement::value() const
{
// The value getter steps are to return this's descendant text content.
return descendant_text_content();
return Utf16String::from_utf8(descendant_text_content());
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-value
void HTMLOutputElement::set_value(String const& value)
void HTMLOutputElement::set_value(Utf16String const& value)
{
// 1. Set this's default value override to its default value.
m_default_value_override = default_value();
// 2. String replace all with the given value within this.
string_replace_all(value);
string_replace_all(value.to_utf8_but_should_be_ported_to_utf16());
}
// https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element:concept-form-reset-control