Commit graph

50413 commits

Author SHA1 Message Date
Jelle Raaijmakers
2959c2f2eb LibGfx: Remove clip check in Painter::do_draw_scaled_bitmap
We were performing a check whether source pixels would fall into a
clipped rect too early. Since we already clamp the resulting source
coordinates to the clipped rect, we can just remove this code.
2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
b79fd3d1a9 LibWeb: Use box sampling instead of bilinear scaling when downscaling
As a heuristic, either the width or height of the scaled image should
decrease for box sampling to be used. Otherwise, we use bilinear
scaling.
2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
81b30ec372 PixelPaint: Use box sampling scaling for layer thumbnails 2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
d6aefb1bf1 PixelPaint: Add support for box sampling scaling 2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
032c2a882a ImageViewer: Add support for box sampling scaling 2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
eb418bec32 LibGfx: Implement box sampling image scaling
Box sampling is a scaling algorithm that averages all the pixels that
form the source for the target pixel. For example, if you would resize a
9x9 image to 3x3, each target pixel would encompass a 3x3 pixel area in
the source image.

Box sampling is a near perfect scaling algorithm for downscaling. When
upscaling with this algorithm, the result is similar to nearest neighbor
or smooth pixels.
2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
4944b16bd5 LibGfx: Cleanup of Painter::do_draw_scaled_bitmap()
No functional changes.
2023-05-19 06:16:14 +02:00
Jelle Raaijmakers
88a7bb5ba7 LibGfx: Implement alternative Rect right/bottom edge calculations
For `IntRect`, we assume that the right/bottom edge is offset by minus
one. This obviously will not work for `FloatRect`, since those edges are
infinitely small.

Specialize `right()` and `bottom()` and add a `FIXME` to get rid of the
offset in the future.
2023-05-19 06:16:14 +02:00
Aliaksandr Kalenik
902ceb1675 LibWeb: Resolve grid item fixed size paddings in GFC
Adds support for grid items with fixed size paddings. Supporting
percentage paddings will probably require to do second pass of tracks
layout: second pass is needed to recalculate tracks sizes when final
items sizes are known when percentage paddings are already resolved.
2023-05-19 06:12:05 +02:00
Aliaksandr Kalenik
f8d6569841 LibWeb: Move resolving grid item heights into separate method in GFC 2023-05-19 06:12:05 +02:00
Tim Ledbetter
c87053c685 Base: Add man page for shuf 2023-05-18 21:06:37 -06:00
Tim Ledbetter
12d6845c4e shuf: Add -r option to allow output lines to be repeated
This commit also modifies the behavior of the `-z` option, so that a
'\0' character now delimits output lines, as well as input lines. This
matches the behavior of the GNU coreutils and FreeBSD implementations
of shuf.
2023-05-18 21:06:37 -06:00
Muhammad Zahalqa
0f0d16bbec AK: Include Array.h in Base64.h
Array.h should be included in Base64.h and removed from Base64.cpp
2023-05-18 22:49:02 +02:00
djwisdom
1b9c31da12 Ports: Update and clean up serenity-theming use latest commit 83fb3e7 2023-05-18 22:47:29 +02:00
kleines Filmröllchen
3b8ccd123b LibAudio: Compute and verify FLAC frame header checksums
This is currently not a failure condition, but we will print out a
message to the console informing the user of a potential corrupted file.
2023-05-18 22:23:15 +02:00
kleines Filmröllchen
70ab4566f3 LibCrypto: Add a checksumming stream wrapper
This generic stream wrapper performs checksum calculations on all data
passed through it for reading or writing, and is therefore convenient
for calculating checksums while performing normal data input/output, as
well as computing streaming checksums on non-seekable streams.
2023-05-18 22:23:15 +02:00
kleines Filmröllchen
daf50ed885 LibCrypto: Add generic 8-bit CRC
The implementation of this is naive enough so it can handle all 8-bit
CRC polynomials, of which there are quite a few. The table generation
and update procedure is MSB first, which is backwards from the LSB first
method of CRC32.
2023-05-18 22:23:15 +02:00
kleines Filmröllchen
4f9c91e34d LibCrypto: Expose checksum type of ChecksumFunction 2023-05-18 22:23:15 +02:00
kleines Filmröllchen
c9f6605fb2 AK: Account for bit position 8 in bit stream alignment
See identical code in LittleEndianBitStream; even in the bytewise
reading BigEndianBitStream an offset of 8 is not inconsistent state and
handled just fine by read_bits.
2023-05-18 22:23:15 +02:00
Timothy Flynn
70c977aa56 AK: Discard bits from LittleEndianInputBitStream as they are read
Rather than tracking our position in the bit buffer, we can simply shift
away the bits that we read. This is mostly for simplicity, but also does
help performance a bit.

