Commit Graph

58029 Commits

Author SHA1 Message Date
Jelle Raaijmakers
055f78f528 Ports: Update SDL2 scancode mapping
This was broken since c8f27d7cb8 introduced a new enum value in
between existing values. Since the Serenity platform support in SDL2
relied on a sequential array index, a lot of keys were now incorrectly
mapped.

This introduces a new way to map Serenity `KeyCode` to SDL2's scancode
constants that is less prone to breaking in the future.
2024-01-14 15:06:37 -07:00
Jelle Raaijmakers
015622bc22 Kernel: Set correct KeyCode count
The underlying value of the `KeyCode::Key_*` enum values starts at 0,
so we should add 1 to `Key_Menu` to get the correct count.
2024-01-14 15:06:37 -07:00
Lucas CHOLLET
b7bce816b2 LibGfx/TIFF: Sort tags in the known_tags list
The intruder comes from 5b62d877.
2024-01-14 15:04:43 -07:00
Lucas CHOLLET
cb669675f1 FileManager: Start displaying basic metadata for images
Let's add a new group in the Image tab of the properties window. The
goal is to provide generic metadata, only a few tags are displayed here.
2024-01-14 15:04:43 -07:00
Lucas CHOLLET
383be5e49c LibGfx/TIFF: Override ImageDecoderPlugin::metadata() 2024-01-14 15:04:43 -07:00
Lucas CHOLLET
48347d1923 LibGfx/TIFF: Make ExifMetadata inherit from Metadata 2024-01-14 15:04:43 -07:00
Lucas CHOLLET
e3f976f17a LibGfx: Add an API to retrieve metadata from images
All the data is passed using the `Metadata` object, which has a
`main_tags` method. This method should be used when displaying only a
few main tags, for example to fill the property window of a file
manager. Another method returning the entire list of tags will be
implemented later on.
2024-01-14 15:04:43 -07:00
Lucas CHOLLET
7962f5e04b LibGfx/TIFF: Parse some pure-metadata tags
This will be useful to test a metadata displayer :^)
2024-01-14 15:04:43 -07:00
Lucas CHOLLET
f47666a93b LibGfx/TIFF: Rename Metadata => ExifMetadata
I originally thought that this would be our global `Metadata` class, but
that won't happen so let's give it a less general name.
2024-01-14 15:04:43 -07:00
Tim Ledbetter
b242fe20cc SystemMonitor: Make the icon column in the Processes tab non-selectable 2024-01-14 15:01:47 -07:00
Tim Ledbetter
1eb1f7bde9 LibGUI: Allow HeaderView column selectability to be toggled
Previously, any TableView column could be made visible through a
context menu shown by right clicking on the table header. This change
allows columns to be marked as non-selectable, so their visibility
cannot be toggled in this way.
2024-01-14 15:01:47 -07:00
Sam Atkins
4ffd43a5f4 HackStudio: Stop crash from leaking Editor widgets when closing tabs
When re-opening an existing file, we would reuse the document and
register a new Editor with it, but never unregister that Editor.

Previously, this would cause a crash if you opened a binary file, closed
its tab, then opened that binary file again. HackStudio would crash
while calling `HackStudio::EditorWrapper::update_title()` on an invalid
EditorWrapper. But now it doesn't!

Something still gets leaked each time, but we now don't crash at least.
2024-01-14 15:00:32 -07:00
Kevin Meyer
284f14d046 LibVideo: Replace DeprecatedFlyString with FlyString 2024-01-14 15:00:13 -07:00
Jelle Raaijmakers
8b2144c8e6 Ports: Update ScummVM to 2.8.0 2024-01-14 14:59:57 -07:00
Sergey Bugaev
1205f29a40 LibSQL: Don't try to fchmod() socket on GNU/Hurd
Because of the way sockets are implemented, a local socket object inside
pflocal has little to do with the filesystem node that has an ifsock
translator sitting on it; and the latter doesn't even exist until you
bind() the socket.

