Commit Graph

61050 Commits

Author SHA1 Message Date
Tim Ledbetter
398bf10b92 LibWeb: Use TraversalDecision for multi level Node traversal methods
This adds the `SkipChildrenAndContinue` option, where traversal
continues but child nodes are not included.
2024-05-07 16:45:28 -06:00
Tim Ledbetter
c57d395a48 LibWeb: Use IterationDecision in single level Node iteration methods
`Node::for_each_child()` and `Node::for_each_child_of_type()` callbacks
now return an `IterationDecision`, which allows us to break early if
required.
2024-05-07 16:45:28 -06:00
Abuneri
b5bed37074 AK: Replace FP math in is_power_of with a purely integral algorithm
The previous naive approach was causing test failures because of
rounding issues in some exotic environments. In particular, MSVC
via MSBuild
2024-05-07 16:43:34 -06:00
Dan Klishch
5f33db9abe DynamicLoader+LibSanitizer: Link LibSanitizer to DynamicLoader properly 2024-05-07 16:39:17 -06:00
Dan Klishch
da48a0ca5b LibC: Don't use assert in malloc.cpp 2024-05-07 16:39:17 -06:00
Dan Klishch
d510d2aeb2 LibC: Remove now redundant NO_TLS guards
Since DynamicLoader is compiled with -fdata-sections and --gc-sections,
unused thread_local variables won't create TLS section in it anymore.
2024-05-07 16:39:17 -06:00
Dan Klishch
5963b785e7 LibELF: Unbreak dynamic loader on riscv64
It turns out riscv64 indeed requires -fno-stack-protector for
perform_relative_relocations, oopsie :^)
2024-05-07 16:39:17 -06:00
Dan Klishch
61cf20582c DynamicLoader+LibC: Link LibC into DynamicLoader --as-sane-people
In particular, define a static LibC library *in LibC's CMakeLists* and
use it in DynamicLoader. This is similar to the way LibELF is included
in DynamicLoader.

Additionally, compile DynamicLoader with -ffunction-sections,
-fdata-sections, and -Wl,--gc-sections. This brings the loader size from
~2Mb to ~1Mb with debug symbols and from ~500Kb to ~150Kb without. Also,
this makes linking DynamicLoader with LibTimeZone unnecessary.
2024-05-07 16:39:17 -06:00
Dan Klishch
0b6c08c9a2 LibSystem: Slightly simplify CMakeLists.txt
LibSystem's source directory is included project-wide in
/CMakeLists.txt.
2024-05-07 16:39:17 -06:00
Dan Klishch
e3e98ed3eb LibC: Modernize and simplify LibC/CMakeLists.txt 2024-05-07 16:39:17 -06:00
Dan Klishch
ce5813d6ab LibC: Remove libssp_nonshared.a
__stack_chk_fail_local, which libssp_nonshared.a provides, is a relic of
i386 times and is not used on modern architectures.
2024-05-07 16:39:17 -06:00
Dan Klishch
f60a02fc78 LibC: Move architecture detection from fenv.h to arch/fenv.h
This is similar to how it is done in sys/arch/regs.h.
2024-05-07 16:39:17 -06:00
Dan Klishch
4439b4afcf LibC+LibSanitizer+LibSystem: Remove static libc
Static libc on Serenity is broken in a more than one way and requires a
lot of patches to bring it to a usable and useful state. Therefore,
instead of keeping it around (and breaking even more) during the
upcoming libc build refactor, let's just delete it.
2024-05-07 16:39:17 -06:00
Dan Klishch
028f979916 DynamicLoader: Allow syscalls from dynamic loader more often
Previously, if DynamicLoader was invoked directly, it wouldn't be able
to perform syscalls after the point just before the call to the main
executable entry. This made dlopen to crash if it was invoked from
within an executable that was itself executed using
`/usr/lib/Loader.so <executable>`.

