Commit graph

51650 commits

Author SHA1 Message Date
Tim Ledbetter 1737a0d1d9 Browser: Set DownloadWidget progress bar minimum value correctly
This fixes a typo from #19462.
2023-06-19 18:50:52 +02:00
Andreas Kling 1b55ff6f4c LibWeb: Expand CSS var() inside calc() paren blocks
Before this change, this var() would get expanded:

    calc(10px * var(--one))

But this one would not:

    calc(10px * (var(--one))
2023-06-19 17:54:07 +02:00
Kenneth Myhra ce2b88e7cc LibJS: Use copy_data_block_bytes() instead of overwrite() and copy_to()
Replaces usage of ByteBuffer::overwrite() and combinations of
Span::slice() + Span::copy_to() with AO CopyDataBlockBytes.
2023-06-19 17:43:18 +02:00
Kenneth Myhra f3fb005653 LibJS: Partially implement AO CopyDataBlockBytes
Currently we do not support Shared Data Block so that part is not yet
implemented.
2023-06-19 17:43:18 +02:00
Timothy Flynn 2e5fbe8052 Ladybird: Add context menu items to directly open audio files
After commit 7ec7015, we can open audio documents directly. This adds
content menu items to do so, similar to images and videos.
2023-06-19 17:42:55 +02:00
Timothy Flynn 13e1f61a81 LibCore: Support audio file extensions when determining MIME type
Similar to commit bcfa4a3, this enables navigating to a file:// URL in
Ladybird with audio file extensions.

The file extensions used here were taken from
https://docs.fileformat.com/audio/ (except QOA, which isn't listed).
2023-06-19 17:42:55 +02:00
Aliaksandr Kalenik f04ae5f542 LibWeb/WebDriver: Close client connection socket when EOF is reached
Fixes the bug that currently we don't ever close webdriver client
connection socket when header "Connection: keep-alive" is specified.

This allows to run more WPT tests without running out of free file
descriptors :)
2023-06-19 09:55:47 -04:00
implicitfield d4f5e6eb81 Fuzzers: Update the path to fuzzer binaries
This was overlooked in 71b184a, which broke the oss-fuzz configuration.
2023-06-19 07:40:17 -04:00
Andreas Kling 5ef29364db Base: Add some browser content filters for common ads and trackers
Just some things I kept seeing again and again while browsing
newspaper websites. Also sorted the file.
2023-06-19 13:21:15 +02:00
Optimoos e72894f23d Kernel/TCPSocket: Read window size from peer
During receive_tcp_packet(), we now set m_send_window_size for the
socket if it is different from the default.

This removes one FIXME from TCPSocket.h.
2023-06-19 13:20:36 +02:00
Andi Gallo 701b170dc0 LibWeb: Clip cell spans past the end of the table
This occurs on Wikipedia for tournament brackets, for example:
https://en.wikipedia.org/wiki/2022%E2%80%9323_UEFA_Champions_League_knockout_phase
2023-06-19 13:19:55 +02:00
Andi Gallo 205f9c75d9 LibWeb: Fix empty slot finding in table formation algorithm
The algorithm which finds the first free slot must run for every cell,
not for every row.
2023-06-19 13:19:32 +02:00
Nico Weber 282e8357ed Tests: Move pbm, pgm, ppm test images into pnm/ subfolder 2023-06-19 06:42:00 -04:00
Nico Weber ba7d80fcde Tests: Move tga test images into tga/ subfolder 2023-06-19 06:42:00 -04:00
Nico Weber 5d0b170f72 Tests: Move jpg test images into jpg/ subfolder 2023-06-19 06:42:00 -04:00
Nico Weber df0a82668b Tests: Copy webp ICC test inputs into test-inputs/icc
Two files are used both as test inputs for the webp decoder test and
for the icc profile test.

