Commit graph

26307 commits

Author SHA1 Message Date
Shannon Booth c9941ba95b LibWeb: Implement CountQueuingStrategy highWaterMark property 2023-06-21 12:27:04 +02:00
Shannon Booth 0d714ad165 LibWeb: Add IDL definition for Web::Streams::QueuingStrategyInit
This is used in the constructor for ByteLengthQueuingStrategy and
CountQueuingStrategy.
2023-06-21 12:27:04 +02:00
Caoimhe 5ef01e562a LibWeb: Generate JavaScript bindings for CSSKeyframesRule
This one also needs a bit of work, but it's a nice start.
2023-06-21 12:26:22 +02:00
Caoimhe e3612708c7 LibWeb: Generate JavaScript bindings for CSSKeyframeRule
We still need to do a bit of work. For example: `set_key_text` isn't
implemented due to its requirements being quite complex, but it's
a start.
2023-06-21 12:26:22 +02:00
Tim Ledbetter f02ccffaa8 WebServer: Show the correct port when using port 0
Specifying port 0 on the command line causes WebServer to select a
random available port. We now show the port WebServer is actually
using rather than assuming it is the same as the command line argument.
2023-06-21 08:35:44 +02:00
Andi Gallo 5bd9f4c31c LibWeb: Add undistributable space to GRID{MIN, MAX} instead of content
Adding undistributable space right before setting the content width is
incorrect when it's a percentage. Follow the specification and add it to
GRIDMIN and GRIDMAX instead.
2023-06-21 06:15:04 +02:00
Aliaksandr Kalenik a8211abc1e LibWeb: Support CSS functions other than calc() for grid sizes
Makes grid size parser to handle not only calc() but min(), max() and
other CSS functions we support.
2023-06-21 06:14:51 +02:00
Timothy Flynn 1c4dd0caad Ladybird+LibWeb+WebConent: Drive audio in Ladybird off the main thread
The main thread in the WebContent process is often busy with layout and
running JavaScript. This can cause audio to sound jittery and crack. To
avoid this behavior, we now drive audio on a secondary thread.

Note: Browser on Serenity uses AudioServer, the connection for which is
already handled on a secondary thread within LibAudio. So this only
applies to Lagom.

Rather than using LibThreading, our hands are tied to QThread for now.
Internally, the Qt media objects use a QTimer, which is forbidden from
running on a thread that is not a QThread (the debug console is spammed
with messages pointing this out). Ideally, in the future AudioServer
will be able to run for non-Serenity platforms, and most of this can be
aligned with the Serenity implementation.
2023-06-21 06:14:15 +02:00
Luke Wilde f4446cdf8c LibWeb: Resolve padding against 0 and not inf for indefinite width more
In particular, in BFC:
- Non-floating, non-replaced elements
- Floating, non-replaced elements
- Floating, replaced elements

The first two regressed in 1d76126abe

The third one seems to have been introduced by this regression, as it
was seemingly copied from compute_width_for_floating_box in
7f9ede07bc
2023-06-21 06:13:05 +02:00
Andreas Kling 0ec522ab54 LibWeb: Don't infer SVG viewBox if width and/or height is zero
The fix here has two parts:
1. Don't use the fallback viewBox at all if we're not in SVG-as-image.
2. Don't make a fallback viewBox with zero width and/or height.

This fixes a crash on Bandcamp pages. Thanks Tim Flynn for reporting!
2023-06-20 20:55:12 +02:00
Aliaksandr Kalenik ffd5b3da16 LibWeb: Implement reload for navigables 2023-06-20 18:30:27 +02:00
Aliaksandr Kalenik 21f39061fd LibWeb: Set 0px fixed size to collapsed auto-fit tracks in GFC
Fixes the issue that before we set base_size and growth_limit of
collapsed tracks to 0px which still allowed them to grow by space
distribution.
2023-06-20 18:24:26 +02:00
Andi Gallo e4d0c077c3 LibWeb: Don't skip width computation for intrinsic table width
The shortcut we put in place didn't resolve percentage widths and
ignored border spacing. We can still return early after we compute the
width per the specifications.
2023-06-20 18:24:19 +02:00
Aliaksandr Kalenik aafa09e7a5 LibWeb: Implement "traverse the history by delta" for traversables 2023-06-20 17:36:44 +02:00
Sam Atkins 0e2684b10f LibWeb: Fix serialization of CSSFontFaceRule
- The check for `local()` sources wasn't working, and output `local()`
  every time. Since we don't parse `local()` yet, let's just always
  output a regular URL source.
