Commit graph

26330 commits

Author SHA1 Message Date
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
Andreas Kling 43e1343abf LibWeb: Treat % max-height as none when containing block size indefinite
Fixes #19371
2023-06-14 17:08:15 +02:00
Andreas Kling b6f3369b66 LibWeb: Fix spelling of non_anonymous_containing_block() 2023-06-14 17:08:15 +02:00
Andreas Kling 34591ff3d9 LibWeb: Use a separate class for shared image requests
As it turns out, making everyone piggyback on HTML::ImageRequest had
some major flaws, as HTMLImageElement may decide to abort an ongoing
fetch or wipe out image data, even when someone else is using the same
image request.

To avoid this issue, this patch introduces SharedImageRequest, and then
implements ImageRequest on top of that.

Other clients of the ImageRequest API are moved to SharedImageRequest
as well, and ImageRequest is now only used by HTMLImageElement.

This fixes an issue with image data disappearing and leading to asserts
and/or visually absent images.
2023-06-14 14:23:17 +02:00
Ali Mohammad Pur cdec23a68c LibRegex: Treat \<ORD_CHAR> as unescaped in POSIX BRE/ERE
This is undefined according to the spec, but glibc ignores the backslash
and some applications seem to prefer this behaviour (e.g. sed).
2023-06-14 12:38:10 +02:00
Andi Gallo ce186dca70 LibWeb: Fix the x coordinate of a block after a float
The margin from the containing blocks shouldn't be included in the
amount by which we increment x after a float was places. That coordinate
should be relative to the containing block.

Fixes the comments layout on https://lobste.rs.
2023-06-14 08:30:22 +02:00
Nico Weber 0db8ac7465 image: Add a --move-alpha-to-rgb flag
I didn't put this as a method on Bitmap since it doesn't seem generally
useful.  Easy to move the impl over to Bitmap in the future if we want
to use it elsewhere.
2023-06-14 08:30:06 +02:00
Nico Weber ca35b5d767 image: Add a --strip-alpha flag
It can be used to look at an input image without its alpha channel.
2023-06-14 08:30:06 +02:00
Nico Weber d70ddc8961 LibGfx: Add Bitmap::strip_alpha_channel()
Sets all alpha values to 0xff and sets the bitmap's format to BGRx8888.

Currently only implemented for BGRA8888 and BGRx8888.
2023-06-14 08:30:06 +02:00
Nico Weber 6e0fc5e221 LibGfx: Remove a static on a method in a .h file
Methods defined in header files should generally be `inline`,
not `static`.

`static` means that each translation unit will have its own local copy
of the function when the function isn't inlined and it's up to the
linker's identical code folding to hopefully merge the potentially many
copies in the program. `inline` means that the linker can put the
identical copies in a comdat and merge them by name, without having to
compare contents.

No behavior change.
2023-06-14 08:30:06 +02:00
Ali Mohammad Pur fb262de7cb LibRegex: Make append_alternation() actually skip the common blocks
Previously we started with 'left_skip' set to zero, which made it so
that no blocks were selected to be skipped.
2023-06-14 06:41:17 +02:00
Ali Mohammad Pur b1ca2e5e39 LibRegex: Do not treat repeats followed by fallthroughs as atomic 2023-06-14 06:41:17 +02:00
Shannon Booth bd26d022ac LibWeb: Implement FileAPI::Blob::stream() 2023-06-14 06:27:04 +02:00
Shannon Booth 9f39be6e23 LibWeb: Implement FileAPI::Blob::get_stream()
This is used internally in many Blob algorithms, such as Blob::stream(),
Blob::text() and Blob::array_buffer().
2023-06-14 06:27:04 +02:00
Shannon Booth 94883866f5 LibWeb: Implement Web::Streams::readable_stream_enqueue AO
This AO will be used in the Web::FileAPI::Blob::get_stream()
implementation to enqueue all data in the blob to the stream.