So it's not possible to set the socket's mode using Unix-level APIs
(other than by temporarily changing umask). It's still possible to do
this with Mach-level APIs, essentially doing the same thing as glibc's
bind() implementation does, but supplying the desired mode instead of
0666, but let's not go there.
2024-01-14 14:56:33 -07:00
Sergey Bugaev
c64c199ab7 LibJS: Don't use MADV_FREE / MADV_DONTNEED on GNU/Hurd
Much like on Serenity itself, these aren't implemented.
2024-01-14 14:56:33 -07:00
Sergey Bugaev
8c1f87a869 LibJIT: Fix 32-bit build
Cast through the integer of an appropriate size. This still generates
a 64-bit ELF image.
2024-01-14 14:56:33 -07:00
Lucas CHOLLET
66f52d6db9 LibGUI: Use BoxSampling to draw thumbnails 2024-01-14 21:26:36 +01:00
Lucas CHOLLET
a3d48319fe LibCompress/Deflate: Remove three useless FIXMEs 2024-01-14 21:22:35 +01:00
Lucas CHOLLET
830e6472e6 LibCompress/Deflate: Simplify DeflateDecompressor::decompress_all() 2024-01-14 21:22:35 +01:00
Lucas CHOLLET
cc6ca7d873 LibGfx/TIFF: Parse the ExifIFD tag
And add a spec link :^)
2024-01-14 21:17:50 +01:00
Lucas CHOLLET
1d0a762cdb LibGfx/TIFF: Add support for the IFD type
As described in the first edition of the TIFF technical notes, the IFD
type is identical to Long (UnsignedLong) except that it only contains
offset of valid IFDs.

https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf
2024-01-14 21:17:50 +01:00
Lucas CHOLLET
1de90bf55e LibGfx/TIFF: Generate the function that returns the size of a TIFF::Type 2024-01-14 21:17:50 +01:00
Lucas CHOLLET
3124c1616c LibGfx/TIFF: Generate code for the u16 to TIFF::Type conversion 2024-01-14 21:17:50 +01:00
Nicolas Ramz
a1255cb6c9 LibGfx/ILBMLoader: Don't decode bits once full row has been decoded
We were potentially decoding more bits than needed: this could
trash the next lines if decoder didn't zero the extra bits.
2024-01-14 20:41:25 +01:00
Tim Ledbetter
d545fb2b60 LibCrypto: Parse negative input correctly in BigFraction::from_string()
Previously, when calling `BigFraction::from_string()`, the fractional
part of the number was always treated as positive. This led to an
incorrect result if the input string was negative.
2024-01-14 20:15:15 +01:00
Sam Atkins
e0fd5beb36 LibGUI+Applications: Default the SpinBox min/max to the full int range
By default, a SpinBox's value should be unlimited, (or as close as we
can get to that,) and then the GML or code can impose a limit if
needed. This saves the developer from entering an arbitrary "big" max
value when they want the value to have no maximum.

I've audited the use of SpinBox and added `min: 0`, and removed a `max`,
where appropriate. All existing SpinBoxes constructed in code have a
range set explicitly as far as I can tell.
2024-01-14 13:46:14 +00:00
Sam Atkins
cbd28c9110 HexEditor: Add annotations system
Allow the user to highlight sections of the edited document, giving them
arbitrary background colors. These annotations can be created from a
selection, or by manually specifying the start and end offsets.
Annotations can be edited or deleted by right-clicking them.

Any color can be used for the background. Dark colors automatically make
the text white for easier readability. When creating a new annotation,
we use whatever color the user last picked as this is slightly more
likely to be the one they want.

Icons contributed by Cubic Love.

Co-authored-by: Cubic Love <7754483+cubiclove@users.noreply.github.com>
2024-01-14 13:45:02 +00:00
Sam Atkins
1168e46c1d HexEditor: Extract pixel-position-to-byte-offset code 2024-01-14 13:45:02 +00:00
Sam Atkins
84dd0ce1ae HexEditor: Wrap selection and behavior in a struct 2024-01-14 13:45:02 +00:00
Nico Weber
96e8debf0b test-jpeg-roundtrip: Add a few more colors 2024-01-14 11:35:40 +00:00
Nico Weber
25efe65a83 test-jpeg-roundtrip: Print summary statistics at the end 2024-01-14 11:35:40 +00:00
Nico Weber
8ef3310525 test-jpeg-roundtrip: Print perceived delta of fixpoint to start color 2024-01-14 11:35:40 +00:00
Nico Weber
5a47e71604 Utilities: Add test-jpeg-roundtrip
This creates a bitmap filled with a fixed color, then (in memory)
saves it as jpeg and loads it again, and repeats that until the
color of the bitmap no longer changes. It then reports how many
iterations that took, and what the final color was.

It does this for a couple of colors.

This is for quality assessment of the jpeg codec. Ideally, it should
converge quickly (in one iteration), and on a color not very far from
the original input color.
2024-01-14 11:35:40 +00:00
Shannon Booth
9d4278ad9a LibWeb: Wait until new document is active before running SVG scripts
This is the same fix as 07928129dd
also applied to the SVG script element case. Fixes a crash for the
following HTML:

```html
<svg>
<script>
location.reload();
</script>
</svg>
```

