Commit graph

46745 commits

Author SHA1 Message Date
Baitinq 743f494a9c Toolchain: Add fuse2fs to serenity.nix
This previously missing package was needed for root-less image building
:)
2023-02-11 00:06:55 +01:00
MacDue 654950eaf7 Tests: Add a few tests to verify vectors are using inline storage 2023-02-11 00:03:14 +01:00
MacDue c0b7ff3c4c AK: Always initialize vector capacity to inline_capacity
This ensures constructors that take a span or an initializer_list
don't allocate when there's already enough inline storage.
(Previously these constructors always allocated)
2023-02-11 00:03:14 +01:00
Victor Panisa e1b15b9a44 Keymaps: Stop pt-br's r-shift printing "?"
Currently when trying to use the right-shift on the pt-br layout
it prints a "?" on key-down on top of applying the shift modifier.
This patch removes the unwanted "?".
2023-02-10 23:35:10 +01:00
Zaggy1024 e6c3b0e495 LibVideo/VP9: Rename round_2() to rounded_right_shift() for clarity 2023-02-10 23:34:37 +01:00
Zaggy1024 33ff3427eb LibVideo/VP9: Drop the decoder intermediate bounds checks
Checking the bounds of the intermediate values was only implemented to
help debug the decoder. However, it is non-fatal to have the values
exceed the spec-defined bounds, and causes a measurable performance
reduction.

Additionally, the checks were implemented as an assertion, which is
easily broken by bad input files.

I see about a 4-5% decrease in decoding times in the `webm_in_vp9` test
in TestVP9Decode.
2023-02-10 23:34:37 +01:00
Andreas Kling 7c607462a4 LibGfx+LibWeb: Store radii as FloatSize rather than FloatPoint
Radii are sizes, not points. This becomes important when mapping them
through a 2D transform.
2023-02-10 23:33:16 +01:00
Andreas Kling e9078e216d LibGfx: Make sure the Painter clip rect is never larger than the target
The new Painter::set_clip_rect(IntRect) API was able to make the clip
rect larger than the underlying target bitmap. This was not good, as it
could make it possible to draw outside the bitmap memory.

Fixes a crash when viewing https://twinings.co.uk/ in the browser. :^)
2023-02-10 23:33:16 +01:00
Liav A b4596b48f5 LibCore: Fix wrong call to stat on the Core::System::lstat method
We should call lstat and not stat, because lstat gives information on
the symbolic link itself (if the path is about a symbolic link).
2023-02-10 23:23:12 +01:00
Luke Wilde 349c126d8d LibWeb/Fetch: Implement CORS preflight
The main things missing is the CORS preflight cache and making
extract_header_list_values properly parse, validate and return split
values for the Access-Control headers.
2023-02-10 22:18:19 +00:00
Luke Wilde d9d556fbab AK: Allow Vector<ByteBuffer>::contains_slow to accept (Readonly)Bytes
This is done by providing Traits<ByteBuffer>::equals functions for
(Readonly)Bytes, as the base GenericTraits<T>::equals is unable to
convert the ByteBuffer to (Readonly)Bytes to then use Span::operator==

This allows us to check if a Vector<ByteBuffer> contains a
(Readonly)Bytes without having to making a copy of it into a ByteBuffer
first. The initial use of this is in LibWeb with CORS-preflight, where
we check the split contents of the Access-Control headers with
Fetch::Infrastructure::Request::method() and static StringViews
such as "*"sv.bytes().
2023-02-10 22:18:19 +00:00
Luke Wilde 237df9df5c LibWeb: Make extract_header_list_values differentiate parsing failures
Previously, parsing failures and the header not existing made
extract_header_list_values return an empty Optional, making it
impossible to differentiate between the two.

Required for implementing CORS-preflight, where parsing failures for
the headers makes it fail, but not having them doesn't make it fail in
all cases.
2023-02-10 22:18:19 +00:00
Luke Wilde bf2895365b LibWeb/Fetch: Don't add cookies when creating ResourceLoader request
Using LoadRequest::create_for_url_on_page will unconditionally add
cookies as long as there's a page available. However, it is up to
http_network_or_cache_fetch to determine if cookies should be added to
the request.

