Commit graph

51272 commits

Author SHA1 Message Date
Jelle Raaijmakers 65a9eb1fdf AK: Simplify Vector::padded_capacity
We don't need to do `max(4, ...)` if the RHS always adds 4.
2023-06-13 13:08:14 +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
Jelle Raaijmakers 5ff80b60cf Meta: Rename BuildIt.sh to BuildGNU.sh
Bring it in line with `Toolchain/BuildClang.sh`.
2023-06-12 16:22:55 -07: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 e27081a8ca Base: Add an SVG fill-rule example page 2023-06-11 19:34:24 +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