Commit graph

45538 commits

Author SHA1 Message Date
kleines Filmröllchen
2475f6a641 LibCore: Explain EventLoop and reorder some members in the header
This hopefully makes EventLoop easier to understand.
2023-01-11 11:49:05 +01:00
Sam Atkins
ae6a84c261 LibGUI: Lex INI files as Utf8
Iterating byte by byte meant that the column positions assigned to INI
tokens would be off if there were any multi-byte codepoints. Using a
Utf8View means these positions refer to whole codepoints instead, and
the column positions match what GUI::TextEditor expects. :^)

Fixes #12706.
2023-01-11 10:24:51 +01:00
Matthew Olsson
95df712c2e HackStudio: Hide autocomplete popup when switching tabs 2023-01-11 09:15:10 +00:00
Karol Kosek
d4367f42ba PDFViewer: Port to Core::Stream::File 2023-01-10 22:15:23 +00:00
Andreas Kling
7826cb2556 LibJS: Use a work queue instead of the C++ stack for the GC mark phase
This fixes an issue where we'd run out of C++ stack while traversing
large GC heap graphs.
2023-01-10 15:30:07 -05:00
Andreas Kling
5dcc58d54a Kernel+LibCore: Make %sid path parsing not take ages
Before this patch, Core::SessionManagement::parse_path_with_sid() would
figure out the root session ID by sifting through /sys/kernel/processes.

That file can take quite a while to generate (sometimes up to 40ms on my
machine, which is a problem on its own!) and with no caching, many of
our programs were effectively doing this multiple times on startup when
unveiling something in /tmp/session/%sid/

While we should find ways to make generating /sys/kernel/processes fast
again, this patch addresses the specific problem by introducing a new
syscall: sys$get_root_session_id(). This extracts the root session ID
by looking directly at the process table and takes <1ms instead of 40ms.

This cuts WebContent process startup time by ~100ms on my machine. :^)
2023-01-10 19:32:31 +01:00
Timothy Flynn
491edaffc7 LibWeb: Ensure legacy constructors are defined on the global object
This regressed in 6e93d89ee3.
2023-01-10 17:55:23 +00:00
Arda Cinar
4d335f3819 LibWeb: Remove all whitespace from input in decode_forgiving_base64
Instead of only stripping it from the ends, since that's actually what
the spec says.
2023-01-10 17:54:01 +00:00
Arda Cinar
283187afc5 AK+LibWeb: Move decode forgiving base64 under Web::Infra namespace
Since the forgiving base64 is part of the web infra standard
2023-01-10 17:54:01 +00:00
Arda Cinar
4ab2954210 AK: Expose Base64 tables from Base64.h
This change is necessary to move the forgiving base64 decoder to LibWeb
2023-01-10 17:54:01 +00:00
Timothy Flynn
6e93d89ee3 LibWeb: Generate exposed Window/Worker interfaces as lazy objects
We now lazily create these instances on-demand rather than all at once
when a Window/Worker object is created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
3deb8e322f LibWeb: Remove Intrinsics::cached_web_prototype
It's now unused, and won't be safe to use once Web constructors and
prototypes are lazily created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
c2939d58c7 LibWeb: Convert uses of cached_web_prototype to ensure_web_prototype
Once the construction of these objects is lazy, we cannot assume they
exist.
2023-01-10 16:08:14 +01:00
Timothy Flynn
af75493883 LibWeb: Move passing of Web object prototypes out of constructors 2023-01-10 16:08:14 +01:00
Timothy Flynn
834202aeb9 LibWeb: Move setting of Web object prototypes to initialize()
This needs to happen before prototype/constructor intitialization can be
made lazy. Otherwise, GC could run during the C++ constructor and try to
collect the object currently being created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
7bd8fd000f LibWeb: Generate dedicated methods to create Web constructors/prototypes
Currently, for each exposed interface, we generate one massive function
to create every Web constructor and prototype. In an effort to lazily
create these instead, this first step is to extract the creation of each
of these into its own method.

First, this generates a forwarding header for all IDL types. This is to
allow callers to remain unchanged without forcing them to include the
(very heavy) generated IDL headers. This header is included by LibWeb's
forwarding header.

