Commit graph

65412 commits

Author SHA1 Message Date
Andreas Kling
26f32b11f9 LibWeb: Avoid expensive Vector filtering in event loop
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
Instead of collecting all documents in a big vector and then filtering
the vector (twice!) with remove_all_matching(), we now pass a filter
callback to documents_in_this_event_loop_matching() and avoid all the
extra shuffling work.

Saw this stuff hogging ~20% of CPU time when profiling a WebContent
process in the middle of a WPT run.
2024-11-24 17:17:01 +01:00
Jeremia Dominguez
eafa70331d LibWeb/Layout: Simplified margin collapsing
Rather than accumulating margins into a vector, and then looping through
them when resolving the margin, it's much simpler to just update two
fields, and sum them when resolving.
2024-11-24 14:45:28 +01:00
Psychpsyo
6f52064c4f LibWeb: Make SVGs respect their CSS transforms 2024-11-24 14:30:32 +01:00
Milo van der Tier
15741350ba LibWeb: Make replaceData create new surrogate pairs
When inserting a new utf-16 surrogate next to an existing surrogate
with replaceData, the surrogates would not get merged correctly into a
single code point. This is because internally the text data is stored
as utf-8, and the two surrogates would be converted seperately. This
has now been fixed by first recreating the whole string in utf-16 and
then converting it back to utf-8.

It's not the most efficient solution, but this fixes at least 6 WPT
subtests.
2024-11-24 13:04:06 +00:00
Andreas Kling
01f4bbbba7 LibWeb: Abandon Node.replaceChild() if removal rejigs the DOM
This isn't directly in the spec, but since replaceChild is implemented
in terms of remove + insert, the removal step may cause arbitrary code
to execute, and so we have to verify that the replaceChild inputs still
make sense afterwards, before doing the insertion.

This roughly matches what WebKit does, and makes a bunch of HTML parsing
tests in WPT stop asserting.
2024-11-24 11:45:23 +01:00
Andreas Kling
5c70436cb2 LibWeb: Teach more of HTMLTokenizer to stop at the insertion point
In particular, input character lookahead now knows how to stop at the
insertion point marker if needed.

This makes it possible to do amazing things like having document.write()
insert doctypes one character at a time.
2024-11-24 11:45:23 +01:00
Timothy Flynn
82b540e501 LibJS: Implement Temporal.PlainDate.prototype.toPlainDateTime 2024-11-24 11:43:59 +01:00
Timothy Flynn
d22ea4db4c LibJS: Implement Temporal.PlainDateTime.prototype.valueOf 2024-11-24 11:43:59 +01:00
Timothy Flynn
649328fed2 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainDate/Time 2024-11-24 11:43:59 +01:00
Timothy Flynn
990daaf63a LibJS: Implement Temporal.PlainDateTime.prototype.with* methods
Includes with, withCalendar, and withPlainTime.
2024-11-24 11:43:59 +01:00
Timothy Flynn
e3082b5bed LibJS: Implement Temporal.PlainDateTime.prototype.round 2024-11-24 11:43:59 +01:00
Timothy Flynn
906d951104 LibJS: Implement Temporal.PlainDateTime.prototype.since/until 2024-11-24 11:43:59 +01:00
Timothy Flynn
85ffacacde LibJS: Implement Temporal.PlainDateTime.prototype.add/subtract/equals 2024-11-24 11:43:59 +01:00
Timothy Flynn
d314fcce7a LibJS: Implement stringification Temporal.PlainDateTime prototypes 2024-11-24 11:43:59 +01:00
Timothy Flynn
1a80161011 LibJS: Fix Temporal.PlainMonthDay.prototype.calendarId references
Small mistake porting old Temporal tests to the new spec. This getter
was `.calendar` in the old Temporal spec.
2024-11-24 11:43:59 +01:00
Timothy Flynn
029b6ad1a8 LibJS: Implement the Temporal.PlainDateTime constructor
And the simple Temporal.PlainDateTime.prototype getters, so that the
constructed Temporal.PlainDateTime may actually be validated.
2024-11-24 11:43:59 +01:00
Kenneth Myhra
a61cdeba24 LibWeb: Switch to using TemporaryExecutionContext
TemporaryExecutionContext has support to prepare for callbacks so we can
use it here now instead of setting this up manually.
2024-11-24 11:12:08 +01:00
Kenneth Myhra
968c38e54f LibWeb: Implement FetchController::abort() 2024-11-24 11:11:44 +01:00
Kenneth Myhra
4c5019f89c LibWeb: Add serialization and deserilization steps to DOMException
This makes DOMException a Serializable object.
2024-11-24 11:11:44 +01:00
Kenneth Myhra
490c05ef29 LibWeb: Make create_serialized_type() in-fallible
The ::create() functions have all been converted into in-fallible
versions so there is no longer any point in create_serialized_type()
being fallible.
2024-11-24 11:11:44 +01:00
Kenneth Myhra
53394230ca LibWeb: Reorganize definitions and includes to avoid circular references
This is necessary to avoid a circular reference when including
Serializable.h in DOMException.h.

