Commit graph

62914 commits

Author SHA1 Message Date
Jamie Mansfield
9eede09c3c LibWeb/HTML: Stub HTMLImageElement.{x,y} 2024-07-21 10:50:05 +02:00
Jamie Mansfield
e1317915f4 LibWeb/SVG: Stub missing SVGLength attributes
setraises is no longer used by the spec, so I've removed that FIXME :^)
2024-07-21 10:50:05 +02:00
Jamie Mansfield
6c7089fc9e LibWeb/SVG: SVGSymbolElement includes SVGFitToViewBox 2024-07-21 10:50:05 +02:00
Aliaksandr Kalenik
821416027d LibWeb: Remove unused code in BorderRadiusCornerClipper
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
48bd39c23c LibWeb/Painting: Remove unused apply_filter_list() function
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
1ad35f4677 LibWeb: Remove unused shadow painting functions
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
f3b3b3f5b9 LibWeb: Delete DisplayListPlayerCPU
No longer used after switching to Skia as a default.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
3627329bed Everywhere: Use Skia painter by default
Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
9851176c25 headless-browser: Disable screenshot tests on macOS
LibGfx's output is consistent across different platforms, which allows
us to have one set of expectations for screenshot tests. This
consistency will not hold for Skia, where features like antialiasing and
gradient color interpolation vary slightly depending on the platform. In
upcoming changes, we are going to switch to using Skia as the default
painter, which leaves us with the following options:

- Have per-platform screenshot test expectations.
- Limit screenshot tests to run only on one platform and maintain a
  single set of expectation files.

For now, I have decided to choose the latter option, using Linux as it
seems to be the most popular platform among developers.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik
9ab25c47a4 Tests: Transform some ref tests into screenshot tests
These test work with LibGfx painter but won't longer work after
switching to Skia, because it produces slightly different antialiasing,
rounding in color blending, etc.
2024-07-21 10:36:17 +02:00
sideshowbarker
de66e2551f CI: Make the notes-push workflow not run in forks 2024-07-21 10:34:24 +02:00
sideshowbarker
ce1aa49405 Documentation: Add a bit of history to the FAQ 2024-07-21 07:07:33 +02:00
Andrew Kaster
0384b484bd Ladybird: Set Mach port server namespace to ladybird.org 2024-07-20 23:03:45 +02:00
Andrew Kaster
faa6022ced Ladybird: Switch macOS plist information to use ladybird.org 2024-07-20 23:03:45 +02:00
Andrew Kaster
c6ecf01d7b Meta: Update mailmap with my new ladybird.org email address 2024-07-20 23:03:45 +02:00
mobounya
9c93630d02 LibWeb: Conform HTTP-network-or-cache to specs
Implement step 8.10 in '4.5. HTTP-network-or-cache fetch' from the
fetch specs.
2024-07-20 14:09:51 -06:00
mobounya
9e223f6dae LibWeb: Add fetch group from the fetch spec
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.
2024-07-20 14:09:51 -06:00
mobounya
8d38a1326e LibWeb: Implement fetch record from the fetch spec
Implement fetch record concept from the '2.4. Fetch groups' in
the fetch specs.
2024-07-20 14:09:51 -06:00
Ángel Carias
69da6a0ce4 LibWeb: Implement Text.wholeText
This getter returns the concatenation of the data of the contiguous
Text nodes of `this` (being this plus its siblings) in tree order.
2024-07-20 18:02:51 +01:00
Andreas Kling
7dacd6be89 LibWeb: Use static_cast<HTMLTemplateElement> right after an is<> check
The double verify_cast here was just barely visible in a profile.
2024-07-20 15:35:30 +02:00
Andreas Kling
f9f11dc51d LibWeb: Stop creating transient throwaway JS::Handles in HTML parser
These were being immediately stored in JS::GCPtrs (and dutifully visited
by HTMLParser), so creating temporary handles for them was a complete
waste of time.
2024-07-20 15:35:30 +02:00
Andreas Kling
dba6216caa LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.

