Commit graph

48038 commits

Author SHA1 Message Date
Seal Sealy 8ba6cd6ab9 Ports: Add bzip3 port 2023-03-14 21:41:46 +01:00
Timothy Flynn 9c569e8a0f LibWeb: Implement the [PutForwards] IDL extended attribute
For example, consider the attribute:

    interface Element {
        [PutForwards=value] readonly attribute DOMTokenList classList;
    }

When `classList` is set, we should instead set the attribute `value` on
the `classList` attribute of the Element interface.
2023-03-14 16:30:19 -04:00
Mathis Wiehl 3bd1d8bf6c LibWeb: Invalidate styles on font load
It is not sufficient to just invalidate layout when a new font has
loaded, because while it was loading we might have chosen a fallback
font-family value instead.

Invalidate style instead.
2023-03-14 21:07:44 +01:00
Andreas Kling 50f9a86086 LibWeb/Tests: Remove image from a test
The image made the test flaky when running on my machine, so this
doesn't seem safe at the moment. We can just hardcode the dimensions.

Eventually we should make it possible to use external images in tests,
but for now let's not flake up the CI.
2023-03-14 18:49:37 +01:00
Andreas Kling c598c092c2 LibWeb: Actually instantiate ::before/::after pseudo elements when found
Regressed in 3e970540b4.

Thanks to Luke for noticing the issue on YouTube! :^)
2023-03-14 18:47:20 +01:00
Timothy Flynn e6dc3c291e LibWeb: Prevent variadic arguments from reserving heaps of memory
Don't try to reserve capacity for a variadic arguments list unless we
actually have enough arguments to fill it with anything. Otherwise we
may overflow to an extremely large size if, e.g., the argument count
is 0 and the start of the variadic arguments is index 1.
2023-03-14 16:41:35 +00:00
Andreas Kling 3e970540b4 LibWeb: Don't compute full style for ::before/::after unless matched
Before this patch, we would build full computed style for these pseudo
elements, for every DOM element, even if no ::before/::after selector
actually matched.

This was a colossal waste of time, and we can also just not do that.
Instead, just abort pseudo element style resolution early if no relevant
selectors matched. :^)
2023-03-14 16:53:03 +01:00
Andreas Kling a58d84407f WebContent: Coalesce multiple sequential MouseMove events
This can avoid getting into a situation where lots of MouseMove events
are queued up and they all trigger relayout (or something else that
takes a lot of time).

To make sure that we don't get out of sync with the input events queue
on the UI process side, we still send acknowledgements for coalesced
MouseMoves. There's room for improvement here.

My Discord friends list is now pleasantly responsive. :^)
2023-03-14 16:52:44 +01:00
Andreas Kling f8c075f2b1 AK: Add Queue::tail()
We already had head(), so let's also have tail().
2023-03-14 16:52:44 +01:00
Andreas Kling 479e269c8b WebContent: Give paint requests a chance to happen between input events
Before this patch, we had an issue where the WebContent process could
get backed up with tons of pending input events (especially mouse moves)
and have to work through all of those before responding to a paint
request from the UI process.

This could lead to a situation where we went for a very long time
without seeing any visual updates.

The approach I've taken here is pretty simple, we basically make a queue
of all incoming input events on the WebContent process side, and then
process that queue one event at a time, using a zero timer. This is
basic, but it allows paint requests to come in between the input events
and we do now get more frequent visual updates even during heavy
pressure from input events.
2023-03-14 16:52:44 +01:00
Andreas Kling d1065afdd3 LibWeb: Avoid inside layout of flex items during intrinsic sizing
When we're calculating the intrinsic size of a flex container, we don't
*need* to layout the inside of each flex item. That's only necessary if
the flex items will be seen (as is the case for "normal" layout).

This avoids a whole bunch of unnecessary layout work on pages that use
flexbox layout. :^)
2023-03-14 16:52:44 +01:00
networkException 1a958633fa Ladybird: Rely on transparent text color for location highlighting
This patch replaces the usage of QPalette::PlaceholderText with
QPalette::Text with opacity reduced to roughly 50%. This fixes the non
highlighted spans having an extremely low contrast compared to the
background in dark mode.
2023-03-14 14:56:37 +01:00
Mathis Wiehl b96920a9d6 LibWeb: Consider margins of atomic inlines in layout
According to CSS Inline Layout Module Level 3 § 2.2 Step 1. atomic
inlines should be layed out in a line box based on their margin box.