This was noticed when implementing CORS-preflight requests, where we
sent cookies in OPTIONS requests.
2023-02-10 22:18:19 +00:00
Luke Wilde c51026a855 Ladybird: Teach RequestManagerQt how to handle every valid HTTP method 2023-02-10 22:18:19 +00:00
Aliaksandr Kalenik 2ed5415750 LibWeb: Fix clearance to update y offset within current block
If a box has clearance and margin bottom of preceding box is greater
than static y of the box then it should also affect y offset in current
block container so subsequent boxes will get correct y position too.
2023-02-10 20:55:33 +01:00
Aliaksandr Kalenik 0cd63f851e LibWeb: Store y offset of current block container in BFC member
This change should make it possible to access y offset of current block
container in BFC without explicitly passing it using method parameters.
2023-02-10 20:55:33 +01:00
konrad 84e8d5f418 Kernel: Remove old ‘main id register accessorʼ for Aarch64 2023-02-10 11:51:47 -07:00
konrad a6526cd90c Kernel: Migrate ‘main id registerʼ access in Aarch64 MMIO 2023-02-10 11:51:47 -07:00
konrad d6c620dc4f Kernel: Provide better types in MIDR register accessor for Aarch64
This avoids unnecessary and-masks during reading.
2023-02-10 11:51:47 -07:00
Timothy Flynn 3b4879d29b LibJS+Userland: Port the JS Console object and direct callers to String 2023-02-10 17:26:20 +00:00
Timothy Flynn 8f9659a549 LibJS: Surround the VM parameter of TRY_OR_THROW_OOM with parentheses
Depending on how this is invoked, the preprocessor may get confused when
pasting the VM parameter into this expression. For example, it trips up
on the JS REPL in cases such as:

    TRY_OR_THROW_OOM(*g_vm, ...);
2023-02-10 17:26:20 +00:00
Timothy Flynn 519a1cd23d LibJS: Add a fallible ThrowableStringBuilder::appendff 2023-02-10 17:26:20 +00:00
Timothy Flynn 7163e4d456 LibJS: Change ThrowableStringBuilder to privately inherit StringBuilder
Not an issue currently, but while developing, it's easy to miss cases
where an infallible AK::StringBuilder method is still used. By making
this inheritance private, and explicitly pulling in base methods we
can safely use, we get extra help from the compiler to indicate such
mistakes immediately.
2023-02-10 17:26:20 +00:00
Nico Weber 4eebe753d1 LibGfx: Validate ICC cicpTag some more 2023-02-10 17:06:40 +00:00
Nico Weber 9f0f3f434f LibGfx+icc: Stringify known signatureType values 2023-02-10 15:19:14 +00:00
Julian Offenhäuser ab5b61c3fe DisplaySettings: Capitalize fallback display mode when loading settings
This setting was capitalized a while ago, except for this place where
we fall back to "[C]center". This caused a crash in MonitorWidget.
2023-02-10 15:41:56 +01:00
Aliaksandr Kalenik 2649bc737f LibWeb: Use device pixels for transform rect of stacking context 2023-02-10 15:38:54 +01:00
Julian Offenhäuser 4f4bd3793f LibPDF: Fix glyph sizing bug that caused incorrect spacing
When loading OpenType fonts, either as a replacement for the standard
14 fonts or an embedded one, we previously passed the font size as the
_point_ size to the loader class. The difference is quite subtle, being
that Gfx::ScaledFont uses the optional dpi parameter to convert the
input from inches to pixels.

This meant that our glyphs were exactly 1.333% too large, causing them
to overlap in places.
2023-02-10 15:37:51 +01:00
Julian Offenhäuser 152a8c5c43 LibPDF: Use more appropriate standard 14 replacement fonts
The mapping of standard font to replacement now looks like this:

Times New Roman -> Liberation Serif
Courier -> Liberation Mono
Helvetica, Arial -> Liberation Sans
2023-02-10 15:37:51 +01:00
Julian Offenhäuser d470df1c6a Base: Add LiberationSans and LiberationMono fonts
These will be used by LibPDF as replacements for Helvetica/Arial and
Courier.
2023-02-10 15:37:51 +01:00
Nico Weber b232281d15 LibGfx+icc: Read chromaticityTag
This isn't terribly useful. But some profiles, for example the ones at
https://vpifg.com/help/icc-profiles/, do contain this tag and it seems
nice to be able to dump it, just for completeness.

