Commit graph

47994 commits

Author SHA1 Message Date
Timothy Flynn
1d5b45f7d9 AK: Compute UTF-8 code point lengths using only leading bytes
We don't need to decode the entire code point to know its length. This
reduces the runtime of decoding a string containing 5 million instances
of U+10FFFF from over 4 seconds to 0.9 seconds.
2023-03-13 15:16:02 +00:00
Lucas CHOLLET
516d2f4892 image: Add an argument to choose to write PPMs in binary or in ASCII 2023-03-13 15:15:41 +00:00
Lucas CHOLLET
13d1721852 image: Support writing to PPM files 2023-03-13 15:15:41 +00:00
Lucas CHOLLET
9c9bd271c8 LibGfx/PortableFormat: Add PortableFormatWriter
Currently, the encoder only output ppm files, but it can easily be
extended to support both PBM and PGM.
2023-03-13 15:15:41 +00:00
Andrew Kaster
e32267c902 Documentation: Add query-driver to clangd arguments in NvimConfiguration 2023-03-13 08:00:09 -06:00
Andrew Kaster
ad5db213ca Documentation: Update VS Code docs for tone, add query-driver directions 2023-03-13 08:00:09 -06:00
kleines Filmröllchen
e20038a04b LibAudio+Piano: Correct header style 2023-03-13 13:59:41 +00:00
Fabian Dellwing
7448db9940 Ports: Add lrzip port 2023-03-13 13:53:58 +01:00
Timothy Flynn
50cef4708c Ladybird: Remove the mode to dump the layout tree
This use case is now handled by headless-browser.
2023-03-13 12:41:10 +00:00
Timothy Flynn
127d2e2098 LibWeb: Run LibWeb layout tests using headless-browser 2023-03-13 12:41:10 +00:00
Timothy Flynn
7090f74524 headless-browser: Add a mode to dump the layout tree after load finish 2023-03-13 12:41:10 +00:00
Timothy Flynn
2845a8e139 headless-browser: Support loading local file:// URLs 2023-03-13 12:41:10 +00:00
Timothy Flynn
31bdd8a918 headless-browser: Massage URLs a bit before loading
This is to mimic what Ladybird and Browser do before trying to load the
URL.
2023-03-13 12:41:10 +00:00
kleines Filmröllchen
4420e48dc3 LibAudio: Use symbolic constants for MP3 frame and granule size 2023-03-13 13:25:42 +01:00
kleines Filmröllchen
264cc76ab4 LibAudio: Move audio stream buffering into the loader
Before, some loader plugins implemented their own buffering (FLAC&MP3),
some didn't require any (WAV), and some didn't buffer at all (QOA). This
meant that in practice, while you could load arbitrary amounts of
samples from some loader plugins, you couldn't do that with some others.
Also, it was ill-defined how many samples you would actually get back
from a get_more_samples call.

This commit fixes that by introducing a layer of abstraction between the
loader and its plugins (because that's the whole point of having the
extra class!). The plugins now only implement a load_chunks() function,
which is much simpler to implement and allows plugins to play fast and
loose with what they actually return. Basically, they can return many
chunks of samples, where one chunk is simply a convenient block of
samples to load. In fact, some loaders such as FLAC and QOA have
separate internal functions for loading exactly one chunk. The loaders
*should* load as many chunks as necessary for the sample count to be
reached or surpassed (the latter simplifies loading loops in the
implementations, since you don't need to know how large your next chunk
is going to be; a problem for e.g. FLAC). If a plugin has no problems
returning data of arbitrary size (currently WAV), it can return a single
chunk that exactly (or roughly) matches the requested sample count. If a
plugin is at the stream end, it can also return less samples than was
requested! The loader can handle all of these cases and may call into
load_chunk multiple times. If the plugin returns an empty chunk list (or
only empty chunks; again, they can play fast and loose), the loader
takes that as a stream end signal. Otherwise, the loader will always
return exactly as many samples as the user requested. Buffering is
handled by the loader, allowing any underlying plugin to deal with any
weird sample count requirement the user throws at it (looking at you,
SoundPlayer!).

