Commit graph

50421 commits

Author SHA1 Message Date
Andreas Kling
77db621be5 Revert "LibWeb: Use box sampling instead of bilinear scaling when downscaling"
This reverts commit b79fd3d1a9.
2023-05-19 13:33:52 +02:00
Andreas Kling
fb1a151fe3 Revert "LibGfx: Remove clip check in Painter::do_draw_scaled_bitmap"
This reverts commit 2959c2f2eb.
2023-05-19 13:33:50 +02:00
thankyouverycool
444470b238 Applications: Improve FSAC error message handling
Fixes apps showing redundant error messages and terminating
unnecessarily on failed file requests. It's nicer to drop the
user off at the equivalent of a default document on failure if
possible.

Also fixes TextEditor not showing response errors for missing files
in the recently opened list.
2023-05-19 06:20:41 +02:00
thankyouverycool
fef594708e FileSystemAccessServer: Return EPERM for denied prompts
Instead of showing an ambiguous "Unknown error" when FSAS approval is
denied, let's affirm the user's action wasn't permitted if they
reject the prompt.
2023-05-19 06:20:41 +02:00
thankyouverycool
37e621a3c7 LibFileSystemAccessClient: Improve error propagation
Previously FSAC displayed some but not all errors and always
rejected directories and devices. This has led most apps to ignore
response errors in open/save actions or show redundant messages.

Now FSAC displays all errors including fd failures and has the ability
to silence messages for directories, devices and ENOENT, which some
apps handle differently. Silenced directory and device errors now
return files on success.

A request's access mode is now stored in RequestData to format more
accurate error messages from the user's perspective.

Resolved promises don't require callback propagation so they're voided
2023-05-19 06:20:41 +02:00
thankyouverycool
7a183ee568 LibGUI: Set Open/Save button as default in FilePicker
This makes it more obvious that enter will return the current
selection and prevents returning without a valid selection.
2023-05-19 06:20:41 +02:00
Andreas Kling
f823b297b4 LibWeb: Push the realm execution context while linking modules
If linking fails, we throw a JS exception, and if there's no execution
context on the VM stack at that time, we assert in VM::current_realm().

This is a hack to prevent crashing on failed module loads. Long term we
need to rewrite module loading since it has been refactored to share
code differently between HTML and ECMA262.
2023-05-19 06:20:14 +02:00
Andreas Kling
819fb39a87 LibWeb: Implement the "error to rethrow" mechanism in HTML::Script
This allows JS module loads to fail and throw without crashing the
WebContent process due to a TODO() assertion.
2023-05-19 06:20:14 +02:00
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