The fix can be tested by executing
`cd /usr/Tests/LibELF; /usr/lib/Loader.so /usr/Tests/LibELF/TestDlOpen`
in Serenity's terminal.
2024-05-07 16:36:38 -06:00
Dan Klishch
cc5bacf886 Kernel: Allow annotating initially loaded executable segments
This allows marking regions as VirtualMemoryRangeFlags::SyscallCode in
static executables.
2024-05-07 16:36:38 -06:00
Sam Atkins
926a275794 HexEditor: Move endianness selector to Value Inspector panel
It's clearer to have the choice here than hidden away in a menu. It also
means we don't need the column heading to say the endianness.
2024-05-07 16:33:59 -06:00
Andrew Kaster
6d72d02d7e Documentation: Describe how to use add_libweb_test.py for Text tests 2024-05-07 16:29:19 -06:00
Andrew Kaster
e5f361500e CI: Use common cache restore and cache save action on GitHub Actions
Unfortunately a composite action cannot have a `post:` step like
JavaScript actions are allowed to have, so we need to explicitly call
the post/save actions ourselves from the workflow file when we want to
save Toolchain/QEMU/ccache caches.

Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
2024-05-07 15:28:46 -06:00
Timothy Flynn
3d6d2b2589 CI: Use the Setup action for the WASM REPL
This ensures we install ccache, for example.
2024-05-07 15:28:46 -06:00
theonlyasdk
efc88c73fa Ladybird: Add Wikipedia search button in newtab.html 2024-05-07 11:46:03 -04:00
Nico Weber
3435770c23 Meta: Use -std=c++2b on mac hosts in the GN build
Xcode clang doesn't understand the -std=c++23 spelling yet, and this
is what CMake's `set(CMAKE_CXX_STANDARD 23)` translates to too.

Unbreaks building with Xcode clang on macOS.
2024-05-07 11:41:40 -04:00
Nico Weber
2f81a3610d Meta: Port recent changes to the GN build
3a73eb99ac
2024-05-07 11:41:40 -04:00
Jamie Mansfield
8c4dc9476b LibWeb: Precision when using background-size: contain
This ensures that precision is maintained when calculating the image
size when using `background-size: contain`.
2024-05-07 11:15:04 -04:00
Jamie Mansfield
e48cb80a66 LibWeb: Precision when using background-size: cover
This ensures that precision is maintained when calculating the image
size when using `background-size: cover`.
2024-05-07 11:15:04 -04:00
Nico Weber
dad4843ee4 TestImageWriter: Add a JPEG roundtrip test 2024-05-07 11:14:41 -04:00
Nico Weber
9384f118d2 TestImageWriter: Add a QOI roundtrip test 2024-05-07 11:14:41 -04:00
Nico Weber
83bdc9c831 TestImageWriter: Add a BMP roundtrip test 2024-05-07 11:14:41 -04:00
Nico Weber
0a26831a10 TestImageWriter: Add a PNG roundtrip test 2024-05-07 11:14:41 -04:00
Nico Weber
aefab64984 TestImageWriter: Use double parens instead of temporary err
Explicit template arguments must be wrapped in parens,
else they confuse the preprocessor.

Add the parens instead of avoiding the use of explicit template
arguments.

No behavior change.
2024-05-07 11:14:41 -04:00
Nico Weber
51fc51d0b5 LibGfx/WebPWriter: Use one-element huffman tree for opaque images
That way, we can write 0 instead of 8 bits for every alpha byte.
Reduces the size of sunset-retro.png when saved as a webp file
from 3 MiB to 2.25 MiB, without affecting encode speed.

Once we use CanonicalCodes we'll get this for free for all channels,
but opaque images are common enough that it feels worth it to do this
before then.
2024-05-07 11:13:01 -04:00
Nico Weber
7d93f7fc99 LibGfx/WebPWriter: Correctly fill in alpha_is_used hint 2024-05-07 11:13:01 -04:00
Nico Weber
0e2e7cd1be LibGfx/WebPWriter: Rename alpha_hint to alpha_is_used_hint
No behavior change.
2024-05-07 11:13:01 -04:00
Nico Weber
5b335d51e1 LibGfx/WebPWriter: Implement ICC color profile data writing
Most of this code (VP8X chunk writing) will be used for writing
animated webp files too.
2024-05-07 11:11:41 -04:00
Nico Weber
c174adc6b1 LibGfx/WebPLossless: Remove a useless non-spec comment
There's already a spec comment saying the same thing a few lines
further down, just move that up.