This moves the definition of SerializationRecord, SerializationMemory,
and DeserializationMemory into LibWeb/Forward.h so that Serializable.h
only needs to include LibWeb/Forward.h.
2024-11-24 11:11:44 +01:00
Kenneth Myhra
4569b997a6 LibWeb: Add missing spec links for pipe_through() and pipe_to() 2024-11-24 11:11:44 +01:00
Psychpsyo
1d44df74f7 LibWeb: Stop zero-area children from causing scrollable overflow 2024-11-24 11:10:47 +01:00
Marc Jessome
efcaf991e6 LibRegex: Ensure nested capture groups have non-conflicting names
Take record of the named capture group prior to parsing the group's
body. This requires removal of the recorded minimum length of the named
capture group directly, and now needs to be looked up via the group
minimu lengths table.
2024-11-24 10:26:09 +01:00
Timothy Flynn
e37c9eaeff LibJS: Implement Temporal.PlainTime.prototype.valueOf
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
2024-11-23 19:35:36 -05:00
Timothy Flynn
d639e9429f LibJS: Implement Temporal.PlainTime.prototype.round/equals 2024-11-23 19:35:36 -05:00
Timothy Flynn
a0df194528 LibJS: Implement Temporal.PlainTime.prototype.with 2024-11-23 19:35:36 -05:00
Timothy Flynn
85eef698b9 LibJS: Implement Temporal.PlainTime.prototype.since/until 2024-11-23 19:35:36 -05:00
Timothy Flynn
1c22011ed6 LibJS: Implement Temporal.PlainTime.prototype.add/subtract 2024-11-23 19:35:36 -05:00
Timothy Flynn
ab3c825fa8 LibJS: Implement stringification Temporal.PlainTime prototypes 2024-11-23 19:35:36 -05:00
Timothy Flynn
66365fef57 LibJS: Implement the Temporal.PlainTime constructor
And the simple Temporal.PlainTime.prototype getters, so that the
constructed Temporal.PlainTime may actually be validated.
2024-11-23 19:35:36 -05:00
Timothy Flynn
971f794127 LibJS: Add and use a BigInt-aware override of BalanceTime
With Temporal.PlainTime, we will need precise results for extremely
large values.
2024-11-23 19:35:36 -05:00
Timothy Flynn
7f3de3be9c LibJS: Capture sub-second nanoseconds as a u64 in FormatTimeString
This is not a plain nanosecond value (which has a range of [0, 999]).
Rather, it is all of the sub-second components added together.
2024-11-23 19:35:36 -05:00
Timothy Flynn
0b59971ef9 LibJS: Reject ambiguous annotated time strings
This missing rejection will be caught by an upcoming Temporal.PlainTime
test.
2024-11-23 19:35:36 -05:00
Timothy Flynn
c83a3db542 LibJS: Handle Temporal.PlainDate in dynamic calendar operations 2024-11-23 19:35:36 -05:00
Andrew Kaster
5be4825504 LibWeb: Report exceptions from custom element upgrades to global object
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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
Push notes / build (push) Waiting to run
2024-11-24 00:15:59 +00:00
Milo van der Tier
54b0476d70 LibWeb: Handle second condition in NamedNodeMap's property names
This removes the FIXME and fixes a WPT subtest.
2024-11-23 23:21:50 +00:00
Psychpsyo
8aaa9324b2 LibWeb: Unapply CSS filters after applying them to SVG 2024-11-23 21:39:50 +00:00
Tim Ledbetter
f378f41526 LibWeb: Use correct comparison logic in NamedNodeMap::get_attribute()
Previously, we were doing a case insensitive comparison, which could
return the wrong result if the attribute name was uppercase.
2024-11-23 21:19:28 +00:00
Jonne Ransijn
a0fb092d94 LibWeb: Transform PaintableBox::hit_test positions
Elements with transforms were tested on their pre-transformed
positions, causing incorrect hits.

Copy the position transformation done in `StackingContext::hit_test`
to ensure that hit tests are done on the _actual_ position.
2024-11-23 22:06:32 +01:00
Jonne Ransijn
d2ca522540 LibWeb: Use is_viewport helper
This method exists precicely to simplify the check being done here,
so lets use it!
2024-11-23 22:06:32 +01:00
Pavel Shliak
6ad93d2b21 UI/Qt: Use Qt-reported dark theme
For Qt >= 6.5, the system theme can be determined reliably, so no
guesswork is needed. A fallback remains for Qt < 6.5, but it is
hacky and less reliable.
2024-11-23 19:53:43 +00:00
Saksham Mittal
ecdb53cca6 LibWeb: Deduplicate opacity code in ApplyFilters
The opacity is still being set separately by using
ApplyOpacity for both CSS and SVG
2024-11-23 20:20:12 +01:00
Saksham Mittal
ab1cf8f89b LibWeb: Use ApplyFilters command for SVGs 2024-11-23 20:20:12 +01:00
Saksham Mittal
8562b0e33b LibWeb: Migrate CSS filter application to new ApplyFilters command
This helps reuse this code in other areas, such as for filters for SVGs
2024-11-23 20:20:12 +01:00
Psychpsyo
628e1d9853 LibWeb: Fix incorrect spec link for the @supports rule 2024-11-23 18:44:38 +00:00
Pavel Shliak
442629064b LibCore: Remove deprecated ElapsedTimer::elapsed()
This follows FIXME in the code.
2024-11-23 19:20:03 +01:00
Andreas Kling
69367194a6 LibWeb: Make HTML tokenizer stop at insertion point after state switch
If we reach the insertion point at the same time as we switch to another
tokenizer state, we have to bail immediately without proceeding with the
next code point. Otherwise we'd fetch the next token, get an EOF marker,
and then proceed as if we're at the end of the input stream, even though
more data may be coming (with more calls to document.write()..)
2024-11-23 19:19:31 +01:00
Andreas Kling
1d554f97de LibWeb: Reset the "stop parsing" flag when entering HTML parser
Otherwise we'll always bail after processing one token, which is not
what we want.
2024-11-23 19:19:31 +01:00
Andreas Kling
7309f2a6f9 LibWeb: Add spec comments to HTML parser's "initial" insertion mode 2024-11-23 19:19:31 +01:00