Commit graph

56953 commits

Author SHA1 Message Date
Timothy Flynn
1aedb0ae5a Ladybird/Qt: Replace the QString-from-AK helpers with a single method
There's no need for 2 overloads for String and DeprecatedString, we can
just use a StringView. This also avoids some cases of needlessly
allocating a DeprecatedString from a StringView when calling this
method.
2023-12-04 12:03:48 -07:00
Timothy Flynn
4d5d282e6a Meta: Port recent changes to the GN build
64ffae9c55
2023-12-04 12:03:48 -07:00
Andrew Kaster
08cacea7d5 Documentation: Begin document on execution and navigation in LibWeb 2023-12-04 12:01:25 -07:00
Timothy Flynn
965bd00cf3 LibWebView: Avoid trying to break a schemeless URL into renderable parts 2023-12-04 14:47:09 +00:00
Timothy Flynn
65a9eae142 LibWebView: Draw some knurling on the draggable Inspector separator 2023-12-04 13:58:20 +01:00
dependabot[bot]
f1837eded9 CI: Bump actions/github-script from 6 to 7
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 07:13:30 -05:00
dependabot[bot]
5f4015821e CI: Bump JamesIves/github-pages-deploy-action from 4.4.3 to 4.5.0
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.4.3 to 4.5.0.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.4.3...v4.5.0)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 06:32:42 -05:00
dependabot[bot]
2ff7011b7a CI: Bump actions/setup-java from 3 to 4
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3 to 4.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 06:32:26 -05:00
networkException
b95e7772e7 Documentation: Improve nix related commands
This patch fixes `nix develop` commands not using proper paths, uses
the serenity root directory as an assumption for all commands and
adds variants of nix commands to use a custom entry point, for example
a shell.
2023-12-04 08:03:29 +00:00
networkException
20162874e0 Toolchain: Use nixos-unstable instead of nixpkgs master in flake
This patch updates the flake to track the nixos-unstable branch instead
of master for the nixpkgs flake input.

This ensures that hydra.nixos.org (the NixOS CI) has built all packages,
made them available in the cache.nixos.org binary cache without the risk
of a definitions (evalulation) being broken on master.
2023-12-04 08:03:29 +00:00
Nico Weber
b2a1130556 LibGfx/ICC: Implement conversion between different connection spaces
If one profile uses PCSXYZ and the other PCSLAB as connection space,
we now do the necessary XYZ/LAB conversion.

With this and the previous commits, we can now convert from profiles
that use PCSLAB with mAB, such as stress.jpeg from
https://littlecms.com/blog/2020/09/09/browser-check/ :

    % Build/lagom/icc --name sRGB --reencode-to serenity-sRGB.icc
    % Build/lagom/bin/image -o out.png \
        --convert-to-color-profile serenity-sRGB.icc \
        ~/src/jpegfiles/stress.jpeg
2023-12-04 08:02:36 +00:00
Nico Weber
9f7b33c31f LibGfx/ICC: Extract a lab_from_xyz() function
Pure code move, no behavior change.
2023-12-04 08:02:36 +00:00
Nico Weber
fda9840f48 LibGfx/ICC: Make mAB tags work for profiles that use PCSLAB
ICC profiles work by transforming from the input color space
(one of many: RGB, CMYK, YUV, etc) to a "profile connection space" (PCS)
and then from there to the output color space.

However, there's not one but two possible profile connection spaces,
PCSXYZ and PCSLAB. The matrix/curve tags can only be used with PCSXYZ,
but the mAB, mBA, mft1, mft2 tags can be used with PCSLAB as well.

The PCSLAB encoding has L going from 0 to 100 and ab from -128 to 127,
instead of from 0 to 1. So they need to be scaled up at the end.

That's also the reason for the "mystery conversion factor": PCSXYZ
doesn't go from 0 to 1 either, but from 0 to 65535/32768, per ICC v4
6.3.4.2 General PCS encoding, Table 11 - PCSXYZ X, Y or Z encoding.

Between input and output are various curves (and the CLUT) that
have domain and range of 0..1. For these, the color has to be linearly
scaled to 0..1 before the curve and back to the actual range after
the curve. Doing that back-to-back is a no-op, so scaling back at
the very end is sufficient.
2023-12-04 08:02:36 +00:00
Nico Weber
64ffae9c55 LibGfx/ICC: Move enums to dedicated Enums.{cpp,h}
We will need to use ColorSpace in TagTypes.h, and it can't include
Profile.h.

