Commit graph

63580 commits

Author SHA1 Message Date
Andreas Kling
ddbfac38b0 LibWeb: Note what's causing a style invalidation to happen
You can now build with STYLE_INVALIDATION_DEBUG and get a debug stream
of reasons why style invalidations are happening and where.

I've rewritten this code many times, so instead of throwing it away once
again, I figured we should at least have it behind a flag.
2024-09-08 09:45:31 +02:00
Andreas Kling
1f5c49f40d LibWeb: Make CSS::is_inherited_property(PropertyID) go fast
Instead of switching on the PropertyID and doing a boatload of
comparisons, we reorder the PropertyID enum so that all inherited
properties are in two contiguous ranges (one for shorthands,
one for longhands).

This replaces the switch statement with two simple range checks.

Note that the property order change is observable via
window.getComputedStyle(), but the order of those properties is
implementation defined anyway.

Removes a 1.5% item from the profile when loading https://hemnet.se/
2024-09-08 09:45:31 +02:00
Jamie Mansfield
0fab3d3b62 LibWeb: MathMLElement includes ElementCSSInlineStyle
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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-09-07 19:44:56 +02:00
Jamie Mansfield
48366ddddf LibWeb/WebAssembly: Use a debug flag for dbgln calls
This prevents the horrendous console spam when functions are resolved,
e.g. on the Royal Albert Hall website.
2024-09-07 19:44:23 +02:00
Andreas Kling
b10016d914 LibWeb+LibGfx: Optimize generation of alpha mask from bitmap
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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
It would be nice if we could somehow move this work to the GPU, but even
with some basic local optimization (mostly coalescing bounds checks and
inlining pixel data access), this knocks a 13% item down to 9% in a
profile of loading https://vercel.com/
2024-09-07 14:35:29 +02:00
Andreas Kling
f647d190a3 LibWeb: Avoid synchronous layout when getting scroll box of root element
When accessed on the root/document element, the following properties are
derived from the viewport, not layout-dependent metrics:

- scrollLeft
- scrollTop
- scrollWidth
- scrollHeight

We now avoid synchronous layout in such cases. This was causing some
unnecessary layout work when loading https://vercel.com/
2024-09-07 14:35:29 +02:00
Tim Ledbetter
b140206a91 LibWeb: Don't crash when calling getBBox() on the outermost SVG element 2024-09-07 14:35:02 +02:00
Tim Ledbetter
7a26de7464 LibWeb: Allow SVGElement.ownerSVGElement to cross shadow boundary 2024-09-07 14:35:02 +02:00
Andreas Kling
44e4ea3d7a LibWeb: Cache the qualified layer name in CSSRule
This makes cascade layer filtering take <2% of CPU time when loading
https://vercel.com instead of 30%.
2024-09-07 13:23:55 +02:00
Andreas Kling
95bd0602ba LibWeb: Keep custom properties from all cascade layers
Before this change, we were cascading custom properties for each layer,
and then replacing any previously cascaded properties for the element
with only the set from this latest layer.

The patch fixes the issue by making each pass of the custom property
cascade add to the same set, and then finally assigning that set of
properties to the element.
2024-09-07 12:37:15 +02:00
Andrew Kaster
237bcbff36 LibWeb: Add ServiceWorker discarded flag to ESO
Looking at the spec it doesn't seem like there's a chance for a service
worker client to be an environment but not an environment settings
object. In the case that that changes in the implementation, we can
move it.
2024-09-07 11:37:49 +02:00
Andrew Kaster
0ece40c466 LibWeb: Add service worker client to ServiceWorkerContainer 2024-09-07 11:37:49 +02:00
Andrew Kaster
ade4fc1779 LibWeb: Remove obsolete PlatformObject::global_object() API 2024-09-07 11:37:49 +02:00
Andrew Kaster
02a56f6480 LibWeb: Remove uses of obsolete PlatformObject::global_object()
This API is a relic from the time when it was important for objects to
have easy access to the Window, and to know it was the global object.