As with the linked commit:
> With this change WebContent does not crash when `location.reload()` is
> invoked but `Navigable::reload()` still not working because of spec
> issue (whatwg/html#9869) so we can't add a
> test yet.
2024-01-14 11:27:58 +00:00
Shannon Booth
4135c3885c LibWeb: Only wait for document to be ready for scripts if executing one
HTML fragments are parsed with a temporary HTML document that never has
its flag set to say that it is ready to have scripts executed. For these
fragments, in the HTMLParser, these scripts are prepared, but
execute_script is never called on them.

This results in the HTMLParser waiting forever on the document to be
ready to have scripts executed.

To fix this, only wait for the document to be ready if we are definitely
going to execute a script.

This fixes a hang processing the HTML in the attached test, as seen on:
https://github.com/SerenityOS/serenity

Fixes: #22735
2024-01-14 11:27:58 +00:00
Tim Ledbetter
48a3a02238 LibCrypto: Make constructing a BigInteger from string fallible
Previously, constructing a `UnsignedBigInteger::from_base()` could
produce an incorrect result if the input string contained a valid
Base36 digit that was out of range of the given base. The same method
would also crash if the input string contained an invalid Base36 digit.
An error is now returned in both these cases.

Constructing a BigFraction from string is now also fallible, so that we
can handle the case where we are given an input string with invalid
digits.
2024-01-13 19:01:35 -07:00
Tim Ledbetter
0b0c7693e2 LibCrypto: Prefer operator when converting string literal to BigInteger 2024-01-13 19:01:35 -07:00
Tim Ledbetter
65827826fe AK: Add CharacterTypes::is_ascii_base36_digit()
This can be used to validate the string passed to
`parse_ascii_base36_digit()`.
2024-01-13 19:01:35 -07:00
Tim Ledbetter
bbdbd71439 Tests/AK: Add unit test for Base36 digit parsing 2024-01-13 19:01:35 -07:00
Liav A
fc0dbd2334 Utilities: Add the listdir utility
This utility uses the Core::DirIterator facility which in turn uses the
get_dir_entries syscall. Therefore, this utility lets us to view the
actual values for inode numbers, and entry type value for directory
entries.
2024-01-13 19:01:07 -07:00
Liav A
603516e8c0 LibCore: Add new flag for DirIterator to not use fstatat
This will be useful in the upcoming listdir utility (in the next commit)
to get the file type which is obtained in the get_dir_entries syscall,
so it's not changed later by the fstatat syscall.

This will ensure that we get the raw file type value as it's represented
by directory entries from the get_dir_entries syscall.
2024-01-13 19:01:07 -07:00
Liav A
d568b09632 LibCore: Add methods to convert DirectoryEntry types to names
We can either convert DirectoryEntry::type to its representative name or
to the POSIX DT_* name.
2024-01-13 19:01:07 -07:00
Liav A
90152dc859 Tests/Kernel: Add test cases for proper types in dirent for various FSes 2024-01-13 19:01:07 -07:00
Liav A
a10e63f08e Kernel/FileSystem: Send proper filetypes when traversing RAM-backed FSes
SysFS, ProcFS and DevPtsFS were all sending filetype 0 when traversing
their directories, but it is actually very easy to send proper filetypes
in these filesystems.
This patch binds all RAM backed filesystems to use only one enum for
their internal filetype, to simplify the implementation and allow
sharing of code.
Please note that the Plan9FS case is currently not solved as I am not
familiar with this filesystem and its constructs.

The ProcFS mostly keeps track of the filetype, and a fix was needed for
the /proc root directory - all processes exhibit a directory inside it
which makes it very easy to hardcode the directory filetype for them.
There's also the `self` symlink inode which is now exposed as DT_LNK.

As for SysFS, we could leverage the fact everything inherits from the
SysFSComponent class, so we could have a virtual const method to return
the proper filetype.
Most of the files in SysFS are "regular" files though, so the base class
has a non-pure virtual method.

Lastly, the DevPtsFS simply hardcodes '.' and '..' as directory file
type, and everything else is hardcoded to send the character device file
type, as this filesystem is only exposing character pts device files.
2024-01-13 19:01:07 -07:00
Lucas CHOLLET
75bd1308c5 Tests/LibCompress: Add a reproducer of oss-fuzz issue 58046
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58046
2024-01-13 15:17:08 -07:00
Sam Atkins
336b8ed80b HackStudio: Use Core::System APIs where possible 2024-01-13 15:13:36 -07:00
Sam Atkins
16543a1918 HackStudio: Convert ProjectTemplate::create_project to ErrorOr
This lets us also use the Core::System APIs, which reduces the amount of
error checking code.
2024-01-13 15:13:36 -07:00
Bastiaan van der Plaat
63c6eae918 LibWebView: Fix sanitizing about scheme URLs 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat
cde14901bc Ladybird+LibWeb: Add initial about:version internal page 2024-01-13 13:41:09 -05:00