Commit graph

60453 commits

Author SHA1 Message Date
Nico Weber
1f7924e14c LibPDF: Convert CFF::parse_charset to Stream
No behavior change.
2024-04-14 10:45:11 +02:00
Nico Weber
4995dfe8f1 LibPDF: Convert CFF::parse_fdselect to Stream
No behavior change.
2024-04-14 10:45:11 +02:00
Nico Weber
16c22885eb LibPDF: Convert CFF::parse_encoding to Stream
No behavior change.
2024-04-14 10:45:11 +02:00
Arthur Grillo
3645b676fb LibWeb: Remove RecordingPainter::paint_frame()
PaintFrame is not primitive painting command, we inherited from OS, that
is hard to replicate in GPU-painter or alternative CPU-painter API. We
should remove it as a part of refactoring towards simplifying recording
painter commands set.

Fixes: 
2024-04-13 20:25:48 -07:00
Nico Weber
3b89a187ac Meta/gn: Port 2024-04-13 19:30:53 -06:00
Aliaksandr Kalenik
91377f3ab9 LibWeb: Fix always hanging Navigable::reload()
See spec issue https://github.com/whatwg/html/issues/9869

Previous attempt on fixing reload had to be reverted because it broke
Soundcloud and GitHub, but this change does not seem to introduce new
crashes.
2024-04-13 09:19:00 -07:00
Andreas Kling
f7e57881ad LibWeb: Don't limit available space during early height for inline-flex
There was no need to set an available height constraint when doing early
height calculation for inline-flex boxes. It created a situation where
the flex containers could wrongly get zero height early, and then
resolve percentages against zero instead of the real intrinsic size.

Fixes 
2024-04-13 14:10:10 +02:00
Aliaksandr Kalenik
69d6abc60f LibWeb: Add test when networking task is interrupted by networking task
It does fetching and uses parseFromString() DOMParser API in the fetch
callback. Following steps end up hanging before reverting
664611bae4:
1. Do fetching initiated by fetch() js call.
2. Invoke fetch callback on networking task source
3. Fetch callback does parseFromString()
4. parseFromString() invokes HTMLParser
5. HTMLLinkElement inserted into new document initiates fetching
6. Fetching callback cannot run because networking source was blocked on
   step 2.
7. HTMLParser::the_end() spins waiting for HTMLLinkElement to unblock
   load event, which will never happen because fetching callback cannot
   proceed.
2024-04-13 12:07:33 +02:00
Aliaksandr Kalenik
9d69563da4 LibWeb: Revert blocking of task by source in EventLoop
This reverts commit 664611bae4.

It seems like the HTML spec has been misinterpreted and this text:
"... Note that in this setup, the processing model still enforces that
the user agent would never process events from any one task source out
of order."

does not mean we can't interrupt execution of task by a task with the
same task source. It just says they should be processed in the order
they were added.

Fixes hanging while navigating from PR list to PR page on GitHub.
2024-04-13 12:07:33 +02:00
Shannon Booth
ccd16c847e LibWeb: Set timestamp for DOM Events 2024-04-12 09:08:46 +02:00
Shannon Booth
51a52a867c LibWeb: Use "current high resolution time" AO where relevant
And updating some spec comments to latest spec where it is not relevant.
2024-04-12 09:08:46 +02:00
Shannon Booth
33bd6cfc2a LibWeb: Implement "current high resolution time" AO 2024-04-12 09:08:46 +02:00
Shannon Booth
144e53a209 LibWeb: Stub out Navigator.maxTouchPoints 2024-04-12 09:08:46 +02:00
Timothy Flynn
3ab5ecb671 Ladybird/AppKit: Implement a simple TaskManager window
Unlike the Inspector window, this is owned by the ApplicationDelegate as
there should be only a single task manager for the entire application.
2024-04-12 09:08:16 +02:00
Andreas Kling
40a914ce1a LibWeb: Use static position for abspos box axes with auto insets
When both insets in a given axis are auto, we should use the static
position for absolutely positioned elements.

By doing this correctly, we exposed a bunch of other small bugs which
had to be fixed to compensate for new test failures. Those fixes are
included here as well:
- Don't apply margins twice.
- Compute the static position containing block chain correctly.

