Commit graph

68652 commits

Author SHA1 Message Date
Andreas Kling
fb020a3c8f LibWeb: Store final box model metrics in paint tree, not layout tree
This was a weird case of layout results being stored in the layout tree
instead of in the paint tree like everything else.
2025-02-17 18:28:29 +01:00
Sam Atkins
71cb04d8cb IPCCompiler: Allow arguments to not be default-constructible
All fields are always initialized, so we don't need to initialize them
by default. This lets us send types over IPC that can't be
default-constructed, such as a Variant without Empty.
2025-02-17 11:37:38 -05:00
Sam Atkins
b3b7e76c10 IPCCompiler: Remove invalid state from IPC message classes
At some point, we stopped ever constructing invalid messages. This makes
that clearer, and will allow us to stop requiring that IPC arguments be
default-constructible.
2025-02-17 11:37:38 -05:00
Timothy Flynn
e53df7e6c9 WebDriver: Correctly report the client's readiness state 2025-02-17 11:14:40 -05:00
stasoid
dcfc552d25 AK: Don't crash on empty extension in LexicalPath::has_extension
... on Windows
2025-02-17 14:57:00 +01:00
David Hewitt
6b661a91c6 RequestServer: Send empty headers in requests 2025-02-17 13:43:16 +01:00
Gingeh
4966fa4aed LibWeb: Prevent crash with custom cursor
We don't support custom cursors, use the default instead of crashing.
Also clean up a bit of dead code from when Cursor was optional.
2025-02-17 12:24:49 +00:00
Sam Atkins
7be78ec044 Inspector: Keep property filter across tabs
Remember the query, so that if you're filtering for "color" on the
computed style tab, and switch to the resolved style tab, it's filtered
for "color" too.

This means we also can save looking up the filter text when a new node
is inspected.
2025-02-17 12:55:30 +01:00
Sam Atkins
4c024e41cb Inspector: Do less work when filtering properties
As soon as a row has a cell that matches, we can stop looking.

If the search text is empty, we can skip matching altogether.
2025-02-17 12:55:30 +01:00
Sam Atkins
37ca2fc25c Inspector: Preserve zebra-striping when hiding table rows
Instead of simply setting rows to hidden, add a class so that we can
only include visible rows when applying zebra-striping.
2025-02-17 12:55:30 +01:00
Sam Atkins
a10984ea03 Inspector: Keep current property filter when switching selected node
If you have a search filter and then click on a different node, this now
applies the filter to the new node's properties, instead of showing all
of them.
2025-02-17 12:55:30 +01:00
Andrew Kaster
7ed4557573 UI: Only run Screenshot tests on x86_64 Linux
These were previously skipped on macOS, due to hard to
fix inconsistencies in the exact produced pixels.

Turns out, this is not just a macOS thing. The same sort
of hard-to-spot slight pixel deviations are present on
arm64 Linux as well.
2025-02-17 12:36:26 +01:00
devgianlu
62cd358fab Meta: Link with OpenSSL explicitly
Explicitly link final targets with OpenSSL to ensure that the vcpkg
version is loaded instead of the system one.

Before this change we would inherit `libcrypto.so` and `libssl.so` from
other dependencies, like Qt, that do not have their RPATH rewritten.
This would cause the loader to prefer the system libraries over the
vcpkg ones causing all sorts of version mismatch issues.

The effectiveness of this change can be verified with
`readelf -d ./bin/Ladybird` showing `libcrypto.so` and `libssl.so` as
direct dependencies, before they would not appear. Additionally, `ldd`
will show `libcrypto.so` and `libssl.so` pointing to the vcpkg builds.
2025-02-17 12:36:26 +01:00
rmg-x
41c6f93aa8 RequestServer: Remove IPV6 bracket notation on host before resolving
Previously, we were passing in the serialized value which included
square brackets but that isn't a valid IPV6 address.
2025-02-17 12:02:41 +01:00
Timothy Flynn
23a8bbca01 WebContent: Annotate unexpected alert open errors for WebDriver
This was missed in commit 2583996e18.
WPT recently began testing for this.
2025-02-16 22:30:20 +01:00
InvalidUsernameException
29d74632c7 LibWeb: Move z-index to table wrapper box
When drawing a table, some of the CSS properties must be moved from the
table grid box to an anonamyous table wrapper box. One of these
properties is `position`. `z-index` however is not. This leads to the
following behavior if a table has both `position` and `z-index`:
* The wrapper box has the `position`, but a `z-index` of `auto`.
* The grid box has the `z-index`, but `position: static`.

