Commit graph

49202 commits

Author SHA1 Message Date
stelar7 611a235a52 LibTLS: Rename AlertLevel Critial to FATAL
This matches the wording used in the TLS RFC
2023-04-14 12:32:04 +01:00
stelar7 ca6b8bfe7f LibTLS: Rename Version to ProtocolVersion
This matches the wording used in the TLS RFC
Also define GREASE values as specified in RFC8701
2023-04-14 12:32:04 +01:00
stelar7 082e64e167 LibTLS: Rename MessageType to ContentType
This matches the wording used in the TLS RFC
2023-04-14 12:32:04 +01:00
Arda Cinar 1cfc630d13 LibC: Implement if_indextoname and if_nametoindex 2023-04-14 12:29:03 +01:00
Arda Cinar 38dc54317c Kernel/Net: Implement SIOCGIFINDEX and SIOCGIFNAME for sockets
These ioctls exist on Linux and can be used to implement libc functions
if_indextoname and if_nametoindex (without needing to parse any JSON).
2023-04-14 12:29:03 +01:00
Andreas Kling 47c21cc349 LibWeb: Honor column-gap and row-gap CSS properties in flex layout
This isn't actually part of CSS-FLEXBOX-1, but all major engines honor
these properties in flex layout, and it's widely used on the web.

There's a bug open against the flexbox spec where fantasai says the
algorithm will be updated in CSS-FLEXBOX-2:
https://github.com/w3c/csswg-drafts/issues/2336

I've added comments to all the places where we adjust calculations for
gaps with "CSS-FLEXBOX-2" so we can find them easily. When that spec
becomes available, we can add proper spec links.
2023-04-14 13:22:07 +02:00
Brendan Kelly 7dd3c4a79c SoundPlayer: Check if loader is null
This patch prevents SoundPlayer from crashing when attempting to "seek"
when no file has been loaded
2023-04-14 07:13:32 -04:00
Zaggy1024 5e3192c8d9 LibVideo/VP9: Extend the borders on reference frames to avoid branching
Extending the borders on reference frames so that motion vectors that
point outside the reference frame allows `predict_inter_block()` to
avoid some branches to clamp the sample coordinates in its loops.

This results in about a 25% improvement in decode time of a motion-
heavy YouTube video (~20.8s -> ~15.6s).
2023-04-14 07:11:45 -04:00
Zaggy1024 08b90bb2d0 LibVideo/VP9: Clamp reference frame prediction coords outside loops
Moving the clamping of the coordinates of the reference frame samples
as well as some bounds checks outside of the loop reduces the branches
needed in the `predict_inter_block()` significantly.

This results in a whopping ~41% improvement in decode performance
of an inter-prediction-heavy YouTube video (~35.4s -> ~20.8s).
2023-04-14 07:11:45 -04:00
Zaggy1024 bc49af08b4 LibVideo/VP9: Pre-calculate inter-frames' reference frame scale factors
Changing the calculation of reference frame scale factors to be done on
a per-frame basis reduces the amount of work done in
`predict_inter_block()`, which is a big hotspot in most videos.

This reduces decode times in a test video from YouTube by about 5%
(~37.2s -> ~35.4s).
2023-04-14 07:11:45 -04:00
Zaggy1024 5cd5edc3bd LibVideo/VP9: Copy data to reference frames row by row
This changes the order of the loop copying data to a reference frame
store so that it copies each row in a contiguous line rather than
copying a column at a time, which caused unnecessary branches.

This reduces the decode time on a fairly long 720p YouTube video by
about 14.5% (~43.5s to ~37.2s).
2023-04-14 07:11:45 -04:00
Zaggy1024 dfd0eb877f TestVP9Decode: Dequeue frames from the decoder after sending a sample
Frames must be dequeued from the decoder, or the queue will grow
continuously until OOM.
2023-04-14 07:07:38 -04:00
Zaggy1024 e1b3f9a26e LibVideo/Matroska: Remove assertion that cue seeks find earlier samples
Files can contain a first keyframe that is timestamped later than zero.
We don't want to crash in those cases, so don't assert that it can't
happen.
2023-04-14 12:05:52 +01:00
Zaggy1024 d4c33a7134 LibGUI: Only redraw sliders after the on_change callback has finished
This prevents the seek slider in VideoPlayer from skipping forward and
then back when fast seeking is enabled. Previously, it was possible for
a single frame to render before the actual seek position in the seek
bar was set.
2023-04-14 12:05:52 +01:00
Zaggy1024 e391f18e9e LibVideo: Remove Starting playback state in favor of Seeking to zero 2023-04-14 12:05:52 +01:00
Zaggy1024 4df9ef487d VideoPlayer: Use rounded seconds for the timestamp label
Previously, the time would read "00:00:01" when the timestamp was
merely 1 millisecond past the start of the video. If a video does not
start with a sample at timestamp 0, then, seeking to the start would
display that text rather than "00:00:00".
2023-04-14 12:05:52 +01:00
Zaggy1024 79779aff18 VideoPlayer: Update the current timestamp on state changes
The state could change and cause a timestamp change without the video
frame event firing, which could desync the seek bar from the video's
actual time.
2023-04-14 12:05:52 +01:00
Zaggy1024 dc049e36cf LibVideo: Add a method to get the playback state from PlaybackManager 2023-04-14 12:05:52 +01:00
Zaggy1024 b081967762 LibVideo: Always present a frame when not fast-exiting seek
Previously, there was some leftover logic in `SeekingStateHandler`
which would avoid presenting a frame if it didn't find a frame both
before and after the target frame. However, this logic was unnecessary
as the `on_enter()` function would check if it needed to present a
frame and exit seeking if not.