There are still plenty of cases to handle, but this appears to be enough
for the basic case of reading all chunks from a readable stream until it
is done.
2023-06-14 06:27:04 +02:00
Shannon Booth b7b5b5763e LibWeb: Add support to set up stream with byte reading support
This is used by Blobs to set up their stream in their get stream
algorithm.
2023-06-14 06:27:04 +02:00
Shannon Booth 666e413cd2 LibWeb: Add missing forward of Web::Streams::PullIntoDescriptor 2023-06-14 06:27:04 +02:00
Shannon Booth 79fc7d7c7c LibWeb: Add HTML::Task::Source::FileReading 2023-06-14 06:27:04 +02:00
Jelle Raaijmakers 70ca295404 LibSQL+SQLServer: Do not re-open databases
Both `Database` and `Heap` were allowed to be opened twice. Prevent
this, and change SQLServer to only open databases that are not already
opened.

This fixes a Ladybird crash where opening the application twice would
erroneously duplicate free heap block indices.
2023-06-13 16:33:42 -04:00
Jelle Raaijmakers c05e08decb LibSQL: Prevent writing to free heap blocks
Each block index should have been requested before a write happens to
it. If this is not the case, return an error.
2023-06-13 16:33:42 -04:00
Jelle Raaijmakers d3335d6ef8 LibSQL: Standardize some debugging statements in Heap 2023-06-13 16:33:42 -04:00
Andreas Kling 41da9a4231 LibWeb: Resolve auto margins on abspos elements in more cases
Specifically, we now handle cases where all three of `left`, `width`
and `right` are non-`auto`.
2023-06-13 17:47:50 +02:00
Andreas Kling 434df52b91 LibWeb: Make stretch-fit return 0 when the available size is indefinite
The spec says the result of this algorithm is undefined in such cases,
and it appears that other engines yield a zero size.

More importantly, this prevents us from leaking a non-finite value into
the layout tree.
2023-06-13 16:14:45 +02:00
Lucas CHOLLET 521ad55a61 SystemServer: Handle waitpid's status correctly
We used to call `did_exit()` directly with the status returned from
`waitpid` but the function expected an exit code. We now use several
of `wait`-related macros to deduce the correct information.
2023-06-13 06:15:10 +02:00
Valtteri Koskivuori 2c5a062c8f LibWeb: Teach CSS transformed StackingContexts about image-rendering
Previously, all StackingContexts which were scaled using CSS transforms
were hard-coded to use BilinearBlend. This fix maps specified
image-rendering properties to reasonable ScalingModes for painting.
2023-06-13 06:14:17 +02:00
Timothy Flynn ac2238ee70 LibWeb: Begin implementing the HTMLAudioElement for audio playback
This uses LibAudio to attempt to decode resoures downloaded with <audio>
elements, and draws some basic media controls for the element.
2023-06-13 06:14:01 +02:00
Timothy Flynn c89fd6dff0 LibWeb: Implement the AudioTrack and AudioTrackList interfaces
These are used to own and manage the playing of audio data.
2023-06-13 06:14:01 +02:00
Timothy Flynn a34e369252 Ladybird+LibWeb+WebContent: Create a platform plugin for playing audio
This creates (and installs upon WebContent startup) a platform plugin to
play audio data.

On Serenity, we use AudioServer to play audio over IPC. Unfortunately,
AudioServer is currently coupled with Serenity's audio devices, and thus
cannot be used in Ladybird on Lagom. Instead, we use a Qt audio device
to play the audio, which requires the Qt multimedia package.

