Commit Graph

47285 Commits

Author SHA1 Message Date
Kenneth Myhra
dcbe927b48 LibWeb: Make factory method of Selection::Selection fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
d69e863286 LibWeb: Propagate error in factory method of Streams::ReadableStream 2023-02-22 09:55:33 +01:00
Kenneth Myhra
07db02cd2c LibWeb: Make factory method of Geometry::DOMRectReadOnly fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
ec0049441c LibWeb: Make factory methods of Geometry::DOMRect fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
9b190b9509 LibWeb: Make factory method of Geometry::DOMRectList fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
4de5dc7a86 LibWeb: Make factory method of Geometry::DOMPointReadOnly fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
530ec85c4a LibWeb: Make factory method of Geometry::DOMPoint fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
459959b297 LibWeb: Make factory method of HTML::BrowsingContext fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
3f50025126 LibWeb: Make factory method of Fetch::Response fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
54913adf37 LibWeb: Make factory method of Fetch::Request fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
d7446089ae LibWeb: Make factory method of Encoding::TextEncoder fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
77e4432367 LibWeb: Make factory method of DOMParsing::XMLSerializer fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
f918d12655 LibWeb: Make factory methods of WebGL::WebGLContextEvent fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
ff92324fa5 LibWeb: Make factory method of DOM::ElementFactory fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
a2381a672d LibWeb: Make factory method of Fetch::HeadersIterator fallible 2023-02-22 09:55:33 +01:00
Kenneth Myhra
b3734627a1 LibWeb: Make factory method of URL::URLSearchParamsIterator fallible 2023-02-22 09:55:33 +01:00
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