Commit Graph

49530 Commits

Author SHA1 Message Date
Tim Schumacher
5e7c838160 AK: Rename Stream::format() to Stream::write_formatted()
This brings the function name in line with how we usually name those
functions, which is with a `read_` or `write_` prefix depending on what
they do.

While at it, make the internal `_impl` function private and not-virtual,
since there is no good reason to ever override that function.
2023-04-25 07:30:16 +01:00
Lucas CHOLLET
ddbe65e2f8 LibGfx/JPEG: Factorize chunk size reading 2023-04-25 06:01:39 +02:00
Lucas CHOLLET
105a40f4f6 LibGfx/JPEG: Rename qtable_id => quantization_table_id 2023-04-25 06:01:39 +02:00
Lucas CHOLLET
dd5d2e3505 LibGfx/JPEG: Support up to 4 quantization tables
We used to limit this number to two and name them with their usual
usage. The specification is however broader, and you can find files that
use more tables as in the following link:

https://www.w3.org/MarkUp/Test/xhtml-print/20050519/tests/A_2_1-BF-01.htm
2023-04-25 06:01:39 +02:00
Lucas CHOLLET
f46e3e6644 LibGfx/JPEG: Add myself to the copyright header 2023-04-25 06:01:39 +02:00
Lucas CHOLLET
0d3b62cbb7 LibGfx/JPEG: Use more explicit types and add a bunch of const 2023-04-25 06:01:39 +02:00
Pankaj Raghav
83b87a5ade Kernel: Add bar_address_mask to mask the last 4 bits of a BAR address
Create a bar_address_mask constant to mask the last 4 bits of a BAR
address instead of hand coding the mask all over the kernel.
2023-04-24 21:41:54 +02:00
Sam Atkins
20d517f1da LibChess: Remove use of DeprecatedString in Move::from_algebraic() 2023-04-24 20:58:35 +02:00
Sam Atkins
a10cc37ef0 LibChess: Return ErrorOr<String> from to-algebraic/fen methods
Also, avoid creating temporary Strings for numbers, and stop appending
empty StringViews.
2023-04-24 20:58:35 +02:00
Sam Atkins
5f6dd87163 LibChess: Add and use Square::{file,rank}_char() methods
This saves us having to build and allocate a String, just to then use
one character of it.
2023-04-24 20:58:35 +02:00
Sam Atkins
c73c697f94 LibChess: Make piece_for_char_promotion() more generally useful
- Rename to make it clear it's not just for promotion
- Understand 'p' for pawns
- Take a char parameter instead of StringView since it's always 1 char
2023-04-24 20:58:35 +02:00
Sam Atkins
b111782f18 LibChess: Include pawns in FEN output
Previously, the initial position would look like this:

rnbqkbnr//8/8/8/8//RNBQKBNR w KQkq - 0 1

Now, we correctly give pawns the P/p character in FEN output:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Also, we only ever have 1 or 0 characters for a piece, so let's return
`Optional<char>` instead of `StringView` from `char_for_piece()`.
2023-04-24 20:58:35 +02:00
Sam Atkins
8529e660ca LibChess: Move inputs when creating chess Commands 2023-04-24 20:58:35 +02:00
Sam Atkins
29c41e953b LibChess: Convert Commands to use String and propagate errors 2023-04-24 20:58:35 +02:00
Sam Atkins
6576bbc098 LibChess: Return Commands by pointer from FooCommand::from_string()
This removes this slightly silly pattern:
`make<FooCommand>(FooCommand::from_string(s))`