No behavior change.
2024-05-07 11:10:06 -04:00
Nico Weber
7b3cc2e055 LibGfx/WebPLossless: Add spec ref about color indexing modifying width
No behavior change. This got clarified here:
https://chromium-review.googlesource.com/c/webm/libwebp/+/4688320
2024-05-07 11:10:06 -04:00
Nico Weber
26b3e31f2e LibGfx/WebPLossless: Make width_bits reading look more like in the spec
No behavior change.
2024-05-07 11:10:06 -04:00
Nico Weber
c1b289c144 LibGfx/WebPLossless: Add spec note about combining predicted values
No behavior change. This got clarified in the spec in
https://chromium-review.googlesource.com/c/webm/libwebp/+/4638649
2024-05-07 11:10:06 -04:00
Nico Weber
3662eea0ac LibGfx/WebPLossless: Update spec comments for reading max_symbol
This used to be misleading in the spec, but that was fixed in
https://chromium-review.googlesource.com/c/webm/libwebp/+/4674031

Update the comments to match.

Also, a check we already had got added to the spec in
https://chromium-review.googlesource.com/c/webm/libwebp/+/4674032
so add a citation for that.

No behavior change.
2024-05-07 11:10:06 -04:00
Nico Weber
a511f5507c LibGfx/WebPLossless: Add spec comment about transform order
This used to not be mentioned in the spec, but it got added
based on our feedback:
https://chromium-review.googlesource.com/c/webm/libwebp/+/4637757
2024-05-07 11:10:06 -04:00
Nico Weber
e69a0fa7d3 LibGfx/WebPLossless: Add a spec comment
No behavior change. Makes things flow better with the comment I'm
about to add in the next commit.
2024-05-07 11:10:06 -04:00
Nico Weber
5897e9bd29 LibGfx/WebPLossless: Move around a spec comment
That way, we don't need a comment that wasn't from the spec.
No behavior change.
2024-05-07 11:10:06 -04:00
Nico Weber
076a8e5d0b LibGfx/WebPLossless: Remove "AMENDED" in spec comments
No behavior change. This corresponds to this spec change:
https://chromium-review.googlesource.com/c/webm/libwebp/+/4567695
2024-05-07 11:10:06 -04:00
Nico Weber
05bb657b8b LibGfx/WebPLossless: Replace num_code_lengths check with VERIFY
No behavior change. This corresponds to this spec change:
https://chromium-review.googlesource.com/c/webm/libwebp/+/4779444
2024-05-07 11:10:06 -04:00
Lucas CHOLLET
ed1bdf3851 Tests/LibGfx: Add a test for bilevel images with only required tags
Bilevel images are not required to have a BitsPerSample or a
SamplesPerPixel tag, while this is unusual these images are still valid.

The test case has been generated by first making a copy of
ccitt3_1d_fill.tiff and then, using `tiffset` to remove both tags:
tiffset -u 258 ccitt3_no_tags.tiff
tiffset -u 277 ccitt3_no_tags.tiff
2024-05-07 11:06:12 -04:00
matjojo
cd1eeb3cdd LibWeb: Do not consume scroll event in PaintableBox without overflow
Specifically, without scrollable overflow.

Fixes #24009, both on brave.com and on the reduction.
2024-05-07 14:04:02 +00:00
Andreas Kling
a020a0779d LibJS/Bytecode: Do a stack check when entering run_bytecode()
If we don't have enough stack space, throw an exception while we still
can, and give the caller a chance to recover.

This particular problem will go away once we make calls non-recursive.
2024-05-07 09:15:40 +02:00
Andreas Kling
ebe6ec6069 AK: Check for u32 overflow in String::repeated()
I don't know why this was checking for size_t overflow, but it was
tripping up ASAN malloc() checks by passing a way-too-large size.
2024-05-07 09:15:40 +02:00
Andreas Kling
7b93b8cea7 LibJS/Bytecode: Flatten the interpreter main loop (Clang only)
This means inlining all the things. This yields a 40% speedup on the for
loop microbenchmark, and everything else gets faster as well. :^)

This makes compilation take foreeeever with GCC, so I'm only enabling it
for Clang in this commit. We should figure out how to make GCC compile
this without timing out CI, since the speedup is amazing.
2024-05-07 09:15:40 +02:00
Andreas Kling
f4af056aa9 LibJS/Bytecode: Thread the bytecode interpreter
This commit converts the main loop in Bytecode::Interpreter to use a
label table and computed goto for fast instruction dispatch.

This yields roughly 35% speedup on the for loop microbenchmark,
and makes everything else faster as well. :^)
2024-05-07 09:15:40 +02:00
Andreas Kling
b45f55b199 LibJS/Bytecode: Fix wonky serialization of instruction value lists 2024-05-07 09:15:40 +02:00