This allows seeking to succeed if the Seeking handler cannot find a
frame before the one to be seeked to, which could occur if the first
frame of a video is not at timestamp 0.
2023-04-14 12:05:52 +01:00
Zaggy1024 989f965f54 LibVideo: Dispatch PlaybackManager state changes after on_enter()
Previously, the state change was dispatched before the new state that
was adopted had been entered, causing it to have invalid state.
2023-04-14 12:05:52 +01:00
Zaggy1024 41ed0cbbce LibVideo: Improve logging when PLAYBACK_MANAGER_DEBUG=on
This adds a timestamp to the debug output when presenting a frame, so
it can be clear the frame spacing between a presented frame and a state
change.

The seeking state will also now print when it early-exits if the seek
point is within the current sample's duration.
2023-04-14 12:05:52 +01:00
Matthew Olsson db1be40b13 LibWeb: Propogate OOM errors from readable_stream_reader_generic_cancel 2023-04-14 13:03:34 +02:00
Matthew Olsson f9d6a161e8 LibWeb: Add ByteStreamController to ReadableStreamController type 2023-04-14 13:03:34 +02:00
Matthew Olsson bd7809cc18 LibWeb: Mostly implement ReadableByteStreamController.[[ReleaseSteps]] 2023-04-14 13:03:34 +02:00
Matthew Olsson 51abecc8bc LibWeb: Mostly implement ReadableByteStreamController.[[PullSteps]] 2023-04-14 13:03:34 +02:00
Matthew Olsson c97f6b7701 LibWeb: Implement ReadableByteStreamController.[[CancelSteps]] 2023-04-14 13:03:34 +02:00
Matthew Olsson 8274906301 LibWeb: Expose ReadableStream::m_state and use in AOs
This allows us to be a bit closer to the spec phrasing and matches
what we do with WritableStream
2023-04-14 13:03:34 +02:00
Ali Mohammad Pur eba466b8e7 LibRegex: Avoid calling GenericLexer::consume() past EOF
The consume(size_t) overload consumes "at most" as many bytes as
requested, but consume() consumes exactly one byte.
This commit makes sure to avoid consuming past EOF.

Fixes #18324.
Fixes #18325.
2023-04-14 12:33:54 +02:00
Luke Wilde 821702fadd LibWeb: Set Comment's prototype
This makes YouTube's thumbnails start appearing on the homepage.
Yes,seriously.

Simply put, this is because this check failed when Comment had the
incorrect prototype:
90cb97f847/packages/shadycss/src/style-util.js (L397)

This causes it to try and reconvert style sheets that are already in
Shady format, which would cause it to spuriously add things such as
class selectors on the end of tag selectors. This caused nothing to
match the selectors.

When YouTube is generating the thumbnails, it checks if the thumbnail
grid container has a non-zero clientWidth. If it's zero, it simply
bails generating thumbnails. Since the selectors for this container did
not apply, we would not properly create a paint box for it, causing
clientWidth to return zero.
2023-04-14 12:30:43 +02:00
Tim Schumacher 18565dd286 Ports/llvm: Increase the default stack size for LLVM executables 2023-04-14 10:05:05 +02:00
Tim Schumacher b1136ba357 AK: Efficiently resize CircularBuffer seekback copy distance
Previously, if we copied the last byte for a length of 100, we'd
recalculate the read span 100 times and memmove one byte 100 times,
which resulted in a lot of overhead.

Now, if we know that we have two consecutive copies of the data, we just
extend the distance to cover both copies, which halves the number of
times that we recalculate the span and actually call memmove.

This takes the running time of the attached benchmark case from 150ms
down to 15ms.
2023-04-14 10:03:42 +02:00
Matteo Benetti 3e1626acdc Spreadsheet+LibSyntax: Never insert spans directly
Function `CellSyntaxHighlighter::rehighlight()` direct inserted spans
to TextDocument `m_span` vector missing out important reordering and
merging operation carried out by `TextDocument::set_spans()`.