Next, this defines a base template method on Web::Bindings::Intrinsics
to create a prototype/constructor pair. Specializations of this template
are now generated in a new .cpp file, IntrinsicDefinitions.cpp. The base
Intrinsics class is updated to use this new method, and will continue to
cache the result.

Last, some WebAssembly classes are updated to use this new mechanism.
They were using some ad hoc cache keys that are now in line with the
generated specializations.

That one massive function is still used to invoke these specializations,
so they are not lazy as of this commit.
2023-01-10 16:08:14 +01:00
Timothy Flynn
59104262a4 LibWeb: Use correct arguments in WEB_PLATFORM_OBJECT invocations
The base class should be the second argument, and must be the immediate
base class (not the grandparent).
2023-01-10 16:08:14 +01:00
Timothy Flynn
1d7f44b629 ImageDecoder: Remove unused LibWeb forwarding header
ImageDecoder has no reason to depend on LibWeb.
2023-01-10 16:08:14 +01:00
BodilessSleeper
9a60d3509d LibJS: Update ISODaysInMonth in Calendar.cpp
This commit ticks away a box in #15525
Temporal commit: tc39/proposal-temporal@eee1e27
2023-01-10 10:22:21 +00:00
Tim Schumacher
7e3625b0e2 LibCompress: Move compressor construction out of ZlibCompressor() 2023-01-10 10:28:26 +01:00
Tim Schumacher
f4afee4278 LibCompress: Switch DeflateCompressor to a fallible constructor 2023-01-10 10:28:26 +01:00
Tim Schumacher
8cd2cf2b77 LibCompress: Port DeflateCompressor to Core::Stream 2023-01-10 10:28:26 +01:00
Tim Schumacher
a212bc3052 LibCompress: Port GzipCompressor to Core::Stream 2023-01-10 10:28:26 +01:00
Tim Schumacher
b4b80b7ec6 LibCore: Add {Big,Little}EndianOutputBitStream
Also add some tests that ensure that the input and output streams match
each other, because I can't wrap my head around what the internal
representation looks like.
2023-01-10 10:28:26 +01:00
Tim Schumacher
0bdbe27d6b LibCore: Rename InputBitStream.h to BitStream.h
We won't just be defining readable streams here from now on, but also
writable streams.
2023-01-10 10:28:26 +01:00
MacDue
c8c065b6b0 LibWeb+LibGfx: Migrate (most of) the CSS gradient painting to LibGfx
This moves the CSS gradient painting to the painter creating:

 - Painter::fill_rect_with_linear_gradient()
 - Painter::fill_rect_with_conic_gradient()
 - Painter::fill_rect_with_radial_gradient()

This has a few benefits:
 - The gradients can now easily respect the painter scale
 - The Painter::fill_pixels() escape hatch can be removed
 - We can remove the old fixed color stop gradient code
    - The old functions are  now just a shim
 - Anywhere can now easily use this gradient painting code!

This only leaves the color stop resolution in LibWeb (which is fine).
Just means in LibGfx you have to actually specify color stop positions.

(Also while here add a small optimization to avoid generating
excessively long gradient lines)
2023-01-10 10:25:58 +01:00
MacDue
668204041b AK: Add Span::first()
The missing sibling to Span::last()!
2023-01-10 10:25:58 +01:00
Aliaksandr Kalenik
30b51b06b9 LibWeb: Fix y position calculation for blocks with clearance
This change fixes problem that y position of blocks with
clearance might not include border_top and padding_top
by changing `place_block_level_element_in_normal_flow_vertically`
to accept y position without `border_box_top` and adding it
on the last step when clearance is already taken in account.

