Commit graph

35416 commits

Author SHA1 Message Date
Andreas Kling
44f672bacf LibIPC: Handle spurious wake-ups on the send queue thread
Fixes #1441
2024-09-21 15:50:11 +02:00
Andreas Kling
a0ed12e839 LibWeb: Always flush character insertions before exiting HTML parser
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 fixes an issue where document.write() with only text input would
leave all the character data as unflushed text in the parser.

This fixes many of the WPT tests for document.write().
2024-09-21 10:05:48 +02:00
Tim Ledbetter
089139f09d LibWeb: Return a WindowProxy from document.defaultView
This aligns our implementation with the most recent specification steps.
2024-09-21 10:05:34 +02:00
Aliaksandr Kalenik
74f6dce9e6 LibWeb: Use Gfx::Painter in CanvasRenderingContext2D::get_image_data()
...instead of directly mutating Gfx::Bitmap.

This change is preparation for using GPU-backend for canvas painting
where direct mutating of backing storage that bypasses painter is no
longer possible.
2024-09-21 08:59:00 +02:00
Timothy Flynn
f0105b473b LibWeb: Iterate over text chunks using a grapheme-aware segmenter
Our current text iterator is not aware of multi-code point graphemes.
Instead of simply incrementing an iterator one code point at a time, use
our Unicode grapheme segmenter to break text into fragments.
2024-09-21 08:57:54 +02:00
Andreas Kling
8543b8ad6a LibWeb: Let style elements remember which StyleSheetList they live in
Instead of trying to locate the relevant StyleSheetList on style element
removal from the DOM, we now simply keep a pointer to the list instead.

This fixes an issue where using attachShadow() on an element that had
a declarative shadow DOM would cause any style elements present to use
the wrong StyleSheetList when removing themselves from the tree.
2024-09-21 08:56:01 +02:00
Andreas Kling
2064be708f LibWeb: Add StyleElementUtils::visit_edges()
Let's do this instead of making embedders visit every field of this
helper class.
2024-09-21 08:56:01 +02:00
Pavel Panchekha
9075f64cac LibWeb: Change inline float clearance to not reset margin collapsing
Some checks are pending
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
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 (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
When a block container has `clear` set and some clearance is applied,
that clearance prevents margins from adjoining and therefore resets
the margin state. But when a floating box has `clear` set, that
clearance only goes between floating boxes so should not reset margin
state. BlockFormattingContexts already do that correctly, and this PR
changes InlineFormattingContext to do the same.

Fixes #1462; adds reduced input from that issue as test.
2024-09-21 01:55:43 +02:00
Andrew Kaster
c77d9a2732 LibWeb: Start implementing serviceWorker.register
This is mostly the fun boilerplate. Actually creating the Job queue
to do the heavy lifting is next.
2024-09-20 22:41:24 +01:00
Andrew Kaster
acd604c5e1 LibWeb: Add a test-only API to spoof the current URL and origin
This is not that easy to use for test developers, as forgetting to set
the url back to its original state after testing your specific API will
cause future navigations to fail in inexplicable ways.
2024-09-20 22:41:24 +01:00
Andrew Kaster
f0270b92f1 LibWeb: Implement StorageKey and related AOs from Storage specification 2024-09-20 22:41:24 +01:00
Andrew Kaster
1d43d5b086 LibWeb: Use proper enums in WorkerOptions dictionary 2024-09-20 22:41:24 +01:00
Andrew Kaster
a0c07d1bb2 LibWeb: Add stub of ServiceWorker interface 2024-09-20 22:41:24 +01:00
Annya
75c7dbc5d2 LibWeb: Implement Range's extension method
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 patch implements `Range::getClientRects` and
`Range::getBoundingClientRect`. Since the rects returned by invoking
getClientRects can be accessed without adding them to the Selection,
`ViewportPaintable::recompute_selection_states` has been updated to
accept a Range as a parameter, rather than acquiring it through the
Document's Selection.

With this change, the following tests now pass:

- wpt[css/cssom-view/range-bounding-client-rect-with-nested-text.html]
- wpt[css/cssom-view/DOMRectList.html]

Note: The test
"css/cssom-view/range-bounding-client-rect-with-display-contents.html"
still fails due to an issue with Element::getClientRects, which will
be addressed in a future commit.
2024-09-20 19:58:20 +02:00
Kevin Perdlich
a3472aef24 LibJS: Extend supported date string formats 2024-09-20 12:20:11 -04:00
Ali Mohammad Pur
5ac0e81c4a LibLine: Correctly slice completion substrings as unicode strings
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
Ports a fix from Serenity's LibLine.
cee0d979cc
2024-09-20 06:57:09 -04:00
Tim Ledbetter
087fcb84cb LibWeb: Don't crash when resolving grid properties of inline elements
Previously, attempting to get the computed value for a
grid-template-rows or grid-template-columns property would cause a
crash for inline elements.
2024-09-20 08:16:33 +02:00
ronak69
96335f31d5 LibWebView: Do floating-point-error-free zoom calculation using rounding
The current min/max zoom levels are supposed to be: 30% and 500%.
Before, due to floating point error accumulation in incremental addition
of zoom-step into zoom-level, one extra zoom step would get allowed,
enabling user to zoom 20%-to-510%.

Now, using rounding, the intermediate zoom-level values should be as
close to the theoretical value as FP32 can represent. E.g. zoom-level of
70% (theoretical multiplier 0.7) is 0.69... .
2024-09-20 07:15:02 +01:00
Aliaksandr Kalenik
15c47dc623 Meta+LibWeb: Update Skia to version 129 2024-09-19 14:07:16 -04:00
Aliaksandr Kalenik
f25676dea1 LibWeb: Remove workaround for header conflict in DisplayListPlayerSkia
No longer needed after we added AK prefix for Duration and FixedPoint.
2024-09-19 14:07:16 -04:00
Timothy Flynn
3332230cef LibWebView+WebContent+headless-browser: Make the page info IPCs async
The IPCs to request a page's text, layout tree, etc. are currently all
synchronous. This can result in a deadlock when WebContent also makes
a synchronous IPC call, as both ends will be waiting on each other.

This replaces the page info IPCs with a single, asynchronous IPC. This
new IPC is promise-based, much like our screenshot IPC.
2024-09-19 18:07:17 +02:00
Andreas Kling
3ef0fc89b3 RequestServer: Fix assertion on exit when curl had pending timeouts
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
If we already destroyed our timer during destruction, and then curl
tries to flush its timeouts when we tear down the multi, we can just
ignore the timer callbacks.
2024-09-19 11:45:15 +02:00
Andreas Kling
3e6448efcf RequestServer: Use CURLOPT_PRIVATE to store pointer to our own data
This is a lot nicer than scanning through our list of requests. :^)
2024-09-19 11:45:15 +02:00
Andreas Kling
6f34758947 LibWeb: Don't invalidate layout tree on all DOM node removals
DOM nodes that didn't have a layout node before being removed from the
DOM are not going to change the shape of the layout tree after being
removed.