Also makes Profile.cpp a bit smaller.

No behavior change, pure code move.
2023-12-04 08:02:36 +00:00
Timothy Flynn
6d743ce9e8 LibWebView: Allow editing the DOM through the Inspector WebView
This allows a limited amount of DOM manipulation through the Inspector.
Users may edit node tag names, text content, and attributes. To initiate
an edit, double-click the tag/text/attribute of interest.

To remove an attribute, begin editing the attribute and remove all of
its text. To add an attribute, begin editing an existing attribute and
add the new attribute's text before or after the existing attribute's
text. This isn't going to be the final UX, but works for now just as a
consequence of how attribute changes are implemented. A future patch
will add more explicit add/delete actions.
2023-12-04 01:33:57 +01:00
Timothy Flynn
1236cbd41a LibWeb+LibWebView+WebContent: Add Inspector IPCs to manipulate DOM nodes
This adds the IDL methods and IPC to forward DOM-editing events from the
Inspector WebView to the Inspector client.
2023-12-04 01:33:57 +01:00
Timothy Flynn
4cfeb41c4b LibWebView+WebContent: Add APIs to manipulate DOM nodes
This adds APIs to allow Ispector clients to:
* Change a DOM text or comment node's text data.
* Add, replace, or remove a DOM element's attribute.
* Change a DOM element's tag.
2023-12-04 01:33:57 +01:00
Timothy Flynn
18a4455d43 LibWeb: Do not assume a shadow root has a host
After commit ff48b7333c, we remove shadow
roots from elements that are removed from the DOM. Setting a node's
shadow root to null also sets that shadow root's host to null. Thus, the
comment in Node::is_shadow_including_descendant_of that assumes the host
is always non-null is not true.

The test added here would previously crash when interacting with a node
that is a descendant of a removed shadow root.
2023-12-04 01:33:57 +01:00
Timothy Flynn
fd297a3248 LibWeb: Run the unfocusing steps when a click does not focus anything
For example, when clicking the document body outside of a focused input
element, we should unfocus that element.
2023-12-04 01:33:57 +01:00
Timothy Flynn
48240a6fc3 LibWeb: Focus the document element when unfocusing an element
Otherwise, the currently focused element remains focused.
2023-12-04 01:33:57 +01:00
Timothy Flynn
3c0c300039 LibWeb: Check all entries in the focus chain when unfocusing a node
The way this step was currently implemented, we would bail the unfocus
steps if the node isn't the first entry in the chain.
2023-12-04 01:33:57 +01:00
Timothy Flynn
08ee48606d LibWeb: Fire a change event on input elements in the focus update steps
This ensures the change event is received before the blur event.
2023-12-04 01:33:57 +01:00
Timothy Flynn
301d58e2d9 LibWeb: Fire the change event synchronously when committing changes
The spec does not say to do this asynchronously on a task queue.
2023-12-04 01:33:57 +01:00
Idan Horowitz
b749167506 LibCompress: Fix off-by-one error in generate_huffman_lengths
Previously we would calculate the index of the first parent node as
heap.size() (which is initialized to non_zero_freqs), so in the edge
case in which all symbols had a non-zero frequency, we would use the
Size-index entry in the array for both the first symbol's leaf node,
and the first parent node.

The result would either be a non-optimal huffman code (bad), or an
illegal huffman code that would then go on to crash due to an error
check in CanonicalCode::from_bytes. (worse)

We now store parent nodes starting at heap.size() - 1, which eliminates
the potential overlap, and resolves the issue.
2023-12-04 00:06:38 +01:00
Andreas Kling
ec081a2ef5 LibWeb: Don't crash on FormData.append() with emoji in name
If you can believe it, we were once again using StringBuilder's append()
when we really wanted append_code_point().
2023-12-04 00:04:04 +01:00
Andreas Kling
0d74ced9b5 LibWeb: Don't crash on Document.createElement() with emoji in tag name
Once again, we were mistakenly using StringBuilder's append(char) when
we really wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
1b81e0081d LibWeb: Don't crash on Element.setAttribute() with emoji in name
We were mistakenly using StringBuilder's append(char) when we really
wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
dbca63a1db LibWeb: Don't get stuck in TreeWalker.nextNode() when current detached
This fixes a hang on https://reddit.com/