Bug reproducer:
```html
<style>
.a {
    border: 10px salmon solid;
    width: 50px;
    height: 50px;
    float: left;
}
.b {
    clear: both;
    border: 20px slateblue solid;
    width: 50px;
    height: 50px;
}
</style>
<div class="a"></div><div class="b"></div><div class="c"></div>
```
2023-01-10 10:24:05 +01:00
Linus Groh
7762c1ac61 LibJS: Verify that objects are only initialized once
We already do this in a couple of other places, we wouldn't ever want to
re-assign already initialized constructor and prototype objects.
2023-01-09 22:14:35 -05:00
Linus Groh
63136615d2 LibJS: Make namespace object initialization lazy as well 2023-01-09 22:14:35 -05:00
Linus Groh
76f89bf50d LibJS: Use intrinsic namespace objects in set_default_global_bindings()
We were accidentally allocating a new instance for each of the namespace
objects. Use the existing ones from the realm's intrinsics instead.
2023-01-09 22:14:35 -05:00
Taj Morton
20991a6a3c Kernel/FileSystem: Fix kernel panic during FS init or mount failure
Resolves issue where a panic would occur if the file system failed to
initialize or mount, due to how the FileSystem was already added to
VFS's list. The newly-created FileSystem destructor would fail as a
result of the object still remaining in the IntrusiveList.
2023-01-09 19:26:01 -07:00
Timothy Flynn
6fcc1c7426 AK+LibUnicode: Provide Unicode-aware String case transformations
Since AK can't refer to LibUnicode directly, the strategy here is that
if you need case transformations, you can link LibUnicode and receive
them. If you try to use either of these methods without linking it, then
you'll of course get a linker error (note we don't do any fallbacks to
e.g. ASCII case transformations). If you don't need these methods, you
don't have to link LibUnicode.
2023-01-09 19:23:46 -07:00
Timothy Flynn
12f6793223 LibUnicode: Move Unicode-aware case transformations to a helper file
These will be needed by AK::String as well, so move them to a helper
file where they can be re-used.
2023-01-09 19:23:46 -07:00
Nico Weber
2949824849 Toolchain: Do not use install -D in BuildIt.sh
`-D` doesn't exist on macOS. Just call `mkdir -p` instead.
2023-01-09 19:23:20 -07:00
Nico Weber
491af34d36 Toolchain: Add macOS definitions of MD5SUM and NPROC in BuildIt.sh 2023-01-09 19:23:20 -07:00
Nico Weber
f2011ad0dd Toolchain: Make BuildCMake.sh work on macOS without brew on PATH 2023-01-09 19:23:20 -07:00
Timothy Flynn
f3db548a3d AK+Everywhere: Rename FlyString to DeprecatedFlyString
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so
let's rename it to A) match the name of DeprecatedString, B) write a new
FlyString class that is tied to String.
2023-01-09 23:00:24 +00:00
Timothy Flynn
2eacc7aec1 AK: Add Utf16View::to_utf8 to convert the view to a UTF-8 AK::String 2023-01-09 23:00:24 +00:00
Timothy Flynn
d0403ec14f AK+Everywhere: Rename Utf16View::to_utf8 to to_deprecated_string
A subsequent commit will add to_utf8 back to create an AK::String.
2023-01-09 23:00:24 +00:00
Julian Offenhäuser
2a70ea3ee7 LibPDF: Propagate errors in PDFFont::create() 2023-01-09 22:54:36 +00:00
Julian Offenhäuser
ac31b1bda3 LibPDF: Make glyphs from standard 14 fonts show up in Type1Font
Previously, we would assume that all standard 14 fonts use a
TrueTypeFont dictionary. Now we render them in Type1Font as well,
given that it doesn't contain a PostScript font program.
2023-01-09 22:54:36 +00:00
Julian Offenhäuser
a37f3390dc LibPDF: Allow numbers to start with whitespace 2023-01-09 22:54:36 +00:00
Karol Kosek
ab57fde8ec LibWebView: Port to Core::Stream 2023-01-09 22:50:53 +00:00
Karol Kosek
e3d9a3426e Ladybird: Port to Core::Stream::File 2023-01-09 22:50:53 +00:00
Timothy Flynn
3d22efccca LibUnicode+LibJS: Propagate OOM from Unicode normalization 2023-01-09 22:48:15 +00:00
Timothy Flynn
1ff29afc45 LibUnicode+LibJS+LibWeb: Propagate OOM from Unicode case transformations 2023-01-09 22:48:15 +00:00
Timothy Flynn
48474b0de6 LibJS: Handle OOM errors in String.prototype.replaceAll 2023-01-09 22:48:15 +00:00
Timothy Flynn
57b918807e LibJS: Handle OOM errors in the GetSubstitution AO 2023-01-09 22:48:15 +00:00
Julian Offenhäuser
5b7dfe848d LibGfx: Implement TrimmedTable mappings for Cmaps 2023-01-09 22:38:40 +00:00