I haven't seen any files that contain a phosphor or colorant type
different from "Unknown", even for the Rec2020 profile on that page.
(It has x,y coordinates that match the values required for Rec2020,
but it doesn't set the phosphor or colorant type to that.)
2023-02-10 14:23:37 +00:00
Nico Weber c61cfdd5ed LibGfx+icc: Read viewingConditionsType
Not terribly useful in practice either and also mostly for
completionism. But with this, we can dump all types present
in Lightroom Classic-exported jpegs :^)
2023-02-10 14:16:52 +00:00
Nico Weber 664946c543 LibGfx+icc: Read measurementType
Also not terribly useful in practice and mostly for completionism.
Lightroom Classic-exported jpegs contain this type in their ICC data.
2023-02-10 14:02:19 +00:00
networkException 143f28b735 CI: Add script to post mastodon toots for commits on master
This patch adds the toot-commits script (mirroring tweet-commits),
posting new commits on the master branch to
https://serenityos.social/@commits.
2023-02-10 13:54:07 +00:00
Timothy Flynn 7955cb14fb LibWeb: Add missing GCPtr.h includes to Fetch headers
These are missing in most Fetch headers, and clangd is (rightfully) very
loud about it on a few of these.
2023-02-10 13:53:45 +00:00
Tim Schumacher 332b253a47 AK: Provide is_errno for Kernel Errors
It wouldn't make much sense on its own (as the Kernel only has errno
Errors), but it's an easy fix for not having to ifdef away every single
usage of `is_errno` in code that is shared between Userland and Kernel.
2023-02-10 12:15:02 +01:00
Tim Schumacher be25602d44 AK: Allow explicitly copying Errors in the Kernel 2023-02-10 12:15:02 +01:00
Tim Schumacher cc8874b5aa AK: Fix a linting issue in Error.h
I'm not sure why, but `clang-format` gets unhappy if we touch the
adjacent line.
2023-02-10 12:15:02 +01:00
Liav A 048fb2c204 AK: Disallow returning of string literals for errors in kernel code
This code should not be used in the kernel - we should always propagate
proper errno codes in case we need to return those to userland so it
could decode it in a reasonable way.
2023-02-10 09:14:20 +00:00
Liav A 56b799c556 LibEDID: Return proper errno codes for kernel code 2023-02-10 09:14:20 +00:00
Liav A ab27fce86f AK: Add a new method to propagate errno while printing errors in Kernel
This new method is meant to be used in both userspace and kernel code.
The idea is to allow printing of a verbose message and then returning an
errno code which is the proper mechanism for kernel code because we
should almost always assume that such error will be propagated back to
userspace in some way, so the userspace code could reasonably decode it.

For userspace code however, this new method is meant to be a simple
wrapper for Error::from_string_view, because for most invocations, it's
much more useful to have a verbose & literal error than a errno code, so
we simply ignore that errno code completely in such context.
2023-02-10 09:14:20 +00:00
Liav A df72c9327b Kernel: Return proper errno codes from Coredump::write_regions method 2023-02-10 09:14:20 +00:00
Liav A 2d1719da73 Kernel/Net: Propagate proper errno codes from determine_network_device
Returning literal strings is not the proper action here, because we
should always assume that error could be propagated back to userland, so
we need to keep a valid errno when returning an Error.
2023-02-10 09:14:20 +00:00
Liav A 2715f91c92 Kernel/VirtIOGPU: Propagate proper errno codes from query_and_set_edid
Returning literal strings is not the proper action here, because we
should always assume that error could be propagated back to userland, so
we need to keep a valid errno when returning an Error.
2023-02-10 09:14:20 +00:00
Timothy Flynn 8eb3d79129 AK: Disallow implicitly copying Error and ErrorOr instances
In the rare cases that a copy is actually needed, the Error::copy
factory will suffice.
2023-02-10 09:08:52 +00:00
Timothy Flynn 604d5f5bca AK+Everywhere: Do not implicitly copy variables in TRY macros
For example, consider cases where we want to propagate errors only in
specific instances:

    auto result = read_data(); // something like ErrorOr<ByteBuffer>
    if (result.is_error() && result.error().code() != EINTR)
        continue;
    auto bytes = TRY(result);

The TRY invocation will currently copy the byte buffer when the
expression (in this case, just a local variable) is stored into
_temporary_result.

This patch binds the expression to a reference to prevent such copies.
In less trival invocations (such as TRY(some_function()), this will
incur only temporary lifetime extensions, i.e. no functional change.
2023-02-10 09:08:52 +00:00
Timothy Flynn 4a916cd379 Everywhere: Remove needless copies of Error / ErrorOr instances
Either take the underlying objects with release_* methods or move() the
instances around.
2023-02-10 09:08:52 +00:00
Timothy Flynn 52687814ea Kernel: Explicitly copy Plan9FS read errors to registered delegates 2023-02-10 09:08:52 +00:00
Timothy Flynn 945f392392 AK: Add an explicit Error factory to copy an existing error
As of now, there is a default copy constructor on Error. A future commit
will make this non-public to prevent implicit copies, so to prepare for
that, this adds a factory for the few cases where a copy is really
needed.
2023-02-10 09:08:52 +00:00
Timothy Flynn 142f327e63 LibGfx: Remove the optional Error member from QOI's decoder context 2023-02-10 09:08:52 +00:00