- Put a space between the URL and the `format()`.
- Stop double-quoting the format string.
2023-06-20 15:50:26 +01:00
Andreas Kling c808f6c637 LibWeb: Don't use BFC auto height for non-BFC abspos elements
While CSS 2.2 does tell us to use the "auto height for BFC roots"
calculation when resolving auto heights for abspos elements, that
doesn't make sense for other formatting context roots, e.g flex.

In lieu of implementing the entire new absolute positioning model from
CSS-POSITION-3, this patch borrows one small nugget from it: using
fit-content height as the auto height for non-BFC-root abspos elements.
2023-06-20 13:42:31 +02:00
Andreas Kling 38a6b7ad3d LibWeb: Don't assert when flex-item has align-self: end
We were missing the code to convert this to `align-items: end`.
2023-06-20 13:26:41 +02:00
Andreas Kling 55c1d8ba29 LibWeb: Honor the opacity attribute on SVG graphics elements
This is simply converted to an equivalent CSS `opacity` property value.
2023-06-20 13:24:33 +02:00
Andreas Kling 9f24c1b34c LibWeb: Use width & height to create fallback viewBox for SVG-as-image
When embedding an SVG in an img element, if the external SVG's root
element has both width and height attributes, but no viewBox attribute,
we now create a fallback viewBox with "0 0 width height".

This appears to match the behavior of other browsers. Inspired by
discussion on Mozilla's bug tracker:
https://bugzilla.mozilla.org/show_bug.cgi?id=614649
2023-06-20 11:34:09 +02:00
Andreas Kling a0b4987e92 headless-browser: Paint while running layout tests (but discard results)
If we don't paint, SVG-as-image documents don't get laid out, and so
have 0x0 size throughout.

This change is also generally nice, as it makes the painting code run
on all the layout tests, increasing coverage. :^)
2023-06-20 11:34:09 +02:00
Fabian Dellwing 79d3942012 sed: Allows the usage of escaped delimiters
This allows us to parse the sed script `s/\//S/g` successful.
2023-06-20 10:47:02 +02:00
Daniel b10c87d31e LibAudio: Remove redundant checks in WavLoader
- Max size of a wav is u32::MAX, so file/data size will never be larger
2023-06-20 09:12:17 +02:00
Andi Gallo ac6af51549 LibWeb: Improve span column width distribution
Compute the contributions to a spanning cell width from each cell in the
span. This better handles uneven column widths, since each cell
contribution is proportional with its own width as opposed to the own
width of the first cell in the span.

This better matches the behavior of other browsers and further aligns
with the specification.
2023-06-20 06:59:43 +02:00
Aliaksandr Kalenik b37fbcb159 LibWeb: Use PaintContext::would_be_fully_clipped_by_painter() everywhere
Always use `would_be_fully_clipped_by_painter` to check if painting can
be skipped.

This allows to quickly find all the places where this check happens and
also removes incosistency that before we checked for intersection with
viewport rect in some places and for intersection with painter clip
rect in other places.
2023-06-20 06:58:47 +02:00
kleines Filmröllchen 2e4bb2941d Utilities: Add pixelflut, a Pixelflut protocol client
For the meme and for GPN.
2023-06-20 00:22:03 +02:00
Tim Ledbetter cba46a2d64 rmdir: Add -v option to list each directory as it is removed 2023-06-19 22:52:15 +02:00
Tim Ledbetter 307dc00ee0 rmdir: Add -p option to remove all directories in each given path 2023-06-19 22:52:15 +02:00
MacDue 130ec7e5b4 LibJS: Align HeapBlock cell storage to __BIGGEST_ALIGNMENT__
alignas(Cell) is just the alignment requirement for the base class
(which resolves to 8-bytes). This does not necessarily hold for all
subclasses.
2023-06-19 21:59:35 +02:00
Aliaksandr Kalenik c90136d48d LibWeb: Start fleshing out "apply the history step" for traversables
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik caf7fd4f19 LibWeb: Add supporting method to get navigables whose SHE will change
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#get-all-navigables-whose-current-session-history-entry-will-change-or-reload
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik 9c1087de8c LibWeb: Implement "get the used step" for traversable navigables
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-the-used-step
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik 5b06e43938 LibWeb: Implement get_the_history_object_length_and_index() 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik 09cb266cb8 LibWeb: Implement "activate history entry" for navigables 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik 0285a363e2 LibWeb: Add set_current_session_history_entry setter for Navigable 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik eb4db6057d LibWeb: Implement child_navigables() for navigables 2023-06-19 21:28:20 +02:00
MacDue 5f8b9f7936 LibWeb: Use enclosing (rather than rounded) rect for overflow clipping
If we use a rounded rect we'll clip off subpixels around the edge.
2023-06-19 21:19:08 +02:00
Tim Ledbetter b471ddfa73 groupdel: Ensure the veil is closed after required files are unveiled 2023-06-19 18:56:36 +02:00
Andreas Kling e99a6fede4 LibWeb: Allow IFC to size inline-flex boxes midway through flex layout
The part in FFC where we ask the parent formatting context to size the
flex container midway through layout is really weird, but let's at least
be consistently weird for BFC and IFC. Since IFC always works within its
parent BFC, it can simply forward these requests to the BFC.