Observing this, we can avoid a full layout tree rebuild on some DOM node
removals.

This avoids a bunch of tree building work when loading https://x.com/
2024-09-19 10:12:44 +02:00
Andreas Kling
aa8f17aea4 LibWeb: Rename invalidate_layout() => invalidate_layout_tree()
I believe this is slightly less confusing, since what the function does
is trigger a full layout tree *rebuild*, not just a relayout.
2024-09-19 10:12:44 +02:00
Andreas Kling
e205723b95 RequestServer: Make WebSocket IPC APIs asynchronous
This fixes deadlocking when interacting with WebSockets while
RequestServer is trying to stream downloaded data to WebContent.
2024-09-19 07:37:46 +02:00
Andreas Kling
853a75c4ab RequestServer: Remove download progress updates that nobody used 2024-09-19 07:37:46 +02:00
Andreas Kling
f0fc516cf2 LibIPC: Increase the local socket buffer size to 128 KiB if possible
This makes a big difference on macOS, where the default buffer size
for local sockets is 8 KiB. With bigger buffers, we don't have to
block on IPC nearly as often.
2024-09-19 07:37:46 +02:00
Andreas Kling
4bc5d6a681 LibIPC: Send IPC messages on a secondary thread
To prevent deadlocks when both IPC peers are trying to send to each
other but both sides have too much in their buffer already, we now
move the send operation to a secondary thread where it can block until
the peer is able to handle it.
2024-09-19 07:37:46 +02:00
Andreas Kling
6d91c42214 RequestServer: Remove "dump connection info" mechanism and UI
This is not relevant anymore when we use CURL.
2024-09-19 07:37:46 +02:00
Andreas Kling
e483bb70f0 RequestServer: Use libcurl for HTTP and HTTPS downloads
This replaces the use of our home-grown implementations inherited
from SerenityOS.
2024-09-19 07:37:46 +02:00
Aliaksandr Kalenik
9772afcd29 LibGfx: Remove unused Bitmap::fill() 2024-09-19 06:21:33 +02:00
Aliaksandr Kalenik
a499ece16c LibGfx+LibWeb: Replace usages of Bitmap::fill() with Gfx::Painter
Let's always mutate a bitmap using painter, because Skia likely could
do it faster than our own implementation.
2024-09-19 06:21:33 +02:00
Aliaksandr Kalenik
f2d3f8bc42 LibGfx: Remove unused Gfx::Bitmap scaling functions 2024-09-19 06:21:33 +02:00
Timothy Flynn
e74d2b1762 LibWeb+LibWebView: Set the default path for invalid cookie Path values
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
We were missing this spec step when parsing the Path attribute.
2024-09-19 00:01:56 +01:00
Timothy Flynn
ba1189cd1c LibWeb: Support cookie Max-Age attributes that exceed i64 limits
Attributes have a max value length of 1024. So we theoretically need to
support values in the range -${"9".repeat(1023)} to ${"9".repeat(1024)}.
These obviously do not fit in an i64, so we were previously failing to
parse the attribute.

We will now cap the parsed value to the numeric limits of an i64, after
ensuring that the attribute value is indeed a number.
2024-09-19 00:01:56 +01:00
Timothy Flynn
47e9357243 WebContent: Search all known navigables when WebDriver switches windows
We were only looking at the current top-level navigable and its children
when searching for the specified window handle. We need to search *all*
known navigables if the handle belongs to a window not in the current
tree.
2024-09-19 00:01:56 +01:00
Timothy Flynn
4ce05e5ccf LibWebView: Disable persisted SQL storage when forcing new UI processes
We very much assume that the SQL storage backend runs in a singleton
process. When this is not the case, and multiple UI processes try to
write to the database at the same time, one of them will fail.

