Commit Graph

27956 Commits

Author SHA1 Message Date
Karol Kosek
51fefb57fc LibCore: Check if a promise is already resolved in Promise::map() 2023-08-31 11:10:09 +02:00
Shannon Booth
50d8ef94ba AK: Port percent_encode_after_encoding to String 2023-08-31 11:02:18 +02:00
Andrew Kaster
da060eedb1 LibWeb: Create IdentifierStyleValue for fit-content size declarations
This doesn't quite resolve the FIXME, because we still don't support the
fit-content(percentage) syntax.
2023-08-31 10:57:44 +02:00
Ali Mohammad Pur
33a3f0e134 Shell: Implement close redirections in POSIX mode
Fixes #20631.
2023-08-31 11:02:57 +03:30
Andi Gallo
23fc1f988f LibWeb: Use reference instead of pointer for table cell paintable boxes 2023-08-31 07:21:20 +01:00
Zaggy1024
8852561967 LibWeb: Make use of fractions in solve_replaced_size_constraint() 2023-08-30 20:36:27 +02:00
MacDue
2876e2f58e LibWeb: Fix border-radius corner overlap algorithm for zero-width boxes
Previously, the corner overlap algorithm implementation did not shrink
the border radii for zero width/height boxes, which resulted in
incorrect painting.

With this the implementation is updated to more closely follow the spec
steps, which naturally handles the zero width/height case. This makes
use of the `CSSPixelFraction` class for lossless comparison and
multiplication of the scaling factor for the radii.

Co-authored-by: Zaggy1024 <Zaggy1024@gmail.com>
2023-08-30 20:36:27 +02:00
Zaggy1024
8cd1f65507 LibWeb: Add a CSSPixelFraction class to allow comparison of fractions
This class will allow us to compare the ratio of two `CSSPixels` values
losslessly.

Not only that, but an operation like `a * (b / c)` should no longer
be lossy, since the operation can be carried out as `(a * b) / c`
implicitly instead.
2023-08-30 20:36:27 +02:00
Aliaksandr Kalenik
0fb571c1c2 LibWeb: Add Length::resolved() overload for CSSPixels
Since we always pass the px value as an argument to resolved(), we can
pass it directly as CSSPixels instead of wrapping it in Length. This
approach allows us to avoid converting to a double, resulting in fewer
precision issues.
2023-08-30 20:09:15 +02:00
Timothy Flynn
5eb0f65cc0 LibWebView: Do not block the console for the initial message request
If we set m_waiting_for_messages to true for the intial message request,
we might never receive a response, and block the console from requesting
any more messages indefinitely. Instead, issue a non-blocking initial
request, which is how the Qt and Serenity chromes behaved before the
ConsoleClient abstraction.

This also changes ConsoleClient::clear() to use run_javascript() rather
than js_console_input(), as that is also how the chromes used to behave.
2023-08-30 07:29:48 -04:00
Andi Gallo
ece122353b LibWeb: Simplify table_containing_cell signature and implementation
Reflect expectations of its only call site.
2023-08-30 13:05:47 +02:00
Bastiaan van der Plaat
258a6cb126 FileManager: Use new window remember state 2023-08-30 06:49:51 -04:00
Bastiaan van der Plaat
613557a535 LibGUI: Add window remember state that loads and saves from config 2023-08-30 06:49:51 -04:00
circl
e0e67a2b27 LibWeb: Partially implement MouseEvent.movementX/movementY
Currently doesn't handle the mouse leaving and entering the window per
the spec, and uses clientX/Y instead of screenX/Y. See FIXMEs.
2023-08-30 10:21:30 +02:00
Timothy Flynn
bf59e06d2a Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be
common to the JS consoles of all Ladybird chromes. This will let each
chrome focus on just the UI.

