Commit graph

43475 commits

Author SHA1 Message Date
Andrew Kaster 1adc3530b2 CI: Install gcc-12 for Android nightly CI job
This *also* got missed in the gcc-12 update, because we weren't
installing an explicit gcc version prior. Hopefully that's the last of
the long tail of issues from that migration!
2022-11-26 09:40:07 +01:00
cflip bad3e2a089 LibGL: Add some tests for the buffer API 2022-11-26 09:38:13 +01:00
cflip b83181ef93 LibGL: Use buffers in vertex pointer functions and glDrawElements
Many of these functions will treat the 'pointer' parameter as an offset
into a buffer if one is currently bound.

This makes it possible to run ClassiCube with OpenGL 1.5 support!
2022-11-26 09:38:13 +01:00
cflip 59df2e62ee LibGL: Add simple implementation of buffer objects
For now, buffers are only implemented on the LibGL side, however in the
future buffer objects should be stored in LibGPU.
2022-11-26 09:38:13 +01:00
cflip 892006218a LibGL: Refactor TextureNameAllocator to a more general NameAllocator
This functionality can also be used for other types of objects.
2022-11-26 09:38:13 +01:00
cflip 9a0bb8212a AK: Add contains_slow method to Stack 2022-11-26 09:38:13 +01:00
Timothy Flynn e86e59699d LibJS: Use Object's new deferred instrinsic storage for GlobalObject 2022-11-26 09:36:22 +01:00
Timothy Flynn 12f9f3d9ef LibJS: Support instrinsic Object properties with deferred evaluation
For performance, it is desirable to defer evaluation of intrinsics that
are stored on the GlobalObject for every created Realm. To support this,
Object now maintains a global storage map to store lambdas that will
return the associated intrinsic when evaluated. Once accessed, the
instrinsic is moved from this global map to normal Object storage.

To prevent this flow from becoming observable, when a deferred intrinsic
is stored, we still place an empty object in the normal Object storage.
This is so we still create the metadata for the object, and in doing so,
can preserve insertion order of the Object storage. Otherwise, this will
be observable by way of Object.getOwnPropertyDescriptors.
2022-11-26 09:36:22 +01:00
Timothy Flynn 4f08f2f581 LibJS: Lazily initialize most Realm instrinsic contructors/prototypes
This changes Intrinsics to not initialize most of its constructors and
prototype right away. We still initialize a few that are needed before
some others are created, though we may eventually be able to "link"
dependencies at compile time to avoid this.
2022-11-26 09:36:22 +01:00
Rahmanu Hermawan c54334c8e4 Ports/bc: Update to version 6.1.1 2022-11-26 09:31:40 +01:00
Jelle Raaijmakers 70a7bca920 LibSQL: Fix BTree corruption in TreeNode::split
After splitting a node, the new node was written to the same pointer as
the current node - probably a copy / paste error. This new code requires
a `.pointer() -> u32` to exist on the object to be serialized,
preventing this issue from happening again.

Fixes #15844.
2022-11-26 09:15:34 +01:00
Jelle Raaijmakers e5e00a682b LibSQL: Remove unused method Heap::has_block 2022-11-26 09:15:34 +01:00
Jelle Raaijmakers 0460a654d4 LibSQL: Remove superfluous VERIFYs for Vector accessing
Remove some `[]` operators' out-of-bounds checks which are already
performed by the underlying `Vector`.
2022-11-26 09:15:34 +01:00
Sam Atkins 234bc0c237 LibGfx: Prevent calling to_type<T>() on Line/Point/Rect/Size<T>
Also, add `Line::to_type<T>()` since that was missing.