Also, let's propagate OOM here, even if nobody reacts to it yet.
2023-04-24 20:58:35 +02:00
Sam Atkins
b904435866 LibChess: Fix typo that always created DebugCommands as "on" 2023-04-24 20:58:35 +02:00
Timothy Flynn
8b7c5db186 LibVideo: Do not invoke Vector2D's destructor in order to resize it
This leads to all kinds of undefined behavior, especially when callers
have a view into the Vector2D.
2023-04-24 18:21:01 +02:00
thankyouverycool
683c8284cf Meta: Fix a typo in CONTRIBUTING.md 2023-04-24 16:48:37 +01:00
Jelle Raaijmakers
99451b14b2 Aplay: Determine absolute path before first unveil
`Core::DeprecatedFile::absolute_path` uses `stat` to determine whether a
file exists, which will always fail after the first `unveil` call
`aplay` does. Reorder things so we don't get a stack trace thrown at us
for each file being played.
2023-04-24 14:50:11 +02:00
Timothy Flynn
f08499b4cf WebContent: Add the 'thread' pledge for video playback
This is required after 036eb82aca.
2023-04-24 14:49:42 +02:00
Timothy Flynn
8fe846eb7f Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every file 2023-04-24 14:49:04 +02:00
Aliaksandr Kalenik
269c25e1d2 LibWeb/Fetch: Pass recursive=false to manual navigation redirect
Implement ca10f49748

Fixes the issue I found while working on navigation:
https://github.com/whatwg/fetch/issues/1629
2023-04-24 13:38:37 +01:00
Liav A
7b6cea9ef4 Kernel: Improve context state keeping in the VirtIOGPU3DDevice class
This is done mainly by implementing safe locking on the data structure
keeping the pointers to the PerContextState objects. Therefore, this now
eliminates the need for using LockRefPtr, as SpinlockProtected is enough
for the whole list.

The usage of HashMap in this class was questionable, and according to
Sahan Fernando (the original contributor to the VirGL work also known as
ccapitalK) there was no deep research on which data structure to use for
keeping all pointers to PerContextState objects.
Therefore, this structure is changed to IntrusiveList as the main reason
and advantage to use it is that handling OOM conditions is much more
simple, because if we succeeded to create a PerContextState object, we
can be sure now that inserting it to the list will not cause OOM error
condition.
2023-04-24 13:09:22 +02:00
Liav A
8289759f1d Kernel: Allow configuring a Jail to not impose PID isolation restriction
This is quite useful for userspace applications that can't cope with the
restriction, but it's still useful to impose other non-configurable
restrictions by using jails.
2023-04-24 12:15:29 +02:00
Jonah
cf8875426d Browser: Support selections from the accessibility tab
You can now select elements and see their attributes in the bottom
panel like when navigating from the DOM tab.
2023-04-24 10:39:34 +02:00
Jonah
837a8dc213 LibWeb: Serialize element's IDs when serializing a11y tree 2023-04-24 10:39:34 +02:00
Cameron Youell
8df04f37e4 LibGUI: Convert JsonArrayModel to use Core::File
While we're here lets also convert all the `{set/store/add/remove}`
functions to use `ErrorOr`
2023-04-24 09:21:51 +02:00
Cameron Youell
da305017de Shell: Use JsonArray::append in save_to
We can convert it into a failable function here easily
2023-04-24 09:21:51 +02:00
Cameron Youell
ba38984a60 SQLStudio: Convert MainWidget to a failable constructor 2023-04-24 09:21:51 +02:00
Cameron Youell
e9ad7b8eed BrowserSettings: Convert BrowserSettingsWidget to a failable factory 2023-04-24 09:21:51 +02:00
Cameron Youell
2df0eeaa20 Browser: Convert BookmarksBarWidget to use failable functions 2023-04-24 09:21:51 +02:00
Cameron Youell
bedb370dec Services/WebContent: Use JsonArray::append
We can use the failable function here easily
2023-04-24 09:21:51 +02:00
Cameron Youell
ada6dbf636 AK: Use JsonArray::append when parsing array 2023-04-24 09:21:51 +02:00
Cameron Youell
8134dccdc7 AK: Add new failable JsonArray::{append/set} functions
Move all old usages to the more explicit `JsonArray:must_{append/set}`
2023-04-24 09:21:51 +02:00
Aliaksandr Kalenik
3b00636288 LibWeb: Implement "create a new browsing context and document"
Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-24 07:57:15 +02:00
Andreas Kling
6871fbce9f LibWeb: Implement the "top-level traversable" of a browsing context 2023-04-24 07:57:15 +02:00
Andreas Kling
65467021e2 LibWeb: Add updated version of "determine the origin" AO from HTML spec
The old version is still around since it has many users, so we can't
remove it until everything has been updated to use the new version.
2023-04-24 07:57:15 +02:00
Aliaksandr Kalenik
3225c39191 LibWeb: Implement Document::make_active()
Implementation of "make active" algorithm from the spec for Document.

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-24 07:57:15 +02:00
Timothy Flynn
32e2207b55 LibWeb: Implement the HTMLMediaElement fastSeek method 2023-04-24 07:55:54 +02:00
martinfalisse
c987c934d0 LibWeb: Fix grid size when intrinsically sized
This fixes a bug that was seen when a combination of the grid having
been floated with `float: left` and a `minmax()` column size were used.