Using the "enwik8" file as a test (100MB uncompressed, commonly used in
benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), compression time
decreases from:

    3.96s to 3.79s on Serenity (cold)
    1.08s to 1.04s on Serenity (warm)
    0.83s to 0.82s on Linux
2023-05-18 11:21:56 -07:00
Nico Weber
0c53b02149 AK: Add dbg()
We have outln() and out(), warnln() and warn(),
now we have dbgln() and dbg().

This is useful for printing arrays element-by-element while still
only printing one line per array.
2023-05-18 18:20:54 +02:00
Andreas Kling
e3d182bfe2 LibWeb: Fix "Unsupported main size for flex-basis" spam about calc()
For flex items with a calc() value for a main size, we can just convert
them to a calculation-backed LengthPercentage.
2023-05-18 18:06:30 +02:00
Aliaksandr Kalenik
82aedfcaf0 LibWeb: Use grid item used width as available width during track sizing
This change addresses the incorrect assumption that the available width
inside a grid item is equal to the width of the track it belongs to.
For instance, if a grid item has a width of 200px, the available width
inside that item is also 200px regardless of its column(s) base size.

To solve this issue, it was necessary to move the final resolution of
grid items to occur immediately after the final column track sizes are
determined. By doing so, it becomes possible to obtain correct
available width inside grid items while resolving the row track sizes.
2023-05-18 18:06:05 +02:00
Sam Atkins
52e9dced1a LibWeb: Remove unitless-length quirk from properties that don't need it
A list of every property that has this quirk is available here:
https://quirks.spec.whatwg.org/#the-unitless-length-quirk
2023-05-18 18:04:48 +02:00
kleines Filmröllchen
b73b4d7533 Meta: Build abench on Lagom
This makes it possible to test audio decoding without much I/O overhead.
2023-05-18 07:05:25 -07:00
Liav A
0bbd9040ef Kernel+Userland: Split bind-mounting and re-mounting from mount syscall
These 2 are an actual separate types of syscalls, so let's stop using
special flags for bind mounting or re-mounting and instead let userspace
calling directly for this kind of actions.
2023-05-17 23:39:15 -06:00
kleines Filmröllchen
04b44a827a LibThreading: Only run on_error callback when action wasn't canceled
This mirrors the same UAF protection for event loops used by the
on_complete callback.
2023-05-17 22:40:15 -06:00
kleines Filmröllchen
7704d89496 LibCore: Cancel jobs on event loop exit
This important feature was regressed with the recent architectural
change.
2023-05-17 22:40:15 -06:00
Ben Wiederhake
f2609281a3 CatDog: Stop recognizing name of deleted program
Inspector was deleted a long time ago in commit
16c47ccff6, and likely isn't coming back
any time soon.
2023-05-17 23:25:51 +02:00
Andreas Kling
f063eb3218 LibWeb: Add missing call to Base in VideoTrack::visit_edges()
This fixes a GC crash that happened after a while on the Steam store.
2023-05-17 13:09:02 -07:00
Andreas Kling
5bb6e2c80c LibWeb: Null-check layout node before dereferencing in HTMLVideoElement
DOM elements don't always have a corresponding layout node. This fixes a
crash soon after loading the Steam store.
2023-05-17 13:09:02 -07:00
Andreas Kling
fb722e69f3 LibWeb: Resolve CSS custom properties on pseudo elements
The resolved property sets are stored with the element in a
per-pseudo-element array (same as for pseudo element layout nodes).

Longer term, we should stop storing this with elements entirely and make
it temporary state in StyleComputer somehow, so we don't waste memory
keeping all the resolved properties around.

This makes various gradients show up on https://shopify.com/ :^)
2023-05-17 20:37:29 +02:00
Timothy Flynn
6970f1b6c1 Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebView
The goal here is to reduce the amount of WebContent client APIs that are
duplicated across every ViewImplementation. Across our three browsers,
we currently:

    Ladybird - Mix some AK::Function callbacks and Qt signals to notify
    tabs of WebContent events.

    Browser - Use only AK::Function callbacks.

    headless-browser - Drop most events on the floor.

Instead, let's only use AK::Function callbacks across all three browsers
to propagate events to tabs. This allows us to invoke those callbacks
directly from LibWebView instead of all three browsers needing to define
a trivial `if (callback) callback();` override of a LibWebView virtual
function. For headless-browser, we can simply not set these callbacks.

As a first pass, this only converts WebContent events that are trivial
to this approach. That is, events that were simply passed onto the tab
or handled without much fuss.
2023-05-17 19:47:05 +02:00
Timothy Flynn
c113d780c6 Ladybird: Move ownership of the JS console/inspector to the tab object
This is to match Browser, where ownership of all "subwidgets" is placed
on the tab as well. This further lets us align the web view callbacks to
match Browser's OOPWV as well, which will later let us move them into
the base LibWebView class.
2023-05-17 19:47:05 +02:00
Timothy Flynn
2d51b8c286 Browser+Ladybird+LibWebView: Virtualize computing content/widget points
This will allow moving some copy-pasted functionality from web view
implementations to the base LibWebView class.
2023-05-17 19:47:05 +02:00
Timothy Flynn
31d7565cf3 Ladybird: Remove unused JS console methods
Note that the real implementations of these functions are:
    notify_server_did_output_js_console_message
    notify_server_did_get_js_console_messages