We now have more spec-related concepts like relevant_global_object and
current_global_object to pull the Window out of thin air.
2024-09-07 11:37:49 +02:00
Andrew Kaster
4df280689b LibWeb: Add oncontrollerchange to ServiceWorkerContainer 2024-09-07 11:37:49 +02:00
Andrew Kaster
2667726b74 LibWeb: Add WorkerNavigator.serviceWorker API
This simply adds a ServiceWorkerContainer object to the WorkerNavigator.
2024-09-07 11:37:49 +02:00
Tim Ledbetter
7c953552b7 UI: Add the --disable-scripting option to disable scripting by default 2024-09-07 11:37:41 +02:00
Tim Ledbetter
256b56dde8 UI/AppKit: Disable popup blocking on startup if --allow-popups is set 2024-09-07 11:37:41 +02:00
Gingeh
74e12a9c97 LibWeb: Add tests for ellipses with varying angles and directions 2024-09-07 11:11:31 +02:00
Gingeh
1b8c0cd368 LibWeb: Fix rendering of counter-clockwise arcs 2024-09-07 11:11:31 +02:00
Timothy Flynn
40db0848d5 UI/AppKit: Implement the Inspector's cookie context menu 2024-09-07 11:10:27 +02:00
Timothy Flynn
a011aceeba UI/Qt: Implement the Inspector's cookie context menu 2024-09-07 11:10:27 +02:00
Timothy Flynn
fc809f9755 LibWebView: Add context menu support to the Inspector's cookie table
The menu can currently support deleting a specific cookie or all cookies
for the current page.
2024-09-07 11:10:27 +02:00
Timothy Flynn
3c5650f846 LibWebView: Add a storage tab to the Inspector to manage cookies
This adds a storage tab which contains just a cookie viewer for now. In
the future, storage like Local Storage and Indexed DB can be added here
as well.

In this patch, the cookie table is read-only.
2024-09-07 11:10:27 +02:00
Timothy Flynn
693af180dd LibWebView: Ensure manually expired cookies are purged from the database
Cookies are typically deleted by setting their expiry time to an ancient
time stamp (i.e. this is how WebDriver is required to delete cookies).

Previously, we would update the cookie in the cookie jar, which would
mark the cookie as dirty. We would then purge expired cookies from the
jar's transient storage, which removed the cookie from the dirty list.
If the cookie was also in the persisted storage, it would never become
expired there as it was no longer in the dirty list when the timer for
synchronization fired.

Now, we don't remove any cookies from the transient dirty list when we
purge expired cookies. We hold onto the dirty cookie until sync time,
where we now update the cookie in the persisted storage *before* we
delete expired cookies.
2024-09-07 11:10:27 +02:00
Timothy Flynn
2c35e272ba LibWebView: Migrate the Inspector's HTML to its own HTML file
It's getting a bit unwieldy to maintain as an inlined string. Move it to
its own file so it can be edited with syntax highlighting and other IDE
features.
2024-09-07 11:10:27 +02:00
Timothy Flynn
440f40fde6 LibWebView: Clear the style and font tabs when the Inspector is reset 2024-09-07 11:10:27 +02:00
Timothy Flynn
5233f9c8e6 LibWeb: Disable worker-blob and worker-location tests for now
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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
These frequently time out on macOS CI.
2024-09-06 16:58:52 -04:00
Timothy Flynn
28f27ff1c4 LibWebView+LibUnicode: Remove (nearly) unused GeneratorUtil header
This header held a bunch of utility functions shared across several code
generators. The only user of any of these utilities now is the public
suffix generator. Move the one used function to that generator, and
remove the common header.
2024-09-06 16:36:20 -04:00
Timothy Flynn
5eda629326 LibUnicode: Remove unused emoji support methods 2024-09-06 15:42:33 -04:00
Aliaksandr Kalenik
0244859ab7 LibGfx+Ladybird: Remove unused Emoji.h and Emoji.cpp 2024-09-06 16:56:20 +02:00
Aliaksandr Kalenik
eb7e12887e LibGfx: Remove unused ScaledFont::glyph_or_emoji_width() 2024-09-06 16:56:20 +02:00
Aliaksandr Kalenik
8502420401 LibWeb: Use glyph run to get position in text_index_at()
There is no need to use actual string when glyph run already has all
necessary info to find position at specified offset.
2024-09-06 16:56:20 +02:00
sideshowbarker
6f5d0de5e7 Tests: Add some colorful pass/fail emoji to a test case
This change adds green and red pass/fail emoji indicators to an in-tree
test — to make it easier to manually scan through the test results and
quickly see which cases are passing, and which are failing.
2024-09-06 16:55:57 +02:00
sideshowbarker
a924e8747a Tests: Add an in-tree test for ARIA attribute reflection
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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
This is a straightforward port to our test harness of the WPT test at
https://wpt.fyi/results/html/dom/aria-attribute-reflection.html
2024-09-06 13:34:40 +01:00
sideshowbarker
e86711a5b7 LibWeb: Make aria-relevant and ariaRelevant reflect
This change makes the aria-relevant content attribute the ariaRelevant
IDL/DOM attribute get reflected — which makes the Ladybird behavior
interoperable with the implemented behavior in other existing engines.