None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.

This patch makes the common case faster in two ways:

- We use TextCodec::Decoder::to_utf8() instead of process()
  This way, we do a one-shot fast validation and conversion to UTF-8,
  instead of using the generic code-point-at-a-time callback API.

- We scan for '\r' and '\f' before filtering, and if neither is present,
  we simply use the unfiltered string.

With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.
2024-07-20 15:35:30 +02:00
Andreas Kling
7892ee355d LibWeb: Use StringBuilder::append_code_point() over append(Utf32View)
When appending a single Unicode code point, we don't have to go through
the trouble of creating a Utf32View wrapper over it.
2024-07-20 15:35:30 +02:00
Andreas Kling
1a46d8df5f LibTextCodec: Use String::from_utf8() when decoding UTF-8 to UTF-8
This way, we still perform UTF-8 validation, but don't go through the
slow generic code path that rebuilds the decoded string one code point
at a time.

This was a bottleneck when loading a canned copy of reddit.com, which
ended up being ~120 MiB large.

- Time spent decoding UTF-8 before this change: 1192 ms
- Time spent decoding UTF-8 after this change:  154 ms

That's still a long time, but 7.7x faster is nothing to sneeze at! :^)

Note that if the input fails UTF-8 validation, we still fall back to
the slow path and insert replacement characters per the WHATWG Encoding
spec: https://encoding.spec.whatwg.org/#utf-8-decode
2024-07-20 14:29:37 +02:00
sideshowbarker
1a9dabe5ff LibGfx: Handle UTF-16-encoded OpenType font names
This change makes OpenType::Name::string_for_id handle fonts whose names
are UTF-16-encoded (along with handling UTF-8-encoded names).

Otherwise, without this change, the existing code assumes the names are
UTF-8-encoded, fails gracelessly if they’re not, and crashes.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/75
2024-07-20 12:41:02 +01:00
Andreas Kling
3faff34bf6 LibWeb: Make details and summary elements display:block in the UA style
This is the expected behavior per the HTML spec. Fixes an issue where
styling these elements wouldn't have the expected effect unless you also
set the display property.
2024-07-20 13:09:28 +02:00
Diego Frias
4b9649282e LibWasm: Implement the rest of the SIMD conversions 2024-07-20 11:17:29 +02:00
Diego Frias
21c5084d23 LibWasm: Fix v128.any_true instruction 2024-07-20 11:17:29 +02:00
Diego Frias
616048c67e LibWasm: Implement integer conversion and narrowing SIMD instructions 2024-07-20 11:17:29 +02:00
Diego Frias
146646b597 LibWasm: Implement bitmask and float conversion instructions 2024-07-20 11:17:29 +02:00
Edwin Hoksberg
5f154ba372 LibWeb: Implement Element::check_visibility 2024-07-20 09:14:50 +01:00
sideshowbarker
4a2d5bcf89 CI: Make the notes-push.yml workflow fetch the entire repo history
This change makes the notes-push.yml·workflow fetch the entire history
on each push, rather than just the one HEAD commit it otherwise sees.

Because we push multiple commits from PR merges, git-gloss need access
on each push to an arbitrary number of commits (however many commits
were pushed in a PR that got merged). There’s no easy way from GH
Actions to know how may commits got pushed at the same time. So we
instead fetch the whole history.
2024-07-20 09:30:43 +02:00
Timothy Flynn
e8f4ae487d LibJS: Pre-allocate the resolved rope string's underlying buffer
For performance, rather than slowly incrementing the capacity of the
rope string's buffer, compute an approximate length for that buffer to
be reserved up front.
2024-07-20 06:45:49 +02:00
Timothy Flynn
29879a69a4 AK: Construct Strings from StringBuilder without re-allocating the data
Currently, invoking StringBuilder::to_string will re-allocate the string
data to construct the String. This is wasteful both in terms of memory
and speed.

