Commit graph

45884 commits

Author SHA1 Message Date
Tim Schumacher 49b30d3013 AK: Remove InputBitStream and OutputBitStream 2023-01-21 00:45:33 +00:00
Tim Schumacher b1bfeb391e LibPDF: Use Core::Stream to parse the page offset hint table 2023-01-21 00:45:33 +00:00
Nico Weber f28b052590 LibGfx: Add scaffolding for reading ICC tag table
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.
2023-01-20 21:44:36 +00:00
Nico Weber 5017d8fdcb LibGfx: Extract Profile::read_header() function 2023-01-20 21:44:36 +00:00
Nico Weber e5234f582d LibGfx: Make ICCHeader use FourCC types for fourcc fields
No behavior change. Arguably more expressive.
2023-01-20 21:44:36 +00:00
Nico Weber 046c79b468 LibGfx: Make DistinctFourCC compatible with BigEndian 2023-01-20 21:44:36 +00:00
Tim Schumacher 0245614a4f LibCore: Remove FileStream 2023-01-20 20:50:42 +00:00
Tim Schumacher 2def995d22 wasm: Interface with the standard output via Core::Stream 2023-01-20 20:50:42 +00:00
Tim Schumacher 29cdd124d1 gunzip: Use Core::Stream to write the decompression output 2023-01-20 20:50:42 +00:00
Tim Schumacher debde54928 WebServer: Use Core::Stream to read served files 2023-01-20 20:50:42 +00:00
Tim Schumacher 3a16168ace LibGfx: Use Core::Stream to write bitmap fonts 2023-01-20 20:50:42 +00:00
Tim Schumacher 9eb040af32 Tests: Use Core::Stream to write output files in LibGL tests 2023-01-20 20:50:42 +00:00
Tim Schumacher d7eead4f4c AK: Remove DuplexMemoryStream 2023-01-20 20:48:40 +00:00
Tim Schumacher 5896f8cf2b LibAudio: Use AllocatingMemoryStream as the MP3 loader bit reservoir 2023-01-20 20:48:40 +00:00
Tim Schumacher 52cb066cae LibWasm: Use AllocatingMemoryStream around Wasm::Printer 2023-01-20 20:48:40 +00:00
Ali Mohammad Pur 7d4a30af56 LibCore: Avoid logical OOB read in AllocatingMemoryStream::offset_of()
The previous impl was trimming the last chunk to the free space instead
of the used space, which yielded an OOB read if the needle wasn't found.
2023-01-20 20:34:31 +00:00
Timothy Flynn c8e25a71e0 AK: Disable use of consteval in String::from_utf8_short_string for Apple
This causes an ICE on older versions of clang, and Apple's clang is
currently based on such a version.
2023-01-20 20:33:04 +00:00
Timothy Flynn 95d1678553 LibJS: Mark infallible operations that may throw only due to OOM 2023-01-20 20:31:38 +00:00
Timothy Flynn 52b76060f9 LibJS: Add a macro for infallible operations that may throw OOM
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.
2023-01-20 20:31:38 +00:00
Timothy Flynn f1de4f8872 Everywhere: Convert known short-strings to the infallible String factory
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).
2023-01-20 14:24:12 -05:00
Timothy Flynn d48266a420 AK: Support creating known short string literals at compile time
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.
2023-01-20 14:24:12 -05:00
Timothy Flynn e634778679 CI: Install a more up-to-date version of emscripten
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.
2023-01-20 14:24:12 -05:00
Sam Atkins 93ca5d4772 Tests: Use AK::shuffle() for shuffling 2023-01-20 17:45:33 +00:00
Sam Atkins 4b525fc98e ColorLines: Use AK::shuffle() for shuffling 2023-01-20 17:45:33 +00:00
Liav A 5b273f3823 LibGfx: Fix TGA decoder being out of boundary after calling frame method
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.
2023-01-20 17:05:09 +00:00
Liav A 20033d06d8 Tests/LibGfx: Fix test_gif test case
We should expect the GIF image to be animated, therefore fix that
condition.
2023-01-20 17:05:09 +00:00
Liav A da525ccc43 Tests/LibGfx: Fix test_not_ico test case
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.
2023-01-20 17:05:09 +00:00
Aliaksandr Kalenik 87f0e835eb LibWeb: Improve auto height calculation for tables
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.
2023-01-20 18:04:17 +01:00
Aliaksandr Kalenik addfa4ed58 LibWeb: Include table intrinsic offsets in child boxes position
Table's border and padding should be taken in account while
calculating child boxes x and y offsets.
2023-01-20 18:04:17 +01:00
Liav A 57e19a7e56 LibGfx: Re-structure the whole initialization pattern for image decoders
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.
2023-01-20 15:13:31 +00:00
Liav A 6e6999ce57 LibGfx: Re-work the abstractions of sending image for decoding over IPC
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.
2023-01-20 15:13:31 +00:00
Liav A fedd18eb89 LibCore: Add MIME type string for TGA files 2023-01-20 15:13:31 +00:00
Liav A e77b110541 LibCore: Return StringView from guess_mime_type_based_on_filename method 2023-01-20 15:13:31 +00:00
Jelle Raaijmakers 2428ba3832 Kernel: Remove dbgln when unregistering an unhandled x86_64 interrupt
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.
2023-01-20 15:22:42 +01:00
Jelle Raaijmakers 5f85f1abaa Kernel: Simplify (un)registering interrupt logic
Lose a level of indentation and remove a superfluous `handler_slot`
check.
2023-01-20 15:22:42 +01:00
Jelle Raaijmakers 100c8f9bcf CI: Add GitHub author presence check in commit linter
If GitHub is unable to match a commit's author to a GitHub user, the
`.author` object is set to `null` in the API's response.
2023-01-19 23:48:57 +00:00
Timothy Flynn be8907e6bb LibJS: Return OptionalNone in fallible functions in the Intl namespace 2023-01-19 23:13:44 +00:00
Timothy Flynn 5349972f41 LibJS: Add a special ThrowCompletionOr constructor for OptionalNone
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.
2023-01-19 23:13:44 +00:00
Timothy Flynn d901a9989d LibLocale: Remove now-unused [LanguageID,LocaleID]::to_deprecated_string 2023-01-19 20:57:30 +00:00
Timothy Flynn bb4b6d8ce3 LibJS: Port Intl locale resolution to String 2023-01-19 20:57:30 +00:00
Timothy Flynn 2f1184ccdb LibJS: Do not fully qualify references to CanonicalizeUnicodeLocaleId
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.
2023-01-19 20:57:30 +00:00
Timothy Flynn 1e6e719592 LibJS: Propagate OOM errors from the PartitionPattern Abstract Operation 2023-01-19 20:57:30 +00:00
Timothy Flynn bff0e25ebe LibJS: Propagate OOM errors from Intl Abstract Operations
This excludes the PartitionPattern AO as that has a much larger foot-
print and will be handled separately.
2023-01-19 20:57:30 +00:00
Timothy Flynn ca62aeb6bd LibLocale+LibJS: Port locale parsing and processing to String
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.
2023-01-19 20:57:30 +00:00
Timothy Flynn 618714e29a LibLocale: Add a method to convert LocaleID to a String 2023-01-19 20:57:30 +00:00
Karol Kosek f3c6510b83 Ladybird: Accept file drops 2023-01-19 19:22:03 +00:00
Karol Kosek 731fec525e Ladybird: Add URL and 'open in background' parameters to new_tab()
This will avoid loading starting about:blank page in places when we know
exactly what we want to load.

The opening in background part might be useful for future things like
file drops and right-click open in new tab.
2023-01-19 19:22:03 +00:00
Karol Kosek 194ddca24f Ladybird: Move the initial blank page load to BrowserWindow
Takes care of a FIXME :^)
2023-01-19 19:22:03 +00:00
Karol Kosek 5e89773937 Ladybird: Don't prepend 'about:' urls with an http:// scheme 2023-01-19 19:22:03 +00:00
Karol Kosek 4f36893fda Ladybird: Set initial page when NOT connected to WebDriver
This flips an if check condition, making the JS console work in new tabs
again.
2023-01-19 19:22:03 +00:00