Commit graph

45528 commits

Author SHA1 Message Date
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
Julian Offenhäuser
04ee181b21 LibGfx: Implement ByteEncoding mappings for Cmaps 2023-01-09 22:38:40 +00:00
Julian Offenhäuser
0ff9f2b865 LibGfx: Select a valid TTF cmap subtable for the Macintosh platform
While this subtable ID is supposed to be deprecated, it is used heavily
in PDF files.

It supports mapping one or two-byte values, with quite a large list of
encodings to tell you which one to expect.
For our use case, we ignore this encoding ID and just pick the first
subtable with this platform ID. Unsupported encodings will get caught
by Subtable::glyph_id_for_code_point() anyway.
2023-01-09 22:38:40 +00:00
Jelle Raaijmakers
7c2976e006 Ports: Make sed work on macOS
The ports `libvorbis`, `readline` and `timidity` would not install on
macOS as a result of using `sed -i` without an extension provided. GNU
sed is available through Homebrew, but it does not replace `sed` by
default.

Instead, provide a new `sed_in_place` function that calls `sed` with the
right arguments.
2023-01-09 22:36:50 +00:00
Andreas Kling
3110f5b328 Presenter: Rearchitect on top of LibWeb
This patch replaces the bespoke rendering engine in Presenter with a
simple pipeline that turns presentations into single-page HTML files.
The HTML is then loaded into an OutOfProcessWebView.

This achieves a number of things, most importantly:
- Access to all the CSS features supported by LibWeb
- Sandboxed, multi-process rendering

The code could be simplified a lot further, but I wanted to get the new
architecture in place without changing anything about the file format.
2023-01-09 22:34:57 +00:00
Andreas Kling
ed3c2cbdf6 LibWebView: Add OOPWV "content scales to viewport" hint
By setting this hint, you indicate to OOPWV that the content inside will
scale itself to the viewport size. In such situations, it's fine for
OOPWV to reuse a scaled version of an outdated backing store while the
view is being resized.
2023-01-09 22:34:57 +00:00
Andreas Kling
c55739bbc0 LibGfx: Make Rect::align_within() correct for TopCenter and BottomCenter
Also update the LibGfxDemo to actually show off these alignments.
2023-01-09 19:54:26 +01:00
implicitfield
f63ecc2763 VideoPlayer: Port to GML 2023-01-09 17:32:03 +00:00
implicitfield
f0a33b2a8e VideoPlayer: Propagate errors from VideoPlayerWidget::initialize_menubar 2023-01-09 17:32:03 +00:00
implicitfield
a2ca2d8364 LibGUI: Register "jump_to_cursor" as a GML property 2023-01-09 17:32:03 +00:00
Arda Cinar
33ea96912a SpaceAnalyzer: Do not reset the path to '/' after a refresh
Clicking analyze or deleting a file would always cause the tree view in
the widget to reset back to viewing the root. This was changed to stay
in the directory currently being viewed
2023-01-09 17:08:17 +00:00