This fixes an issue where inline-flex containers incorrectly had main
axis margins subtracted from their content size.
2023-06-19 18:51:00 +02:00
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
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
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
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
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
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
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
Shannon Booth ef391de635 LibWeb: Implement Web::FileAPI::Blob::text to spec 2023-06-18 08:34:02 +02:00
Shannon Booth 501b698385 LibWeb: Implement Web::FileAPI::Blob::array_buffer to spec 2023-06-18 08:34:02 +02:00
Shannon Booth b0bc8f2282 LibWeb: Add ReadableStreamDefaultReader::read_all_bytes_deprecated
This is not to the specification, but as the FIXME comment for the
function states, we need it to be able to properly interface with the
FileAPI spcification, which seems to have not been updated to the non
promise based API.
2023-06-18 08:34:02 +02:00
Shannon Booth 3df10d7fb6 LibWeb: Add Streams::ReadableStreamDefaultReader::read_all_bytes 2023-06-18 08:34:02 +02:00
Shannon Booth 46f9a49bd8 LibWeb: Add Streams::ReadableStreamDefaultReader read-loop reader
This algorithm is used by ReadableStreamDefaultReader to read all bytes
from a given stream. Currently the algorithm used is somewhat naive as
it is recursive, but given the initial use of this reader, it should not
be a problem.
2023-06-18 08:34:02 +02:00
Shannon Booth f320406a4c LibWeb: Make Bindings::dom_exception_to_throw_completion public API
I found myself needing to call this method when attempting to implement
Blob::text and Blob::array_buffer. Turns out that the only caller
outside of the Detail namespace  already had a FIXME to make this a
public API - so let's do that.
2023-06-18 08:34:02 +02:00
Andi Gallo c5eeb303d8 LibWeb: Don't cap used width by available width from a constraint
In compute_table_box_width_inside_table_wrapper, we should only consider
available_width when it's valid. Values which come from {min,
max}-content constraints aren't meaningful and shouldn't be considered
for the cap.
2023-06-18 08:27:24 +02:00
MacDue a910c4d984 LibWeb: Fix end position for objectBoundingBox SVG <radialGradient>s
The translation to the bounding box location is handled by the gradient
transform, also doing it here breaks things.

This fixes the MDN <radialGradient> example.
2023-06-17 22:25:26 +01:00
Kenneth Myhra 57626c4f9a LibWeb: Migrate WebSockets::WebSocket to String 2023-06-17 20:38:20 +02:00
Sam Atkins b264d29515 Snake: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins 46f365df5c MasterWord: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins 2dc96155f7 GameOfLife: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins f3b08ffc8a SpaceAnalyzer: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins aa7346d23e HexEditor: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins 200892868a ThemeEditor: Add a recent files list 2023-06-17 20:36:03 +02:00
Sam Atkins 16240942ba ThemeEditor: Add a Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins ae6bde6847 GMLPlayground: Add a Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins 506f9484e3 LibGUI: Give recent-file actions a nicer status tip
"Open /path/to/file" instead of just "/path/to/file".
2023-06-17 20:36:03 +02:00
Andreas Kling c374541711 LibWeb: Use correct reference for abspos elements with % height sizes
Absolutely positioned elements should have their percentage sizes
resolved against the padding box of the containing block, not the
content box.

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.."
2023-06-17 20:35:19 +02:00
Luke Wilde 357174d8fd LibJS/Bytecode: Actually get value from super base for computed property 2023-06-17 20:26:14 +02:00
Luke Wilde 1116ba191a LibJS/Bytecode: Implement optional chaining 2023-06-17 20:26:14 +02:00
Malik Ammar Faisal c9088fa6ec LibJS: Add tests for new Obj with optional chain 2023-06-17 20:01:38 +02:00
Malik Ammar Faisal 5c913d9cc4 LibJS: Correctly handle parentheses and new Object
Parses `new Object()?.foo`, `(new Object)?.foo`
and shows syntax error on `new Object?.foo`
2023-06-17 20:01:38 +02:00
Andreas Kling eee4b6eca7 LibJS/Bytecode: Let var without initializer codegen to nothing
Otherwise we incorrectly overwrite the binding with `undefined` at the
point where the `var` statement is.

