Commit Graph

62295 Commits

Author SHA1 Message Date
Tim Ledbetter
6f5ccaecbd LibWeb: Update current find in page match after performing query
Previously, the `Page::find_in_page_next_match()` needed to be called
twice before the match index would be updated.
2024-06-20 10:59:32 +02:00
Andreas Kling
a91bb72dab LibJS: Don't overwrite cached this value on async/generator reentry
When resuming execution of a suspended function, we must not overwrite
any cached `this` value with something from the ExecutionContext.

This was causing an empty JS::Value to leak into the VM when resuming
an async arrow function, since the "this mode" for such functions is
lexical and thus ExecutionContext will have an empty `this`.

It became a problem due to the bytecode optimization where we allow
ourselves to assume that `this` remains cached after we've executed a
ResolveThisBinding in this (or the first) basic block of the executable.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/138
2024-06-20 10:17:18 +02:00
Timothy Flynn
ad10705615 LibLocale: Move definition of Range structure to dedicated header
We were redefining a Range type in a few formatters. Move it to its own
header to avoid ODR violations (and give it a more descriptive name).
2024-06-19 13:11:38 -04:00
Aliaksandr Kalenik
8a509a8023 LibWeb: Take into account specified winding rule in Skia painter 2024-06-19 16:51:52 +02:00
Aliaksandr Kalenik
0b48c1ea3f Everywhere: Remove AffineCommandExecutorCPU
No need to have it after introduction of Skia painter that supports
transforms.
2024-06-19 17:22:30 +03:00
Aliaksandr Kalenik
de6d99e940 LibWeb: Respect selected painter in SVGDecodedImageData
Now SVGDecodedImageData uses Skia painter, if it's selected.
2024-06-19 16:26:37 +03:00
Aliaksandr Kalenik
6dd124fc87 LibWeb+WebContent+WebWorker: Allow to query painter type from PageClient
Now it's possible to query selected type from SVGPageClient.
2024-06-19 16:26:37 +03:00
Ali Mohammad Pur
8c9d3b30cf LibWeb/CSS: Avoid capturing structured binding in generic lambda
Apple Clang doesn't like this, rather than waiting for their version of
random-clang-commit-to-call-a-release to catch up with llvm trunk, just
work around the issue.

Fixes #186.
2024-06-19 12:46:27 +02:00
Andreas Kling
847243b706 LibWeb: Only inject "User-Agent"/"Accept" headers when they're missing
...otherwise we send out HTTP requests with duplicates of these headers.
2024-06-19 08:09:10 +02:00
Aliaksandr Kalenik
bd16648b71 LibWeb: Support bitmap scaling mode in Skia painter
Co-authored-by: Andreas Kling <kling@serenityos.org>
2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
ef1f54b6b0 LibWeb: Accept value by reference in Skia type conversion helpers 2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
8f721e5b1a LibWeb: Drop gfx_{type} prefix from helpers that convert LibGfx to Skia
Having it was unnecessary verbosity.
2024-06-19 07:52:14 +02:00
Aliaksandr Kalenik
e9658356c4 LibWeb: Skip missing glyphs in Skia painter
Port fbc42e7d42
2024-06-19 07:52:14 +02:00
Zaggy1024
5a6950be8e LibMedia: Make Media::Sample final using Variant for auxiliary data
We don't need to allocate these little things onto the heap, that's
silly.
2024-06-19 07:51:55 +02:00
Zaggy1024
7c10e1a08d LibMedia: Rename LibVideo to LibMedia
This change is in preparation for implementing audio codecs into the
library and using audio as timing for video playback.
2024-06-19 07:51:55 +02:00
Andreas Kling
9bfed9a9ae Ladybird/Qt: Use "Ladybird" as the QSettings organization 2024-06-18 21:48:55 +02:00
Andreas Kling
722a669b22 Ladybird: Load about:blank when opening a new tab
Let's not show the unappealing about:newtab to new users by default.
If it becomes more useful/interesting in the future, we can reconsider.
2024-06-18 21:48:38 +02:00
Timothy Flynn
8d7216f4e0 LibUnicode: Replace IDNA ASCII conversion with ICU 2024-06-18 21:07:56 +02:00
Timothy Flynn
83475c5380 LibUnicode: Replace Unicode string normalization with ICU
In a benchmark, ICU's implementation was over 3x faster than ours.
2024-06-18 21:07:56 +02:00
Timothy Flynn
187349e4db LibLocale: Inline a couple of ICU string conversion methods
This just allows using the ICU header within LibUnicode, without having
to link against LibLocale.