Calling to_type() with the same type as the existing object accomplishes
nothing except wasting some cycles and making the code more verbose,
and it is hard to spot. Nobody does this in the code currently
(yay!) but I made this mistake repeatedly when doing my step-by-step
CSS Pixels conversion, so let's make it easier to catch them.
2022-11-26 09:14:49 +01:00
Timothy Flynn 34fd5cb206 SoundPlayer+VideoPlayer: Set the play/pause action text on state change 2022-11-26 09:02:25 +01:00
Timothy Flynn 4addad67d1 LibGUI: Propagate changing an action's text to its associated buttons
All other action state changes are already propagated to the action's
buttons. Do the same for text.
2022-11-26 09:02:25 +01:00
Timothy Flynn 234ae3a2ae LibGUI: Allow buttons to control the behavior when their text changes
Some buttons control how their text is set in unique ways. For example,
GUI::ToolbarButton will set only its tooltip instead of its text if it
has an icon. So when the text changes, ToolbarButton will want to change
its tooltip instead.
2022-11-26 09:02:25 +01:00
Timothy Flynn 62cbfc68b9 Revert "LibGUI: Update buttons' text/tooltips in Action::set_text"
This reverts commit e20756f9f7.

Some buttons, e.g. GUI::ToolbarButton, set text to be used only as a
tooltip instead of text on the button itself. This commit forced those
buttons to have text on them when their action became set. For most
toolbars, this was an invisible side effect; the button icons covered
the whole button rect. But the toolbar for EmojiInputDialog has slightly
smaller icons, causing an ellipsis to be displayed next to the icon.
2022-11-26 09:02:25 +01:00
Rodrigo Tobar d04613d252 LibPDF: Fix path coordinates calculation
Paths rendering was buggy because the map() function that translates
points from user space to bitmap space applied the vertical flip
conversion that the current transformation matrix already considers;
Hence, all paths were upside down. The only exception was the "re"
instruction, which manually adjusted the Y coordinate of its points to
be flipped again (and had a FIXME saying that this should be
unnecessary).

This commit fixes the map() function that maps userspace points to
bitmap coordinates. The "re" operator implementation has also been
simplified creating a rectangle first and mapping *that* instead of
mapping each point individually.
2022-11-26 08:56:35 +01:00
Andrew Kaster 21f500937b Meta: Add devcontainer configuration for use with Github Codespaces
This configuration allows developing serenity and ladybird in github
codespaces. It should also help anyone who wants to use a devcontainer
locally.
2022-11-25 18:41:21 -07:00
Andrew Kaster 9bf2a7c7e5 Meta: Use proper versions in is_compiler_supported check in serenity.sh
We were checking the compilers against clang-12 and gcc-10. Since the
check itself is confusing, some comments are warranted.
2022-11-25 18:41:21 -07:00
kleines Filmröllchen d9c1eb860f AudioServer: Detect improperly detached audio clients
Because IPC is used very little in audio server communication, a
ping-pong method like WindowServer is neither a good nor a reliable way
of detecting detached audio clients. AudioServer was previously doing
nothing to detect the kinds of clients that never closed their
connection properly, which happens e.g. when a program is force-closed.
Due to reference-counting cycles, the associated client connection
queues were being kept alive. However, the is_open method of local
sockets reliably detects all kinds of disconnected sockets and can
easily be adapted for this use case. With this fix, we no longer get
"Audio client can't keep up" spam on improperly disconnected clients,
and the client queues don't fill up indefinitely, reducing processing
and memory usage in AudioServer.
2022-11-25 17:43:16 -07:00
Jelle Raaijmakers 441555ea56 LibVT: Prevent u16 underflow when resizing terminal to a height of 1
Resizing the Terminal window to its smallest size no longer crashes.

Fixes #7296.
2022-11-26 01:28:05 +01:00
implicitfield 19e6befddc FuzzTar+tar: Advance the stream before continuing
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53733
This bug was caused by a regression introduced in c88d8a2.
2022-11-26 01:24:12 +01:00
Baitinq 73e87d694e LibWeb: Don't collapse TextNode if it's editable
Fixes #16127
2022-11-26 01:21:02 +01:00
MacDue 76de41c3b7 LibGfx: Add draw_line_for_path() and remove AntiAliasPolicy
draw_line_for_path() is the same as the standard antialiased
draw_line() but with a few few small hacks to improve the look of
paths.