Note that this includes the `console.group` functionality that only the
Serenity chrome previously had. This was a FIXME in the Qt chrome, and
it is implemented such that all chromes will receive this functionality
for free.
2023-08-30 09:24:59 +02:00
Timothy Flynn
b9b2274078 Browser: Prevent moving a Database callback while it is executing
All SQL callbacks here were already moving the to-be-executed callback
out of its storage before executing it, except for on_next_result().
This makes on_next_result() do the same move to ensure we do not later
attempt to move it while the callback is executing.
2023-08-30 09:19:28 +02:00
Andi Gallo
fab4d543f6 LibWeb: Set line height for table boxes generated during fixup 2023-08-30 07:57:56 +02:00
Luke Wilde
b3fa79e64d LibJS: Cover all property kinds when stringifying Put bytecode ops 2023-08-29 21:38:54 -04:00
Luke Wilde
2aaae6fc70 LibJS: Avoid ToPropertyKey for spreading in PutByValue(WithThis)
This is not we're supposed to do according to https://tc39.es/ecma262/#sec-runtime-semantics-propertydefinitionevaluation
Furthermore, this was observable by ToPrimitive looking up toString and
valueOf and potentially calling them if they exist. The big ticket
issue however is that for objects without toString and valueOf, such as
null-proto objects, this would unexpectedly throw.
2023-08-29 21:38:54 -04:00
Luke Wilde
3ceedbd16a LibJS: Allow assignment expression in spreading property definition
See: https://tc39.es/ecma262/#sec-runtime-semantics-propertydefinitionevaluation
PropertyDefinition : ... AssignmentExpression
Also add a test for this in array spreading, which already had this in
place.
2023-08-29 18:46:01 -04:00
Zaggy1024
766cd852d3 LibWeb: Move the unique task source start to be last in Task::Source
This also adds some big text to draw attention to the fact that this
enum value must remain last.
2023-08-29 14:50:21 -04:00
Karol Kosek
40d732a73c PDFViewer: Accept file drops 2023-08-29 14:12:38 -04:00
Tim Ledbetter
fa0606ea36 find: Explicitly specify type when converting to uid_t
This reduces the risk of unintentional conversion errors.
2023-08-29 14:09:44 -04:00
Tim Ledbetter
bc50b629ee find: Don't allow negative GIDs to be passed to the -group option 2023-08-29 14:09:44 -04:00
Andreas Kling
6d7a2f5cc9 LibWeb: Prune old paintable pointers from layout tree after relayout
When text paintables shift around in the tree due to line wrapping,
we may end up in a situation where some text node does not generate
a paintable (due to being all whitespace, for example), even though
in the previous layout pass, it *did* generate a paintable.

To prevent holding on to old paintables in such cases, we now do a
pass in LayoutState::commit() where we explicitly detach all old
paintables from the layout tree.
2023-08-29 17:05:16 +02:00
Timothy Flynn
9c4ce1b80b Ladybird: Do not enable the reload button if history is empty
Not much of an issue currently, but will be once tabs are used to render
plain HTML.
2023-08-29 08:11:11 -04:00
Timothy Flynn
1e1c3e5a34 LibWebView: Create a method to syntax-highlight page source with HTML
This tokenizes a page's source to produce HTML with syntax highlighting.
The first implementation here is rather simple; we do not yet implement
code folding, line numbers, etc.

The goal is for this to be used as the View Source implementation for
all Ladybird chromes.
2023-08-29 08:11:11 -04:00
Timothy Flynn
fea440055a LibWeb: Track the byte offset of an HTMLToken's position
We currently track the [line, column] position of every HTMLToken, as
this is what is needed for LibGUI's syntax highlighting. Some non-LibGUI
purposes (e.g. highlighting HTML with HTML) require a byte offset. Track
both during tokenization.
2023-08-29 08:11:11 -04:00
Ali Mohammad Pur
ba4db899d4 LibSyntax+Userland: Make LibSyntax not depend on LibGUI
This moves some stuff around to make LibGUI depend on LibSyntax instead
of the other way around, as not every application that wishes to do
syntax highlighting is necessarily a LibGUI (or even a GUI) application.
2023-08-29 07:57:39 -04:00
Aliaksandr Kalenik
2495302991 LibWeb: Reset auto_placement_cursor_x after adding new column in GFC
We need to start looking from the beginning of current row if adding
new implicit column track made enough space to accomodate spanning item

This fixes placement for spanning grid items when `grid-auto-flow` is
specified to `column`.
2023-08-29 12:35:21 +02:00
Zaggy1024
ac6c06e235 LibAudio: Don't count buffered samples in Loader::loaded_samples()
The `Loader` uses a `Vector<Sample>` to store any samples that the
actual audio decoder returned that the loader client did not request
yet. However, it did not take that buffer into account when those
clients asked for the number of samples loaded. The buffer is an
internal implementation detail, and should not be reflected on the
external API.

This allows LibWeb to keep better track of audio position without any
desync caused by the buffer. When using the Serenity `PlaybackStream`
implementation as the back end for an `HTMLAudioElement`, this allows
us to perfectly stop on the exact last sample of the audio file, so it
will not stop before the media element can see that it has finished
playback.

