Commit Graph

33926 Commits

Author SHA1 Message Date
Andreas Kling
a12d28fd30 LibWeb: Implement CSSStyleDeclaration.parentRule
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).
2024-06-14 20:45:37 +02:00
Tim Ledbetter
ec4d29849d LibWeb: Support finding text split across multiple text nodes
Previously, the find in page function would fail to find text which was
split across multiple text nodes. For example, given the following
markup: `WH<span>F` the query `WHF` would previously fail to be
matched.

This is done by traversing all of the document's text nodes -
constructing a complete string to query against and keeping track of
the locations where that string is split across multiple nodes.
2024-06-14 16:55:39 +02:00
circl
d2f9ba7db1 Revert "LibWeb: Use memcpy() in CanvasRenderingContext2D.getImageData()"
This reverts commit 59cb7994c6.

This change caused a bug where getImageData returned the image in
BGRA8888 format instead of RGBA8888.
2024-06-14 16:54:32 +02:00
Andreas Kling
60a05ef414 LibJS/Bytecode: Give TypeofBinding instructions a lookup cache
These can use an EnvironmentCoordinate for caching, just like normal
binding lookups. Saves a bunch of time for repeated typeof checks.
2024-06-14 16:08:02 +02:00
Andreas Kling
4302e07346 LibJS/Bytecode: Rename TypeofVariable => TypeofBinding 2024-06-14 16:08:02 +02:00
Andreas Kling
9d21d88374 LibJS: Allow let and const to create locals in global code
This is actually safe everywhere but in the topmost program scope.
For web compatibility reasons, we have to flush all top-level bindings
to the environment, in case a subsequent separate <script> program
comes looking for them.
2024-06-14 16:08:02 +02:00
Andreas Kling
0aa8cb7dac LibJS/Bytecode: Display local variable names in bytecode dumps
Instead of displaying locals as "locN", we now show them as "name~N".
This makes it a lot easier to follow bytecode dumps, especially in
longer functions.

Note that we keep displaying the local index, to avoid confusion in case
there are multiple separate locals with the same name in one executable.
2024-06-14 16:08:02 +02:00
Timothy Flynn
fdacf8ebeb LibJS: Link LibLocale publicly to ensure ICU data is available
Linking LibLocale publicly ensures that libicudata.a is also available
in all embedders of LibJS. Otherwise, ICU crashes in hard-to-track-down
ways at runtime when the data is not available.
2024-06-14 14:05:45 +02:00
Aliaksandr Kalenik
57c735dec4 LibGfx: Remove draw_signed_distance_field() in Gfx::Painter
No longer used since we switched to vector paths for checkbox rendering.
2024-06-14 08:00:17 +02:00
Aliaksandr Kalenik
9502926b76 LibWeb: Remove painting command for drawing signed distance field
No longer used since we switched to vector paths for checkbox rendering.
2024-06-14 08:00:17 +02:00
Aliaksandr Kalenik
20c506f597 LibWeb: Replace SDFs with vector paths in CheckBoxPaintable
Initially, SDF rendering was adopted for checkbox rendering because our
vector path renderer had not yet matured. This is no longer the case.
2024-06-14 08:00:17 +02:00
Timothy Flynn
f9a7fc6263 LibLocale: Remove the number formatting data generator
The last user of the remaining data (Intl.DurationFormat) no longer
consumes these APIs.
2024-06-14 07:59:42 +02:00
Timothy Flynn
d634039c10 LibJS: Implement the latest Intl.DurationFormat proposal
The proposal has undergone quite a few normative changes since we last
synced with it. There was a time when it could not be implemented as it
was written, which is no longer the case. The resulting proposal has had
so many changes compared to our implementation, that it wouldn't make
sense to implement them commit-by-commit as we normally do. So instead,
this just implements the HEAD revision of the spec in one pass.
2024-06-14 07:59:42 +02:00
Timothy Flynn
0e5cd2c45a LibLocale: Add a method to access a locale's digital format options
For Intl.DurationFormat, we will need to know a locale's hours-minutes
time separator, minutes-seconds time separator, and whether the locale
prefers digital hours to always display as 2 digits.
2024-06-14 07:59:42 +02:00
Timothy Flynn
98a437d9a8 LibLocale: Initialize TrailingZeroDisplay number format rounding option
This was missed in commit 67f3de2320.
2024-06-14 07:59:42 +02:00
Aliaksandr Kalenik
b2dcdf0096 LibWeb: Use button layout for input elements with button type 2024-06-14 07:58:55 +02:00
Aliaksandr Kalenik
8feaecd5c8 LibWeb: Create BlockContainer layout node for <input type="button">
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.
2024-06-14 07:58:55 +02:00
Tim Ledbetter
572ebe00ea LibWeb: Avoid null dereference when performing mixed content checks
Previously, navigating to or from `about:newtab` caused a crash due to
inadvertent null dereferences when checking whether a request or
response to a request should be blocked as mixed content.
2024-06-14 07:52:18 +02:00
Aliaksandr Kalenik
7a04a95c8a LibWeb+LibGfx: Replace usage of Gfx::PaintStyle in fill{stoke}_commands
...with a struct defined in LibWeb. This is a step towards uncoupling
LibWeb from LibGfx, so we can try third-party libraries for painting.
2024-06-13 20:17:10 +03:00
Diego
6e419db26c LibWasm: Tighten validation algorithm
The big improvement included in this commit is stack height mismatch
validation. There are other minor improvements included (related to the
validation algorithm). The method of supporting stack polymorphism has
changed to be more like the spec, which was necessary for confidently
handling stack height mismatches.