Since --force-new-process is a testing mode flag, let's just disable the
SQL backend when that flag is present.
2024-09-19 00:01:56 +01:00
mierenhoop
259e798a26 LibWeb: Implement CanvasDrawPath::isPointInPath() 2024-09-18 21:21:57 +01:00
mierenhoop
18bc5972f4 LibGfx: Add Path::contains()
With this new method, it is possible to check whether a 2D point is
inside of the path.
2024-09-18 21:21:57 +01:00
Sam Atkins
76daba3069 LibWeb/CSS: Rename CalculatedStyleValue -> CSSMathValue
This matches the name in the CSS Typed OM spec. There's quite a lot
still to do to make it match the spec behavior, but this is the first
step.
2024-09-18 20:38:41 +01:00
Sam Atkins
35cb6badc2 LibWeb/CSS: Remove unused checks for calculated dimension types
These are a remnant of when Length itself could hold a pointer to a
CalculatedStyleValue. That hasn't been the case for a long time now.
2024-09-18 20:38:41 +01:00
Tim Ledbetter
779de840af LibWeb: Don't crash when resolving style of grid template properties
Previously, attempting to get the computed value for a
grid-template-rows or grid-template-columns property would cause a crash
if the element had no associated paintable.
2024-09-18 17:38:20 +01:00
Aliaksandr Kalenik
fa907029ee LibWeb: Print FIXME instead of crashing in abspos SVG element layout
Currently we are crashing in `verify_cast<BlockContainer>(box)` on
attempt to create BFC for SVG box.
2024-09-18 15:50:05 +02:00
Sam Atkins
d757c8b78d LibWeb/DOM: Implement spec changes to dir=auto directionality
Computing the "contained text auto directionality" is now its own
algorithm, with an extra parameter, and is additionally called from
step 2.1.3.2 instead of calling "auto directionality".
2024-09-18 15:18:07 +02:00
Sam Atkins
2a5390ef4f LibWeb/DOM: Move "text node directionality" algorithm into DOM::Text 2024-09-18 15:18:07 +02:00
Tim Ledbetter
89b6cd3fb1 LibWeb: Expose crypto object to workers
This change moves the `crypto()` getter from `Window` to
`WorkerOrWindowGlobalScope`. This aligns our implementation with the
WebCrypto specification.
2024-09-18 10:09:01 +02:00
Aliaksandr Kalenik
d6a31d80c0 LibWeb: Resolve floating box's paddings before width calculation
...because calculate_inner_width() assumes layout state has resolved
paddings that could be used to account for "box-sizing: border-box".

Fixes regression introduced in 5f74da6ae8
2024-09-18 10:07:14 +02:00
Tim Ledbetter
21897c8ed0 LibIPC: Wait until socket is writable when transferring IPC messages 2024-09-18 10:06:47 +02:00
Aliaksandr Kalenik
41e37f0079 LibWeb: Use correct resolved type for round() CSS function
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
Function is defined as `round(<rounding-strategy>?, A, B?)`

With this change resolved type is `typeof(resolve(A))`, instead of
`typeof(A)`.

For example `round(up, 20%, 1px)` with 200px percentage basis is now
correctly resolved in 40px instead of 40%.

Progress on https://www.notion.so/ landing page.
2024-09-17 20:02:29 +02:00
Aliaksandr Kalenik
c875cdae64 LibWeb: Avoid layout run to calculate auto height of FC child in BFC
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
Before this change, each BFC child that established an FC root was laid
out at least twice: the first time to perform a normal layout, and the
second time to perform an intrinsic layout to determine the automatic
content height. With this change, we avoid the second run by querying
the formatting context for the height it used after performing the
normal layout.
2024-09-17 07:58:07 +02:00
Aliaksandr Kalenik
5f74da6ae8 LibWeb: Fix "box-sizing: border-box" resolution for abspos items
The `calculate_inner_width()` and `calculate_inner_height()` resolve
percentage paddings using the width returned by
`containing_block_width_for()`. However, this function does not account
for grids where the containing block is defined by the grid area to
which an item belongs.

This change fixes the issue by modifying `calculate_inner_width()` and
`calculate_inner_height()` to use the already resolved paddings from the
layout state. Corresponding changes ensure that paddings are resolved
and saved in the state before box-sizing is handled.