This effectively means that the `z-index property is ignored since it
has no effect on non-positioned elements. This behavior contradicts what
other browsers do and causes layout issues on websites.

To align Ladybird behavior with other browser this commit also moves the
`z-index` property to the wrapper box.
2025-02-16 21:05:59 +01:00
Gingeh
91e4fb248b LibWeb: Hide unrelated popovers when showing popovers
Also hides decendant popovers when hiding.
Also hides unrelated popovers when showing dialogs.
2025-02-16 19:40:07 +00:00
Gingeh
bc0729f5d2 LibWeb: Create a BlockContainer for 'block ruby' elements
Prevents the layout engine from crashing.
(and unlocks ~200 new subtests)
2025-02-16 19:40:07 +00:00
David Hewitt
be3e221b3f LibWeb/XHR: Ensure type set on blob responses 2025-02-16 19:08:45 +00:00
Andreas Kling
31a69ce887 LibWeb+LibGfx: Make IntersectionObserver checks edge-inclusive
This fixes an issue where 0x0 rectangles were not considered to be
intersecting, even when they fell inside (or were adjacent to) the
viewport.
2025-02-16 18:09:08 +01:00
Andreas Kling
4e653c99bb Tests: Import WPT test for edge inclusivity in IntersectionObserver 2025-02-16 18:09:08 +01:00
Luke Wilde
105096e75a LibJS: Stop executing successful regex if it's past the end of the input
If the regex always matches the input, even if it's past the end, then
we need to stop execution of the regex when it's past the end. This
corresponds to step 13.a and prevents it from infinitely looping.

Reduced from: d98672060f/packages/react-i18n/src/utilities/money.ts (L10-L14)
2025-02-16 09:22:37 +01:00
Psychpsyo
f839f1b44b LibWeb: Make a elements honor base element's target 2025-02-16 09:21:52 +01:00
Timothy Flynn
79d6d5a7fa Base: Revert usage of color-scheme in the Inspector
The usage of color-scheme was introduced in commit:
ce5cd012b9

This reverts the Inspector to use self-selected colors, as the default
color-scheme colors do not look great in this window.
2025-02-16 09:20:25 +01:00
Luke Wilde
751b93959f LibWeb/CSS: Use fallback var() value if custom property is empty
If the expansion of a custom property in variable expansion returns
tokens, then the custom property is not the initial guaranteed-invalid
value.

If it didn't return any tokens, then it is the initial
guaranteed-invalid value, and thus we should move on to the fallback
value.

Makes Shopify checkout show the background colours, borders, skeletons,
etc.
2025-02-16 09:19:19 +01:00
Psychpsyo
8f79f2137e LibWeb: Fix steps for finding a navigable by target name 2025-02-16 09:03:51 +01:00
Aliaksandr Kalenik
d3c481f71a LibWeb: Schedule input event processing on HTML event loop
Our existing coalescing mechanism for input events didn't prevent
multiple mousemove/mousewheel events from being processed between paint
cycles. Since handling these events can trigger style & layout updates
solely for hit-testing purposes, we might end up doing work that won't
be observable by a user and could be avoided by shceduling input events
processing to happen right before painting the next frame.
2025-02-15 21:09:18 +01:00
Shannon Booth
9072a7caef Everywhere: Use URL::about_XXX factory functions 2025-02-15 17:05:55 +00:00
Shannon Booth
07f054e067 LibURL: Add 'about:XXX' helper factory functions
Currently we create URLs such as 'about:blank' through the StringView
or ByteString constructor of URL. However, in order to elimate the
use of URL::is_valid, we need to get rid of these constructors as it
makes it way too easy to create an invalid URL.

It is very cumbersome to construct an 'about:blank' URL when using
URL::Parser::basic_parse. So instead of doing that, create some
helper functions which will create the 'about:XXX' URLs with the
correct properties set.

Conveniently, this is also a much faster way of creating these URLs
as it means we do not need to parse the URL and can set all of the
members up front.
2025-02-15 17:05:55 +00:00
Shannon Booth
53826995f6 LibURL+LibWeb: Port URL::complete_url to Optional
Removing one more source of the URL::is_valid API.
2025-02-15 17:05:55 +00:00
Jess
356728b1e0 LibJS: Fix bytecode generation for super property stores and loads
The new test case crashes during bytecode generation due to
`emit_super_reference` not correctly generating the reference record
for the property access.
2025-02-15 06:59:59 -05:00
stasoid
778947213b ImageDecoder: Port to Windows 2025-02-14 09:38:59 -07:00
stasoid
4ae3522b10 LibCore: Implement System::socketpair on Windows 2025-02-14 09:38:59 -07:00
Francesco Gazzetta
886a8fca86 LibGfx: Fix skia include
Same as #1328 / 7af940dab3

Fixes #3539
2025-02-14 05:08:17 -07:00
Psychpsyo
f92d037752 LibJS: Parse dates like "Jan 15, 2025" 2025-02-14 06:27:37 -05:00
Tim Ledbetter
4bb22c52d1 LibWeb: Initialize AnalyserNode previous block at construction time 2025-02-13 20:31:37 +00:00
Andreas Kling
c9cd795257 LibWeb: Don't lose change events on MediaQueryList internal state change
MediaQueryList will now remember if a state change occurred when
evaluating its match state. This memory can then be used by the document
later on when it's updating all queries, to ensure that we don't forget
to fire at least one change event.

This also required plumbing the system visibility state to initial
about:blank documents, since otherwise they would be stuck in "hidden"
state indefinitely and never evaluate their media queries.
2025-02-13 20:52:31 +01:00
Andreas Kling
6fd24c2a68 LibWeb: Update layout when checking media queries inside iframes
This ensures that the containing iframe has up-to-date viewport metrics,
which is important since that may affect media query results.
2025-02-13 20:52:31 +01:00
Andreas Kling
afff44be86 Tests: Import a WPT test for dynamic changes to media queries in iframes 2025-02-13 20:52:31 +01:00
Aliaksandr Kalenik
327dc8e82a LibWeb: Avoid full tree traversal for non-subject :has() invalidation
Instead of checking all elements in a document for containment in
`:has()` invalidation set, we could narrow this down to ancestors and
ancestor siblings, like we already do for subject `:has()` invalidation.

This change brings great improvement on GitHub that has selectors with
non-subject `:has()` and sibling combinators (e.g., `.a:has(.b) ~ .c`)
which prior to this change meant style invalidation for whole document.
2025-02-13 16:24:51 +01:00
Sam Atkins
604400f758 LibWeb/HTML: Ensure HTMLOrSVGElement is BC-connected when running steps 2025-02-13 14:49:19 +00:00
Sam Atkins
b6fc4ec892 LibWeb/HTML: Update radio group when a checked radio button is connected
Corresponds to https://github.com/whatwg/html/pull/10917
2025-02-13 14:49:19 +00:00
Timothy Flynn
01044cbf1f LibIPC: Restore inline attribute on IPC constexpr booleans
These were mistakenly removed in commit d41e577ba.
2025-02-13 08:27:02 -05:00
Timothy Flynn
9a4bb958ac LibCore: Remove ErrorOr return type from read_long_version_string
Nothing in this function is fallible.
2025-02-13 08:27:02 -05:00
aplefull
6e61cc5a1e Inspector: Add ability to filter css properties 2025-02-13 11:45:07 +00:00
stasoid
3e46cb9067 LibWebView+ImageDecoder+RequestServer+WebContent: Add init_transport 2025-02-12 22:32:13 -07:00
stasoid
652af318db LibIPC: Port to Windows
The Linux IPC uses SCM_RIGHTS to transfer fds to another process
(see TransportSocket::transfer, which calls LocalSocket::send_message).
File descriptors are handled separately from regular data.

On Windows handles are embedded in regular data. They are duplicated
in the sender process.

Socket handles need special code both on sender side (because they
require using WSADuplicateSocket instead of DuplicateHandle, see
TransportSocketWindows::duplicate_handles) and on receiver side
(because they require WSASocket, see FileWindows.cpp).

TransportSocketWindows::ReadResult::fds vector is always empty, it is
kept the same as Linux version to avoid OS #ifdefs in Connection.h/.cpp
and Web::HTML::MessagePort::read_from_transport. Separate handling of
fds permeates all IPC code, it doesn't make sense to #ifdef out all this
code on Windows. In other words, the Linux code is more generic -
it handles both regular data and fds. On Windows, we need only the
regular data portion of it, and we just use that.

Duplicating handles on Windows requires pid of target (receiver)
process (see TransportSocketWindows::m_peer_pid). This pid is received
during special TransportSocketWindows initialization, which is performed
only on Windows. It is handled in a separate PR #3179.
Note: ChatGPT and [stackoverflow](https://stackoverflow.com/questions/25429887/getting-pid-of-peer-socket-on-windows) suggest using GetExtendedTcpTable/GetTcpTable2
to get peer pid, but this doesn't work because [MIB_TCPROW2::dwOwningPid](https://learn.microsoft.com/en-us/windows/win32/api/tcpmib/ns-tcpmib-mib_tcprow2)
is "The PID of the process that issued a context bind for this TCP
connection.", so for both ends it will return the pid of the process
that called socketpair.

Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
2025-02-12 22:31:43 -07:00
stasoid
d41e577ba1 LibIPC: Make Vector concept match AK::Vector with any inline_capacity
Also:
* Use SpecializationOf for Optional and Variant concepts
* Remove inline because it is implied by constexpr
* Reorder declarations from less to more specialized (in common sense)
2025-02-12 22:31:43 -07:00
Andrew Kaster
46444c89c9 Meta: Disable implicit-const-int-float-conversion for clang-cl 2025-02-12 19:13:49 -07:00
Andrew Kaster
489bea0c23 LibTest: Remove uses of gettimeofday in favor of AK::Time
gettimeofday is not a thing on Windows or esoteric Unixen.
2025-02-12 19:13:49 -07:00