While we use Qt to play the audio, note that we can still use LibAudio
to decode the audio data and retrieve samples - we simply send Qt the
raw PCM signals.
2023-06-13 06:14:01 +02:00
Timothy Flynn ee48d7514f LibWeb: Extract media element timeline painting to a base class
This moves the painting of the media timeout out of VideoPaintable into
a base MediaPaintable. This is to allow re-using the same timeline logic
and controls for audio elements.
2023-06-13 06:14:01 +02:00
Timothy Flynn 3a4e64bdbd LibAudio: Add a forwarding header 2023-06-13 06:14:01 +02:00
Timothy Flynn 936ec94f81 AK+LibAudio+AudioServer: Silence very noisy debug statements by default
These are spammed quite heavily on the debug console, especially at the
end of audio playback.
2023-06-13 06:14:01 +02:00
MacDue 976d9b32d6 LibGfx: Avoid fill_path() crashes due to rounding errors
It seems for very narrow tall paths it is possible for the dxdy value
to round to a value (that after many repeated additions) overshoots
the desired end x. This caused a (rather rare) crash on this 3D canvas
demo: https://www.kevs3d.co.uk/dev/html5logo/. For now, lets just avoid
a crash here. This does not make any noticeable visual differences on
the demos I tired.
2023-06-13 06:09:28 +02:00
Aliaksandr Kalenik 147c3b3d97 LibWeb+WebContent: Forbid access to underlying type of CSSPixels
Although DistinctNumeric, which is supposed to abstract the underlying
type, was used to represent CSSPixels, we have a whole bunch of places
in the layout code that assume CSSPixels::value() returns a
floating-point type. This assumption makes it difficult to replace the
underlying type in CSSPixels with a non-floating type.

To make it easier to transition CSSPixels to fixed-point math, one step
we can take is to prevent access to the underlying type using value()
and instead use explicit conversions with the to_float(), to_double(),
and to_int() methods.
2023-06-13 06:08:27 +02:00
Aliaksandr Kalenik 5a54c686a7 LibWeb: Transform GridItem from a class to a struct in GFC
GridItem is simple enough to be a struct. No behavior change.
2023-06-13 06:05:26 +02:00
Hendiadyoin1 ca0106ba1d AK: Forbid from_utf8 and from_deprecated_{...} with unintended types
Calling `from_utf8` with a DeprecatedString will hide the fact that we
have a DeprecatedString, while using `from_deprecated_string` with a
StringView will silently and needlessly allocate a DeprecatedString,
so let's forbid that.
2023-06-13 01:49:02 +02:00
Hendiadyoin1 02c4b69f16 cal: Don't pretend ConfigServer returns a StringView 2023-06-13 01:49:02 +02:00
Hendiadyoin1 3d83d70cac Shell: Stop lying about string types 2023-06-13 01:49:02 +02:00
Hendiadyoin1 eeb15fc10b LibWeb: Stop lying about string types 2023-06-13 01:49:02 +02:00
Hendiadyoin1 9300b9a364 LibJS: Don't lie about m_deprecated_string being a StringView 2023-06-13 01:49:02 +02:00
Hendiadyoin1 3d1fd17f8b SQLStudio: Stop lying about string types 2023-06-13 01:49:02 +02:00
Hendiadyoin1 e4f627f299 LibGUI: Stop lying about string types 2023-06-13 01:49:02 +02:00
Hendiadyoin1 a45682dcdc Applications: Stop lying about string types 2023-06-13 01:49:02 +02:00
Andreas Kling 867e04768e LibWeb: Use grid item *outer* size when calculating minimum contribution
Previously we used the border box, which meant that tracks did not grow
to accommodate item margins.
2023-06-12 17:51:08 +02:00
Andreas Kling 741c7aef21 LibWeb: Support more CSS functions in grid track size lists
Instead of hard-coding a check for "calc", we now call out to
parse_dynamic_value() which allows use of other functions like min(),
max(), clamp(), etc.
2023-06-12 17:51:08 +02:00
Andi Gallo 6a7a7e2337 LibWeb: Some row span fixes when combined with nested tables
Add logic to compute {min, max}-height and use min-height when
calculating table height, per specifications.

