Commit graph

50433 commits

Author SHA1 Message Date
Jelle Raaijmakers
aebc260940 PixelPaint: Add support for box sampling scaling 2023-05-19 18:36:36 +02:00
Jelle Raaijmakers
6b07926466 ImageViewer: Add support for box sampling scaling 2023-05-19 18:36:36 +02:00
Jelle Raaijmakers
6242d8e023 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 18:36:36 +02:00
Jelle Raaijmakers
31fa449538 LibGfx: Cleanup of Painter::do_draw_scaled_bitmap()
No functional changes.
2023-05-19 18:36:36 +02:00
Andreas Kling
6f204f8c32 LibWeb: Fix null dereference on SVG element with bogus fill URL
Fixes a crash seen on YouTube channel pages.
2023-05-19 15:41:34 +02:00
Andreas Kling
411b28fc59 LibWeb: Make sure that margins don't collapse across a nested BFC
In order to fix this, I also had to reorganize the code so that we
create an independent formatting context even for block-level boxes
that don't have any children. This accidentally improves a table
layout test as well (for empty tables).
2023-05-19 15:09:09 +02:00
Andreas Kling
9ce7681ff2 Revert "LibGfx: Implement alternative Rect right/bottom edge calculations"
This reverts commit 88a7bb5ba7.
2023-05-19 13:33:55 +02:00
Andreas Kling
3a670389d6 Revert "LibGfx: Cleanup of Painter::do_draw_scaled_bitmap()"
This reverts commit 4944b16bd5.
2023-05-19 13:33:54 +02:00
Andreas Kling
2d3b7eff15 Revert "LibGfx: Implement box sampling image scaling"
This reverts commit eb418bec32.
2023-05-19 13:33:54 +02:00
Andreas Kling
9fb81c2c4e Revert "ImageViewer: Add support for box sampling scaling"
This reverts commit 032c2a882a.
2023-05-19 13:33:53 +02:00
Andreas Kling
20537ed3da Revert "PixelPaint: Add support for box sampling scaling"
This reverts commit d6aefb1bf1.
2023-05-19 13:33:53 +02:00
Andreas Kling
1c4d69681c Revert "PixelPaint: Use box sampling scaling for layer thumbnails"
This reverts commit 81b30ec372.
2023-05-19 13:33:52 +02:00
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