However, up until this patch we were unconditionally considering only
the border box during line box height calculation. This made us
essentially drop all vertical margins for atomic inlines.
2023-03-14 14:45:40 +01:00
Timothy Flynn 0aa4466ce9 LibWeb: Port {set,clear}{Timeout,Interval} to IDL 2023-03-14 09:07:40 -04:00
Timothy Flynn 6c5e79ce3a LibWeb: Begin adding support for Function IDL types in unions
For example, setTimeout/setInterval use a TimerHandler, which is a union
of (DOMString or Function).
2023-03-14 09:07:40 -04:00
Timothy Flynn 50717ce404 LibWeb: Support variadic "any..." parameters in IDL
For example, this is used by setTimeout/setInterval.
2023-03-14 09:07:40 -04:00
Timothy Flynn 2895b7e733 LibWeb: Port the WindowOrWorkerGlobalScopeMixin timer handler to String
This will make porting to IDL a bit cleaner.
2023-03-14 09:07:40 -04:00
Timothy Flynn dd992e7dad LibWeb: Move timer implementations to WindowOrWorkerGlobalScopeMixin
This is where it belongs according to the spec, and where these methods'
IDL will be placed.

This forces us to implement a few steps closer to the spec as well.
2023-03-14 09:07:40 -04:00
Timothy Flynn b579093ad0 LibWeb: Change HTML::Timer to store its owning window as a JS::Object
Rather than being limited to a Window object, it will also need to be
ownable by a WorkerGlobalScope.
2023-03-14 09:07:40 -04:00
Linus Groh ea11a84332 Documentation: Start documenting LibWeb code style & patterns 2023-03-14 11:31:57 +01:00
Timothy Flynn 97536e4684 LibWeb+Ladybird+Userland: Port window.[alert,confirm,prompt] to String
LibGUI and WebDriver (read: JSON) API boundaries use DeprecatedString,
so that is as far as these changes can reach.

The one change which isn't just a DeprecatedString to String replacement
is handling the "null" prompt response. We previously checked for the
null DeprecatedString, whereas we now represent this as an empty
Optional<String>.
2023-03-13 22:05:22 +00:00
Timothy Flynn b4d3fea002 Ladybird: Add a utility to create a QString from an AK::String 2023-03-13 22:05:22 +00:00
Timothy Flynn fc15968418 WebDriver: Fix typo in browser capabilities key parsing 2023-03-13 17:34:00 -04:00
Linus Groh 6d19a9f9da Toolchain: Use '|' as sed delimiter in Build{Clang,It}.sh, not '@'
The latter is problematic as it may be contained in the username (e.g.
email address-like) and thus the $SRC_ROOT path. This would cause an
invalid sed command to be created, breaking both of these scripts.
2023-03-13 20:12:44 +00:00
Andreas Kling d21d1d99bd LibJS: Don't skip CPU registers when gathering conservative roots
We were accidentally skipping over most of the CPU registers by
incrementing the register index by sizeof(FlatPtr) instead of 1.

This fixes a long-standing issue where live objects could still get
garbage-collected if they were only pointed to by an unlucky register.
2023-03-13 20:50:38 +01:00
Timothy Flynn 6070875564 LibAudio: Update stream APIs used when reading audio metadata 2023-03-13 12:46:42 -04:00
kleines Filmröllchen 68447d8f39 SoundPlayer: Display title and artist in the window title if available 2023-03-13 12:35:17 -04:00
kleines Filmröllchen 0563048949 file: Read more metadata from audio files
We can always read the basic format information (sample rate, bit depth,
etc.), but we will also print artist, album, and title if available in
the metadata.
2023-03-13 12:35:17 -04:00
kleines Filmröllchen a8963a270f LibAudio: Detect and read FLAC metadata
FLAC uses the very simple vorbis comment metadata format, which we can
now read most standard and non-standard fields from.
2023-03-13 12:35:17 -04:00
kleines Filmröllchen d8e8ddedf3 LibAudio: Add a generic audio metadata container
This container has several design goals:
- Represent all common and relevant metadata fields of audio files in a
  unified way.