Spec bug: https://github.com/whatwg/dom/issues/1102
2023-12-03 23:16:26 +01:00
Aliaksandr Kalenik
f93cab7679 LibWeb/Painting: Use scaled font for selected text
Fixes regression introduced in:
681771d210
2023-12-03 23:16:17 +01:00
Timothy Flynn
b7c0815469 LibWeb: Remove DeprecatedString usage from HTMLScriptElement's text
There was some awkward timing between these APIs being added and the
methods they use being ported to String.
2023-12-03 14:48:36 -05:00
Andreas Kling
c0bacc6c4b LibWeb: Fix two bad capture-by-reference bugs caught by ASAN
In both cases, related to fetching/loading modules.
2023-12-03 20:46:55 +01:00
Andreas Kling
62361e40a1 LibWeb: Set a TemporaryExecutionContext when finishing module loads
I'm not entirely sure why this is needed, but it's the same ol'
workaround we're using in a bazillion places where we get caught trying
to do JavaScripty things without a running execution context.
2023-12-03 20:46:55 +01:00
Andreas Kling
58294db294 LibJS: Add successfully loaded modules to the VM's stored module list
This ensures that repeated loads of the same module succeed. (There is a
specific criteria where the same exact module object has to be returned
for multiple loads of the same referrer + specifier.)

Note that we don't check the referrer at the moment, that's a FIXME.
2023-12-03 20:46:55 +01:00
Andreas Kling
99106df834 LibJS: Update import referrer's [[LoadedModules]] in place
We were previously updating a copy of the list, which meant loading
could not proceed even after a module was loaded.
2023-12-03 20:46:55 +01:00
Andreas Kling
5e67853b49 LibJS: Fix logic typo in ContinueModuleLoading 2023-12-03 20:46:55 +01:00
Andreas Kling
fc31a0d506 LibJS: Support LoadRequestedModule AO on SyntheticModule records
This allows test-js to run all the module tests in the new world.
2023-12-03 20:46:55 +01:00
Andreas Kling
4b1053e327 LibJS: Fix logic typo in CyclicModule::inner_module_linking()
The comment was right, but the code didn't match.
2023-12-03 20:46:55 +01:00
Andreas Kling
8b7d27b349 LibJS+LibWeb: More bringing module loading closer to spec
In particular, this patch removes three host hooks on JS::VM in favor
of the new JS-side module loading stuff.
2023-12-03 20:46:55 +01:00
Andreas Kling
07f567cd9f LibJS+LibWeb: Another round of bringing module loading closer to spec
In particular, this patch focuses on:
- Updating the old "import assertions" to the new "import attributes"
- Allowing realms as module import referrer
2023-12-03 20:46:55 +01:00
Andreas Kling
82977ab44b LibJS: Implement GetImportedModule and call it where appropriate
This breaks module loading temporarily while transitioning.
2023-12-03 20:46:55 +01:00
Andreas Kling
a24c543921 LibJS: Update spec steps & add missing assertions in ResolveExport 2023-12-03 20:46:55 +01:00
Andreas Kling
40d2560a93 LibJS: Update spec steps & add missing assertions in GetExportedNames 2023-12-03 20:46:55 +01:00
Andreas Kling
467a5ceb18 LibJS: Split big VERIFY conditions into smaller ones in CyclicModule
This makes assertion failures here more informative.
2023-12-03 20:46:55 +01:00
Andreas Kling
b08683e588 LibWeb: Don't capture stack variables by reference in MainThreadVM hooks 2023-12-03 20:46:55 +01:00
Andreas Kling
0817d8bda6 LibJS+LibWeb: Make CyclicModule & GraphLoadingState GC-allocated
This allows them to participate in the ownership graph and fixes a
lifetime issue in module loading found by ASAN.

Co-Authored-By: networkException <networkexception@serenityos.org>
2023-12-03 20:46:55 +01:00
Andreas Kling
aa7501a66a LibJS: Set initial state of CyclicModule.[[Status]] to NEW
This is what the specification tells us to do:
https://tc39.es/ecma262/#cyclic-module-record

Co-Authored-By: networkException <networkexception@serenityos.org>
2023-12-03 20:46:55 +01:00
Bastiaan van der Plaat
01f000acb0 LibWeb: Add HTML col element span attribute 2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
7e6fc9c26e LibWeb: Add textarea cols and rows attribute 2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
f3db0003c2 LibWeb: Add script element text getter setter 2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
529fd0a65c LibWeb: Add HTML legend element form getter 2023-12-03 20:29:14 +01:00