Fixes 9 test262 tests. :^)
2023-06-17 15:37:33 +02:00
Andreas Kling 743943a042 LibJS/Bytecode: Reorder function compilation to ensure correct hoisting
Fixes 37 test262 tests. :^)

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2023-06-17 15:37:33 +02:00
Andreas Kling 9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
Luke Wilde 7ec7015750 LibWeb: Create an audio document for audio/ MIME types on navigation 2023-06-17 14:16:26 +02:00
stelar7 d6db924d47 LibWeb: Implement CSS rem() 2023-06-17 12:13:28 +01:00
stelar7 dc042662d1 LibWeb: Implement CSS mod() 2023-06-17 12:13:28 +01:00
stelar7 b2230c826b LibWeb: Implement CSS round() 2023-06-17 12:13:28 +01:00
Luke Wilde 26f8a441f5 LibWeb: Add audio mime types to HTMLMediaElement.canPlayType
Now that we support audio, we can start correctly reporting we support
certain audio mime types!

Required by certain sites like Gartic Phone, which fails to load audio
because we didn't return a non-empty string for `audio/mpeg`:
```
"https://garticphone.com/sounds/turnundefined", Error: Load failed: 404
```

```js
(new Audio).canPlayType("audio/mpeg") && (this._extension = ".mp3"),
```
2023-06-17 06:26:56 -04:00
Andreas Kling d89e0b36d4 LibJS/Bytecode: Support class field initializers
Fixes 513 test262 tests. :^)
2023-06-17 11:00:39 +02:00
Andreas Kling 82828ad936 LibJS/Bytecode: Extract accumulator value before incurring side effects
Many operations in JavaScript may incur side effects, including calling
arbitrary user code. Since the user code will clobber the accumulator,
we have to take care to extract anything we need from the accumulator
before doing anything that may have side effects.

Fixes 3 test262 tests. :^)
2023-06-17 11:00:39 +02:00
tgsm c30775522e LibCompress/Gzip: Replace usage of DeprecatedString 2023-06-17 06:44:16 +02:00
Simon Wanner 7990f1b85a LibXML: Fix parser not leaving self-closing tags 2023-06-17 06:39:21 +02:00
MacDue 4f2770a745 LibWeb: Apply canvas transform while building paths
The transform can change between path building operations (and before
the path is filled or stroked). This fixes the sun ray backgroun on
the https://www.kevs3d.co.uk/dev/html5logo/ canvas demo.
2023-06-17 06:38:32 +02:00
MacDue 9e57f8d183 LibGfx: Invalidate path bounding boxes when invalidating split lines
If the lines are no longer valid then the bounding box (which is derived
from the lines) is also invalid.
2023-06-17 06:38:32 +02:00
stelar7 4436ab0cb1 LibWeb: Handle calculated vertical-align 2023-06-17 06:33:52 +02:00
kamp c476ff10a5 LibWeb/CSS: Update Default.css from the HTML specification 2023-06-17 06:31:28 +02:00
Andreas Kling 61148bce5f LibJS/Bytecode: Use the correct this value in GetById
The fix for this was to port the "don't create unnecessary FooObject
for property access on primitives" optimization from Reference,
which also brings us the correct behavior.
2023-06-16 21:46:43 +02:00
Andreas Kling dbfe1311ef LibJS/Bytecode: Simplify creating/leaving lexical environment
Since we no longer need to create or leave var environments directly
in bytecode, we can streamline the two instructions by making them
always operate on the lexical environment.
2023-06-16 21:46:43 +02:00
Andreas Kling 12ce0789da LibJS/Bytecode: Remove BlockBoundaryType::LeaveVariableEnvironment
We never need to manually exit a var environment from bytecode anymore.
2023-06-16 21:46:43 +02:00
Andreas Kling ac246d764d LibJS/Bytecode: Leave BlockDeclarationInstantiation in C++
Instead of implementing this AO in bytecode, we now have an instruction
for it that simply invokes the C++ implementation.

