1. Don't use double_hash. This is not for doubles, as its name implies.
2. Specialize traits and formatters using the underlying DistinctNumeric
type of Web::DevicePixels and Web::CSSPixels.
The idea is that we'll have one type for each tag type.
For now, this treats all tag types as unknown, but it puts most
of the infrastructure for reading tags in place.
If a spec step hasn't been marked as fallible, but might throw due to
OOM, this is to make it clear that OOM is the only thing that may cause
a failure.
For now, this is limited to strings that are 3 bytes or less. We can use
7 bytes on 64-bit platforms, but we do not yet assume 64-bit for Lagom
hosts (e.g. wasm).
In cases where we know a string literal will fit in the short string
storage, we can do so at compile time without needing to handle error
propagation. If the provided string literal is too long, a compilation
error will be emitted due to the failed VERIFY statement being a non-
constant expression.
This is to allow using more recent C++20 features in upcoming commits.
Version 3.1.6 is what is installed on Ubuntu 22.10 and works with the
C++20 features we want.
This happened because the reader was incrementing the byte index of it
after each read of a byte from the Span, so by the end of the frame
method, we could be at the end of the mapped file, so the next call
on the same decoder will just resume from that point and will be quickly
out of boundary.
To ensure this doesn't happen we only set the bitmap to m_context member
at the end of the method, and call to that method again will just give
the already-generated bitmap.
In case of setting the bitmap as volatile, we test for that case and
re-generate a reader to read the frame again correctly.
We should expect the sniffing method and the initialize method to fail
because this test case is testing that the ICO image decoder should not
decode random data within it.
Change `compute_auto_height_for_block_level_element` to use max height
(`m_automatic_content_height` produced from TFC) for tables with auto
height which is more correct behaviour than treating them like block
containers.
When trying to figure out the correct implementation, we now have a very
strong distinction on plugins that are well suited for sniffing, and
plugins that need a MIME type to be chosen.
Instead of having multiple calls to non-static virtual sniff methods for
each Image decoding plugin, we have 2 static methods for each
implementation:
1. The sniff method, which in contrast to the old method, gets a
ReadonlyBytes parameter and ensures we can figure out the result
with zero heap allocations for most implementations.
2. The create method, which just creates a new instance so we don't
expose the constructor to everyone anymore.
In addition to that, we have a new virtual method called initialize,
which has a per-implementation initialization pattern to actually ensure
each implementation can construct a decoder object, and then have a
correct context being applied to it for the actual decoding.
Originally I simply thought that passing file paths is quite OK, but as
Linus pointed to, it turned out that passing file paths to ensure some
files are able to be decoded is awkward because it does not work with
images being served over HTTP.
Therefore, ideally we should just use the MIME type as an optional
argument to ensure that we can always fallback to use that in case
sniffing for the correct image type has failed so we can still detect
files like with the TGA format, which has no magic bytes.
A lot of interrupt numbers are initialized with the unhandled interrupt
handler. Whenever a new handler is registered on one of these
interrupts, the old handler is unregistered first. Let's not be verbose
about this since it is perfectly normal.
Currently, if you have a fallible function with an Optional return type
and try to return OptionalNone like this:
ThrowCompletionOr<Optional<SomeType>> { return OptionalNone {}; }
Then ThrowCompletionOr's m_value (whose type is an Optional<ValueType>)
will be set to empty, rather than containing an empty Optional. This is
due to the ThrowCompletionOr's WrappedValueType constructor.
This patch adds a constructor specifically for OptionalNone. If someone
attempts to construct a ThrowCompletionOr with OptionalNone, but the
ValueType is not an Optional, a compile error like the following will
occur:
ThrowCompletionOr<String> foo() { return OptionalNone {}; }
error: no matching constructor for initialization of 'AK::String'
Otherwise, it will fill ThrowCompletionOr's m_value with an empty
Optional.
This might've been needed at some point to disambiguate between another
function of the same name that is in LibLocale. But now that it takes a
VM parameter, it is for sure clear to the compiler what is being called.
In order to prevent this commit from having to refactor almost all of
Intl, the goal here is to update the internal parsing/canonicalization
of locales within LibLocale only. Call sites which are already equiped
to handle String and OOM errors do so, however.