- Allow perfect recreation of any metadata format from the in-memory
  structure. This requires that we allow non-detected fields to reside
  in an "untyped" miscellaneous collection.

Like with pictures, plugins are free to store their metadata into the
m_metadata field whenever they read it. It is recommended that this
happens on loader creation; however failing to read metadata should not
cause an error in the plugin.
2023-03-13 12:35:17 -04:00
kleines Filmröllchen d1dd753a95 LibAudio: Add a formatter for LoaderError 2023-03-13 12:35:17 -04:00
Daniel Bertalan b668000e44 Meta+Documentation: Allow cross-debugging x86_64 Serenity on M1 Macs
While there is no native GDB on Apple Silicon, a cross-debugger that
supports x86-64 does exist.
2023-03-13 17:02:56 +01:00
Daniel Bertalan 59ba94a2d2 Documentation: Add a note about running on Apple Silicon 2023-03-13 17:02:56 +01:00
Tim Schumacher ae51c1821c Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
Tim Schumacher 26516ee160 LibSQL: Always read and write entire heap blocks 2023-03-13 15:16:20 +00:00
Tim Schumacher ba354fa396 LibCore: Use length-checking stream reads and writes for SOCKS5 2023-03-13 15:16:20 +00:00
Tim Schumacher 8032724574 CodeGenerators: Ensure that we always print the entire generated output 2023-03-13 15:16:20 +00:00
Tim Schumacher e007279315 AK: Read and write accumulated BitStream bits directly 2023-03-13 15:16:20 +00:00
Tim Schumacher 424df62b00 LibAudio: Read FLAC MD5 directly into the class member 2023-03-13 15:16:20 +00:00
Tim Schumacher 26ba195cf6 LibArchive: Read Tar archive headers through read_value 2023-03-13 15:16:20 +00:00
Tim Schumacher b623dda765 AK: Remove unneeded overrides for write_until_depleted from BitStream 2023-03-13 15:16:20 +00:00
Tim Schumacher ecd1862859 AK: Rename Stream::write_entire_buffer to Stream::write_until_depleted
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher a3f73e7d85 AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher d5871f5717 AK: Rename Stream::{read,write} to Stream::{read_some,write_some}
Similar to POSIX read, the basic read and write functions of AK::Stream
do not have a lower limit of how much data they read or write (apart
from "none at all").

Rename the functions to "read some [data]" and "write some [data]" (with
"data" being omitted, since everything here is reading and writing data)
to make them sufficiently distinct from the functions that ensure to
use the entire buffer (which should be the go-to function for most
usages).

No functional changes, just a lot of new FIXMEs.
2023-03-13 15:16:20 +00:00
Timothy Flynn 1d5b45f7d9 AK: Compute UTF-8 code point lengths using only leading bytes
We don't need to decode the entire code point to know its length. This
reduces the runtime of decoding a string containing 5 million instances
of U+10FFFF from over 4 seconds to 0.9 seconds.
2023-03-13 15:16:02 +00:00
Lucas CHOLLET 516d2f4892 image: Add an argument to choose to write PPMs in binary or in ASCII 2023-03-13 15:15:41 +00:00
Lucas CHOLLET 13d1721852 image: Support writing to PPM files 2023-03-13 15:15:41 +00:00
Lucas CHOLLET 9c9bd271c8 LibGfx/PortableFormat: Add PortableFormatWriter
Currently, the encoder only output ppm files, but it can easily be
extended to support both PBM and PGM.
2023-03-13 15:15:41 +00:00
Andrew Kaster e32267c902 Documentation: Add query-driver to clangd arguments in NvimConfiguration 2023-03-13 08:00:09 -06:00
Andrew Kaster ad5db213ca Documentation: Update VS Code docs for tone, add query-driver directions 2023-03-13 08:00:09 -06:00