This allows us to simplify Bytecode::Generator quite a bit by removing
all the variable scope tracking.
2023-06-16 21:46:43 +02:00
Andreas Kling 4684d3fe54 LibJS: Make BlockDeclarationInstantiation take a VM&
There's no need for this to require an AST Interpreter.
2023-06-16 21:46:43 +02:00
Timothy Flynn 9e95c9892c Ladybird+LibWeb+WebContent: Add context menu controls for muting audio 2023-06-16 19:34:42 +02:00
Timothy Flynn b3bbdb1e2c Ladybird: Add a context menu for audio elements 2023-06-16 19:34:42 +02:00
Timothy Flynn 14ca04de25 Ladybird+LibWeb+WebContent: Generalize video context menus for all media
The data we want to send out of the WebContent process is identical for
audio and video elements. Rather than just duplicating all of this for
audio, generalize the names used for this IPC for all media elements.

This also encapsulates that data into a struct. This makes adding new
fields to be sent much easier (such as an upcoming field for muting the
element).
2023-06-16 19:34:42 +02:00
Timothy Flynn e81abbde7b LibWeb: Explicitly set the audio element playback position after seeking
The audio element behaves a bit differently than the video element in
that the audio element drives itself on a timer (as opposed to LibVideo
notifying the video element when a frame is available). So if an audio
element is paused while seeking, we wouldn't receive an updated playback
position until the element is unpaused.

This fixes an issue where you would have to click the play button twice
to re-start an audio track after it reached the end.
2023-06-16 19:34:42 +02:00
Andreas Kling 58478d572f headless-browser: Bump test timeout from 5s to 15s
We're seeing occasional timeouts on the very first test when running
on CI. Let's try giving it more time to see if it goes away. :^)
2023-06-16 17:43:14 +02:00
Andi Gallo 52956d355c LibWeb: Make border-collapse actually inherited
Move it to the inherited section of ComputedValues.
2023-06-16 17:21:15 +02:00
stelar7 5727e276ea LibWeb: Implement CSS exp() 2023-06-16 14:58:47 +01:00
stelar7 6dde49404a LibWeb: Implement CSS log() 2023-06-16 14:58:47 +01:00
stelar7 fa37bb8b76 LibWeb: Implement CSS hypot() 2023-06-16 14:58:47 +01:00
stelar7 0d30fb5a6e LibWeb: Implement CSS sqrt() 2023-06-16 14:58:47 +01:00
stelar7 9aed8ec7f0 LibWeb: Implement CSS pow() 2023-06-16 14:58:47 +01:00
Sam Atkins 8ef25989b6 LibWeb: Parse identifiers last in parse_paint_value()
Previously, using an identifier color like `currentColor` would fail to
parse, since we look at ident tokens (and reject unrecognised ones)
before trying to parse colors.
2023-06-16 15:39:32 +02:00
Andreas Kling a988241f3f LibWeb: Resolve % min-sizes against 0 while under min-content constraint
When resolving a percentage min-width or min-height size against a
containing block currently under a min-content constraint, we should act
as if the containing block has zero size in that axis.
2023-06-16 14:39:03 +02:00
Andi Gallo b69036970b LibWeb: Add layout support for border spacing
When border-collapse is separate, border-spacing affects layout.
Implement most of that functionality.
2023-06-16 13:57:31 +02:00
Andi Gallo 396f1a977c LibWeb: Add CSS support for border-spacing property 2023-06-16 13:57:31 +02:00
Timothy Flynn f662a452c9 LibWeb: Draw a volume scrub bar on media elements to control volume 2023-06-16 13:50:15 +02:00
Timothy Flynn a4cb3b5d4d LibWeb: Draw a speaker on media elements to toggle muting audio 2023-06-16 13:50:15 +02:00
Timothy Flynn 1107cb58c0 LibWeb: Compute some media timeline rects/sizes before painting anything
The idea here is to let us decide ahead of time what components to paint
depending on the size available. We currently paint each component left-
to-right, until we run out of room. This implicitly gives priority to
the left-most components.