As a side effect, this change also improves abspos layout for BFC where
now paddings are resolved using padding box of containing block instead
of content box of containing block.
2024-09-17 07:56:18 +02:00
Aliaksandr Kalenik
805b0fed13 LibWeb: Use grid area size for abspos grid items alignment
Fixes yet another case of GFC bug, where Node::containing_block() should
not be used for grid items, because their containing block is grid area
which is not represented in layout tree.
2024-09-17 07:51:50 +02:00
Timothy Flynn
fce003a8f5 LibWeb+LibWebView: Implement the latest cookie draft RFC
Some checks are pending
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
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 (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
We currently implement the official cookie RFC, which was last updated
in 2011. Unfortunately, web reality conflicts with the RFC. For example,
all of the major browsers allow nameless cookies, which the RFC forbids.

There has since been draft versions of the RFC published to address such
issues. This patch implements the latest draft.

Major differences include:
* Allowing nameless or valueless (but not both) cookies
* Formal cookie length limits
* Formal same-site rules (not fully implemented here)
* More rules around cookie domains
2024-09-17 00:04:33 +01:00
Timothy Flynn
c7db1204ca WebContent: Protect the switch-to-window endpoint against null BCs
This is one of the few endpoints that does not ensure a top-level BC is
open. It's a bit of an implementation-defined endpoint, so let's protect
against a non-existent BC explicitly.
2024-09-17 00:04:33 +01:00
Timothy Flynn
30ec88dce0 WebContent: Implement the switch-to-parent-frame endpoint 2024-09-17 00:04:33 +01:00
Tim Ledbetter
b4aff45854 LibWeb/WebDriver: Use correct dimensions for WPT reftest screenshots
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
Reftest screenshots are now captured using the dimensions specified in
the draw a bounding box from the framebuffer AO defined in the
WebDriver specification.
2024-09-16 09:11:52 -04:00
Arhcout
b4d996680a LibJS: Allow date format "YYYY-M-DD"
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-15 12:24:39 -04:00
Aliaksandr Kalenik
6481ef821d LibWeb: Use available size in calculate_inner_height()
Although the parameter is named "available size," it is always supposed
to represent the containing block size whenever it has a definite value.
Therefore, it is possible to simply use this value instead of performing
a containing block lookup.

This change actually improves correctness for grid items whose
containing block is defined by the grid area, as
`Node::containing_block()` does not account for this.
2024-09-15 18:00:08 +02:00
Aliaksandr Kalenik
e3499c7953 LibWeb: Use grid area as available space for abspos grid items
Our abspos layout code assumes that available space is containing block
size, so this change aligns us with the spec by using grid area for this
value.

This change does not have attached test because it is required for
upcoming fix in calculate_inner_height() that will reveal the problem.
2024-09-15 18:00:08 +02:00
Aliaksandr Kalenik
ea04500bb2 LibWeb: Remove unreachable abspos width calculation in BFC
compute_width() could never be invoked for abspos boxes because they
are skipped during normal layout and processed in
parent_context_did_dimension_child_root_box()
2024-09-15 16:57:20 +02:00
Aliaksandr Kalenik
17f4ed6ea1 LibGfx+LibWeb: Simplify text shaping API by removing per glyph callback
All places where text shaping happens, the callback is used to simply
append a glyph into the end of glyphs vector. This change removes the
callback parameter and makes the text shaping function return a glyph
run.
2024-09-15 15:42:36 +02:00
Timothy Flynn
60fa3752ee LibWeb+WebContent: Partially implement the switch-to-frame endpoint
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 needed by the cookie tests for WPT.
2024-09-15 00:56:21 +01:00
Timothy Flynn
bf60765903 LibWeb+WebContent: Implement the WebDriver JSON clone steps for elements
This is needed by WPT to serialize NodeList instances.
2024-09-15 00:56:21 +01:00
Timothy Flynn
2dc8cad785 LibWeb+WebContent: Move element reference WebDriver AOs to a helper file
These will be needed outside of WebDriverConnection.cpp.
2024-09-15 00:56:21 +01:00
Timothy Flynn
5fc51b2ff9 WebContent+WebDriver: Update the current BC when switching windows
We had only implemented this step in the WebDriver process, but we need
to update the remote WebContent process as well.
2024-09-15 00:56:21 +01:00
Timothy Flynn
4a6d0e0f90 LibWeb+WebContent: Use the current window to execute WebDriver scripts
Rather than using the page's top-level window, we must use the window
that is currently active in the WebDriver session.
2024-09-15 00:56:21 +01:00
Timothy Flynn
c4da022864 WebContent: Implement the WebDriver concept of current browsing context
When we create a WebDriverConnection object, we currently hand it the
page client for which it was opened, and perform all actions on that
client. However, some WebDriver endpoints change the browsing context
(and therefore page client) on which future commands should be executed.
For example, the switch-frame endpoint will switch the current browsing
context to a frame/iframe context.

This patch implements the current browsing context (and current top-
level browsing context) concepts. They are initialized to that of the
original page. Most of this patch is making sure we execute actions on
the correct context.
2024-09-15 00:56:21 +01:00
Aliaksandr Kalenik
9621439db0 LibWeb: Assign static position for abspos boxes nested into TFC
TFC is not aware of how to correctly calculate a static position for
abspos boxes, but assigning (0, 0) is better than crashing during abspos
item layout.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/1382
2024-09-14 15:04:08 +02:00
Aliaksandr Kalenik
d17f94e7cc LibWeb: Don't create dummy formating context for internal table boxes
Internal table boxes are managed by TFC and do not need a dummy FC. We
still need to keep dummy FC for <math> though.
2024-09-14 15:04:08 +02:00
Arhcout
20f18d6ec2 LibWeb: Defined all the keycodes
I did this to respond to the issue #974.
I changed the other keys to not have problems with two keys having the
same keycode.
2024-09-14 10:38:33 +01:00
Aliaksandr Kalenik
6199870528 LibWeb: Reset a vector of contained abspos before collecting them again
Fixes a bug when a vector with contained absolutely positioned boxes
keeps growing, resulting in more duplicated work on each subsequent
layout.
2024-09-13 16:48:51 +02:00
Timothy Flynn
c2cf65adac WebDriver: Handle script execution results without spinning event loops
We currently spin the platform event loop while awaiting scripts to
complete. This causes WebContent to hang if another component is also
spinning the event loop. The particular example that instigated this
patch was the navigable's navigation loop (which spins until the fetch
process is complete), triggered by a form submission to an iframe.

So instead of spinning, we now return immediately from the script
executors, after setting up listeners for either the script's promise to
be resolved or for a timeout. The HTTP request to WebDriver must finish
synchronously though, so now the WebDriver process spins its event loop
until WebContent signals that the script completed. This should be ok -
the WebDriver process isn't expected to be doing anything else in the
meantime.

Also, as a consequence of these changes, we now actually handle time
outs. We were previously creating the timeout timer, but not starting
it.
2024-09-13 10:11:21 -04:00
Timothy Flynn
6f31a19c5f LibWeb: Spin the HTML event loop when awaiting a navigable fetch
Spinning the HTML event loop allows microtasks to run (i.e. Promise
completions).
2024-09-13 10:11:21 -04:00
Andreas Kling
bdb67d2bcb LibWeb: Use LayoutState::UsedValues::containing_block_used_values() more
Use this cached pointer to the containing block's used values when
obviously possible. This avoids a hash lookup each time, and these
hash lookups do show up in profiles.
2024-09-13 15:59:11 +02:00
Simon Wanner
77610db58c LibWeb: Handle http-equiv pragmas without insertion requirements
These pragmas are either ignored or handled elsewhere
2024-09-13 12:11:07 +02:00
Simon Wanner
d828d80b75 LibWeb: Use correct http-equiv keywords for comparisons
Previously `#keyword` was used in the macro, meaning all keywords
gained `""` around them
2024-09-13 12:11:07 +02:00
Aliaksandr Kalenik
de3c007d79 LibWeb: Fix min-width and max-width resolution for grid items
Change try_compute_width() to check whether min-width/max-width or width
is auto instead of always using `computed_values.width()`.

`grid/min-max-content.html` test is affected but it's progression.
2024-09-13 11:59:51 +02:00
Timothy Flynn
541968b30d LibWeb+LibWebView+WebContent: Return a named enum from UI event handlers
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
UI event handlers currently return a boolean where false means the event
was cancelled by a script on the page, or otherwise dropped. It has been
a point of confusion for some time now, as it's not particularly clear
what should be returned in some special cases, or how the UI process
should handle the response.

This adds an enumeration with a few states that indicate exactly how the
WebContent process handled the event. This should remove all ambiguity,
and let us properly handle these states going forward.