The goal here is to simply hand the string buffer over to String, and
let String take ownership of that buffer. To do this, StringBuilder must
have the same memory layout as Detail::StringData. This layout is just
the members of the StringData class followed by the string itself.

So when a StringBuilder is created, we reserve sizeof(StringData) bytes
at the front of the buffer. StringData can then construct itself into
the buffer with placement new.

Things to note:
* StringData must now be aware of the actual capacity of its buffer, as
  that can be larger than the string size.
* We must take care not to pass ownership of inlined string buffers, as
  these live on the stack.
2024-07-20 06:45:49 +02:00
Timothy Flynn
77eef8a8f6 AK: Add missing includes to StringData.h
Opening StringData.h in any clangd-enabled editor previously resulted in
a sea of clangd errors.
2024-07-20 06:45:49 +02:00
Timothy Flynn
af220af8bf AK: Remove StringBuilder's UseInlineCapacityOnly feature
This feature is unused in Ladybird and will complicate an upcoming patch
to hand-off StringBuilder's memory to String.
2024-07-20 06:45:49 +02:00
Andreas Kling
33207174a9 LibWeb: Allow splitting surrogate pairs in CharacterData.replaceData()
We're expected to handle this situation gracefully, and certainly not
by falling apart like we were.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling
416c478876 LibWeb: Don't try to set selection with anchor/focus in different roots
If the anchor and focus nodes are not within the same document, we can't
use them for a selection range.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling
4e0edd42b9 LibWeb: Cap HTML dimension values at 17895700 (same as Firefox)
Instead of allowing arbitrarily large values (which could eventually
overflow an i32), let's just cap them at the same limit as Firefox does.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling
093f1dd805 LibWeb: Propagate exceptions from setAttribute() in DOMStringMap setter
We were incorrectly assuming that setAttribute() could never fail here,
even when passed an invalid name.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling
1c00e5688d LibWeb: Fix StringView OOB access when parsing 3-character legacy color
Found by Domato.
2024-07-20 06:41:25 +02:00
sideshowbarker
7360f7fbc6 CI: Fix the permissions syntax for the notes-push.yml workflow 2024-07-20 06:40:02 +02:00
sideshowbarker
980ffd5e19 CI: Give the notes-push.yml workflow write permissions 2024-07-19 21:06:43 +02:00
sideshowbarker
fe3f1c743c CI: Add notes-push.yml, for updating commit Notes on push to master
This change, for each commit pushed/merged to master:

- causes new git Notes with GitHub PR/issue/reviewer/author links to be
  auto-generated for that commit

- pushes the updated refs/notes/commits tree+references back to the repo
2024-07-19 20:15:54 +02:00
Aliaksandr Kalenik
0c1405ad6d LibWeb: Add missing requests to use antialiasing in Skia painter 2024-07-19 15:52:30 +02:00
Aliaksandr Kalenik
0be57df54d LibWeb: Subtract left inset from size_available_for_margins for abspos
Fixes https://github.com/LadybirdBrowser/ladybird/issues/712
2024-07-19 13:29:20 +01:00
Aliaksandr Kalenik
715f033007 Tests+headless-browser: Move screenshot ref-tests into own directory
This change will make it easier to disable screenshot comparison tests
on a specific platform or have per-platform expectations.

Additionally, it's nice to be able to tell if a ref-test uses a
screenshot as an expectation by looking at the test path.
2024-07-19 13:52:00 +02:00
Edwin Hoksberg
0ae048102c LibWeb: Resolve content-visibility fixme in html details element 2024-07-19 09:04:30 +01:00
Edwin Hoksberg
020b20d817 LibWeb: Support content-visibility css 2024-07-19 09:04:30 +01:00
Tim Ledbetter
bd72ff5669 LibWeb: Expose ChildNode methods on the DocumentType IDL interface 2024-07-19 09:22:08 +02:00