This caused overlapping spans for a cell with only a `=` symbol
(one for the actual token and one for the highlighting) to
miscalculate `start` and `end` value and a `length` value (of
`size_t` type) with a `0-1` substraction (result: 18446744073709551615)
causing `Utf32View::substring_view()` to fail the
`!Checked<size_t>::addition_would_overflow(offset, length)` assertion

This remove the possibility to directly alter `TextDocument`'s spans
thus forcing the utilization of `HighlighterClient::do_set_spans()`
interface function.

Proper refactor have been applied to
`CellSyntaxHighlighter::rehighlight()` function
2023-04-14 10:00:52 +02:00
Cubic Love fb47b988ca Base: Add US English Apple Macintosh keymap
Add the full alt + shift-alt keymap for the EN-US Apple Keyboard Layout
2023-04-14 10:00:06 +02:00
Linus Groh 89503a0cfe LibJS: Port PrototypeObject::typed_this_value() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh a23dd88f61 LibJS: Port PrototypeObject::typed_this_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh 15360e50d3 LibJS: Port PrototypeObject::this_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh b33b0d60e6 LibJS: Port Value::get_method() to GCPtr 2023-04-14 09:59:29 +02:00
Linus Groh 9279b0780d LibJS: Port Value::to_bigint() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh f345f72b55 LibJS: Port Value::to_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh e79f5b6e85 LibJS: Port Value::to_primitive_string() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Srikavin Ramkumar 04198a29a8 Base: Fix typo in cursor test page 2023-04-14 09:57:49 +02:00
Srikavin Ramkumar 627d68acdf Ladybird: Display Qt cursors corresponding to missing CSS cursors 2023-04-14 09:57:49 +02:00
Srikavin Ramkumar 33686c8a63 LibWeb: Support NotAllowed CSS cursor 2023-04-14 09:57:49 +02:00
Timon Kruiper 957f89ce4a AK: Add very naive implementation of {sin,cos,tan} for aarch64
The {sin,cos,tan} functions in AK are used as the implementation of the
same function in libm. We cannot use the __builtin_foo functions as
these would just call the libc functions. This was causing an infinite
loop. Fix this by adding a very naive implementation of
AK::{sin, cos,tan}, that is only valid for small inputs. For the other
functions in this file, I added a TODO() such that we'll crash, instead
of infinite looping.
2023-04-13 20:24:25 +02:00
Timon Kruiper 9ed04bdb33 Kernel/aarch64: Add implementation of Processor::for_each 2023-04-13 20:24:25 +02:00
Timon Kruiper 4927eb5396 Kernel/aarch64: Change RPi::Framebuffer::PixelOrder to BGR
This is what the WindowServer expects. Confusingly the pixel format for
MULTIBOOT_FRAMEBUFFER_TYPE_RGB is actually BGRx8888.
2023-04-13 20:22:08 +02:00
Timon Kruiper baa5cb9e30 Kernel/aarch64: Add volatile modifier to various asm statements
This prevents the optimizer from reordering them, which hopefully
prevents future bugs.
2023-04-13 20:22:08 +02:00
Timon Kruiper 10030038e9 Kernel/aarch64: Make sure no reordering of DAIF::read is possible
We were crashing on the VERIFY_INTERRUPTS_DISABLED() in
RecursiveSpinlock::unlock, which was caused by the compiler reordering
instructions in `sys$get_root_session_id`. In this function, a SpinLock
is locked and quickly unlocked again, and since the lock and unlock
functions were inlined into `sys$get_root_session_id` and the DAIF::read
was missing the `volatile` keyword, the compiler was free to reorder the
reads from the DAIF register to the top of this function. This caused
the CPU to read the interrupts state at the beginning of the function,
and storing the result on the stack, which in turn caused the
VERIFY_INTERRUPTS_DISABLED() assertion to fail. By adding the `volatile`
modifier to the inline assembly, the compiler will not reorder the
instructions.

In aa40cef2b7, I mistakenly assumed that the crash was related to the
initial interrupts state of the kernel threads, but it turns out that
the missing `volatile` keyword was the actual problem. This commit also
removes that code again.
2023-04-13 20:22:08 +02:00
Tom 7795b7bc17 WindowServer: Refactor window geometry overlay rect calculation logic
This moves the ideal overlay rect calculation into its own function.
2023-04-13 20:18:49 +02:00
Tom e1077ebbad WindowServer: Prevent some overdraw by the window geometry overlay
While the window geometry overlay is centered inside the tile overlay
neither the text nor the location change, so there is no need to
re-render and update it every time the window moves.
2023-04-13 20:18:49 +02:00