The issue was that a grid track size should be considered intrinsically
sized if both the min and max sizes are intrinsic, not just one of them.
2023-04-24 07:55:40 +02:00
Aliaksandr Kalenik
9f691b7fe4 LibWeb: Convert navigationId from DeprecatedString to String 2023-04-24 07:55:20 +02:00
Jelle Raaijmakers
71c98546b8 LibSQL: Add a note to Serializer about m_heap 2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
fdac8331cc LibSQL: Use Block::Index everywhere; rename pointer to block_index
No functional changes.
2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
6601ff9d65 LibSQL: Redesign heap storage to support arbitrary amounts of data
Previously, `Heap` would store serialized data in blocks of 1024 bytes
regardless of the actual length. Data longer than 1024 bytes was
silently truncated causing database corruption.

This changes the heap storage to prefix every block with two new fields:
the total data size in bytes, and the next block to retrieve if the data
is longer than what can be stored inside a single block. By chaining
blocks together, we can store arbitrary amounts of data without needing
to change anything of the logic in the rest of LibSQL.

As part of these changes, the "free list" is also removed from the heap
awaiting an actual implementation: it was never used.

Note that this bumps the database version from 3 to 4, and as such
invalidates (deletes) any database opened with LibSQL that is not
version 4.
2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
194f846f12 LibSQL: Rename Heap constants to match our code style
No functional changes. The constants are moved to constexpr variables
inside `Heap`.
2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
fcd35e824c LibSQL: Remove unused Tuple::is_compatible 2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
a99c1297e0 LibSQL: Clean up code style and remove unused includes
No functional changes.
2023-04-23 18:08:17 -04:00
Jelle Raaijmakers
8992ff5aeb LibSQL: Remove and update VERIFYs
We are performing a lot of checks on pointers that are performed again
immediately afterwards because of a dereference. This removes the
redundant `VERIFY`s and simplifies a couple others.
2023-04-23 18:08:17 -04:00
Zaggy1024
036eb82aca LibVideo/VP9: Implement threaded tile column decoding
This adds a new WorkerThread class to run one task asynchronously,
and allow waiting for that thread to finish its work.

TileContexts are placed into multiple tile column vectors with their
streams to read from pre-created. Once those are ready, the threads can
start their work on each vector separately. The main thread waits for
those tasks to finish, then sums up the syntax element counts for each
tile that was decoded.
2023-04-23 23:14:30 +02:00
Zaggy1024
ba5bf412e5 LibThreading: Create WorkerThread class run a single task concurrently
This class can be used to run a task in another thread, and allows the
caller to wait for the task to complete to retrieve any error that may
have occurred.

Currently, it doesn't support functions returning a value on success,
but with some template magic that should be possible. :^)
2023-04-23 23:14:30 +02:00