AntiAliasPolicy is also removed as it's now unused.
2022-11-26 01:17:04 +01:00
MacDue f7a680f30a LibGfx: Implement nicer antialiased lines
This is not any 'proper' algorithm, this was just a shower thought
idea. There probably is a better algorithm to achieve the same effect
out there, if someone knows of one please replace this code :^).

This works by rendering the line a scanline at a time, which avoids
repainting over any pixel on the line (so opacity now works with AA
lines). This generally seems to achieve a much nicer looking line.

I've not done any proper benchmarking of this, but some little messing
around showed that this new implementation was a little faster than
the old one too, so that's a nice little bonus.

With the inclusion of a few minor hacks this also goes a surprisingly
far way in improving our SVG rendering too (for both filled and stroked
paths). :^)
2022-11-26 01:17:04 +01:00
MacDue ce6dacbc46 AK: Fix double promotion error when using AK:ceil on floats 2022-11-26 01:17:04 +01:00
kleines Filmröllchen c948777ec4 aplay: Preload more audio
This reduces glitching, but it is in no way a good solution. We should
really do the loading on another thread, but that's out of scope.
2022-11-25 17:01:44 -07:00
kleines Filmröllchen 9b819a0dc9 LibAudio: Set asynchronous audio enqueuer thread to maximum priority
Anything that handles audio in this way should run at maximum priority.
2022-11-25 17:01:44 -07:00
Lucas CHOLLET 4219d50a21 LibGfx: Use the Midpoint Ellipse Algorithm
It is only used to draw non-antialiased and non-filled ellipses.
2022-11-26 00:49:05 +01:00
Daniel Ehrenberg 09841f56ed LibWeb: Add initial implementation of structured clone
This implementation only works for cloning Numbers, and does not try to
do all the spec steps for structured serialize and deserialize.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-26 00:47:23 +01:00
Sam Atkins d94d60219c LibWebView+WebContent: Propagate unconsumed input events out of OOPWV
Since 9e2bd9d261a8c0c1b5eeafde95ca310efc667204, the OOPWV has been
consuming all mouse and keyboard events, preventing action shortcuts
from working. So let's fix that. :^)

OOPWV now queues up input events, sending them one at a time to the
WebContent process and waiting for the new
`did_finish_handling_input_event(bool event_was_accepted) =|` IPC call
before sending the next one. If the event was not accepted, OOPWV
imitates the usual event bubbling: first passing the event to its
superclass, then to its parent widget, and finally propagating to any
Action shortcuts.

With this, shortcuts like Ctrl+I to open Browser's JS console work
again, except when a contenteditable field is selected. That's a
whole separate stack of yaks.

