mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-06 16:19:40 +00:00
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
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:
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
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/StringConversions.h>
|
||||
#include <AK/Utf16String.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
#include <math.h>
|
||||
|
@ -283,7 +284,7 @@ fraction_exit:
|
|||
value *= pow(10, exponent);
|
||||
}
|
||||
|
||||
conversion: {
|
||||
conversion:
|
||||
// 15. Conversion: Let S be the set of finite IEEE 754 double-precision floating-point values except −0,
|
||||
// but with two special values added: 2^1024 and −2^1024.
|
||||
if (!isfinite(value)) {
|
||||
|
@ -305,6 +306,14 @@ conversion: {
|
|||
// 18. Return rounded-value.
|
||||
return rounded_value;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values
|
||||
Optional<double> parse_floating_point_number(Utf16String const& string)
|
||||
{
|
||||
// FIXME: Implement a UTF-16 GenericLexer.
|
||||
if (!string.has_ascii_storage())
|
||||
return {};
|
||||
return parse_floating_point_number(string.ascii_view());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-floating-point-number
|
||||
|
@ -340,6 +349,15 @@ bool is_valid_floating_point_number(StringView string)
|
|||
return lexer.tell_remaining() == 0;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-floating-point-number
|
||||
bool is_valid_floating_point_number(Utf16String const& string)
|
||||
{
|
||||
// FIXME: Implement a UTF-16 GenericLexer.
|
||||
if (!string.has_ascii_storage())
|
||||
return false;
|
||||
return is_valid_floating_point_number(string.ascii_view());
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<String> convert_non_negative_integer_to_string(JS::Realm& realm, WebIDL::Long value)
|
||||
{
|
||||
if (value < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue