Commit graph

47717 commits

Author SHA1 Message Date
Nico Weber
fa34832297 LibGfx: Implement WebPImageDecoderPlugin::loop_count()
Turns out extended-lossless-animated.webp did have a loop count of 0.
So I opened it in Hex Fiend and changed the byte at position 42
(which is the first byte of the little-endian u16 storing the loop
count) to 0x2A, so that the test can compare the loop count to something
not 0.
2023-02-26 15:54:22 +01:00
Nico Weber
3c5450b8be LibGfx: Implement is_animated() and frame_count() for webp plugin 2023-02-26 15:54:22 +01:00
Nico Weber
0393a37843 LibGfx: Add some chunk validation to decode_webp_extended() 2023-02-26 15:54:22 +01:00
Nico Weber
9864963a08 LibGfx: In WebP, rename decode_webp_size to decode_webp_first_chunk
...and make it store the decoded details in the context.
2023-02-26 15:54:22 +01:00
Nico Weber
15d2e8ca2b LibGfx: In WebP, rename decode_webp_first_chunk to read_webp_first_chunk 2023-02-26 15:54:22 +01:00
Tim Ledbetter
799d570afc PixelPaint: Add "Apply Mask" action
This commit adds a "Apply Mask" action which merges the active layer
mask with the layer bitmap. The option is only displayed if the active
layer is masked.
2023-02-26 13:09:16 +01:00
Tim Ledbetter
062c9efa88 PixelPaint: Add "Delete Mask" action
This commit adds a "Delete Mask" action which deletes the active layer
mask. The option is only displayed if the active layer is masked.
2023-02-26 13:09:16 +01:00
Nico Weber
d66f143fb7 Tests: Add webp size decoding tests for webp 2023-02-26 12:21:40 +01:00
Nico Weber
3cfcd2397b Tests: Add one more webp test file
This is "Lossless animated WebP (5 KB) 4" from
https://developers.google.com/speed/webp/faq
2023-02-26 12:21:40 +01:00
Nico Weber
1bb3abd9ab Tests: Add one more webp test file
This is Discord's reencoded version of my profile picture,
which is GitHub's auto-generated avatar for my github profile.
2023-02-26 12:21:40 +01:00
Nico Weber
889a02f9df Tests: Add one more webp test file
It's a simple lossless file from:
https://developers.google.com/speed/webp/gallery2#webp_links

> "baby tux for my user page"
> Image Author: Fizyplankton
> This file is in the public domain.
2023-02-26 12:21:40 +01:00
Andrew Kaster
ce500ed170 Lagom: Look for clang the same way serenity.sh does in BuildFuzzers.sh
Also note that Xcode does not ship libfuzzer and is not usable for
a fuzzer build.
2023-02-26 08:11:08 +00:00
Ali Mohammad Pur
5bc1f135b7 Tests: Implement multi-value returns in test-wasm 2023-02-26 10:54:23 +03:30
Ali Mohammad Pur
8a36d8826f LibWeb: Implement the js-api portion of Wasm multi-value 2023-02-26 10:54:23 +03:30
Ali Mohammad Pur
6b50f23242 LibWasm+LibWeb: Sneak a JS::Completion into Wasm::Result
Imported functions in Wasm may throw JS exceptions, and we need to
preserve these exceptions so we can pass them to the calling JS code.

