Commit graph

57119 commits

Author SHA1 Message Date
Shannon Booth
6e6f3a9a8f LibWeb: Make Web::PageClient GC-allocated
This is a first step towards simplifying the ownership model of
Web::Page. Soon Web::Page will store its WebClient as a
NonnullGCPtr to help solve lifetime issues of the client being
destroyed before the page.
2023-12-05 09:38:32 +01:00
Aliaksandr Kalenik
5c0cd0f484 LibAccelGfx+LibWeb: Add text shadow support in GPU painter 2023-12-05 09:09:56 +01:00
Aliaksandr Kalenik
b5f9c1d003 LibWeb: Use glyph run to represent text in PaintTextShadow command
Given that we have a glyph run where the position of each glyph is
calculated for text fragments during layout, we can reuse it to avoid
this work during painting.
2023-12-05 09:09:56 +01:00
Andrew Kaster
9f01e0f826 WebWorker: Log URL and reason for Worker script load failure 2023-12-04 19:59:10 -05:00
Timothy Flynn
d81c531322 Meta: Explicitly list the Ladybird-related HTML files to bundle
As noted in the comment added here, we cannot just list the directory
containing these files.
2023-12-04 19:46:35 -05:00
Timothy Flynn
05c8d5ba57 Base+Ladybird: Move Ladybird-related HTML files to their own folder
Pages like the new tab page, error page, etc. all belong solely to
Ladybird, but are scattered across a couple of subfolders in Base. This
moves them all to Base/res/ladybird.
2023-12-04 19:46:35 -05:00
Bastiaan van der Plaat
980e32b4fe Ladybird/AppKit: Remove theme color changing background color 2023-12-04 14:56:03 -05:00
Bastiaan van der Plaat
2107ab823d LibWeb: Add basic HTML meter element support 2023-12-04 19:54:43 +00:00
Bastiaan van der Plaat
761d824b72 LibWeb: Add basic parse floating point number function 2023-12-04 19:54:43 +00:00
Bastiaan van der Plaat
3175557cb8 LibWeb: Update progressbar colors to be more pleasant 2023-12-04 19:54:43 +00:00
Bastiaan van der Plaat
4a7d3115c9 AK: Add String to number floating point support 2023-12-04 19:54:43 +00:00
Aliaksandr Kalenik
2361ce25a0 LibAccelGfx: Set blending for alpha separately to be sum of src and dst
With this change we match blending in LibGfx and it fixes rendering on
all websites that use opacity < 1.
2023-12-04 20:51:00 +01:00
Timothy Flynn
c55d8a9971 Ladybird/Qt: Make the Inspector widget owned by its parent tab
This ensures the Inspector is closed when the BrowserWindow which owns
the tab is closed.
2023-12-04 12:03:48 -07:00
Timothy Flynn
4653733a0d Ladybird/Qt: Do not "share" ownership of Qt objects
When a QObject subclass (widgets, etc.) are provided a parent, then
ownership of that object is passed to the parent. Similarly, objects
added to a QLayout are owned by the layout.

Thus, do not store these objects in an OwnPtr.
2023-12-04 12:03:48 -07:00
Timothy Flynn
a21998003c Ladybird/Qt: Make String allocation infallible 2023-12-04 12:03:48 -07:00
Timothy Flynn
82c827fc56 Ladybird/Qt: Support non-ASCII when converting a QString to a String
QString is UTF-16, thus QString::size returns the number of UTF-16 code
units. Thus, we would fail to perform, for example:

    ak_string_from_qstring(QString("😀"));

Which is 2 UTF-16 code units, but 4 UTF-8 code units.
2023-12-04 12:03:48 -07:00
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