Commit graph

47269 commits

Author SHA1 Message Date
Kenneth Myhra e776171d8f LibWeb: Allow prototype.{entries keys,value} to propagate errors
This allows the prototype.{entries keys,value} native functions
generated by the BindingsGenerator to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Kenneth Myhra 1f48081ee4 LibWeb: Make factory methods of IDLEventListener and NodeFilter fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra 3689d58c64 LibWeb: Allow EventListener/NodeFilter path to propagate errors
This allows the EventListener/NodeFilter path of the BindingsGenerator
to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Kenneth Myhra e57461b89e LibWeb: Make factory methods of UIEvents::WheelEvent fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra 587cf355ed LibWeb: Make factory methods of UIEvents::UIEvent fallible
This affects calls to FocusEvent::create() since FocusEvent does not
implement its own create() method.
2023-02-22 09:55:33 +01:00
Kenneth Myhra a401cff4e2 LibWeb: Make factory methods of UIEvents::KeyboardEvent fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra b91d599177 LibWeb: Make factory method of UIEvents::FocusEvent fallible 2023-02-22 09:55:33 +01:00
Lucas CHOLLET ad13c45c28 LibGfx: Log the underlying error when failing to decode a macroblock 2023-02-22 09:22:45 +01:00
Lucas CHOLLET cf6bceeb2c LibGfx: Don't assume that scans are always full when filling macroblocks
In other words: only consider coefficient of the current scan when
adding coefficients to a macroblock. Information about which
coefficients are present in the stream are passed through the spectral
information in the context.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET d421967394 LibGfx: Save spectral information in the context
These variables are useless for baseline JPEG, but they will become
useful for other encodings.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET 3a8c52cabc LibGfx: Put code to add AC coefficients to a macroblock in a function 2023-02-22 09:22:45 +01:00
Lucas CHOLLET 48f7b93a23 LibGfx: Put code to add the DC coefficient to a macroblock in a function 2023-02-22 09:22:45 +01:00
Lucas CHOLLET e38cd8eb4e LibGfx: Don't store the size of a Vector in an external variable 2023-02-22 09:22:45 +01:00
Lucas CHOLLET 8ed630a7ec LibGfx: Put the code to reset the encoder in its own function
With it, we can also add a spec reference. And it will remind to anyone
who wants to add support for a new coding to not forget to update it.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET 3fefb696a3 LibGfx: Make decode_huffman_stream take macroblocks by reference
In progressive mode, this functions will need to be called multiple time
on the same macroblocks, so it shouldn't create the vector every
time it's called.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET bae37676c2 LibGfx: Prepare the decoder to handle multiples scans
This means that we should read markers in a loop instead of quiting on
the first scan. This is useless for now as `SOF0` frames only have one
scan, but this is a step forward `SOF2` support.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET c0c48afe06 LibGfx: Return from scan_huffman_stream before JPEG_EOI
As a JPEG file can contain multiples scans, we should return from
`scan_huffman_stream` on all new markers (except restart markers) and
not only `JPEG_EOI`.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET f1aa189027 LibGfx: Factorize handling of miscellaneous and tables segments
Miscellaneous and tables segments can also be placed between scans,
placing this code in a function will allow us to avoid duplication when
we get there.
2023-02-22 09:22:45 +01:00
Lucas CHOLLET 90573652fd LibGfx: Rename "skip_marker_with_length" to "skip_segment"
As it, in fact, does not skip a marker but a segment :^).
2023-02-22 09:22:45 +01:00
Tim Schumacher 9096b4d893 AK: Ensure that we fill the whole String when reading from a Stream 2023-02-21 22:28:15 -07:00
Hendiadyoin1 5506951ffb LibJS: Don't try to merge unterminated BasicBlocks
This was causing a Segfault, trying to access the non-present terminator
2023-02-21 22:46:18 +01:00
Hediadyoin1 1c8adac442 LibJS: Use HashTable::take_first in GetObjectPropertyIterator
This is a bit more idiomatic than
```c++
auto it = table.begin();
auto k = *it;
table.remove(it);
```
and also saves us from copying the stored value.
2023-02-21 22:13:06 +01:00
Hediadyoin1 fd8c54d720 AK: Add take_first to HashTable and rename pop to take_last
This naming scheme matches Vector.

This also changes `take_last` to move the value it takes, and delete by
known pointer, avoiding a full lookup and potential copies.
2023-02-21 22:13:06 +01:00
Hediadyoin1 93945062a7 AK: Update HashTables head and tail when shifting during deletion
Otherwise we end up with invalid pointers to them, breaking iteration.
2023-02-21 22:13:06 +01:00
Luke Wilde 2ca8cf49ca LibWeb: Use browsing context creator URL for about:blank documents
In about:blank documents, we should use the browsing context's creator
URL as the base URL, if it exists and there is no <base> element.
This means that any about:blank frames will have URLs parse relative to
their parent frame's URL.