Which have the same method bodies as these unused variants.
2023-05-17 19:47:05 +02:00
Timothy Flynn
d8b14da380 Browser+Ladybird+LibWebView: Move some common functions to LibWebView
The implementations of handle_web_content_process_crash and
take_screenshot are exactly the same across Browser and Ladybird. Let's
reduce some code duplication and move them to LibWebView.
2023-05-17 19:47:05 +02:00
Aliaksandr Kalenik
5312a140fe LibWeb: Add for_each_spanned_track to iterate spanned tracks in GFC
Introducing for_each_spanned_track that allows to iterate tracks
spanned by a specific items allow to delete a lot of repeated code.
2023-05-17 15:55:14 +02:00
Aliaksandr Kalenik
628efda754 LibWeb: Consider span > 1 while getting available space for items in GFC 2023-05-17 15:55:14 +02:00
kleines Filmröllchen
79e76ae64c Meta/ShellCompletions: Use standard Serenity comment style 2023-05-17 12:55:15 +02:00
kleines Filmröllchen
e01941b41c Meta/ShellCompletions: Complete binaries for run lagom
This completion only works if you have lagom already built in some
capacity, since it scans the build directory tree for binaries, removing
known false positives. However, that is both more accurate than asking
ninja for the targets and filtering those, and it also makes it
independent of the build system used.
2023-05-17 12:55:15 +02:00
kleines Filmröllchen
97c95eca88 Meta/ShellCompletions: Mention $SERENITY_ARCH in target completions 2023-05-17 12:55:15 +02:00
kleines Filmröllchen
418f1f82e7 Meta/ShellCompletions: Add toolchain completion
This is very convenient for anyone like me who regularly runs the Clang
toolchain. The toolchain is not completed for Lagom and the
toolchain-independent help command.
2023-05-17 12:55:15 +02:00
kleines Filmröllchen
ef7afd8331 Meta/ShellCompletions: Complete command list
The command list was missing the help command, and the command order
was different from the help output.
2023-05-17 12:55:15 +02:00
Daniel Bertalan
96f89d14a3 Kernel: Fix memory mapping size of the BootFramebufferConsole
The Multiboot header stores the framebuffer's pitch in bytes, so
multiplying it by the pixel's size is not necessary. We ended up
allocating 4 times as much memory as needed, which caused us to overlap
the MMIO reserved memory area on the Raspberry Pi.
2023-05-17 01:38:03 -06:00
Daniel Bertalan
3d383974cd Kernel: Flush data cache before passing a buffer to the VC Mailbox
Otherwise, the message's contents might be in the cache only, so
VideoCore will read stale/garbage data from main memory.

This fixes framebuffer setup on bare metal with the data cache enabled.
2023-05-17 01:38:03 -06:00
Daniel Bertalan
0cbcdb227f Meta: Make SERENITY_RUN=ci work with AArch64
This in turn enables `./Meta/serenity.sh test aarch64` and the CI
scripts to work with the AArch64 port.

As the RPi doesn't have a debugcon-like device, we create two serial
devices. The system console, UART0 is redirected to `debug.log`, while
UART1 is made available to the userspace and is used as the stdout for
the test runner script.

We are not yet able to run the full test suite, as the kernel panics due
to some unimplemented features.

Note that Qemu `master` or our patched Qemu build is required for
`SystemServer` to recognize the `system_mode=self-test` parameter.
2023-05-17 01:32:43 -06:00
Daniel Bertalan
c460b84ebe Kernel: Add character device driver for the RPi "mini UART" (UART1)
While the PL011-based UART0 is currently reserved for the kernel
console, UART1 is free to be exposed to the userspace as `/dev/ttyS0`.
This will be used as the stdout of `run-tests-and-shutdown.sh` when
testing the AArch64 kernel.
2023-05-17 01:32:43 -06:00
Daniel Bertalan
3beb488887 Kernel: Add RPi::Timer::get_clock_rate() 2023-05-17 01:32:43 -06:00
Daniel Bertalan
d9c557d0b4 Kernel: Add RPi Watchdog and use it for system shutdown
The Raspberry Pi hardware doesn't support a proper software-initiated
shutdown, so this instead uses the watchdog to reboot to a special
partition which the firmware interprets as an immediate halt on
shutdown. When running under Qemu, this causes the emulator to exit.
2023-05-17 01:32:43 -06:00