Eventually, I think it will make sense to combine LibUnicode & LibLocale
back into a single library. They were separated to remove the large CLDR
data library from LibUnicode since most users did not need it. But that
is not much of a concern now.
2024-06-18 21:07:56 +02:00
Timothy Flynn
1feef17bf7 LibUnicode: Remove completely unused code point name & block name data
These were used for e.g. the Character Map on Serenity, but are not used
at all for Ladybird.
2024-06-18 21:07:56 +02:00
Timothy Flynn
9c3a775395 LibJS: Update AOs involved in locale resolution to the latest ECMA-402
There have been a number of changes to the locale resolution AOs that
we've fallen behind on. Mostly editorial, but includes one normative
change to canonicalize Unicode extension keywords in the Intl.Locale
constructor.
2024-06-18 21:06:50 +02:00
Timothy Flynn
2c311448c7 LibLocale+LibJS: Make a locale canonicalization API a bit more ergonomic
Instead of taking an out-parameter, return the canonicalization result.
This allows the API to be used where specs want to store the result and
the original values in separate variables.
2024-06-18 21:06:50 +02:00
Aliaksandr Kalenik
d292152e2e LibWeb: Add Skia painting command executor
This change introduces Skia painter available under a flag. It's not
yet match capabilities of Gfx::Painter and is not ready to replace it.

Motivation:
- The current CPU painter is a performance bottleneck on most websites.
  Our own GPU painter implementation is very immature and has received
  relatively little attention.
- There is ongoing effort on building painter that supports affine
  transforms (AffineCommandExecutorCPU) but it is far from being on par
  with the default CPU painter. Skia will allow us to immediately get
  full transformation support for all painting commands.

GPU painting:
I experimented with Ganesh GPU-backend, however profiling revealed that
without sharing viewport texture between WebContent and Browser
processes, it won't bring much performance improvement compared to
CPU-backend. Therefore, I decided to keep this PR focused on
implementing most of painting commands and switch to GPU-backend in
future changes.

Text rendring:
Skia painter uses glyph bitmaps produced by LibGfx. Using Skia for text
rendering will require large refactoring of the font rendering
subsystem. Currently, it's impossible to construct SkFont right before
rendering because Gfx::VectorFont can't be serialized back into sequence
of bytes.

There is a problem with ugly include paths like:
`#include <core/SkBitmap.h>`.
I would prefer to have skia prefix in the path. There was an attempt to
fix that but PR was rejected https://github.com/microsoft/vcpkg/pull/32660

Regressions compared to Gfx::Painter:
- DrawText is not implemented
- PaintTextShadow is not implemented
- PaintRadialGradient and PaintLinearGradient do not support "transition
  hints" and repeat length
- PaintConicGradient is not implemented
- DrawTriangleWave is not implemented
- DrawLine does not account for line style property
- DrawScaledBitmap and DrawScaledImmutableBitmap do not account for
  scaling mode property
2024-06-18 21:05:50 +02:00
Aliaksandr Kalenik
25c4355406 Ladybird+LibWeb+WebContent: Add an option to enable Skia painter 2024-06-18 21:05:50 +02:00
Aliaksandr Kalenik
8a7cd8055f LibWeb: Add save and restore commands in recording painter
This change is a preparation before introducing Skia painter in an
upcoming change. It's needed because Skia does not have an API to
implement ClearClipRect command. It only allows to return previous
clip rect by popping from its internal state stack.

