Commit Graph

62272 Commits

Author SHA1 Message Date
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
Timothy Flynn
638a6c8c00 LibJS: Support non-Gregorian calendars for Intl.DateTimeFormat
This almost worked out of the box, but we need to be sure we pass the
full locale (e.g. en-u-ca-hebrew) and not just the data locale (en) to
ICU.
2024-06-17 21:59:59 +02:00
Timothy Flynn
4598a505b1 LibJS: Differentiate between undefined and null locale keys
We were previously treating undefined and null as the same (an empty
Optional). However, there are edge cases in ECMA-402 where we must treat
them differently. Namely, the hour cycle (hc) keyword. An undefined hc
value has no effect on the resolved locale, whereas a null hc value can
actively override any hc specified in the locale string. For example:

    new Intl.DateTimeFormat("en-u-hc-h11", { hour12: false });

In that object, the hour12 option does not match the u-hc-h11 value. So
the spec dictates we remove the hc value by setting it to null.
2024-06-17 21:59:59 +02:00
Andreas Kling
1039acca8c LibGfx: Remove JPEG2000 image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
a34a5af939 LibGfx: Remove ILBM image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
b6daddb088 LibGfx: Remove JBIG2 image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
b7f8d7aec5 LibGfx: Remove TGA image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
681a2ac14e LibGfx: Remove support for the various "portable" image formats
These formats are not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
7141319a7c LibGfx: Remove DDS image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
4b4254c3d0 LibGfx: Remove QOI image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
2a888ca626 LibGfx: Remove home-grown JPEG codec in favor of libjpeg-turbo 2024-06-17 17:59:54 +02:00
Tim Ledbetter
808784092c UI/Qt: Don't show URL when a new tab is initially focused
The URL is now not shown when a new tab is initially activated until
the location bar loses focus. This allows the user to see the location
bar placeholder text when opening a new tab. It also makes it easier to
paste URLs into the location bar after opening a new tab.
2024-06-17 17:26:55 +02:00
Timothy Flynn
7242fdcf23 Meta: Change the default build type to RelWithDebInfo
By default, we were linking the debug version of all vcpkg dependencies,
which was very noticeable in benchmarks. Let's default to a build type
with reasonable performance.
2024-06-17 09:25:25 -04:00
Luke Warlow
5098ed6b1f LibWeb: Add HTMLSelectElement showPicker()
Adds the showPicker() function for select elements.
This doesn't do the check for "being rendered" which is in the spec.
2024-06-17 07:01:26 -06:00
Tim Ledbetter
b94ec419ac WebDriver: Use --allow-popups option when launching Ladybird
This prevents an "unable to find test window" error on tests that
attempt to open a new window.
2024-06-17 14:16:39 +03:00
Tim Ledbetter
577a7610fb UI/Qt: Add --allow-popups option to disable popup blocking by default 2024-06-17 14:16:39 +03:00
Diego
3225e6fad2 LibWasm: Improve element validation and instantiation 2024-06-17 01:55:42 +02:00
Diego
4c3071c7c2 LibWasm: Implement rest of table instructions 2024-06-17 00:58:31 +02:00
Timothy Flynn
7ecca42898 CI: Restore the code linting job
Unlike in Serenity, let's just run this job once per PR rather than on
every job. This lets us install fewer dependencies on the build-and-test
pipelines.
2024-06-16 15:30:28 -04:00
Timothy Flynn
56e9eb6f68 Meta: Restore a couple debug flags in all_the_debug_macros.cmake
These were errantly removed in 666f7338a0.
2024-06-16 15:30:28 -04:00
Timothy Flynn
06ed0dfcc1 LibWeb: Run clang-format
We mistakenly did not add the clang-format linter to the new repo's CI,
and some unformatted code made its way into the repo.
2024-06-16 15:30:28 -04:00
Andreas Kling
fbc42e7d42 LibGfx: Don't try to paint glyphs that aren't in a font
Fixes https://github.com/LadybirdBrowser/ladybird/issues/88
2024-06-16 13:24:36 +02:00
Andreas Kling
1bde774918 LibGfx: Remove unused cruft 2024-06-16 13:24:36 +02:00
Daniel Bertalan
bf1f631f25 Everywhere: Write dtors for types with incomplete members out-of-line
These are rejected by Clang (19) trunk as a result of
https://github.com/llvm/llvm-project/pull/77753.
2024-06-16 07:19:56 -04:00