Note that `Loader::get_more_samples()` also calls `loaded_samples()` to
determine how many samples are remaining to load into the output
buffer. However, this change appears to be correct even there, given
that the samples copied from the internal sample buffer are included in
that count.
2023-08-29 11:31:10 +02:00
Zaggy1024
9d65965060 WebContent: Replace the Serenity audio plugin with the agnostic one
The behavior of the Serenity `PlaybackStream` implementation should
match the `AudioCodecPluginSerenity` class removed by this commit. Any
inconsistencies should be fixable without needing feature additions to
the underlying implementation.
2023-08-29 11:31:10 +02:00
Zaggy1024
88190202cc LibWeb: Update the audio timestamp every 50 ms instead of every 10 ms
The previous update time of 10 ms was set completely arbitrarily, but
puts an unnecessary load on the CPU. This reduces the rate, and it can
be adjusted in future depending on what web pages expect.
2023-08-29 11:31:10 +02:00
Zaggy1024
bb156f8133 LibAudio: Add a Serenity implementation of PlaybackStream
This implementation is very naive compared to the PulseAudio one.

Instead of using a callback implemented by the audio server connection
to push audio to the buffer, we have to poll on a timer to check when
we need to push the audio buffers. Implementing cross-process condition
variables into the audio queue class could allow us to avoid polling,
which may prove beneficial to CPU usage.

Audio timestamps will be accurate to the number of samples available,
but will count in increments of about 100ms and run ahead of the actual
audio being pushed to the device by the server.

Buffer underruns are completely ignored for now as well, since the
`AudioServer` has no way to know how many samples are actually written
in a single audio buffer.
2023-08-29 11:31:10 +02:00
Marcus Nilsson
a2f0804f22 LibC: Move parsing of service file line to static helper function
This patch adds `parse_service_file_line()` which both `getservent()`
and `getaddrinfo()` makes use of.
2023-08-29 11:04:48 +02:00
Marcus Nilsson
2b430e1f56 LibC: Remove dependency of getservbyname() in getaddrinfo() 2023-08-29 11:04:48 +02:00
Marcus Nilsson
37cea81837 LibC: Use gethostbyname_r() in getaddrinfo()
getaddrinfo() used to use gethostbyname() which isn't MT-Safe.
2023-08-29 11:04:48 +02:00
Marcus Nilsson
fd792f93c4 LibC: Use gethostbyname_r() in gethostbyname()
Since `gethostbyname()` can't fail because of memory-related issues, it
has no way of representing a memory-related failure. We therefor use
`NO_RECOVERY` to represent a memory-related failure as well
as its normal name server related failures.
2023-08-29 11:04:48 +02:00
Marcus Nilsson
1a7e262752 LibC: Implement gethostbyname_r()
gethostbyname_r() will be used to make getaddrinfo() MT-Safe.
2023-08-29 11:04:48 +02:00
kleines Filmröllchen
bf3fa19314 LibAudio: Write FLAC metadata
This includes a generalization of the metadata block infrastructure, so
adding and writing blocks is handled in a generalized fashion.
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
fc2301c23c LibAudio: Allow writing Vorbis comments
The vorbis comment parsing code is slightly generalized to reuse
field-role associations for artists.
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
c853a73ae2 aconv: Override encoder in output metadata
After all, we encoded this file :^)
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
34978b364b LibAudio: Understand album (IPRD) metadata in WAV
This is in common usage, just not present in the reference I looked at.
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
4c9c2104f3 aconv: Copy metadata to output
This requires postponing FLAC header finalization, since FLAC cannot
write metadata after a finalized header.
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
1e291753b0 LibAudio: Allow adding metadata to encoders 2023-08-29 10:43:34 +02:00
kleines Filmröllchen
b4b411b8a3 LibAudio: Add a sample count hinting mechanism to audio encoding 2023-08-29 10:43:34 +02:00
kleines Filmröllchen
0960a92670 LibAudio: Add more common classes to the forward declare header 2023-08-29 10:43:34 +02:00
Andreas Kling
9d6f00d918 LibJS: Behave like major engines when substituting missing capture group
When a substitution refers to a 2-digit capture group that doesn't exist
we need to check if the first digit refers to an existing capture group.
In other words, '$10' should be treated as capture group #1, followed by
the literal '0' if 1 is a valid capture group but 10 is not.

This makes the Dromaeo "dom-query" subtest run to completion.
2023-08-29 10:33:48 +02:00
Cubic Love
91269a8064 Chess: Capitalize chess set names + Rename 'stelar7' to 'Classic'
Now when selecting a chess set in Games Settings, the names of the sets
are capitalized which looks much neater.

The default set 'stelar7' has been renamed to 'Classic' to reflect its
default vanilla design, as opposed to more stylized sets.
This commit also updates any code references to this set.
2023-08-29 10:28:24 +02:00
Shannon Booth
f3e5335096 LibWeb: Port CSSKeyframeRules interface from DeprecatedString to String 2023-08-29 10:05:02 +02:00