We will soon paint volume controls on the right-side of the timeline.
Subjectively, they should have a higher priority than, say, the timeline
scrubbing bar (i.e. it's more important to be able to mute audio than to
seek). By computing these components before painting, we can more easily
allocate sections to the components in priority order, until the area
remaining has been depleted.
2023-06-16 13:50:15 +02:00
Timothy Flynn 55b61724a0 LibWeb: Handle media elements being painted before their duration is set
It can take some time to download / decode a media resource. During this
time, its duration is set to NaN. The media control box would then have
some odd rendering glitches as it tried to treat NaN as an actual time.
Once we do have a duration, we also must ensure the media control box is
updated.
2023-06-16 13:50:15 +02:00
Timothy Flynn 8cb0197eeb LibWeb: Slightly decrease the font size used for media timestamps
The default scaled font is currently quite large on Ladybird. Decrease
it a bit to make more room for other elements.
2023-06-16 13:50:15 +02:00
Timothy Flynn 54e674974e LibWeb: Use the scaled font size when computing media timestamp width
We draw the text for the timestamp using the scaled font, so we must
also compute its width using the scaled font.
2023-06-16 13:50:15 +02:00
Timothy Flynn b9e4dc2cb7 LibWeb: Implement the HTMLMediaElement volume and muted IDL attributes 2023-06-16 13:50:15 +02:00
Timothy Flynn d3b8d88598 LibWeb: Expose volume controls through the platform audio plugin 2023-06-16 13:50:15 +02:00
Andreas Kling d364d99cb8 LibJS/Bytecode: Perform ToNumeric on accumulator before postfix inc/dec
This ensures we get the expected behavior of code like:

    let a = []
    let b = a++

(Where b should be 0, not [], because JavaScript.)
2023-06-16 12:56:39 +02:00
Andreas Kling c9bd324369 LibJS/Bytecode: Set "home object" of functions within object expression
We manage this by having a stack of home objects in Generator, and then
adding an optional home object parameter to the NewFunction instruction.
2023-06-16 12:56:39 +02:00
Xuekun Li a33af174b2 LibGUI: Prevent crashes/hangs when deleting words backwards
When the user hits <Ctrl-Backspace> where the previous content has the
format [Punctuation|Seperator]+ before the cursor, there will be a
size_t index underflow in TextDocument::first_word_break_before,
which returns an invalid word break position with a huge column index
(18446744073709551615, -1 in size_t). The invalid text position later
used for executing RemoveTextCommand will cause a crash.