Co-authored-by: Zaggy1024 <zaggy1024@gmail.com>
2022-11-26 00:44:49 +01:00
Sam Atkins 2654bfead4 LibWebView: Define the OOPWV's superclass in one place
This lets us change it later without having to remember to update a
bunch of uses. (More are coming in the next commit.)
2022-11-26 00:44:49 +01:00
Sam Atkins b517032354 LibWeb: Return correct value from EventHandler::fire_keyboard_event()
The returned bool should be true if the event was consumed, aka if we
should ignore it. But `dispatch_event()` returns true if
you *shouldn't* ignore it, so we have to invert that return value.
2022-11-26 00:44:49 +01:00
Ali Mohammad Pur 9ca41a181d Tests: Replace {'if' => 'ifdef'} AK_OS_EMSCRIPTEN
Our main build doesn't have -Werror-undef, so this went unnoticed.
2022-11-26 02:34:29 +03:30
Ali Mohammad Pur 7c93724ee0 Meta: Build and deploy the WebAssembly LibJS REPL on merge 2022-11-26 02:23:15 +03:30
Ali Mohammad Pur f102931688 Meta: Add a js REPL wasm target
...and build it only with emscripten.
2022-11-26 02:23:15 +03:30
Ali Mohammad Pur 2110e7cf85 Everywhere: Add support for compilation under emscripten
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-26 02:23:15 +03:30
Ali Mohammad Pur 84502f53b5 LibJS+js: Move the value print implementation to LibJS
And make it capable of printing to any Core::Stream.
This is useful on its own and can be used in a number of places, so move
it out and make it available as JS::print().
2022-11-26 02:23:15 +03:30
Ali Mohammad Pur af511a64cd LibWeb: Add support for accessing exported wasm table instances 2022-11-26 02:23:15 +03:30
Ali Mohammad Pur 0d1471e72f LibWasm: Avoid parsing if/block/loop instructions recursively 2022-11-26 02:23:15 +03:30
Zaggy1024 f6830eaf73 LibVideo: Implement Matroska Cues for faster keyframe lookup
This implements the fastest seeking mode available for tracks with cues
using an array of cue points for each track. It approximates the index
based on the seeking timestamp and then finds the earliest cue point
before the timestamp. The approximation assumes that cues will be on
a regular interval, which I don't believe is always the case, but it
should at least be faster than iterating the whole set of cue points
each time.

Cues are stored per track, but most videos will only have cue points
for the video track(s) that are present. For now, this assumes that it
should only seek based on the cue points for the selected track. To
seek audio in a video file, we should copy the seeked iterator over to
the audio track's iterator after seeking is complete. The iterator will
then skip to the next audio block.
2022-11-25 23:28:39 +01:00
Zaggy1024 56d8b96c78 Utilities/matroska: Add arguments to print specific details
This adds two options:
- An option to print a specific track number only, and omit all others.
- An option to print each block for each track that is printed.
2022-11-25 23:28:39 +01:00
Zaggy1024 2a9fb8b439 LibVideo: Give Matroska duration an absolute value getter
Previously, the duration had to be multiplied by timestamp_scale and
converted to a Time object, now SegmentInformation::duration() does it
itself.
2022-11-25 23:28:39 +01:00
Zaggy1024 a58bf7c3d1 LibVideo: Calculate Block timestamps for Matroska according to spec
Tracks have a timestamp scale value that should be present which scales
each block's timestamp offset to allow video to be synced with audio.
They should also contain a CodecDelay element and may also contain a
TrackOffset that offsets the block timestamps.
2022-11-25 23:28:39 +01:00
Zaggy1024 ceb7632862 VideoPlayer: Add an option to enable fast seeking
The fast seeking toggle is in the new Playback menu, and when enabled
it makes the PlaybackManager immediately start playing after finding a
keyframe to decode.
2022-11-25 23:28:39 +01:00
Zaggy1024 fd3ffd88ce LibVideo: Add a fast seeking mode to seek only to keyframes
Now that we're able to find the nearest keyframe, we can have a fast
seeking mode that only seeks to keyframes, so that it doesn't have to
also decode inter frames until it reaches the timestamp.

The default is still accurate seeking, so that the entire seeking
implementation can be tested.
2022-11-25 23:28:39 +01:00
Zaggy1024 eef8867d9e LibVideo: Implement Matroska keyframe search for when there are no Cues
This just searches sequentially through each block in a SampleIterator
until it finds a block after the specified seek timestamp. Once it
finds one, it will try to set the input/output iterator to the most
recent keyframe. If the iterator's original position is closer to the
target, however, it leaves it at that original position, allowing
callers to continue decoding from that position until they reach the
target timestamp.
2022-11-25 23:28:39 +01:00
Zaggy1024 9040194d54 LibVideo: Make Matroska Block and Cluster timestamps absolute 2022-11-25 23:28:39 +01:00