A bit more context: initially we had save and restore commands, but
their frequent use led to many reallocations of vector during painting
commands recording. To resolve this, we switched to SegmentedVector to
store commands list, which allows fast appends. Now, having many save
and restore commands no longer causes noticeable performance issue.
2024-06-18 21:05:50 +02:00
Diego
0e705f431e LibWasm: Check exports for valid ref.func targets 2024-06-18 16:58:33 +02:00
Diego
bd97091cbb LibWasm: Ensure that global.get only accesses imports in const exprs 2024-06-18 16:58:33 +02:00
Diego
596dd5252d AK: Read signed LEB128 integers without 64-bit assumptions
This fixes some errors where too many bytes were allowed to be read for
signed integers of a smaller size (e.g. i32). The new parser doesn't
make 64-bit assumptions and now matches the generality of its unsigned
counterpart.
2024-06-18 16:58:33 +02:00
Diego
20d8ea4db1 LibWasm: Read indices as LEB128 u32s
Every type of index was previously being read as a size_t.
2024-06-18 16:58:33 +02:00
Diego
78c56d80f9 LibWasm: Check data segment offset at correct time during instantiation
The data segment offset should be checked _before_ checking if the
contents of the segment are non-existent.
2024-06-18 16:58:33 +02:00
Diego
c2a0c4f581 LibWasm: Report start function traps during instantiation 2024-06-18 16:58:33 +02:00
Diego
1e19be412f LibWasm: Add missing spec extern and prevent spec extern re-use
Add the missing `print` function to the spectest namespace. Also, spec
externs cannot be re-used because operations that modify "memory", for
example, will carry over into subsequent spec test runs. This can be
remedied in the future by implementing some sort of garbage collector
for allocations in the store.
2024-06-18 16:58:33 +02:00
Luke Warlow
099b77d60f LibWeb: Add motion preference
This adds a motion preference to the browser UI similar to the existing
ones for color scheme and contrast.
Both AppKit UI and Qt UI has this new preference.
The auto value is currently the same as NoPreference, follow-ups can
address wiring that up to the actual preference for the OS.
2024-06-18 10:31:54 -04:00
Diego Iastrubni
0b22aae518 Meta: Fix compilation flags for clang-cl
As part of https://github.com/LadybirdWebBrowser/ladybird/issues/38 -
the first baby step, is to make sure that we do not use compile flags
not supported by clang-cl.
2024-06-18 05:52:44 -06:00
Andrew Kaster
bf3c11229f CMake: Create a set of vcpkg overlay triplets for sanitizers
This changes the Sanitizer configs to build all the vcpkg dependencies
with our specified CFLAGS and CXXFLAGS for ASAN and UBSAN.

Unfortunately, we can't yet enable actually compiling them with
sanitizers enabled, because this causes test failures that need to be
investigated.
2024-06-18 04:47:57 -06:00
Andreas Kling
b88e0eb50a AK: Remove unused Complex.h 2024-06-18 12:00:14 +02:00
Andreas Kling
fe9af7c972 AK: Remove unused StackUnwinder.h 2024-06-18 12:00:14 +02:00
Andreas Kling
949508db89 Meta/Lagom: Remove unused ConfigureComponents tool 2024-06-18 12:00:14 +02:00
Andreas Kling
fe1aec124e AK: Remove unused ArbitrarySizedEnum class 2024-06-18 12:00:14 +02:00
Andreas Kling
d8f2a885f9 AK: Remove unused JsonPath class 2024-06-18 12:00:14 +02:00
Andreas Kling
7f5e960b72 AK: Remove unused UUID class 2024-06-18 12:00:14 +02:00
Andreas Kling
47287d2cf1 AK: Remove kstdio.h and dbgputstr()
We can just write directly to stderr in the one place this was used.
2024-06-18 12:00:14 +02:00
Andreas Kling
6df5785fc4 AK: Remove unused PrintfImplementation.h 2024-06-18 12:00:14 +02:00
Andreas Kling
fa56b6cca0 Meta/Lagom: Remove unused StateMachineGenerator 2024-06-18 12:00:14 +02:00
Luke Warlow
564e546ff0 LibWeb: Prevent select.click() opening the dropdown
No other browser allows opening the select element dropdown with the
select.click() function.
This change stops this happening in Ladybird.
2024-06-18 09:37:07 +02:00
Tim Ledbetter
c14dc77349 WebDriver: Launch Ladybird with --force-new-process
This allows multiple WPT tests to be run in parallel with using the
`--processes` option.
2024-06-18 09:36:41 +02:00
Tim Ledbetter
5ca2f4dfd7 Everywhere: Remove all KERNEL #defines 2024-06-18 09:36:25 +02:00
Timothy Flynn
de99dd2c89 LibJS+LibLocale: Change ListFormat to be created once per Intl object
ListFormat was the first formatter I ported to ICU. This patch makes it
match the style of subsequently ported formatters, where we create the
formatter once per Intl object, rather than once per prototype
invocation.
2024-06-17 18:46:22 -04:00
Timothy Flynn
1c51ac4763 LibJS: Remove unused PartitionPattern AO and related types
And move some headers around that are no longer needed in the AO header.
2024-06-17 18:46:22 -04:00