The while loop condition in TextDocument::first_word_break_before is
not right, the loop will never stop when the target.column() becomes
0 inside.
2023-06-16 08:20:09 +01:00
Andreas Kling 6f39882f11 LibJS/Bytecode: Fix multiple wrong jumps in ForStatement codegen 2023-06-16 08:40:45 +02:00
Andreas Kling 0772a23c65 LibJS/Bytecode: Add "raw" property correctly for tagged template literal
We were adding it to the wrong object before. :^)
2023-06-16 08:40:45 +02:00
Andreas Kling 2ac8a4bbb7 LibJS/Bytecode: Add support for direct eval()
This is implemented as a special mode of the Call opcode that invokes
the PerformEval AO (instead of the Call or Construct AO).
2023-06-16 08:40:45 +02:00
Andreas Kling 8a3e350321 LibJS/Bytecode: Don't choke on MemberExpression with PrivateIdentifier 2023-06-16 08:40:45 +02:00
Andreas Kling d063f35afd LibJS/Bytecode: Leave GlobalDeclarationInstantiation in C++
Don't try to implement this AO in bytecode. Instead, the bytecode
Interpreter class now has a run() API with the same inputs as the AST
interpreter. It sets up the necessary environments etc, including
invoking the GlobalDeclarationInstantiation AO.
2023-06-16 08:40:45 +02:00
Andreas Kling 32d9c8e3ca LibJS: Make GlobalDeclarationInstantiation take a VM&
This doesn't need to take an AST Interpreter&.
2023-06-16 08:40:45 +02:00
Andreas Kling 872d798951 LibJS/Bytecode: Leave FunctionDeclarationInstantantiation in C++
Instead of trying to implement this AO in bytecode, we can just let it
be a C++ thing. Once we implement fast uncaptured locals, we won't even
be calling it super often.
2023-06-16 08:40:45 +02:00
Tim Ledbetter 17fe2c4822 pkill: Add -O option to filter processes by age
This option allows the user to specify a number of seconds. Only
processes older than the given number of seconds are killed.
2023-06-16 07:22:45 +02:00
Tim Ledbetter aa79a4ed9a pkill: Add -o option to kill the oldest matching process only 2023-06-16 07:22:45 +02:00
Tim Ledbetter 519893d31f pkill: Add -n option to kill the newest matching process only 2023-06-16 07:22:45 +02:00
Tim Ledbetter 0621a83cb4 pkill: Allow signal names to be used with the -s option 2023-06-16 07:22:45 +02:00
Tim Ledbetter 0d71db6721 pkill: Initialize display_number_of_matches to false
This ensures the number of matches is not displayed when the `-c`
option is not specified.
2023-06-16 07:22:45 +02:00
Sam Atkins cbf84152df LibWeb: Resolve fill and stroke related CSS properties 2023-06-16 07:03:57 +02:00
Sam Atkins af51095fe2 LibWeb: Stop making ComputedValues::stroke_width() optional
This defaults to 1px and should always have some kind of value.
2023-06-16 07:03:57 +02:00
Sam Atkins 5cdcd135ab LibWeb: Add parsing for CSS <paint> values
This gets rid of a couple of FIXMEs in Properties.json :^)
2023-06-16 07:03:57 +02:00
kamp 23aae7c7f3 LibWeb: Implement the align attribute for divs
As specified in section 15.3.3 of the HTML spec.
2023-06-16 06:55:21 +02:00
kamp 4ac7c41483 LibWeb: Add -libweb-left and -libweb-right text-align values
These ensure that block level elements are also left and right aligned
respectively on top of the regular text alignment, matching
-libweb-center.
2023-06-16 06:55:21 +02:00
Romain Chardiny dc65a2f2b8 unzip: Add option to list files of an archive 2023-06-15 21:01:51 +01:00
stelar7 a9a62ad8c9 LibWeb: Implement CSS atan2() 2023-06-15 16:54:14 +01:00
stelar7 1aa84dfddd LibWeb: Implement CSS atan() 2023-06-15 16:54:14 +01:00
stelar7 784e1cfb72 LibWeb: Implement CSS acos() 2023-06-15 16:54:14 +01:00
stelar7 708b5ef447 LibWeb: Implement CSS asin() 2023-06-15 16:54:14 +01:00
stelar7 64f0349a9e LibWeb: Implement CSS tan() 2023-06-15 16:54:14 +01:00
stelar7 46a5efe388 LibWeb: Implement CSS cos() 2023-06-15 16:54:14 +01:00
stelar7 c73f476915 LibWeb: Implement CSS sin() 2023-06-15 16:54:14 +01:00
stelar7 ba7af82c5c LibWeb: Parse css math constants 2023-06-15 15:40:55 +01:00
Om Prakaash 7c66c5f12d LibJS: Replace a DeprecatedString with String
Refactors Date class to use String instead of DeprecatedString.

Changes use of the Date class in DatePrototype accordingly.
2023-06-15 14:03:51 +01:00
Karol Kosek 65a927d16e Help: Clear statusbar when leaving link 2023-06-15 13:53:22 +01:00
Karol Kosek bd8e16b704 CharacterMap: Override statusbar text on action hover
We have quite a lot of nicely described action status tips here that we
have never shown. Let's change that!
2023-06-15 13:53:22 +01:00
Karol Kosek 92ff12a0d0 LibGUI+Userland: Port StatusBar::set_override_text() to String 2023-06-15 13:53:22 +01:00
Karol Kosek 5234a30731 LibGUI+Userland: Port Action status tips to String 2023-06-15 13:53:22 +01:00
Karol Kosek 4b169cf25f LibGUI+Userland: Use action text as a fallback in Action::status_tip()
Many applications already do this in their code. This change will simply
move the logic to a single function to stop repeating ourselves!
2023-06-15 13:53:22 +01:00
Karol Kosek 2029750519 LibGUI+Userland: Port StatusBar::text() and set_text functions to String 2023-06-15 13:53:22 +01:00
Karol Kosek 2064f544c6 LibGUI: Store Statusbar text as String 2023-06-15 13:53:22 +01:00
stelar7 e1e382152c LibWeb: Implement CSS sign() 2023-06-15 12:26:34 +01:00
stelar7 79fc4c8a82 LibWeb: Implement CSS abs() 2023-06-15 12:26:34 +01:00
Ben Wiederhake 85f822381f LibWeb: Avoid copies while computing ARIA name/description
This also makes the cycle-detection work as intended.
2023-06-15 08:09:16 +02:00
Ben Wiederhake a9b3aaa887 LibJS: Fix redundancy-detection when printing raw values
Note that this does not change cycle-detection.

