Commit Graph

57671 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
d4a6564e5a LibWeb: Do not use Optional for aa_translation in RecordingPainter
This allows to remove checks whether translation has value, as it does
not change anything because default value for point is zero.
2023-12-29 09:23:27 +01:00
Nico Weber
e735ee5251 Tests/LibGfx: Add YCCK jpeg test files
Obtained by running:

    convert rgb_components.jpg -colorspace cmyk \
        -sampling-factor 1 ycck-1111.jpg
    convert rgb_components.jpg -colorspace cmyk \
        -sampling-factor 2 ycck-2111.jpg
    convert rgb_components.jpg -colorspace cmyk ycck-2112.jpg

where rgb_components.jpg is the file in Tests/LibGfx/test-inputs/jpg.

(I used the web version of `convert` at
https://cancerberosgx.github.io/magic/playground/index.html)

While this does indeed produce a cmyk jpg (using the YCCK encoding
internally), it uses the mathematical rgb->cmyk conversion and does
not embed an cmyk color space in the output jpg.

Normally, cmyk images are for printing and hence converting them
from cmyk to rgb using a color profile like SWOP leads to better
results. So if a cmyk image does not contain color space information,
applications might use something like SWOP instead of the simple
math transform to convert to RGB. Programs doing that will show
these images as fairly muted (and would arguably be correct doing
so).

Hence, tests using these images shouldn't check their RGB values.
Ideally, we'd add a way to get the raw cmyk data from a cmyk jpeg,
and then tests could test color values against that.

The -1111 image uses no subsampling, meaning each channel's sampling
factor is 1.

The -2111 image uses subsampling for the non-Y channels, meaning the
sampling factors are 2 for Y and 1 each for YYK.

The -2112 image uses subsampling for the two C channels, meaning the
sampling factors are 2 for Y and K and 1 each for YY.

We correctly render the -1111 variant (using e.g.
`Build/lagom/bin/image -o out.png .../ycck-1111.jpg).

We render the -2111 variant, but it looks pretty broken.

We refuse to decode the -2112 variant. This is #21259.

Manual tests for now, but having these in tree will make it easier
to write unit tests later, once things work better.
2023-12-29 08:17:10 +00:00
Lucas CHOLLET
97ded2dc61 FileManager: Conditionally display the "ICC profile:" line
If the "ICC Profile" group is shown, no need to include the related line
in the "Image" group.
2023-12-29 07:57:12 +00:00
Hendiadyoin1
16b14b0688 Meta: Add an isa-debugcon to the q35 machine
Otherwise we would not print debug output to the host console, which we
did in the old run.sh
2023-12-28 17:08:34 +01:00
Hendiadyoin1
5d7ce0343f Meta: Hook up the UHCI HCs up to the EHCI HCs in the q35 machine
Now devices connected to the EHCI controllers show up on the hooked up
UHCI companion controllers.
2023-12-28 17:08:34 +01:00
Hendiadyoin1
f4bfd0468b Kernel/USB: Add a rudimentary interrogation only EHCI driver
This adds a simple EHCI driver that currently only interrogates the
device and checks if all ports are addressable via associated legacy
controllers (companion controllers), and warns if this is not the case.

This also adds a lot of the other data structures needed for actually
driving the controller, but these are currently not hooked up to
anything.

To test this run with `SERENITY_EXTRA_QEMU_ARGS="--device usb-ehci"`
or the q35 machine type
2023-12-28 17:08:34 +01:00
Jami Kettunen
a768685d16 Meta: Add support for QEMU 8.2 audio
Still try parsing the now gone "-audio-help" output first, then attempt
the new "-audiodev help" if stdout was empty. This fixes support for
QEMU 8.2+ audio since "-audio-help" is now an invalid option.
2023-12-28 16:52:20 +01:00
Andreas Kling
6fe6166607 LibWeb: Put a cap on how many image loads we'll batch up before flushing
The BatchingDispatcher mechanism is used by HTMLImageElement to avoid
decoding one image at a time, since interleaving decode/layout/repaint
over and over takes way more time than doing many decodes followed by
a single layout/repaint pair.

Before this change, we didn't have a limit on how many batched loads
we'd allow ourselves to queue up, which could lead to situations where
more and more images kept being added to the queue, and never getting
processed.

This fixes the issue by putting an arbitrary limit (16) on the number
of batched image loads, and then allowing the flush to happen after
that instead of re-deferring processing.
2023-12-28 14:39:15 +01:00
Andreas Kling
473f3a0931 LibWeb: Stop rendering the src (URL) as image alt attribute fallback
If an image element has no alt attribute, other browsers don't fall back
to using the src attribute like we did.

This gave us a janky look while loading pages that other browsers don't
have, and it's not like seeing a partial URL is really helpful to the
user anyway.
2023-12-28 14:39:15 +01:00
Timothy Flynn
f1e01a681e LibJS: Implement missing conditional when creating a TypedArray subarray 2023-12-28 08:19:02 -05:00
Aliaksandr Kalenik
522302d5d6 LibWeb: Skip erroneous blit/sample corner commands in RecordingPainter
Fixes https://github.com/SerenityOS/serenity/issues/22451
2023-12-27 20:00:16 +01:00
Timothy Flynn
916cb256de LibJS: Ensure enlarged ArrayBuffers are filled with zeros
Otherwise, the newly allocated bytes are uninitialized, causing UB when
reading from the buffer immediately after an enlarging resize.
2023-12-27 19:30:39 +01:00
Timothy Flynn
cabd599c8b LibJS: Consolidate duplicate "errors" sections in LibJS tests
A couple of duplicate sections were errantly added in commit 9258d7b98a.
2023-12-27 19:30:39 +01:00
Timothy Flynn
507a5d8a07 AK: Add an option to zero-fill ByteBuffer data upon growth
This is to avoid UB in cases where we need to be able to read from the
buffer immediately after resizing it.
2023-12-27 19:30:39 +01:00
Kenneth Myhra
759c8ccc55 Ports: Update checksum for stpuzzles 2023-12-27 19:30:23 +01:00
Lucas CHOLLET
f389c1cdba LibGfx+LibPDF: Use LibCompress' implementation of the PackBits decoder
No need to have these three copies :^)
2023-12-27 17:40:11 +01:00
Lucas CHOLLET
d748edd994 LibCompress: Add a PackBits decoder
This compression scheme was quite popular during the 80's, and we can
still find it in use inside file formats such as TIFF or PDF.
2023-12-27 17:40:11 +01:00
Shannon Booth
5d0fb4bac3 LibJS: Do not inherit TypedArray constructors from TypedArrayConstructor
In: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object

The spec says:
> is a constructor function object that all of the TypedArray
> constructor objects inherit from.

From what I understand from this, it effectively just means is that the
prototype for the constructor should simply be set to
TypedArrayConstructor. We _were_ doing that, but also inheriting from
it in C++.

This meant we were invoking TypedArrayConstructor::initialize for each
of the typed arrays. This is not actually what we want, since it means
that the 'of' and 'from' functions were being defined as native
properties in both the concrete typed array (e.g Uint8Array), and the
abstract TypedArray. Instead, the properties should only be defined and
inherited from the abstract TypedArray class.

Diff Tests:
    +4     -4 

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-27 10:57:16 -05:00
Bastiaan van der Plaat
009729d5e3 LibWeb: Use resources to find internal HTML template paths 2023-12-27 10:54:07 -05:00
Bastiaan van der Plaat
f8feca5d21 LibWeb: Use directory page when viewing a resource schemed directory URL 2023-12-27 10:54:07 -05:00
Bastiaan van der Plaat
b39d99cf2f LibWeb: Use resource scheme for icons in internal pages 2023-12-27 10:54:07 -05:00
Mr.UNIX
44d623d588 CrashReporter: Port CrashReporter to GML Compiler 2023-12-27 15:29:50 +01:00
Mr.UNIX
4cb2ff1428 LibGUI: Add set_text(String) method to ProgressBar 2023-12-27 15:29:50 +01:00
Nico Weber
3c39c18440 LibGfx/JPEG: Add spec comment to read_start_of_frame() 2023-12-27 13:38:25 +00:00
Andreas Kling
89da988da1 LibWeb: Honor User-Agent spoofing in Fetch headers
This makes spoofing consistent between legacy ResourceLoader loads,
Fetch loads, and the JavaScript `navigator` APIs.
2023-12-27 11:43:14 +01:00
Andreas Kling
a30d263522 LibGfx: Don't clone fonts in FontCascadeList::extend()
This was create a completely avoidable explosion of BitmapFont clones
when running on SerenityOS.
2023-12-27 11:42:05 +01:00
Andreas Kling
bd9989b08a LibWeb: Don't pass StringView to RecordingPainter, to avoid copy
Instead, we now pass String if we have one. In particular, this fixes an
issue where image elements with a data: URL src would copy the entire
URL string every time we painted (before the image had been decoded).
This was very noticeable on "fully downloaded" web pages where every
single image has been turned into a data: URL.
2023-12-27 11:41:15 +01:00
Andreas Kling
0c7b1d27b4 LibWeb: Remove incomplete attempt to avoid repaints outside viewport
This code didn't account for position:fixed elements, which meant that
we'd swallow repaints for such elements when the viewport wasn't
scrolled to the top of the page.

We replace the incomplete optimization with a FIXME noting that this
needs to be handled correctly when reintroduced.
2023-12-27 09:46:06 +01:00
Shannon Booth
1f9942fede BindingsGenerator: Use get_attribute_value for reflected strings
Per:

https://dom.spec.whatwg.org/#concept-reflect

We should be calling `get_attribute_value` for reflected IDL strings.
No functional change as nowhere is performing a reflect on a nullable
type, and just ends up simplifying the code.
2023-12-27 09:23:44 +01:00
Shannon Booth
462f97b28a LibWeb: Port Element::get_attribute_value from ByteString 2023-12-27 09:23:44 +01:00
tetektoza
2751f32a18 HexEditor: Move drawing cursor under a lambda and reuse it
This is a cleanup patch dones for paint event for HexEditor, moving
repeated chunks of code under a common lambda.
2023-12-27 09:22:09 +01:00
tetektoza
017dea2993 HexEditor: Don't initialize background/text colors twice
This is a cleanup patch, moves a chunk of repeated code to one place
instead of assigning variables with the same values twice in two
different places of code.
2023-12-27 09:22:09 +01:00
tetektoza
bd1d384cf6 HexEditor: Remove moving cursor outside bounds if selecting with mouse
Currently if users select last bytes in HexEditor with mouse in either
Hex or Text mode, they will be able to move cursor on the byte outside
bounds. If then they try to write something in either of those modes,
app will crash.

This patch moves the recently added "replace" cursor to always be on the
last byte of the selection instead of being on the byte after the last
selected byte.
2023-12-27 09:22:09 +01:00
tetektoza
c4c9971ed0 HexEditor: Change cursor type from caret to black box
This patch changes cursor type from caret to black box for both Hex and
Text modes, because right now the way how blinking caret looks like is
more closer to "insert" mode in similar editors, whereas the real
behavior of this cursor is more of a "replace" mode seen in similar
editors like GHex.
2023-12-27 09:22:09 +01:00
tetektoza
1ea675a9ec HexEditor: Remove blinking of the cursor 2023-12-27 09:22:09 +01:00
MacDue
daecf741d4 LibWeb: Ensure DocumentObserver document_completely_loaded() is called
This stopped being called for anything without a navigable container
after 76a97d8, due to the early return. This broke SVG <use> elements
that reference elements defined later in the document.
2023-12-26 21:37:04 +01:00
Idan Horowitz
785c9d5c2b Kernel: Add support for TCP window size scaling
This should allow us to eventually properly saturate high-bandwidth
network links when using TCP, once other nonoptimal parts of our
network stack are improved.
2023-12-26 21:36:49 +01:00
Idan Horowitz
2c51ff763b Kernel: Properly report receive window size in sent TCP packets
Instead of lying and claiming we always have space left in our receive
buffer, actually report the available space.

While this doesn't really affect network-bound workloads, it makes a
world of difference in cpu/disk-bound ones, like git clones. Resulting
in a considerable speed-up, and in some cases making them work at all.
(instead of the sender side hanging up the connection due to timeouts)
2023-12-26 21:36:49 +01:00
Sam Atkins
69f88c9a64 LibWeb: Parse grid property using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
5f99edad3b LibWeb: Parse grid-template property using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
b8c6c75ae1 LibWeb: Parse grid-template-[columns,rows] properties using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
ee5b00d1ee LibWeb: Parse grid-auto-[columns,rows] properties using TokenStream 2023-12-26 19:58:20 +00:00
Idan Horowitz
519214697b Kernel: Mark sys$getsockname as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
ed5406e47d Kernel: Mark sys$getpeername as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
24a60c5a10 Kernel: Mark sys$ioctl as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
d63667dbf1 Kernel: Mark sys$kill_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
b44628c1fb Kernel: Mark sys$join_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
82e6090f47 Kernel: Mark sys$detach_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
b49a0e2c61 Kernel: Mark sys$create_thread as not needing the big process lock
Now that the master TLS region is spinlock protected, this syscall does
not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
6a4b93b3e0 Kernel: Protect processes' master TLS with a fine-grained spinlock
This moves it out of the scope of the big process lock, and allows us
to wean some syscalls off it, starting with sys$allocate_tls.
2023-12-26 19:20:21 +01:00