See:
https://webassembly.github.io/spec/core/appendix/algorithm.html
2024-06-13 17:21:23 +02:00
Diego
8217a77728 LibWasm: Refactor validator to use one stack for frame information
Previously, the validator had a lot of extraneous information related to
frames. Now, there's just one stack with all the necessary information
derived from it.
2024-06-13 17:21:23 +02:00
Diego
b92bd12a8e LibWasm: Make loops work
This commit should hopefully allow for `loop.wast` to be run in CI.
2024-06-13 12:15:20 +02:00
Diego
cf7937e369 LibWasm: Make memory.fill fill with single bytes
Previously, `memory.fill` filled memory with 4-byte values, even though
`memory.fill` should fill with just one byte. Also fixes some other
issues with some of the bulk memory instructions, like `memory.init`.
2024-06-13 12:13:18 +02:00
Luke Warlow
ee64684565 LibWeb: Add Contrast preference 2024-06-13 11:18:38 +02:00
Hexeption
2f4668edce LibWeb: Added HTMLLinkElement.as 2024-06-13 07:58:11 +02:00
Timothy Flynn
4b3e26c583 LibJS+LibLocale: Replace calendar weekday information with ICU 2024-06-13 07:42:09 +02:00
Timothy Flynn
9cb1857dc6 LibJS+LibLocale: Replace preferred hour cycle lookups with ICU 2024-06-13 07:42:09 +02:00
Timothy Flynn
e2bffe5612 LibJS+LibLocale: Replace time zone display names with ICU 2024-06-13 07:42:09 +02:00
Timothy Flynn
273694d8de LibJS+LibLocale: Replace date-time formatting with ICU
This uses ICU for the Intl.DateTimeFormat `format` `formatToParts`,
`formatRange`, and `formatRangeToParts`.

This lets us remove most data from our date-time format generator. All
that remains are time zone data and locale week info, which are relied
upon still for other interfaces. So they will be removed in a future
patch.

Note: All of the changes to the test files in this patch are now aligned
with other browsers. This includes:

* Some very incorrect formatting of Japanese symbols. (Looking at the
  old results now, it's very obvious they were wrong.)
* Old FIXMEs regarding range formatting not including the start/end date
  when only time fields were requested, but the dates differ.
* Day period inconsistencies.
2024-06-13 07:42:09 +02:00
Tim Ledbetter
2f5cf8ac20 LibIDL+LibWeb: Mark [FIXME] interfaces as [[Unimplemented]]
Methods and attributes marked with [FIXME] are now implemented as
direct properties with the value `undefined` and are marked with the
[[Unimplemented]] attribute. This allows accesses to these properties
to be reported, while having no other side-effects.

This fixes an issue where [FIXME] methods broke feature detection on
some sites.
2024-06-11 16:33:30 +02:00
Tim Ledbetter
88d425f32b LibJS: Add the [[Unimplemented]] attribute
Properties marked with the [[Unimplemented]] attribute behave as normal
but invoke the `VM::on_unimplemented_property_access callback` when
they are accessed.
2024-06-11 16:33:30 +02:00
circl
990cf9b4e9 LibWeb: Use viewport position for did_enter_tooltip_area
This now matches the behavior of did_request_link_context_menu and
friends. Previously the coordinates relative to the page rather than
viewport were sent to the chrome.
2024-06-11 09:51:39 +02:00
Diego
d20f1a99f8 LibWasm: Validate imports 2024-06-11 02:43:55 +02:00
Tim Ledbetter
1a4b042664 LibURL: Convert ASCII only URLs to lowercase during parsing
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.
2024-06-10 20:34:57 -04:00
Tim Ledbetter
e9f34c7bd1 LibWebView: Don't query public suffix list when sanitizing URLs
Previously, part of the procedure we used to sanitize URLs entered via
the command line would check the host against the public suffix
database. This led to some valid, but not publicly accessible URLs
being treated as invalid.
2024-06-10 20:34:57 -04:00
Diego
94c2b85959 LibWasm: Validate that function and code sections match 2024-06-11 01:45:12 +02:00
Diego
67749300c3 LibWasm: Validate that data section exists for some instructions 2024-06-11 01:45:12 +02:00
Diego
a7b1a9ded7 LibWasm: Disallow multiple start sections 2024-06-11 01:45:12 +02:00
Diego
3d7c824607 LibWasm: Make sure no duplicate export names are possible 2024-06-11 01:45:12 +02:00
Diego
e64ac8c177 LibWasm: Validate number of data sections 2024-06-11 01:45:12 +02:00
circl
a9f3afc29b LibAudio: Remove support for Serenity's AudioServer 2024-06-10 13:53:01 +02:00
circl
c169e43e13 Userland: Remove some SerenityOS checks 2024-06-10 13:53:01 +02:00
Timothy Flynn
3b68bb6e73 LibJS: Store Intl mathematical values as strings when appropriate
The IntlMV is meant to be arbitrarily precise. If the user provides a
string value to be formatted, we lose precision by converting extremely
large values to a double. We were never able to address this, as support
for arbitrary precision was a big FIXME. But ICU can handle it by just
passing the raw string on through.
2024-06-10 13:51:51 +02:00
Timothy Flynn
f6bee0f5a8 LibJS+LibLocale: Replace number range formatting with ICU
This uses ICU for the Intl.NumberFormat `formatRange` and
`formatRangeToParts` prototypes.

Note: All of the changes to the test files in this patch are now aligned
with both Chrome and Safari.
2024-06-10 13:51:51 +02:00
Timothy Flynn
67f3de2320 LibJS+LibLocale: Begin replacing number formatting with ICU
This uses ICU for the Intl.NumberFormat `format` and `formatToParts`
prototypes. It does not yet port the range formatter prototypes.

Most of the new code in LibLocale/NumberFormat is simply mapping from
ECMA-402 types to ICU types. Beyond that, the only algorithmic change is
that we have to mutate the output from ICU for `formatToParts` to match
what is expected by ECMA-402. This is explained in NumberFormat.cpp in
`flatten_partitions`.

This lets us remove most data from our number format generator. All that
remains are numbering system digits and symbols, which are relied upon
still for other interfaces (e.g. Intl.DateTimeFormat). So they will be
removed in a future patch.

Note: All of the changes to the test files in this patch are now aligned
with both Chrome and Safari.
2024-06-10 13:51:51 +02:00
Aliaksandr Kalenik
cbd566a354 LibWeb+WebContent: Move PageClient::paint() into TraversableNavigable
This way we leak less LibWeb implementation details into WebContent.
2024-06-10 14:30:20 +03:00
Aliaksandr Kalenik
c7133faf26 LibWeb: Rename Navigable::paint() to record_painting_commands()
This method does not paint, but only records painting commands that
could be passed to painting commands executor, which will perform
actual painting.
2024-06-10 14:30:20 +03:00
Kenneth Myhra
e70886595a LibWeb: Implement and wire up TransformStream's cancel callback 2024-06-09 21:27:26 -04:00
Kenneth Myhra
6d7885e250 LibWeb: Update steps for transform_stream_default_sink_abort_algorithm
Updating these steps enables the writable side of a TransformStream to
raise the cancel callback when it's aborted.
2024-06-09 21:27:26 -04:00
Kenneth Myhra
38142eaf53 LibWeb: Update cancel_algorithm steps in AO initialize_transform_stream 2024-06-09 21:27:26 -04:00