Use redundant copies of these two files for the two usecases, since
different parts of the files are used in both tests (and we could
remove the unneeded parts later).
2023-06-19 06:42:00 -04:00
Nico Weber 1ea99097aa Tests: Move icc test inputs into icc/ subfolder 2023-06-19 06:42:00 -04:00
Nico Weber c0fe9cee97 Tests: Move webp test images into webp/ subfolder 2023-06-19 06:42:00 -04:00
Tim Ledbetter d89e23d63e ping: Don't call exit() from within closing_statistics()
This improves readability slightly, as it isn't immediately obvious
that calling this function terminates the program.
2023-06-19 06:15:40 +02:00
Tim Ledbetter e74324ad34 ping: Don't wait before displaying closing statistics
Previously, we would wait for the ping interval after the last ping
before displaying the closing statistics. We now display the closing
statistics and exit as soon as the required number of pings has been
performed.
2023-06-19 06:15:40 +02:00
Tim Ledbetter 834dc3747c ping: Avoid overflow for large interval values
Previously `usleep()` was being used, which takes a 32-bit integer
number of microseconds as a parameter. This caused an overflow for
intervals larger than 4294 seconds. We now use `clock_nanosleep()`
instead and ensure the user cannot specify a value larger than
`UINT32_MAX` seconds.
2023-06-19 06:15:40 +02:00
Tim Ledbetter 907e0b9e1d chown: Don't bail immediately on error
Previously, chown would exit immediately if there was an error
changing file ownership. We now print an error to stderr and
continue when an error occurs.
2023-06-19 06:14:02 +02:00
Optimoos bee316cfbe LibGfx: Remove unneeded TODO in BMPLoader
There was a TODO questioning whether breaking on >4bpp images
was the correct behaviour when RLE4 was detected. There is no
indication in the spec that RLE4 can be used with anything >4bpp,
so I believe this doesn't require additional follow-up.

MS Spec:
https://learn.microsoft.com/en-us/windows/win32/gdi/bitmap-compression
2023-06-19 06:13:53 +02:00
Tim Ledbetter 1a17e08f87 Everywhere: Correctly report progress of downloads larger than 4GiB
This commit changes the variables used to represent the size and
progress of downloads from u32 to u64. This allows `pro` and
`Browser` to report the total size and progress of a download
correctly for downloads larger than 4GiB.
2023-06-19 06:13:19 +02:00
Luke Wilde c5e0547377 LibWeb: Add HTMLFormElement#{method,action,target} 2023-06-19 06:12:26 +02:00
Luke Wilde f04d1d493d LibWeb: Bring form submission more up to spec
The main missing things are:
- Dialog submission
- Form validation
- Encoding URLs in the form element's encoding
- Navigables
2023-06-19 06:12:26 +02:00
Luke Wilde bd62fe9c33 LibWeb: Set method, headers and Content-Length in BC navigation
This is all ad-hoc, but will disappear when we switch to navigables.
2023-06-19 06:12:26 +02:00
Luke Wilde eaa4048870 LibTextCodec: Add "get output encoding" from the Encoding specification 2023-06-19 06:12:26 +02:00
Luke Wilde a53486a073 LibWeb: Add method to get last added task to an EventLoop 2023-06-19 06:12:26 +02:00
Luke Wilde 995df8f565 LibWeb: Move get_an_elements_{target,noopener} to HTMLElement
This will be used by form submission on `<form>` elements.
2023-06-19 06:12:26 +02:00
Luke Wilde c9c1ddd0bb LibWeb: Fix up constructing the form entry list
In particular:
- Don't include none submitter buttons.
- Use type_state() instead type() to avoid direct string comparisons
- Support the hidden _charset_ input
- Get form associated element's value directly instead of via the value
  attribute
- Split line break normalization into a separate function so that it
  can also be used by form submission.
2023-06-19 06:12:26 +02:00
Andi Gallo f154446a9f LibWeb: Skip separate height computation for tables
With multi-line text cells, we don't reliably know the height would stay
the same as the one set by the independent format context run. In such
situations, we can end up with a table box which is sized inconsistently
with the grid boxes of the table due to differences in line breaks.
2023-06-18 20:55:06 +02:00
Tim Ledbetter 0cea1a3baf chmod: Don't bail immediately on error
Previously, chmod would exit immediately if there was an error
changing file permissions. We now print an error to stderr and
continue when an error occurs.
2023-06-18 20:34:04 +02:00
Tim Schumacher ead756ca32 Ports: Point to the correct subdirectory for gettext
`ftpmirror.gnu.org` does not seem to have the `/pub/gnu` folder
structure, all files are in `/gnu` instead.

This regressed in 41f7f821f6.
2023-06-18 20:33:38 +02:00
Simon Danner 45f86466bb LibWeb: Add initial implementation of CRC2D.globalAlpha
Works for fills and strokes (using colors, gradients, or patterns),
along with images.