This makes https://brave.com/ look much better. :^)
2024-04-12 09:08:07 +02:00
Aliaksandr Kalenik
ee3dd7977d LibWeb: Add popstate event support
It is going to be useful in writing tests for History API.
2024-04-11 21:25:06 +02:00
Timothy Flynn
0ffc338406 LibWeb: Support dimension attributes on HTMLVideoElement 2024-04-11 18:41:57 +02:00
Timothy Flynn
4b1abcf61d LibWeb: Generalize support for dimension attributes
Rather than each element which supports dimension attributes needing to
implement parsing the attributes and setting the appropriate style, we
can generalize this functionality. This will also make each element more
closely resemble the spec text, as we will be effectively declaring, for
example, "The img element supports dimension attributes" in code.
2024-04-11 18:41:57 +02:00
Timothy Flynn
058dd225dd Meta: Port recent changes to the GN build
f3d3454976
8fa636d8d5
2024-04-11 18:41:57 +02:00
Aliaksandr Kalenik
a73bf1607f LibWeb: Mark initial about:blank as ready to run scripts after creation
This matches how other browsers behave.

Fixes https://github.com/SerenityOS/serenity/issues/23892
2024-04-11 18:41:20 +02:00
Aliaksandr Kalenik
649f70db65 LibWeb+WebContent: Initialise JS console from Document::initialize()
Before this change JS console was initialise from
activate_history_entry() which is too late for about:blank documents
that are ready to run scripts immediately after creation.
2024-04-11 18:41:20 +02:00
Aliaksandr Kalenik
939a8e9393 LibWeb: Reload navigable only if delta=0 in History::go() 2024-04-11 09:40:45 +02:00
Aliaksandr Kalenik
d86ad2fcfa LibWeb: Process all task source while waiting for document population
"apply the history step" initiated by reloading or back/forward
navigation might require doing fetching while populating a document,
so it is not possible to restrict spin_until() to process only
NavigationAndTraversal task source.

"apply the history step" initiated by synchronous navigation keeps
processing only NavigationAndTraversal task source because it will
never have to populate a document. Another reason to keep synchronous
navigation blocking other task sources is that we crash if active SHE
changes in the middle of "apply the history step" initiated by sync
navigation. The new test is added to makes sure we don't regress that.
2024-04-11 09:40:45 +02:00
Aliaksandr Kalenik
600ecdd5f7 LibWeb: Separate spin_until() into multiple steps in apply history step
Now "apply history step" waits for all document population tasks to
complete before doing subsequent steps.
2024-04-11 09:40:45 +02:00
Andrew Kaster
29b12cb449 LibWeb: Add a workaround for excessive memory usage in Page::load_html 2024-04-10 17:17:58 -06:00
Andrew Kaster
4bdd4beb93 Tests/LibWeb: Add a script to create a new test, starting with Text 2024-04-10 17:17:40 -06:00
Tim Ledbetter
8892c25520 Base: Return the correct value for fib(0) in Wasm example
Previously, using `wasm-decompile` to decompile the Wasm bytecode on
the `wasm.html` example page gave this output:

```
export function fib(a:int):int {
  if (a < 2) { return 1 }
  return fib(a - 2) + fib(a - 1);
}
```

With this change the bytecode now decompiles to:

```
export function fib(a:int):int {
  if (a <= 0) { return 0 }
  if (a == 1) { return 1 }
  return fib(a - 2) + fib(a - 1);
}
```

This means that the example page now prints the correct answer of 55 to
the console for `fib(10)`. Previously, `fib(10)` returned 89.