Fixes #17394.
2023-02-21 18:52:46 +01:00
Tim Ledbetter e294c96aef PixelPaint: Make merge up and down actions work with disjoint layers
The "Merge Active Layer Up" and "Merge Active Layer Down" actions now
work with layers of different sizes. These actions now expand the
bounding rect of the newly merged layer to contain all layers being
merged. Layers which are not visible are now ignored by these actions.
2023-02-21 12:06:31 +00:00
Tim Ledbetter 74dff6250c PixelPaint: Make image flattening actions work with disjoint layers
The "Flatten Image" and "Merge Visible" actions now work with layers
of different sizes. These actions now expand the bounding rect of the
newly merged layer to contain all layers being merged.
2023-02-21 12:06:31 +00:00
Andrew Kaster 2bec236ea6 LibJS: Use the EnumerateObjectProperties AO to print objects
Instead of just iterating indexed properties and direct properties on
the object's shape, let's walk the prototype chain and grab every
non-symbol property by re-using the AO for for-in statements.

We'll probably want to move this to a custom algorithm just for pretty
printing that doesn't skip some property types, but this already gives
a major improvement when printing LegacyPlatformObjects from LibWeb to
the console.
2023-02-21 10:57:44 +01:00
Andrew Kaster f40094d014 LibWeb+LibJS: Format Console arguments with JS::Print
Instead of just calling JS::Value::to_string_without_side_effects() when
printing values to the console, have all the console clients use
the same JS::Print that the REPL does to print values.

This method leaves some things to be desired as far as OOM hardening
goes, however. We should be able to create a String in a way that
doesn't OOM on failure so hard.
2023-02-21 10:57:44 +01:00
Andrew Kaster 0ea697ace5 AK: Add String::from_stream method
The caller is responsible for determining how long the string is that
they want to read.
2023-02-21 10:57:44 +01:00
Andreas Kling 7ac7a73758 Revert "AK: Disallow constness laundering in RefPtr and NonnullRefPtr"
This reverts commit 3c7a0ef1ac.

This broke Jakt, which will need some adjustments to its code generation
before we can commit to being this strict.
2023-02-21 09:22:18 +01:00
Humberto Alves f6eb155167 Kernel: Support more clocks in sys$clock_getres()
Support all the available clocks in clock_getres(). Also, fix this
function to use the actual ticks per second value, not the constant
`_SC_CLK_TCK` (which is always equal to 8) and move the resolution
computation logic to TimeManagement.
2023-02-21 01:00:06 +01:00
Andreas Kling 3c7a0ef1ac AK: Disallow constness laundering in RefPtr and NonnullRefPtr
Until now, it was possible to assign a RP<T const> or NNRP<T const>
to RP<T> or NNRP<T>. This meant that the constness of the T was lost.

We had a lot of code that relied on this sloppiness, and by the time
you see this commit, I hopefully found and fixed all of it. :^)
2023-02-21 00:54:04 +01:00
Andreas Kling 33e87d1627 Userland: Fix remaining smart pointer const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling faa1a09042 LibGUI: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling bfe081caad LibGfx: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 38b6eedd54 WebContent: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 025bdcf34c WindowServer: Fix various const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling dbcf2f2dd4 LibManual: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling f11899f885 LibWeb+LibIDL: Fix (or paper over) various const-correctness issues
There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
2023-02-21 00:54:04 +01:00
Andreas Kling 68b5df6bf1 Shell: Fix (and paper over) various const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 39a1702c99 LibPDF: Make Object::cast<T>() non-const
This was only ever used to cast non-const objects to other non-const
object types.
2023-02-21 00:54:04 +01:00
Andreas Kling 87e26d2fa4 Assistant: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling 70d7fb6a03 LibCpp: Make C++ AST (mostly) const-correct
I cheated and used const_cast to avoid dealing with the strange pattern
where we sometimes do a delayed reparenting of an AST node.
2023-02-21 00:54:04 +01:00
Andreas Kling eb4a69c377 LibImageDecoderClient: Fix minor const-correctness issue
By taking ownership of the bitmaps after decoding them, we avoid having
to call an API that would give us a const Bitmap.
2023-02-21 00:54:04 +01:00
Andreas Kling 456f12c5c8 LibPartition: Make Kernel parts const-correct re: StorageDevice&
We can't do I/O with a const StorageDevice&, so it has to be non-const.
2023-02-21 00:54:04 +01:00
Andreas Kling c837e7bbf3 LibGL: Fix minor const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling ca44b26b2a LibGfx: Make Gfx::Path const-correct internally (segment list) 2023-02-21 00:54:04 +01:00
Andreas Kling 485958bb6f LibTest: Fix minor const-correctness issue in TestSuite::find_cases() 2023-02-21 00:54:04 +01:00
Andreas Kling 08a90455ac LibCards: Make find_card_stack_to_drop_on() non-const
This function returns a card stack that we might want to drop a card on,
so intuitively it should be a mutating function.
2023-02-21 00:54:04 +01:00