This also adds a `assert_wasm_result()` API to Result for cases where
only Wasm traps or values are expected (e.g. internal uses) to avoid
making LibWasm (pointlessly) handle JS exceptions that will never show
up in reality.
2023-02-26 10:54:23 +03:30
kleines Filmröllchen
1c3050245e LibDSP: Don't crash on out-of-bounds parameter value
We can just clamp instead.
2023-02-25 20:49:41 -07:00
kleines Filmröllchen
961e263129 AK: Add FixedPoint::clamp 2023-02-25 20:49:41 -07:00
kleines Filmröllchen
7b3b743f88 Piano: Move octave controls into main widget
This is not related to the track controls and it may move into another
separate widget in the future. The move also allows to simplify the
octave slider callback logic.
2023-02-25 20:49:41 -07:00
kleines Filmröllchen
376e7243a9 LibGUI: Use full text width for Label's preferred width
A label would prefer to be exactly as wide as its contained text
requires. This makes min_width: "fit" work better.
2023-02-25 20:49:41 -07:00
kleines Filmröllchen
9f5f6b3868 Piano: Clean up code style with help from clang-tidy
Includes shadowed variables and if-else return.
2023-02-25 20:49:41 -07:00
kleines Filmröllchen
401a21e4f4 Piano: Improve handling of possibly null parameter label
The current implementation could crash in various locations if the label
was null.
2023-02-25 20:49:41 -07:00
kleines Filmröllchen
cf6676beb2 Piano: Rename KnobsWidget to TrackControlsWidget
This more generic name will better reflect the purpose of the widget in
the future, as this commit begins the long process of enhancing the
widget into a container for all controls of Piano's currently selected
track.
2023-02-25 20:49:41 -07:00
Nico Weber
0190be9788 Tests: Use MUST more in TestImageDecoder
No behavior change.
2023-02-26 01:15:10 +01:00
Kenneth Myhra
9a5a8d617d LibWeb: Port IDL implementations Blob and File to new String 2023-02-26 00:27:22 +01:00
Kenneth Myhra
31a9bd2bfd LibWeb: Add to_ascii_upper_case() from the Infra spec
https://infra.spec.whatwg.org/#ascii-uppercase
2023-02-26 00:27:22 +01:00
Kenneth Myhra
2c1e15bd3b LibWeb: Add to_ascii_lower_case() from the Infra spec
https://infra.spec.whatwg.org/#ascii-lowercase
2023-02-26 00:27:22 +01:00
Kenneth Myhra
2facb0e8ed BindingsGenerator: Use JS::Value::to_string() when new String
Make sure to use JS::Value::to_string() when the IDL interface is marked
with the extended attribute UseNewAKString.
2023-02-26 00:27:22 +01:00
Kenneth Myhra
99f094905e BindingsGenerator: Conditionally check dictionary member is string
This adds the condition member.type->is_string() to the if statement, so
that we now conditionally check the dictionary member is a new string
and associated with an optional constructor parameter.
2023-02-26 00:27:22 +01:00
Andrew Kaster
72a48ee1ee LibCore+Utilities: Replace uses of strpbrk with find_any_of()
We don't need to use scary C string POSIX APIs when we have nicer ones
on String/DeprecatedString.
2023-02-25 22:31:17 +01:00
Nico Weber
19ca8d7fb7 LibGfx: Decode WebP canvas size
This reorganizes things so that:

* When initially decoding chunks, we only store pointers to
  their data and don't look at the contents
* We allow pausing decoding after decoding the first chunk, since
  that's where the dimensions are stored, and we don't need to read
  more than that if we only care about dimensions. (Currently
  inconsequential, but maybe we want to get dimensions after
  receiving the first few bytes off the network in the future.)
* We then have separate methods to interpret chunk data
  (only for the first few bytes which store the size, so far.)
2023-02-25 22:30:32 +01:00
Timothy Flynn
5eec76b441 AK: Use the same consteval condition on _short_string as its factory
This fixes the build with Apple Clang.
2023-02-25 22:25:05 +01:00
Timothy Flynn
73239fdd82 LibUnicode: Add a unit test for Unicode grapheme and word segmentation
These include tests for previously broken boundary conditions.
2023-02-25 22:23:39 +01:00
Timothy Flynn
fa96811a22 LibUnicode: Skip over emoji sequences in grapheme boundary segmentation
Emoji sequences in the grapheme segmentation spec are a bit tricky:

    \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic}

Our current strategy of tracking a boolean to indicate if we are in an
emoji sequence was causing us to break up emoji made of multiple sub-
sequences. For example, in the "family: man, woman, girl, boy" sequence:

    U+1F468 U+200D U+1F469 U+200D U+1F467 U+200D U+1F466

We would break at indices 0 (correctly) and 6 (incorrectly).