I also used `wasm-opt -Oz`, which removed an unnecessary `return`
instruction, saving 1 byte!
2024-04-11 01:17:20 +02:00
Jelle Raaijmakers
da60529ab8 Ports: Update ScummVM to 2.8.1 2024-04-10 21:12:25 +02:00
Jelle Raaijmakers
2831e68999 LibGL+LibGPU+LibSoftGPU: Implement constant blending color
Available since OpenGL 2.0, calling `glBlendColor` allows you to set a
constant color to be used as a blend factor.
2024-04-10 21:12:25 +02:00
Jelle Raaijmakers
f3d3454976 LibGL: Move blending functions to a separate unit 2024-04-10 21:12:25 +02:00
Aliaksandr Kalenik
8fa636d8d5 LibWeb: Make SessionHistoryTraversalQueue GC-allocated
- Add missing visit of a navigable in SHTQ entry
- Use HeapFunction instead of SafeFunction for entry callback
2024-04-10 17:18:03 +02:00
Nico Weber
f9fa41cadf LibGfx/JPEG2000: Use streams instead of manual offsets
No behavior change for valid images. More cryptic errors for invalid
images, but on the flipside quite a bit less code.
2024-04-10 10:51:04 -04:00
Nico Weber
2c9c996130 LibGfx/JPEG2000: Fix off-by-one in reading comment data 😬
For text, we always ended up with a leading \0 byte (on little-endian),
which prints as nothing. Since that's the only thing we do with this
data, no actual behavior change.
2024-04-10 10:51:04 -04:00
Nico Weber
b2d7c405cd LibGfx/JPEG2000: Remove needless "AK::" qualifiers 2024-04-10 10:51:04 -04:00
Timothy Flynn
12b3332d3c WebContent: Use outerHTML to copy a DOM node's HTML in the Inspector
We can use outerHTML now instead of cloning the node into a temporary
container and invoking the container's innerHTML.
2024-04-10 07:46:42 +02:00
Timothy Flynn
b5ebbe6159 Meta: Port recent changes to the GN build
676fc5e8c6
b873e5bc1d
2024-04-10 07:46:42 +02:00
Aliaksandr Kalenik
664611bae4 LibWeb: Forbid interleaving execution of HTML tasks with same source
From HTML spec https://html.spec.whatwg.org/#definitions-3
"... Note that in this setup, the processing model still enforces that
the user agent would never process events from any one task source out
of order."

I can't come up with an example that is fixed by this change. However,
debugging a bug caused by violating this assumption from the spec is
likely to be very painful.
2024-04-10 07:36:42 +02:00
Aliaksandr Kalenik
ba633882bf LibWeb: Change load_html_document to run parsing from deferred_invoke()
...callback, otherwise Networking task source will be blocked until the
end of HTML parsing.

This is a preparation before forbidding to interleave HTML tasks with
the same source.
2024-04-10 07:36:42 +02:00
Andrew Kaster
2bd767909c LibWebView: Add process statistics calculations for macOS 2024-04-09 16:43:27 -06:00
Andrew Kaster
3b5ac433ef Ladybird: Use MachPortServer to get WebContent Mach ports on macOS 2024-04-09 16:43:27 -06:00
Andrew Kaster
8c5e64e686 Ladybird+LibWebView: Add mechanism to get Mach task port for helpers
On macOS, it's not trivial to get a Mach task port for your children.
This implementation registers the chrome process as a well-known
service with launchd based on its pid, and lets each child process
send over a reference to its mach_task_self() back to the chrome.

We'll need this Mach task port right to get process statistics.
2024-04-09 16:43:27 -06:00
Andrew Kaster
77f18cf062 LibCore: Add a rough abstraction class around Mach port rights 2024-04-09 16:43:27 -06:00
Andrew Kaster
4a9546a7c8 AK: Add platform macro for Mach-based operating system environments 2024-04-09 16:43:27 -06:00
Andreas Kling
870a954e11 LibWeb: Implement Element.outerHTML
This piggybacks on the same fragment serialization code that innerHTML
uses, but instead of constructing an imaginary parent element like the
spec asks us to, we just add a separate serialization mode that includes
the context element in the serialized markup.

This makes the image carousel on https://utah.edu/ show up :^)
2024-04-09 18:17:14 -04:00
Andreas Kling
0412e17bac LibWeb: Factor out attribute serialization into a separate function 2024-04-09 18:17:14 -04:00
Andrew Kaster
eefd5edc84 LibWebView: Respect dark mode/light mode TaskManager windows
Suggested-By: Timothy Flynn <trflynn89@pm.me>
2024-04-09 16:15:29 -04:00
Nico Weber
f91d8472ee LibGfx/JPEG2000: Make unimplemented markers in tile-part header fatal 2024-04-09 15:52:00 -04:00
Nico Weber
dbe179f0d5 LibGfx/JPEG2000: Decode tile-part QCD and QCC marker segment data 2024-04-09 15:52:00 -04:00
Nico Weber
8ba7c23165 LibGfx/JPEG2000: Decode QCC marker segment data
I haven't seen any images that set this in the main header, but
Tests/LibGfx/test-inputs/jpeg2000/buggie-gray.jpf sets it in a tile-part
header.
2024-04-09 15:52:00 -04:00
Nico Weber
072457edd8 LibGfx/JPEG2000: Decode tile-part COM marker segment data
We don't do anything with this (except log the contents if
JPEG2000_DEBUG is 1).
2024-04-09 15:52:00 -04:00