Otherwise, without this change, Ladybird fails the relevant test case in
https://wpt.fyi/results/html/dom/aria-attribute-reflection.html — which
other existing engines all pass.
2024-09-06 13:34:40 +01:00
Aliaksandr Kalenik
4e9d6a543a Everywhere: Remove bitmap emojis inherited from SerenityOS
These are no longer used since we switched to using the system emoji
font.
2024-09-06 08:30:30 -04:00
Aliaksandr Kalenik
ec315667f0 LibGfx+LibWeb: Remove DrawEmoji variant in GlyphRun
It was needed to support bitmap emoji rendering but no longer used after
switching to Skia+HarfBuzz for text rendering.
2024-09-06 08:30:30 -04:00
Aliaksandr Kalenik
22b8380e37 LibWeb: Include system emoji font in a font cascade list
Adds emoji rendering support on macOS and linux (if it has "Noto Color
Emoji" font).
2024-09-06 08:30:30 -04:00
Aliaksandr Kalenik
c88e76add7 LibGfx: Load fonts with .ttc extension in FontDatabase
That's required for emoji support on macOS where "Apple Color Emoji"
font has TrueType Collection format.
2024-09-06 08:30:30 -04:00
Aliaksandr Kalenik
67fe8d66b2 LibWeb: Skip font if it doesn't contain needed glyph in FontCascadeList
Before this change, we were only checking for actual glyph containment
in a font if unicode ranges were specified. However that is not
sufficient for emoji support, where we want to continue searching for
a font until one containing emojis is found.
2024-09-06 08:30:30 -04:00
Tim Ledbetter
107549dc86 LibWeb/WebDriver: Align execute script methods with the specification
This change updates `ExecuteScript::execute_script()` and
`ExecuteScript::execute_script()` to bring their behavior in line with
each other and the current specification text.

Instances of the variable `timeout` have also been renamed to
`timeout_ms`, for clarity.
2024-09-06 09:54:16 +02:00
Sam Atkins
a50da405e9 LibWeb/CSS: Implement cascade layers (aka @layer)
This is done quite simply for now, there are certainly optimizations
that can and should be made later.

With this we now pass:
- http://wpt.live/css/css-cascade/layer-basic.html
- http://wpt.live/css/css-cascade/layer-important.html
- http://wpt.live/css/css-cascade/layer-statement-copy-crash.html
- http://wpt.live/css/css-cascade/layer-stylesheet-sharing-important.html
- http://wpt.live/css/css-cascade/layer-stylesheet-sharing.html
- http://wpt.live/css/css-cascade/layer-vs-inline-style.html
2024-09-06 07:49:55 +02:00
Sam Atkins
cbb4be3e5e LibWeb/CSS: Replace style-rule iteration methods with a generic one
I didn't want to add another set of boilerplatey tree-walking methods,
so here's a general-purpose one. :^)

`for_each_effective_rule()` walks the tree of effective style rules, and
runs the callback on each one, in either pre- or postorder.  The
previous `for_each_effective_style/keyframes_rule()` methods of
`CSSStyleSheet` are then reimplemented in terms of
`for_each_effective_rule()`, and we can get rid of their equivalents
elsewhere.
2024-09-06 07:49:55 +02:00
Sam Atkins
4c98906e2c LibWeb/CSS: Parse @layer rules
This causes us to pass all of
http://wpt.live/css/css-cascade/parsing/layer.html :^)
2024-09-06 07:49:55 +02:00
Sam Atkins
1c6133aa52 LibWeb/CSS: Add CSSOM types for @layer rules
Depending on usage, `@layer` has two forms, with two different CSSOM
types. One simply lists layer names and the other defines a layer with
its contained rules.
2024-09-06 07:49:55 +02:00
Timothy Flynn
bf9d05d97a LibWeb: Re-assign cmd+arrow key events to home/end keys on macOS
In text documents, pressing the left/right arrow keys with the cmd key
pressed should be treated as home/end key presses.
2024-09-06 07:42:59 +02:00
Timothy Flynn
a0072f422a LibWeb: Support jumping across word boundaries in text nodes
This also supports holding shift to modify the selection.
2024-09-06 07:42:59 +02:00
Timothy Flynn
ecf2cc600b LibWeb: Add Document helpers to move its cursor to word boundaries
This implementation is based on the same feature I added to Serenity's
TextEditor:

https://github.com/SerenityOS/serenity/pull/17477
2024-09-06 07:42:59 +02:00
Timothy Flynn
eece7697fd LibWeb: Rename CharacterData's segmenter indicate it is for graphemes
We will be adding a word segmenter as well, so this is to disambiguate
the two.
2024-09-06 07:42:59 +02:00