Instead of tracking a boolean, it's quite a bit simpler to reason about
emoji sequences by just skipping past them entirely. Note that in cases
like the above emoji, we skip one sub-sequence at a time.
2023-02-25 22:23:39 +01:00
Linus Groh
09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
Linus Groh
85414d9338 AK: Add operator""_{short_,}string to create a String from a literal
We briefly discussed this when adding the new String type but couldn't
settle on a name. However, having to use String::from_utf8() on every
literal string is a bit unwieldy, so let's have these options available!

Naming-wise '_string' is not as short as 'sv' but should be relatively
clear; it also matches '_bigint' and '_ubigint' in length.
'_short_string' may be longer than the actual string itself, but it's
still an improvement over the static function :^)

Since our C++ source files are UTF-8 encoded anyway, it should be
impossible to create a string literal with invalid UTF-8, so including
that in the name is not as important as in the function that can receive
arbitrary data.
2023-02-25 20:51:49 +01:00
kleines Filmröllchen
956450df00 Meta: Document how to manipulate CMake caches for the fuzzing build 2023-02-25 19:39:04 +01:00
kleines Filmröllchen
5ec5c68ed4 Meta: Allow disabling LibWeb fuzzers
The LibWeb fuzzer build is really slow, so for local builds it is useful
to disable it when you're not interested in running that fuzzer.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2023-02-25 19:39:04 +01:00
Nico Weber
7c1455c357 LibGfx: Parse WebP VP8L chunk header
For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber
d5875b5962 LibGfx: Fix lossless fourcc in VP8X chunk decoder 2023-02-25 16:02:51 +01:00
Nico Weber
d78c70c28c LibGfx: Add link to webp overview 2023-02-25 16:02:51 +01:00
Nico Weber
0774d2135c LibGfx: Parse some of WebP 'VP8 ' chunk
This is for lossy compression, in which case a WebP file is
a single VP8 key frame.

This only parses the 10-byte frame header, which contains image
dimensions (and some other things).

For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber
e56e7db9d4 LibGfx: Parse WebP VP8X chunk
For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber
58a5038420 LibGfx: Add a FIXME to WebPImageDecoderPlugin::icc_data() 2023-02-25 16:02:51 +01:00
Nico Weber
65d41f8ed9 LibGfx: Add a WebPLoadingContext::error() helper
No behavior change.

(Well, technically, this now correctly sets the state to Error
if the first chunk is neither of 'VP8 ', 'VP8L', 'VP8X'. But no
*interesting* behavior change.)
2023-02-25 16:02:51 +01:00
kleines Filmröllchen
76b71fcb75 LibDSP: Get rid of DeprecatedString
This was a rather easy change, since only parameter names make use of
strings in the first place.

This also improves OOM resistance: If we can't create a parameter name,
we will just set it to the empty string.
2023-02-25 15:41:01 +01:00
Liav A
8a50c967b8 Kernel: Mark sys$prctl() as not needing the big lock
This syscall has sufficient locking and therefore it doesn't need the
big lock being taken.
2023-02-25 15:21:29 +01:00
Nico Weber
41980675f2 Lagom: Build file in lagom builds 2023-02-25 15:00:23 +01:00
Nico Weber
b07e9d4c8a Lagom: Build LibELF on arm64
This seems to build fine now on Arm Macs.
2023-02-25 15:00:23 +01:00
MacDue
f8bdb584f8 LibDeviceTree: Use unchecked_append() in path parsing
try_append() checks if the vector should increase capacity and if
so grows the vector. unchecked_append() verifies the vector already
has enough capacity, and will never grow the vector.
2023-02-24 23:56:37 +01:00
Linus Groh
69f0339bac Revert "LibDeviceTree: Propagate try_append() errors while parsing paths"
This reverts commit f064f5f36e.

As Andrew points out, this append is not actually fallible in practice,
since the loop is terminated once the vector size reaches its inline
capacity.

https://github.com/SerenityOS/serenity/pull/17606#discussion_r1117662246
2023-02-24 23:40:23 +01:00