This (not accidentally!) makes QOA work in SoundPlayer.
2023-03-13 13:25:42 +01:00
kleines Filmröllchen
d707c0a2f5 LibGUI: Make thumbnail generation resilient between FileSystemModels
With the new canceled background actions, some thumbnail generation
callbacks are not executed if the user closes the window with a
FileSystemModel quickly enough. Therefore, we remember which thumbnails
we started to generate and consider the associated promises if we're
looking up a thumbnail. Since the thumbnail generation itself continues
running and the cache is application-global, instead of never displaying
thumbnails for images that were "interrupted" generating thumbnails the
first time, we can now fetch their images immediately and reliably.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
cf1fa419ab LibThreading: Register BackgroundAction with EventLoop
BackgroundActions are now added as a job to the event loop, therefore
they get canceled when the loop exits and their on_complete action never
runs. This fixes all UAF bugs related to BackgroundAction's use of
EventLoops, as seen with e.g. thumbnail generation.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
8f4d0d3797 LibCore+Userland: Make Promise's on_resolve fallible
This will be primarily necessary for BackgroundAction integration, but
it already allows us to add proper error handling in LibIMAP :^)
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
dc318d3080 LibCore: Add a constructor that sets the parent object 2023-03-13 12:12:17 +00:00
kleines Filmröllchen
30295bd988 LibCore: Allow EventLoop to manage and cancel promises
In this context, the promises are considered "jobs", and such jobs
depend in some way on the event loop. Therefore, they can be added to
the event loop, and the event loop will cancel all of its pending jobs
when it ends.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
bfd9f681f7 LibCore+Userland: Allow canceling promises
To make EventLoop cancel its managed Promises, we need the ability to
cancel them in the first place.
2023-03-13 12:12:17 +00:00
kleines Filmröllchen
afd0f941b7 LibCore: Add Promise to the forward declare header 2023-03-13 12:12:17 +00:00
Tim Ledbetter
82219d0879 Base: Add missing options to sort man page 2023-03-13 07:53:24 +00:00
Tim Ledbetter
0454d655bb sort: Add an option to sort in reverse order
Lines can now be sorted in reverse order by specifying the `-r` option.
2023-03-13 07:53:24 +00:00
Timothy Flynn
f5f1a5228e LibWeb: Escape HTML text fragments with multi-byte code point awareness
The UTF-8 encoding of U+00A0 (NBSP) is the bytes 0xc2 0xa0. By looping
over the string to escape byte-by-byte, we replace the second byte with
" ", but leave the first byte in the resulting text. This creates
an invalid UTF-8 string, with a lone leading byte.
2023-03-13 07:29:40 +00:00
Andrew Kaster
3219ecbdc0 Ports: Add port of backward-cpp, a pretty backtrace library 2023-03-13 07:23:53 +00:00
Andrew Kaster
e690b35fdc Ports: Install libiberty from binutils port
Normally this is supposed to be installed from gdb or gcc. If a port
wants to link against libbfd though, we need to make sure libiberty is
actually available in the root filesytem without requiring the port to
depend on those larger packages.
2023-03-13 07:23:53 +00:00
Andrew Kaster
6ce7257ad7 Kernel: Don't include Kernel/Arch/RegisterState from userspace
Any userspace cpp file that included <syscall.h> would end up with
a large glob of Kernel headers included, all the way down to
Kernel/Arch/x86_64/CPU.h and friends.

Only the kernel needs RegisterState, so hide it from userspace.
2023-03-13 07:23:53 +00:00
Timothy Flynn
11fe34ce0f headless-browser: Re-implement headless-browser using an OOPWV
headless-browser currently uses its own PageClient to load web pages
in-process. Due to this, it also needs to set up a whole bunch of other
objects needed to run LibWeb, e.g. image decoders, request servers, etc.

This changes headless-browser to instead implement a WebView to launch
WebContent out-of-process. This implementation is almost entirely empty,
but can be filled in as-needed. For example, we may want to print
JavaScript console messages.
2023-03-13 07:21:00 +00:00
Timothy Flynn
add15a5f04 Ladybird+LibWebView: Move WebContent process launcher to LibWebView
This is to allow headless-browser to reuse this code. We have a similar
helper for launching SQLServer from Ladybird.
2023-03-13 07:21:00 +00:00
Karol Baraniecki
be4da57004 Base: Make keyboard keys in the BrickGame manual and Help page stand out
by making them `monospace` in the Help page, and bold in the manual.
This helps to quickly find out where the keyboard controls are in the
manual when skimming its contents.
2023-03-13 06:43:59 +00:00
Karol Baraniecki
d4d625b58e Base: Document Escape and P pausing/unpausing BrickGame 2023-03-13 06:43:59 +00:00
Karol Baraniecki
ddac8192e3 BrickGame: Add a "Pause" option to the Game menu
This is how the menu looks like after this commit:
┌────┐
│Game│ Help
├────┴─────────────────────────────┐
│   New game                   F2  │
│   Toggle pause                P  │
├──────────────────────────────────┤
│   Quit                   Alt+F4  │
└──────────────────────────────────┘
2023-03-13 06:43:59 +00:00
Karol Baraniecki
a337557658 BrickGame: Show a box with "Paused" in it when the game is paused
Looks a bit like this:

  ┌────────────┐
  │            │
  │   Paused   │
  │            │
  └────────────┘