Fixes some issues with phylogenetic tree visualizations on Wikipedia.
2023-06-12 17:51:00 +02:00
Andi Gallo 75e87c32f2 LibWeb: Fix table width algorithm when available space is a constraint
Handle available space more carefully when computing a table width, in
order to avoid creating a definite infinite width when available space
width is max-content, as it's the case in calculate_max_content_width.
The constraint is thus correctly propagated by the time we cache the
computed value, which was previously rejected by the hash function due
to being definite but infinite instead of max-content.
2023-06-12 17:51:00 +02:00
Andreas Kling b86ca27692 headless-browser: Improve output for failing tests a bit
- Colorize the "Test failed" part when stdout is a TTY
- Add missing newlines in the output
2023-06-12 11:52:58 +02:00
Ali Mohammad Pur 1696411f66 Shell: Reset the custom Shell keybinds before calling Editor::get_line()
Fixes #19301.
2023-06-12 10:44:44 +03:30
Lucas CHOLLET 36153136c4 LibGfx/PNG: Use ByteBuffer instead of Vector<u8> 2023-06-12 06:41:16 +02:00
Lucas CHOLLET 15df0224e1 LibGfx/PNG: Remove an unused field in PNGLoadingContext 2023-06-12 06:41:16 +02:00
Lucas CHOLLET 07b6c2ebfc LibGfx/PNG: Make chunk-related functions fallible 2023-06-12 06:41:16 +02:00
Lucas CHOLLET 96a1a8512f LibGfx/PNG: Use a StringView to compare the chunk type 2023-06-12 06:41:16 +02:00
Andreas Kling dbcf63e85e LibJS: Combine two declarative record traversals in GlobalEnvironment
In GlobalEnvironment::get_binding_value(), we can avoid an extra walk
of the declarative environment record if has_binding() returns a
cacheable environment coordinate.
2023-06-12 06:40:49 +02:00
Andreas Kling 620c495d31 LibJS: Skip lazy intrinsic allocation check for objects without them
Most JS::Objects don't have lazily-allocated intrinsic properties,
so let's avoid doing hash lookups by putting a flag on JS::Object that
tells us whether it's present in s_intrinsics.

Takes CPU time spent in those hash lookups from 1-2.5% to nothing on
various JS heavy pages.
2023-06-12 06:40:49 +02:00
Aliaksandr Kalenik 5925e6f196 LibWeb: Use static factory methods to construct GridTrack in GFC
This allows to be more explicit in layout code about whether a track is
going to be created from definition or be auto-sized or a gap.
2023-06-12 06:33:51 +02:00
Aliaksandr Kalenik 3fba0a944a LibWeb: Expand minmax in grid tracks defined by grid-auto-rows/columns
Use GridTrack::create_from_definition() that takes care of minmax().
2023-06-12 06:33:51 +02:00
Aliaksandr Kalenik 57581735b7 LibWeb: Add GridTrack::create_from_definition() in GFC
Introducing method to construct grid track from definition allows to
reduce duplication in layout code.
2023-06-12 06:33:51 +02:00
Andreas Kling 2ebb3639aa LibWeb: Remove ImageLoader and ImageResource
The old image loading mechanism is no longer used, as everything has
been moved on top of HTML::ImageRequest! :^)
2023-06-11 20:37:12 +02:00
Andreas Kling a553fe055b LibWeb: Piggyback on HTML::ImageRequest in HTMLObjectElement
Like the piggybacking in CSS, this is also totally ad-hoc, since there's
no spec to follow.

The code here is weird and definitely sub-optimal as we do a second load
if it turns out the loaded resource is an image, but given that object
elements are rarely used nowadays, I doubt we'll even notice.

That said, we should of course improve this code as we move forward.
2023-06-11 20:37:12 +02:00
Andreas Kling 680fc3f90a LibWeb: Piggyback on HTML::ImageRequest in CSS ImageStyleValue
This is all ad-hoc since no spec currently exists for this behavior.
Basically, ImageStyleValue now uses ImageRequest for fetching and
decoding of images.

This already leads to visible improvements on many websites.
2023-06-11 20:37:12 +02:00
Andreas Kling f70d3faa0f LibWeb: Move image fetching & decoding into ImageRequest
This forces us to diverge from the spec, but it's for a good cause:
by moving it into ImageRequest, we'll be able to reuse fetching and
decoding logic from CSS and other places.