There should be no behavior change with this patch. It's meant to only
introduce the enum, not change any of our decisions based on the result.
2024-09-12 17:38:36 -04:00
Aliaksandr Kalenik
a64d182583 LibWeb: Use grid area as available size for abspos contained in GFC
Fixes incorrect percentage length resolution for abspos boxes contained
by a grid.
2024-09-12 21:07:41 +02:00
Gingeh
1d9c404b8c LibWeb: Don't move focus when setting input value
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-12 11:45:34 +02:00
Jelle Raaijmakers
d29797f118 LibMedia: Add ogg/vorbis support
Technically this supports any ogg/* audio stream, but it was at least
tested successfully on ogg/vorbis :^)
2024-09-12 10:01:19 +02:00
Jelle Raaijmakers
1b267abf36 LibMedia: Link to avformat as well
This allows us to process container formats in future commits.
2024-09-12 10:01:19 +02:00
Jelle Raaijmakers
3bf910706f LibMedia: Remove AudioQueue and UserSampleQueue
Both unused.
2024-09-12 10:01:19 +02:00
Jelle Raaijmakers
7728633906 LibMedia+Utilities: Remove encoders and aconv
We don't use these in Ladybird, so let's get rid of them.
2024-09-12 10:01:19 +02:00
Jelle Raaijmakers
85fd2e281b LibMedia: Absorb LibAudio
LibMedia will be responsible for both audio and video decoding.
2024-09-12 10:01:19 +02:00
Sam Atkins
8b3bcf9c0f LibWeb: Reduce unnecessary debug spam from parse_as_sizes_attribute()
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
Logging a parse error when the attribute is not present, is not useful,
but does fill the debug log with errors that hide any real parsing
errors. This patch introduces an early-out in this situation to prevent
this spam.
2024-09-12 07:39:11 +02:00
Sam Atkins
2a0f6fd23e LibWeb: Bring parse_as_sizes_attribute() up to date with the spec
The following spec algorithms had changed since we implemented them:
- "parse a sizes attribute"
- "update the source set"
- "create a source set"

This commit brings them up to date, as well as adding some additional
logging when parsing the sizes attribute fails in some way.
2024-09-12 07:39:11 +02:00
Sam Atkins
99718653e2 LibWeb/HTML: Implement HTMLImageElement::allows_auto_sizes() 2024-09-12 07:39:11 +02:00
Sam Atkins
2671820ace LibWeb: Move our "default sizing algorithm" function into a public place
Specifically, this is used by the updated algorithm for parsing a sizes
attribute, so we need access to it there.

No behaviour changes.
2024-09-12 07:39:11 +02:00
Aliaksandr Kalenik
143c9581a2 LibWeb: Add a cache for ScrollFrame::cumulative_offset()
Calculating cumulative scroll offset is visible in profiles on very
large pages, so let's add a simple caching for it.
2024-09-12 07:37:19 +02:00
Aliaksandr Kalenik
112dd4af3b LibWeb: Transform ScrollFrame from a struct to a class 2024-09-12 07:37:19 +02:00
Aliaksandr Kalenik
863416e3ac LibWeb: Make FC of containing block responsible for abspos layout
Before this change, a formatting context was responsible for layout of
absolutely positioned boxes whose FC root box was their parent (either
directly or indirectly). This only worked correctly when the containing
block of the absolutely positioned child did not escape the FC root.
This is because the width and height of an absolutely positioned box are
resolved based on the size of its containing block, so we needed to
ensure that the containing block's layout was completed before laying
out an absolutely positioned box.

With this change, the layout of absolutely positioned boxes is delayed
until the FC responsible for the containing block's layout is complete.
This has affected the way we calculate the static position. It is no
longer possible to ask the FC for a box's static position, as this FC's
state might be gone by the time the layout for absolutely positioned
elements occurs. Instead, the "static position rectangle" (a concept
from the spec) is saved in the layout state, along with information on
how to align the box within this rectangle when its width and height are
resolved.
2024-09-12 07:36:32 +02:00
Annya
bea7eec518 LibWeb/CSS: Implement revert-layer
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
With the introduction of the cascade layer, the 5th CSS-wide keyword,
`revert-layer`, has been added.
2024-09-11 22:30:20 +01:00
Asutosh Variar
229b64a4b7 Everywhere: Convert from_string_view -> from_string_literal where static 2024-09-11 10:59:04 +01:00
Aliaksandr Kalenik
4eb16b144e LibWeb: Skip abspos boxes layout in intrinsic sizing mode
Some checks are pending
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
CI / Lagom (false, 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
Absolutely positioned boxes do not affect the size of the formatting
context box they belong to, so it's safe to skip their layout entirely
when calculating intrinsic size.
2024-09-11 07:59:52 +02:00
Aliaksandr Kalenik
90b8bfc04c LibWeb: Save layout mode inside formatting context object
FormattingContext::run() does not allow reentrancy, so it's safe to
save and access layout mode from FC object. This avoids need to drill it
through methods of a formatting context and makes it clear that this
value could never be changed after FC construction.
2024-09-11 07:59:52 +02:00
Aliaksandr Kalenik
623e358d7a LibWeb: Remove box argument from FormattingContext::run()
Root formatting context box is passed into constructor and saved in FC,
so it's possible to access it from there instead of passing the same
box into run().
2024-09-11 07:59:52 +02:00
Tim Ledbetter
67981af276 LibWeb: Don't group radio buttons from different trees together
Previously, we were searching for other radio buttons from the document
root, rather than the element root.
2024-09-11 07:59:29 +02:00
sideshowbarker
51528ec677 LibWeb: Normalize all WebIDL definition lines to four leading spaces
This change takes all existing WebIDL files in the repo that had
definition lines without four leading spaces, and fixes them so they
have four leading spaces.
2024-09-10 21:16:53 +01:00
Tim Ledbetter
f9282f65d3 LibWeb: Treat dates and times with repeated separators as invalid
These would previously be treated as valid by the value sanitization
algorithm.
2024-09-10 15:59:30 -04:00
Tim Ledbetter
0de3145071 LibWeb: Don't crash when determining slot element auto directionality 2024-09-10 15:59:01 -04:00
Tim Ledbetter
1b74104c17 LibWeb: Make input type state change handling specification compliant
This change ensures that the value sanitization algorithm is run and
the text cursor is set to the correct position when the type attribute
of an input is changed.
2024-09-10 16:12:58 +01:00
Tim Ledbetter
2d7547921b LibWeb: Don't crash when normalizing a local datetime with a T separator 2024-09-10 16:12:58 +01:00
Tim Ledbetter
eb4e40bc49 LibWeb: Use correct value when parsing datetime-local input type 2024-09-10 16:12:58 +01:00
Tim Ledbetter
c4b82318f4 LibWeb: Ensure value sanitization algorithm trims whitespace if needed
Previously, the value sanitization algorithm would not trim whitespace
for inputs of type URL or email, if they didn't also contain any
newlines.
2024-09-10 16:12:58 +01:00
Andreas Kling
87056ee0d2 LibWeb: Bucket CSS rules by pseudo-element
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
Instead of throwing all pseudo-element rules in one bucket, let's have
one bucket per pseudo-element.

This means we only run ::before rules for ::before pseudo-elements,
only ::after rules for ::after, etc.

Average style update time on https://tailwindcss.com/ 250ms -> 215ms.
2024-09-10 16:54:40 +02:00
Andreas Kling
d22228ab93 LibWeb: Bail early from doomed pseudo-element style computation
Once we know the final value of the `content` property for a
pseudo-element, we can bail early if the value is `none` or `normal`
(note that `normal` only applies to ::before and ::after).

In those cases, no pseudo-element will be generated, so everything
that follows in StyleComputer would be wasted work.

This noticeably improves performance on many pages, such as
https://tailwindcss.com/ where style updates go from 360ms -> 250ms.
2024-09-10 15:19:55 +02:00
Andreas Kling
e399b472e9 LibWeb: Make CSS::StyleProperties copy-on-write internally
This makes the way we've implemented the CSS `revert` keyword a lot less
expensive.

Until now, we were making a deep copy of all property values at the
start of each cascade origin. (Those are the values that `revert` would
bring us back to if encountered.)

With this patch, the revert property set becomes a shallow copy, and we
only clone the property set if the cascade ends up writing something.

This knocks a 5% profile item down to 1.3% on https://tailwindcss.com
2024-09-10 13:51:28 +02:00
Andreas Kling
af68771dda AK+LibURL: Move CopyOnWrite<T> from LibURL to AK 2024-09-10 13:51:28 +02:00
Douwe Zumker
d6d94ba8cb LibWebView: Add GoogleScholar search engine to selection menu 2024-09-10 10:43:17 +01:00
Gingeh
4a3a9e6ec4 LibWeb: Implement justify-*: left/right 2024-09-10 10:40:07 +01:00
Andreas Kling
80e37db280 LibGfx: Cache the family name in TypefaceSkia
Instead of asking Skia for the family name every time we're called,
just cache the string once and make subsequent calls fast.

This knocks a 3.2% item off the profile entirely on
https://tailwindcss.com (at least on macOS with the CoreText backend)
2024-09-10 11:03:46 +02:00
Andreas Kling
84ec690d90 LibGfx: Cache code point -> glyph ID lookups in TypefaceSkia
This brings back the optimization we had in the old OpenType
implementation where we cache lookup tables for code point / glyph ID
mappings.

This noticeably improves performance on https://tailwindcss.com/ by
knocking an 8% profile item down to 0.2%. :^)
2024-09-10 11:03:46 +02:00
Aliaksandr Kalenik
2aa07e0e65 LibWeb: Do not try to load a font if format detection has failed
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
Skia is more permissive when it comes to font loading, compared to our
own OpenType implementation, which it has superseded, parsing an invalid
TTF does not result in an error but rather produces a font that is
incorrectly displayed. This change updates the FontLoader to address
this behavior and to stop attempting to parse a font as a last resort
when format detection has failed.

Fixes regression on x.com when text is not displayed introduced in
a9d5a99568
2024-09-10 07:40:25 +02:00
sideshowbarker
0601216ac4 LibWeb: Replace tabs with 4 spaces in ARIAMixin.idl
Also, remove blank lines. (https://w3c.github.io/aria/#ARIAMixin source
doesn’t have any blank lines, and it’s not clear that the blank lines in
ours follow any intended structure/logic.)
2024-09-09 21:19:53 -06:00
sideshowbarker
6bf3d34a67 LibWeb: Add CEReactions to all IDL for all ARIA attributes
This change adds the [CEReactions] attributes to all ARIA attributes in
the ARIAMixin WebIDL — as required by the WebIDL in the current spec at
https://w3c.github.io/aria/#ARIAMixin, and by the WPT test case at
http://wpt.live/custom-elements/reactions/AriaMixin-string-attributes.html,
and as implemented in other existing engines.

Otherwise, without this change, Ladybird doesn’t conform to the current
spec, fails all those tests, and isn’t interoperable with other engines.
2024-09-09 20:18:32 -06:00
Aliaksandr Kalenik
ee41dbfec3 LibWeb: Fix wrong assumption that repeat() is always first track [GFC]
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
Fixes crashing in
https://wpt.live/css/css-grid/grid-definition/grid-auto-fit-columns-001.html
2024-09-09 22:05:30 +02:00
Aliaksandr Kalenik
1d7c9cd1e1 LibWeb: Return computed grid-template-rows/columns if there's no used
If grid-template-rows or grid-template-columns queried for a box that is
not a grid container, the result should be computed value instead of
null.

Fixes crashing in inspector.
2024-09-09 20:12:20 +02:00
Andreas Kling
b2aff403fc LibWeb: Make CSSStyleRule::qualified_layer_name() return a const-ref
And also make it inline. We were spending 8% of selector matching on
creating and destroying FlyString copies here. With this change, it's
now ~1%.
2024-09-09 20:12:07 +02:00
Andreas Kling
ef4f5ac8fb LibWeb: Filter :hover selectors early for elements that aren't hovered
Some websites (like vercel.com...) have a *lot* of :hover selectors that
we can simply skip for any element that isn't currently hovered.
2024-09-09 20:12:07 +02:00
Andreas Kling
5bb0f43b90 LibWeb: Bucket :is/where() selectors by tag name and ID as well
Instead of only bucketing these by class name, let's also bucket by
tag name and ID.

Reduces the number of selectors evaluated on https://tailwindcss.com/
from 2.9% to 1.9%.
2024-09-09 20:12:07 +02:00
Andreas Kling
49d2b11085 LibWeb: Remove MatchingRule::contains_root_pseudo_class member
This can be a local variable while building a rule cache, no need to
take up space in MatchingRule.
2024-09-09 20:12:07 +02:00
Andreas Kling
c8f22f65d9 LibWeb: Filter rules to run before allocating vector of matches
By filtering first, we end up allocating much less vector space
most of the time.

This is mostly helpful in pathological cases where there's a huge number
of rules present, but most of them get rejected early.
2024-09-09 20:12:07 +02:00
Noah Bright
ee352e59db WebDriver: Add boilerplate for endpoint 15.7 Perform Actions
Some checks are pending
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
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
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
Following the structure of the ReleaseActions endpoints, define
analogous classes and methods for PerformActions
2024-09-09 14:11:23 +01:00
Tim Ledbetter
3ae4ea7b10 LibWeb: Abort dependent signals before firing abort event
Previously, there was a bug in the specification that would cause an
assertion failure, due to the abort event being fired before all
dependent signals were aborted.
2024-09-09 12:48:30 +02:00
Aliaksandr Kalenik
68fcc37531 LibWeb: Return used values for grid tracks in getComputedStyle()
That's awkward, but getComputedStyle needs to return used track values
for gridTemplateColumns and gridTemplateRows properties. This change
implements it by saving style values with used values into layout state,
so it could be assigned to paintables during LayoutState::commit() and
later accessed by style_value_for_property().

I haven't seen it used in the wild, but WPT grid tests extensively use
it. For example this change helps to go from 0/10 to 8/10 on this test:
https://wpt.live/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
2024-09-09 12:48:06 +02:00
Andreas Kling
34fdd0d44f LibWeb: Include immediate child (>) combinator in ancestor filter
Before this change, the ancestor filter would only reject rules that
required a certain set of descendant strings (class, ID or tag name)
to be present in the current element's ancestor chain.

An immediate child is also a descendant, so we can include this
relationship in the ancestor filter as well.

This substantially improves the efficiency of the ancestor filter on
websites using Tailwind CSS.

For example, https://tailwindcss.com/ itself goes from full style
updates taking ~1400ms to ~350ms. Still *way* too long, but a huge
improvement nonetheless.
2024-09-09 12:46:55 +02:00
Andreas Kling
b365a5c42f LibWeb: Bucket div.foo and div#foo as class/ID rather than tag(div)
By bucketing these seletors by class or ID, we can avoid running them
in more cases.

Before, we were only avoiding them if the context element wasn't a div.
Now we avoid them for any element that doesn't have that specific class
or ID.

This reduces the number of selectors ran on https://vercel.com by a bit
more, from 1.90% to 1.65%.
2024-09-09 12:46:55 +02:00
Andreas Kling
ad37c8cd26 LibWeb: Treat :is(.foo) & :where(.foo) as class selectors when bucketing
These are just roundabout ways of writing .foo, so we can still put them
in the rules-by-class bucket and skip running them when the element
doesn't have that class.

Note that :is(.foo .bar) is also bucketed as a class rule, since the
context element must have the `bar` class for the selector to match.

This is a massive speedup on https://vercel.com/ as it cuts the number
of selectors we actually evaluate from 7.0% to 1.9%.
2024-09-09 12:46:55 +02:00
Aliaksandr Kalenik
4ba38c55d6 LibWeb: Remove unnecessary copying of UsedValues in BFC 2024-09-09 11:41:36 +02:00
Aliaksandr Kalenik
07aa25ce50 LibWeb: Clamp growth limit after adding planned increase in GFC
Fixes implementation of the following line from the spec:
"However, limit the growth of any fit-content() tracks by their
fit-content() argument."

Now we correctly apply a limit to increased growth limit rather than to
the planned increase.

Change in "Tests/LibWeb/Layout/input/grid/fit-content-2.html" is a
progression and "Item as wide as the content." is actually as wide as a
content.
2024-09-09 11:41:10 +02:00
Tim Ledbetter
2c8fb49578 LibWeb: Don't attempt to set selection if control has no selectable text 2024-09-09 11:04:07 +02:00
Timothy Flynn
8d6f36f8d6 LibJS+LibWeb: Add a custom host hook to log unparsed date strings
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 lets us log when our Date.parse implementation was unable to handle
a string found on the web.
2024-09-08 18:25:05 +02:00
Timothy Flynn
921a9cef62 LibJS: Add "month day, year" support to Date.parse
Used on https://rauchg.com.
2024-09-08 18:25:05 +02:00
Aliaksandr Kalenik
10064d0e1a LibJS: Reset in_formal_parameter_context after entering a new function
Fixes a bug when "'Await' expression is not allowed in formal parameters
of an async function" is thrown for "await" encountered in a function
definition assigned to a default function parameter.

Fixes loading of https://excalidraw.com/
2024-09-08 17:44:39 +02:00
Francesco Gazzetta
7af940dab3 LibGfx: Fix inconsistent skia includes
The "include/" #include prefix is not used anywhere else in the
codebase, and does not work with distro packages.
2024-09-08 16:25:19 +02:00
Timothy Flynn
0a482e1a53 WebContent+WebDriver: Properly define and invoke stubbed methods
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-08 09:01:25 -04:00
Han
d1ba317e22 WebDriver: Add Routes, IPC definitions, and boilerplates
Added the following Routes, IPC definitions, and boilerplates for the
missing endpoints:

- Switch To Frame
- Switch To Parent Frame
- Element Clear
- Element Send Keys
2024-09-08 12:59:06 +01:00
Kuba314
f3a6a589c8 LibWeb: Consider last resort font in font list
Getting the first font in a font cascade list with an empty font list
results in an OOTB index error. If the font list is empty, the last
resort font should be returned instead.
2024-09-08 13:43:15 +02:00
Andreas Kling
b3f77e4769 LibJS: Don't copy current program counter into new execution contexts
This didn't make any sense, and was already handled by pushing a new
execution context anyway.

By simply removing these bogus lines of code, we fix a bug where
throwing inside a function whose bytecode was shorter than the calling
function would crash trying to generate an Error stack trace (because
the bytecode offset we were trying to symbolicate was actually from
the longer caller function, and not valid in the callee function.)

This makes --log-all-js-exceptions less crash prone and more helpful.
2024-09-08 11:33:50 +02:00
Timothy Flynn
16d003c563 LibWeb: Allow modifying non-editable text selections with the keyboard
This permits the user to use shift and the arrow/home/end keys to mutate
the document selection. Arrow key presses on non-editable text without
the shift key held has no effect.

This behavior differs browser-to-browser. The behavior here most closely
matches Firefox, though all browsers support this to some degree.
2024-09-08 09:46:18 +02:00
Timothy Flynn
fc37c4ad40 LibWeb: Only set the editable text cursor position if necessary
When the user clicks on a text node, the event handler sets the cursor
position to the location that was clicked. But it would then be set back
to 0 in the DOM node's focus handler. Leave the cursor alone, unless the
the DOM node was never set as the cursor position node (which will occur
when the user clicks on the DOM node, but outside the shadow text node).
In that case, move the cursor to the end of the text node.

The end result here is that the cursor is placed where the user clicked,
or set to the end of node if the user clicked outside of the shadow text
node.
2024-09-08 09:46:18 +02:00
Tim Ledbetter
48e5d28ec9 LibWeb: Resolve HTMLFormElement.action relative to document base URL
Rather than returning a relative URL, an absolutized URL is now
returned relative to the document base URL
2024-09-08 09:45:57 +02:00
Tim Ledbetter
33c62be7f9 LibWeb: Implement HTMLInputElement.formAction 2024-09-08 09:45:57 +02:00
Tim Ledbetter
c25dda767e LibWeb: Return document URL if formAction attribute is missing or empty
This change also ensures that relative URLs are resolved relative to
the document's base URL.
2024-09-08 09:45:57 +02:00
Timothy Flynn
f3bdee272b LibWeb: Assign native colors to input, text, and select elements
This allows rendering the elements with a dark color in dark mode. We
must also assign a `fill` color to the <select> element's chevron SVG
to match the text color.
2024-09-08 09:45:39 +02:00
Andreas Kling
7df4365e40 LibWeb: Only invalidate style & DOM version if attribute really changes
When setting an element attribute to the value it already had, we don't
need to update style or invalidate anything that depends on the DOM
version counter.

This was a source of much pointless busywork.
2024-09-08 09:45:31 +02:00
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
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
Gingeh
1b8c0cd368 LibWeb: Fix rendering of counter-clockwise arcs 2024-09-07 11:11:31 +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
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
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
Timothy Flynn
feecf89d65 LibWeb: Define a helper constant for the platform word-jumping key
On Linux/Windows, the ctrl key is used in conjunction with arrow keys to
jump word-by-word in text documents. On macOS, the option key is used
(which is mapped to the alt key code).
2024-09-06 07:42:59 +02:00
Timothy Flynn
3e116769fb LibUnicode: Add code point GC queries for Punctuation and Separator 2024-09-06 07:42:59 +02:00
Timothy Flynn
ed3c450359 LibWebView+UI: Move the database and cookie jar to WebView::Application
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
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00
Timothy Flynn
60f30aad72 LibWeb: Limit the minimum scrollbar size to the overflown box's size
A hard-coded value of 50px is too large for text boxes with a size that
is less than 50px. Reduce this to 24px, and further limit it by the size
of the overflown box.
2024-09-06 01:34:40 +02:00
BenJilks
7e38e12bb0 LibWeb: Use transform-box for resolving percentage transform values
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
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
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
Factor out computing the transform box rect into its own method. Then
use it when resolving the transformation matrix, to compute percentage
values.
2024-09-05 19:22:26 +02:00
Aliaksandr Kalenik
a9d5a99568 LibGfx+LibWeb: Replace remaining OpenType implementation with Skia
This change should move us forward toward emoji support, as we are no
longer limited by our own OpenType implementation, which was failing
to parse the TrueType Collection format used to store emoji fonts
(at least on macOS).
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
99f64139d0 LibGfx+WebContent: Load resource://fonts after FontDatabase construction
This is a preparation for upcoming changes where Gfx::Typeface will
depend on `FontDatabase::should_force_fontconfig()`, so we will no
longer be able to construct typefaces from FontDatabase constructor
because of circular dependency.
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
db74244fb2 LibWeb: Read header to check if a blob without mime type is WOFF/WOFF2
Currently we rely on parser returning an error if encoded data cannot be
parsed into a valid WOFF or WOFF2 font, which is not going to be true
after switching to Skia that sometimes does not fail even if a data does
not represent a valid font.
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
8cd6682e6f LibGfx+WebContent: Remove unused Font::variant() and Typeface::variant() 2024-09-05 19:21:52 +02:00
Tim Ledbetter
b4652e4895 LibWeb: Account for scroll offset when interacting with media controls
Previously, using the mouse to interact with the media player wouldn't
work as expected if the page had been scrolled vertically or
horizontally.
2024-09-05 18:11:31 +02:00
Jamie Mansfield
936ca720b4 LibWeb: Implement WorkerNavigator.mediaCapabilities 2024-09-05 14:52:26 +01:00
Jamie Mansfield
f08946bcd2 LibWeb: Implement Navigator.mediaCapabilities
This is enough to stop Crunchyroll showing an unsupported browser
modal :^)
2024-09-05 14:52:26 +01:00