Commit Graph

21554 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Arda Cinar
c045ae1a96 SpaceAnalyzer: Keep the current path via filenames, not indices
The tree map widget keeps the current path to allow the user to navigate
between directories. This path was being kept as indices into the
children array. The indices might change after the tree is regenerated
and this change is required to keep the user's current place after a
re-analysis
2023-01-09 17:08:17 +00:00
Arda Cinar
ba33267132 SpaceAnalyzer: Add a method to TreeNode to get a child node by name
This will make it easier to get to a tree node given a file path
2023-01-09 17:08:17 +00:00
Arda Cinar
0d67e60559 SpaceAnalyzer: Make sure data fields of TreeNode are encapsulated
Made the member fields of Tree and TreeNode structures private and moved
the functions in main.cpp that accessed the internals of these
structures inside the TreeNode class
2023-01-09 17:08:17 +00:00
Arda Cinar
8ba37872e9 SpaceAnalyzer: Remove an unnecessary level of inheritance
The TreeMapNode and TreeMap structs inside TreeMapWidget.h both had
single implementers, TreeNode and Tree inside main.cpp. The indirection
was removed and the new structures were moved to their own file
2023-01-09 17:08:17 +00:00
Aliaksandr Kalenik
1242bd5ee5 LibWeb: Move clear property from table-root to table-wrapper
CSS 2.2 only mentions that float property need to be moved
but in practice clear property also need to be moved to
produce correct layout.
2023-01-09 15:47:59 +01:00
Aliaksandr Kalenik
77a2b151ea LibWeb: Use table_box() to get root box in TFC
Introduce `table_box()` function that returns table formatting
context root box casted to `TableBox` similar to how it's done
in other formatting contexts like `root()` in BFC and
`flex_container` in FFC. And replace `context_box()` calls
in TFC with calls to `table_box()`.
2023-01-09 15:06:27 +01:00
Aliaksandr Kalenik
f26eed9633 LibWeb: Rename used_width to used_height in TFC row struct
Rename used_width to used_height because it is used
to store row height.
2023-01-09 15:06:27 +01:00
Aliaksandr Kalenik
0e1da540b6 LibWeb: Move cells positioning in separate function in TFC 2023-01-09 15:06:27 +01:00
Aliaksandr Kalenik
ea4937a457 LibWeb: Move rows positioning in separate function in TFC 2023-01-09 15:06:27 +01:00
Aliaksandr Kalenik
7d2a72d748 LibWeb: Move rows heights calculation in separate function in TFC 2023-01-09 15:06:27 +01:00
Andreas Kling
a915fee5f3 LibWeb: Only log HTML parser errors when HTML_PARSER_DEBUG is enabled
At this point, the parser is reliable enough that we don't need to spam
the debug log about minor parsing issues on every websites.
2023-01-09 14:00:26 +01:00
Jelle Raaijmakers
44d679ba7e LibSoftGPU: Remove workaround for i686 depth comparison 2023-01-09 12:55:41 +01:00