This is also was an unnecessary copy, since there is an easier, less
memory-intense way to do cycle detection than copying the entire
visited_set all the time.
2023-06-15 08:09:16 +02:00
Ben Wiederhake 72756f09f4 LibIDL: Avoid unnecessary copies of imported paths 2023-06-15 08:09:16 +02:00
Ben Wiederhake fe9e09fa3a LibGUI: Avoid unnecessary copies of MenuItem pointer sets 2023-06-15 08:09:16 +02:00
Ben Wiederhake c4a9afe31a LibLine: Avoid unnecessary copies of style spans 2023-06-15 08:07:17 +02:00
Ben Wiederhake d3a6512643 WindowServer: Properly handle OOM on drag-and-drop metadata copy 2023-06-15 08:07:17 +02:00
Ben Wiederhake efbf6b7e5f LibWeb: Make HashMap copy of inline CSS declarations fallible 2023-06-15 08:07:17 +02:00
Ben Wiederhake 592e6c89a5 LibGUI: Avoid unnecessary copies of clipboard metadata 2023-06-15 08:07:17 +02:00
Ben Wiederhake 342e1c6eab Browser: Avoid unnecessary copies of temporary Storages 2023-06-15 08:07:17 +02:00
MacDue a8b9130ceb LibWeb: Support SVG vertical/horizontal lineto with multiple parameters
This now allows v 1 2 3 or h 1 2 3, which are treated like v 1 v 2 v 3
and h 1 h 2 h 3 respectively. This fixes the freeCodeCamp SVG logo.
2023-06-15 00:10:53 +02:00
Andreas Kling 3a11b55286 LibWeb: Treat % max-width as none when containing block size indefinite
This is technically "undefined behavior" per CSS 2.2, but it seems
sensible to mirror the behavior of max-height in the same situation.
It also appears to match how other engines behave.

Fixes #19242
2023-06-14 20:12:02 +02:00
Timothy Flynn ff1606ffaf LibWeb: Implement seeking for audio tracks 2023-06-14 17:54:40 +02:00
Timothy Flynn 0c4b28faf3 LibWeb: Dispatch an addtrack event for newly created audio tracks 2023-06-14 17:54:40 +02:00
Timothy Flynn 6520a9a849 LibWeb: Support TrackEvent instances with an AudioTrack track type 2023-06-14 17:54:40 +02:00
Sam Atkins 11af5119b6 FileManager: Save the DirectoryView's visible columns
Since these are stored as numbers, and "1,2,3,5,6" is a bit meaningless
to anyone who looks at this code, the default set of visible columns is
provided as it was before, by them all being visible except a couple
that are specifically hidden.

The callback is wrapped in a debounce() so that if set_visible_columns
() is called, we'll just save the value once instead of doing so for
each column changed.
2023-06-14 17:53:59 +02:00
Sam Atkins 08edc872aa LibCore+Applications: Put timeout parameter first in debounce()
This matches the parameter order for Core::Timer's factory methods,
stops clang-format freaking out so much, and just seems nicer to
me. :^)
2023-06-14 17:53:59 +02:00
Sam Atkins 4c349165f2 LibGUI: Add a callback when the visible columns of a TableView change 2023-06-14 17:53:59 +02:00
Sam Atkins 8eff3b1910 LibGUI: Add functions to get/set all a TableView's visible columns
Specifically, this is to make it easier to save and restore this state
to a config file. I had hoped to use the column names instead of their
IDs, but some columns have an empty string as their name so we wouldn't
be able to distinguish between those.
2023-06-14 17:53:59 +02:00
Sam Atkins f33824d2e9 LibGUI+Userland: Propagate errors in Model::column_name() 2023-06-14 17:53:59 +02:00
Valtteri Koskivuori 94bcb5bea8 Userland: Propagate errors from file detail providers in file utility
They already return ErrorOr<T>, so we can just use TRY() instead of
manually checking for errors.
2023-06-14 11:18:22 -04:00
Valtteri Koskivuori e56098f734 LibCore+Userland: Remove uses of DeprecatedString in file utility
Mainly replacing DeprecatedString with StringView, since the actual mime
type and description texts are just static strings anyway.
2023-06-14 11:18:22 -04:00