Commit graph

65794 commits

Author SHA1 Message Date
Jonne Ransijn
b7e22f0916 AK: Disallow creating NonnullRawPtrs from r-value references
This would always result in a use-after-free.
2024-12-04 16:45:58 +00:00
Jonne Ransijn
1ddc4050f7 Meta: Print failed pre-commit steps in bold
This makes them easier to find, especially for colorblind people.
2024-12-04 16:45:58 +00:00
Jonne Ransijn
bea602f5ed AK: Use Noncopyable.h in NonnullRawPtr 2024-12-04 16:45:58 +00:00
Jonne Ransijn
501a7dbaa3 AK: Use Noncopyable.h in Badge 2024-12-04 16:45:58 +00:00
Jonne Ransijn
cca84aa28d AK: Fix ASSERT_NOT_REACHED macro when NDEBUG is not defined
This is supposed to be a function-like macro just like
`VERIFY_NOT_REACHED()` and when `NDEBUG` is defined.
2024-12-04 16:45:58 +00:00
Jonne Ransijn
d5fbf7323a AK+LibJS: Allow {TRY,MUST}{,_OR_THROW_OOM} on list-initializers
List initializers may contain commas without surrounding parenthesis,
causing them to be passed as multiple macro arguments.
2024-12-04 16:45:58 +00:00
Jonne Ransijn
f617127772 AK: Allow calling ASSERT and VERIFY on list-initializers
List initializers may contain commas without surrounding parenthesis,
causing them to be passed as multiple macro arguments.
2024-12-04 16:45:58 +00:00
Jonne Ransijn
0de15264ab AK: Remove clang-tidy warnings for ASSERT(a || b) lines
Lines like these were getting a warning to simplify the expanded
boolean expression from `!(a || b)` to `(a && b)`, but since the
`!(...)` is part of the macro, that is never going to happen.
2024-12-04 16:45:58 +00:00
Shannon Booth
0fa54c2327 LibURL+LibWeb: Make URL::serialize return a String
Simplifying a bunch of uneeded error handling around the place.
2024-12-04 16:34:13 +00:00
Shannon Booth
d7ac0601ab LibWeb: Simplify OOM exception handling in ImportMap
In some cases by crashing on OOM, and in others removing strange use of
String::formatted altogther.
2024-12-04 16:34:13 +00:00
Shannon Booth
bd2f794873 LibJS: Make output_debug_message accept a StringView 2024-12-04 16:34:13 +00:00
Shannon Booth
e9ab3e5a80 LibWeb: Remove ExceptionOr usage for 'resolve module integrity metadata'
We do not have any exceptions to propogate.
2024-12-04 16:34:13 +00:00
Pavel Shliak
a557632716 LibWeb: Move http response method in setter 2024-12-04 16:33:54 +00:00
Pavel Shliak
134dc57458 LibWeb: Ensure segments are copied only once in set_line_dash 2024-12-04 16:33:54 +00:00
Yuval Carmon
be979a1e65 LibWeb/CSS: Test css shadow host selector matching
Add a test that verifies selectors inside a shadow
root can only match their host element through :host pseudo-class.
Tests both simple selectors (#id, .class)
and complex selectors (:not, :where) to ensure they are blocked from
matching the host element directly.

Fixes issue #2319
2024-12-04 16:19:32 +00:00
Yuval Carmon
3ff8c5c8f1 LibWeb/CSS: Block shadow host matching in DOM
Fixes an issue where selectors inside a shadow root could incorrectly
match their shadow host directly using selectors like #host,
instead of requiring :host pseudo-class selectors.

Fixes issue #2319
2024-12-04 16:19:32 +00:00
Jelle Raaijmakers
90d884a150 LibWeb: Prevent crash when editing outside of <body>
Step 9 of this algorithm might end up at the document node, which does
not have a parent.
2024-12-04 17:18:00 +01:00
Lucas CHOLLET
6804ce348e LibWeb/CSS: Interpret NaN as 0 when resolving alpha and rgb values
Fixes the crash in css/css-color/parsing/color-valid-hwb.html.

The crash was probably introduced in 248e4bb5, as it was the first
commit to VERIFY that the value given to `Color::with_opacity` were in
the correct range. As the values in color-valid-hwb.html were resolved
as NaN, the check never passed.
2024-12-04 16:11:41 +00:00
Sidicer
edf29857f8 UI/Qt: Fix hover_label hiding URLs
m_hover_label did not have checks if the mouse is in the same location.
This caused clickable URLs to be hidden.
Also shortened the label text to not be longer than half of the window.
2024-12-04 16:09:59 +00:00
Aliaksandr Kalenik
72f093ba9f LibWeb: Null-check surface before allocating painter for context2d
Fixes https://github.com/LadybirdBrowser/ladybird/issues/2755
2024-12-04 16:58:55 +01:00
Sam Atkins
1081a7f3e2 CI: Move sanitizer output into a separate CI step
Instead of writing ASAN and UBSAN output into the same stream we use for
test logging, direct them to log files, named asan.log.$PID and
ubsan.log.$PID, and then output them in a separate CI job that runs
afterwards. This should hopefully make it easier to see which tests are
failing.

The downside is that it's now harder to tell which tests the *SAN errors
are related to.
2024-12-04 15:35:15 +00:00
Aliaksandr Kalenik
a6810fec24 LibWeb: Allocate transparent surface based on surface null check
...in HTMLCanvasElement::to_data_url() and HTMLCanvasElement::to_blob().

This fixes the problem when surface is not allocated because context is
not initialized yet, even though canvas size is non-zero.

Fixes broken WebDriver screenshot endpoint.
2024-12-04 15:15:16 +00:00
Jelle Raaijmakers
f57c6a4328 Meta: Add policy on AI/LLM usage for changes and reviews 2024-12-04 14:13:39 +00:00
Sam Atkins
624b4689ac Tests: Remove invalid WPT flexbox test
`css/css-flexbox/order-001.htm` is a ref test that does not include any
page to match against.

https://github.com/web-platform-tests/wpt/issues/49521
2024-12-04 13:33:42 +00:00
Timothy Flynn
3c64e4595a LibJS: Use exact mathematical values for Intl.DurationFormat
We can't use doubles due to precision loss for extremely large values.
2024-12-04 08:01:35 -05:00
Timothy Flynn
912e38c5fb LibCrypto: Add a BigFraction::is_zero helper 2024-12-04 08:01:35 -05:00
Timothy Flynn
e6c96ce57e LibCrypto: Convert BigFraction stringification to String 2024-12-04 08:01:35 -05:00
Timothy Flynn
5cfd50224c LibJS: Use enums instead of strings in Intl.DurationFormat AOs 2024-12-04 08:01:35 -05:00
Timothy Flynn
37fc9b6511 LibJS: Apply editorial updates to Intl.DurationFormat
To help prepare for its stage 4 promotion, this applies the editorial
updates made to Intl.DurationFormat over the last few months.
2024-12-04 08:01:35 -05:00
Milo van der Tier
1882a2e19b LibWeb/CSS: Pass Length::ResolutionContext to resolve_integer
The length resolution context might be needed even when resolving an
integer value, since it might contain a sign() function with length
values inside. This fixes a WPT subtest.
2024-12-04 12:26:50 +00:00
Milo van der Tier
8bec80ac47 LibWeb/CSS: Allow calc() values in media queries
It was initially thought that the spec disallows them, but this turned
out to be incorrect. This fixes several WPT tests.
2024-12-04 12:26:50 +00:00
Lucas CHOLLET
ad3dd547b7 LibWeb/CSS: Shorten the length of srgb serialization
The WPT tests require the shortest possible serialization that support
an 8 bits roundtrip.

As an example, `128` is serialized to `0.5` while `127` needs more
precision and thus will be serialized to `0.498`.

This commit fixes 33 WPT subtests in css/css-color.
2024-12-04 11:30:44 +00:00
Lucas CHOLLET
ded6695c52 LibWeb/CSS: Remove unused serialization helpers 2024-12-04 11:30:44 +00:00
Christoffer Sandberg
879af72850 LibWeb: Improve painting of nested inline elements
PaintableWithLines created from inline nodes need to examine their
children to fully compute their size and offset as nested children
might have textnodes that are placed before their parent.

Fixes #1286
2024-12-04 11:23:54 +00:00
Andrew Kaster
e20a887a8d Toolchain: Actually disable vcpkg metrics
In the move to a python version of this script, I didn't notice that
running the bootstrap script in shell mode precluded it from actually
accepting the -disableMetrics argument.

Existing vcpkg installs can be un-metrics'd by re-running the bootstrap
script with the disable argument, or by adding a vcpkg.disable-metrics
file in $VCPKG_ROOT
2024-12-04 11:15:32 +01:00
Pavel Shliak
2d0fdf804e Documentation: Minor rewordings in Porting.md 2024-12-04 10:26:24 +01:00
Jonne Ransijn
acaf01bf7b LibWeb: Do not normalize border radii containing their initial values
Most computed border-radii contain their initial values, and since the
normalized initial border radii are always zero, there is no need to do
expensive floating point math to normalize them.
2024-12-04 08:30:22 +00:00
Jelle Raaijmakers
9b446df7f5 LibWeb: Replace local name checks with simpler is<T> in editing API 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
e308a3fd3f LibWeb: Be more defensive while traversing ancestors in editing API
In all these cases there should be an ancestor available, but it
definitely cannot hurt to be a bit more defensive about this and prevent
nullptr dereferences.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
b6939c8035 LibWeb: Use wrap algorithm in "fix disallowed ancestors"
We have the wrap algorithm implemented now, so resolve the FIXME.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
4f76cec096 LibWeb: Implement document.execCommand("insertParagraph") 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
2e29d3fb57 LibWeb: Fix is_allowed_child_of_node() for non-element parent node
When passing a DOM::Node that is not a DOM::Element, this method would
always try to cast to a DOM::Element.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
a62b664d0d LibWeb: Put editing command "styleWithCSS" in alphabetical order 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
98df4c2b3c LibWeb: Make Editing::fix_disallowed_ancestors_of_node() take a GC::Ref 2024-12-04 06:51:59 +01:00
Jonne Ransijn
211dc5659c LibWeb: Fix stack-use-after-scope
The refactor in the previous commit was storing a reference to a stack
allocated `Infrastructure::Request::BodyType` which was then immediately
freed. To fix this, we can store the `Infrastructure::Request::BodyType`
in a variable beforehand, so it becomes safe to reference.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
d7596a0a61 AK: Don't implicitly convert Optional<T&> to Optional<T>
C++ will jovially select the implicit conversion operator, even if it's
complete bogus, such as for unknown-size types or non-destructible
types. Therefore, all such conversions (which incur a copy) must
(unfortunately) be explicit so that non-copyable types continue to work.

NOTE: We make an exception for trivially copyable types, since they
are, well, trivially copyable.

Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
2024-12-04 01:58:22 +01:00
kleines Filmröllchen
8468fb9ae5 AK: Use StringView as its own peek type
StringView is already a reference type, and copying it is cheap, so we
should use it as its own peek type.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
d7a721951e LibWasm: Fix UB in LibWasm
Now that `Optional<T&>` are trivially copyable/movable, it is
triggering Undefined Behaviour checks on GCC. We can resolve those
by using an union.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
55383998b1 AK: Use Noncopyable.h in Optional<T&>
This makes them trivially copyable/movable, silencing

> "parameter is copied for each invocation"

warnings on `Optional<T&>`, which are unnecessairy,
since `Optional<T&>` is just a trivially copyable pointer.

This creates a slight change in behaviour when moving out of an
`Optional<T&>`, since the moved-from optional no longer gets cleared.

Moved-from values should be considered to be in an undefined state,
and if clearing a moved-from `Optional<T&>` is desired, you should be
using `Optional<T&>::release_value()` instead.
2024-12-04 01:58:22 +01:00
Aliaksandr Kalenik
7e78d7d332 LibWeb/WebGL+Meta: Stub getSupportedExtensions() and getExtension() 2024-12-03 23:35:45 +01:00