This patch also makes ImageRequests shareable, currently keyed by
the URL (this part needs improvement!)
2023-06-11 20:37:12 +02:00
MacDue 377ff0ac26 LibWeb: Implement SVG fill-rule attribute
Previously, we did an evenodd fill for everything which while for most
SVGs works, it is not correct default (it should be nonzero), and broke
some SVGs. This fixes a few of the icons on https://shopify.com/.
2023-06-11 19:34:24 +02:00
Andi Gallo ead56e88db LibWeb: Avoid crash for unsupported length unit in SVG elements
Acid3 sets 1em as the y coordinate of one of external SVG fonts, we
don't support that yet. Ignore unsupported unit instead of crashing.
2023-06-11 19:04:30 +02:00
MacDue 30c316a2bf LibWeb+LibGfx: Allow stroking with a paint style and opacity 2023-06-11 16:15:56 +02:00
MacDue eb4a58528e LibWeb+LibGfx: Allow filling with a paint style and opacity 2023-06-11 16:15:56 +02:00
Karol Kosek 8bd68198d6 Userland: Filter out unsupported file types in open dialogs in more apps 2023-06-11 09:40:17 +01:00
Karol Kosek 27011cf55d LibFSAC+Userland: Pass options for FSAC::open_file() using a struct
It was rather inconvenient having to specify all arguments if you wanted
to modify only the last one.
2023-06-11 09:40:17 +01:00
Andreas Kling 5c07aeb78e LibWeb: Update HTML image loading algorithm for recent spec changes
Changes: 8a2375aac2

Note that we don't support the full lazy loading machinery yet, so this
isn't actually hooked up.
2023-06-11 10:32:09 +02:00
Andreas Kling 2e9b12d327 LibWeb: Update HTML image loading algorithm with null checks from spec
The spec has been updated to fix the missing null checks we found:
8f3d1fc6d1
2023-06-11 10:32:09 +02:00
Tim Ledbetter 2b89020b6c SystemMonitor: Make byte counts in ProcessStateWidget human-readable 2023-06-11 09:26:54 +01:00
Tim Ledbetter 8d721dc0f7 Kernel+LibCore+SystemMonitor: Make thread statistics values 64-bit
Thread statistics values which count bytes are now 64-bit. This avoids
overflow when these values go above 4GiB.
2023-06-11 09:26:54 +01:00
Dominika Liberda 75307803a2 LibC: Implement stpcpy
For better code clarity, also reformatted how strcpy increments
pointers.
2023-06-11 08:47:15 +02:00
Andreas Kling 8a43f5a64a LibWeb: Forward media attribute from link element to loaded style sheet
Otherwise, we will treat the loaded style sheet as if it had media="all"
which is not always appropriate.
2023-06-11 06:05:03 +02:00
Andreas Kling 79d2c9f3e8 LibWeb: Don't justify text lines that end in a forced break
These are treated the same as the last line in a block, per CSS-TEXT-3.
2023-06-10 21:46:33 +02:00
Andreas Kling 69c33bd4ca LibGfx/OpenType: Load x-height metrics from OS/2 table if available
Before this change we always returned the font's point size as the
x-height which was basically never correct.

We now get it from the OS/2 table (if one with version >= 2 is available
in the file). Otherwise we fall back to using the ascent of the 'x'
glyph. Most fonts appear to have a sufficiently modern OS/2 table.
2023-06-10 21:46:33 +02:00
Andi Gallo 8090adf268 LibWeb: Add partial implementation of border conflict resolution
Fix handling of border style specified per column as well.
2023-06-10 11:17:21 +02:00
Andi Gallo 6c2712764d LibWeb: Add table-column-group to layout tree dump 2023-06-10 11:17:21 +02:00
Andi Gallo 48706742d8 LibWeb: Fix remove_irrelevant_boxes
It's supposed to remove children of table-column-group which are *not*
table-column, we were doing the opposite.
2023-06-10 11:17:21 +02:00