2023-03-13 06:43:59 +00:00
Karol Baraniecki
1fd61d2af3 BrickGame: Disallow manual piece movement while paused
This make the pause feature feel much better.
2023-03-13 06:43:59 +00:00
Karol Baraniecki
06a9e4280b BrickGame: Stop bricks from falling when paused
Allows for pausing with either the `P` or `Escape` keys. In this commit
you can still rotate pieces when paused - which makes for an interesting
"stop-time" cheat mechanic, but probably isn't yet what we want.
2023-03-13 06:43:59 +00:00
Nico Weber
dfb45705e6 LibCompress: Make DeflateCompressor::write() use loop, not recursion
This is performance-neutral, but Instruments.app had a hard time
visualizing the very deeply nested stack frames here.

No behavior change.
2023-03-13 06:32:56 +00:00
Nico Weber
e26aebca4f SpiceAgent: Remove unused BMPWriter.h include 2023-03-12 22:09:34 +01:00
Xexxa
402ff46b78 Base: Add Batak to font Katica Regular 10
1BC0-1BF3, 1BFC-1BFF https://www.unicode.org/charts/PDF/U1BC0.pdf
2023-03-12 22:09:20 +01:00
Tim Schumacher
515f31339c LibC: Correctly reset the getopt state on optind = 1
The Linux `getopt_long` manpage tells users to reset `optind` to 1 when
scanning the same argument vector or a new argument vector again. This
makes sense, since `optind` denotes the _next_ option to be processed.

The behavior of setting `optind` to 0 doesn't seem to be specified
anywhere, so let's also remove that comment from `unistd.h`.
2023-03-12 22:09:09 +01:00
Lucas CHOLLET
b5594bf9a2 PixelPaint: Display color information on mousemove with the PickerTool
Per-channel values of the pixel color are now displayed in the status
bar when the PickerTool is selected. This information obviously updates
on mousemove.
2023-03-12 22:08:24 +01:00
Nico Weber
c587ada084 LibGfx: Make BMPWriter::dump() return ErrorOr
...and use TRY() consistently in BMPWriter.cpp
2023-03-12 21:07:25 +00:00
Nico Weber
a2ccf38f11 LibGfx: Make BMPWriter::dump() not take a RefPtr 2023-03-12 21:32:21 +01:00
Nico Weber
833d0d95c9 LibGfx: Remove a redundant copy of all data when writing a BMP 2023-03-12 21:32:21 +01:00
Nico Weber
f1a3028ef1 LibGfx: Change BMPWriter API to be consistent with other image writers 2023-03-12 21:32:21 +01:00
Nico Weber
01387eb72b LibGfx: Change second argument of BMPWriter::dump() to Options struct
This makes it more economical to add more options here, and makes it
possible to use similar API surface for the other image writers.

(It looks like nothing currently uses this optional parameter, but
having a way to pass options to image writers seems like something
we generally want.)
2023-03-12 21:32:21 +01:00
Nico Weber
74891ab656 LibGfx: Remove unused BMPWriter::set_compression()
This has always been unused, and after #8440 BMPWriter::dump()
unconditionally writes to m_compression, meaning even if this
method was called, it would have no effect.
2023-03-12 21:32:21 +01:00
Andreas Kling
7bb7d87807 LibWeb: Resolve percentage line-height values before CSS inheritance
Percentage line-height values are relative to 1em (i.e the font-size
of the element). We have to resolve their computed values before
proceeding with inheritance.
2023-03-12 18:10:32 +01:00
Andreas Kling
7b55d79d3a LibWeb: Actually incorporate style from imported style sheets 2023-03-12 18:10:32 +01:00
Andreas Kling
1b262f8c89 Tests/LibWeb: Only care about *.html files in layout test runner 2023-03-12 18:10:32 +01:00