fill_rect() has been updated to use fill_path(), which allows it to
easily transform the rect, and already supports opacity.

Co-authored-by: MacDue <macdue@dueutil.tech>
2023-06-18 20:31:11 +02:00
MacDue ff5d530aa3 LibWeb: Pass CRC2D fill_rule as enum rather than StringView 2023-06-18 20:31:11 +02:00
MacDue 0bb0f2e4fb LibGfx: Apply opacity in Painter::draw_scaled_bitmap_with_transform() 2023-06-18 20:31:11 +02:00
Ali Mohammad Pur 12a900b97c LibCpp: Ignore the #error preprocessor directive 2023-06-18 20:30:21 +02:00
Ali Mohammad Pur 543ccecc0b LibCpp: Add support for type aliases with typedef/using 2023-06-18 20:30:21 +02:00
Ali Mohammad Pur 2e2e535abb Meta: Build LibCpp for Lagom 2023-06-18 20:30:21 +02:00
Aliaksandr Kalenik ca0c2339f4 LibWeb: Use padding box of containing block to resolve % height size
From CSS-POSITION-3 <https://www.w3.org/TR/css-position-3/#def-cb>

"..the containing block is formed by the padding edge of the ancestor.."

Fixes crash on Acid2 test.
2023-06-18 20:29:40 +02:00
Luke Wilde 14ae0524e9 LibWeb: Add HTMLButtonElement#disabled 2023-06-18 19:07:06 +02:00
Nico Weber e19892a099 WebP/Lossless: Set alpha to 0xff if is_alpha_used is false in header
simple-vp8l-alpha-used-false.webp is a copy of simple-vp8l.webp,
with the byte at offset 0x18 changed from 0x10 to 0x00 -- that
is, the bit in the VP8L header that stores `is_alpha_used` is cleared.

We would already allocated a BGRx8888 instead of a BGRA8888 bitmap,
but keep actual alpha data in the `x` channel.

That lead to at least `image` still writing a PNG with an alpha channel.
So explicitly set the alpha channel to 0xff when is_alpha_used is false,
to make sure all consumers of decoded lossless webp data have behavior
consistent with other webp readers.

In practice, webp encoders usually don't write files that have
`is_alpha_used` set to false and then write actual alpha data to their
output. So this is rarely observable. However, for example for
lossy+ALPH webp files, the lossless webp used to store the ALPH channel
has `is_alpha_used` set to false and all channels but green are 0
(since the lossless green channel stores the alpha channel of a
lossy+ALPH webp). So if we dump such a bitmap to a standalone webp
file (e.g. with the temporary debugging code in fc3249a1ca),
then without this commit here, `image` would convert that webp to
a fully transparent webp, while other webp software would correctly
display the green image with opaque alpha.
2023-06-18 18:47:47 +02:00
Valtteri Koskivuori 5e5493e334 AK: Add URLParser relative file URL test
I was debugging a different issue in Ladybird, and noticed that
completing relative file URLs with URL::complete_url didn't seem to work
right. This test case covers both the working https case, as well as the
file URL case fixed by the previous commit.
2023-06-18 15:16:08 +02:00
Valtteri Koskivuori 838d586b25 AK: Fix relative file URL parsing in URLParser
The FileSlash state was erroneously copying the base URL host, instead
of the base URL path excluding the last path component. This resulted in
invalid file URLs.
2023-06-18 15:16:08 +02:00
Andi Gallo db121c7af1 LibWeb: Handle leading whitespace in grid-template-* block components
We're already handling whitespace between components, do the same for
leading whitespace. Fixes crash on https://distill.pub/2021/gnn-intro.
2023-06-18 13:41:15 +02:00
Tim Ledbetter 586b47cede Kernel: Put loopback adapter debug spam behind a flag
This significantly increases loopback adapter speed in normal use.
2023-06-18 08:50:33 +01:00
Ben Wiederhake 0184fc5e43 Everywhere: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes 2023-06-18 08:47:51 +01:00
Ben Wiederhake 2ebd79bc76 LibCore: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes in default impls 2023-06-18 08:47:51 +01:00
Ben Wiederhake 2b2e0a4c5a Tests: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes in default impls 2023-06-18 08:47:51 +01:00