Commit graph

57617 commits

Author SHA1 Message Date
Idan Horowitz
8bb423daf7 LibC: Implement siginterrupt()
This is just a simple wrapper around the more-modern sigaction.
2023-12-26 18:36:43 +01:00
Sam Atkins
5e2fc52b25 LibWeb: Remove old ad-hoc document-loading code
This also removes the code for displaying `gemini://` documents. We
currently don't load documents from that protocol anyway - we hit
`attempt_to_create_a_non_fetch_scheme_document()` in `Navigable.cpp`
which is just a stub. It looks like we should be handling those
separately from regular "fetch" documents, so that's a task for a
future person.
2023-12-26 18:35:29 +01:00
Sam Atkins
9733524f8a LibWeb: Load markdown documents using the spec mechanism
This basically just means it now goes through the
`create_document_for_inline_content()` function.
2023-12-26 18:35:29 +01:00
Sam Atkins
c5223ae77f LibWeb: Adjust create_document_for_inline_content() for future use
(Apologies for bad commit title, it's hard to explain in such a short
space!)

We're going to need to call this for producing markdown and gemini
documents, both of which need a Document and Realm to fetch the entire
response body, so that they can then generate their HTML. So this
commit modifies `create_document_for_inline_content()` to take a lambda
instead of a fixed HTML string, to support these uses.

Also, we always return a nonnull pointer, so make that the return type.

This is a move and change in the same commit, (Sorry!) but all the
changes are to the function signature and step 6.
2023-12-26 18:35:29 +01:00
Sam Atkins
ae8e040287 LibWeb: Bring media-document loading closer to spec
There's an unfortunate hack here. We have to load the media file's data
before we call `HTML::HTMLParser::the_end()` with our generated
document, otherwise the media element (`<img>`/`<audio>`/`<video>`)
never loads and that blocks the document's load event. The previous code
path also did this, which is perhaps why the bug was never noticed.
2023-12-26 18:35:29 +01:00
Sam Atkins
91d82ae17a LibWeb: Bring text-document parsing to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
4dbca3e14a LibWeb: Bring XML-document loading to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
6c74069c1e LibWeb: Bring HTML-document loading to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
6ffda5f271 LibWeb: Make HTMLParser::the_end() callable from outside
This is a little awkward: The spec requires when loading media documents
or ones that don't have a DOM, that we "act as if the user agent had
stopped parsing document" which means following this algorithm. Only a
few steps require an HTMLParser, but those that do, involve reaching
into its internals. The simplest solution I could think of (other than
duplicating this fairly hefty function) is making it static and taking
a Document and optional HTMLParser as parameters.
2023-12-26 18:35:29 +01:00
Sam Atkins
a20951fbc0 LibWeb: Support making a document active after it has completely loaded
So far, we always call make_active() before update_readiness
(Complete), but this will soon not be the case once we implement the
spec document-loading algorithms.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-12-26 18:35:29 +01:00
Sam Atkins
ad8ccd4c52 LibWeb: Update spec comment for Document::create_and_initialize()
No functional changes.
2023-12-26 18:35:29 +01:00
Sam Atkins
933231ffd4 LibWeb: Spec-comment load_document()
This function is currently very ad-hoc. This commit adds comments which
are almost entirely FIXMEs, so that we can then start filling in the
details one step at a time.
2023-12-26 18:35:29 +01:00
Sam Atkins
40f7cab21e LibWeb: Implement Document::populate_with_html_head_and_body() 2023-12-26 18:35:29 +01:00
Sam Atkins
8dc8d57418 LibWeb: Make load_document()'s NavigationParams non-optional
There's no mention in the spec of this being optional, all the places
that call it always pass a NavigationParams directly, and we're
VERIFYing that it's got a value too!
2023-12-26 18:35:29 +01:00
Andreas Kling
f900957d26 LibGfx+LibWeb: Move Gfx::ScaledFont caching from LibWeb into LibGfx
Before this change, we would only cache and reuse Gfx::ScaledFont
instances for downloaded CSS fonts.

By moving it into Gfx::VectorFont, we get caching for all vector fonts,
including local system TTFs etc.

This avoids a *lot* of style invalidations in LibWeb, since we now vend
the same Gfx::Font pointer for the same font when used repeatedly.
2023-12-26 18:15:55 +01:00
Timothy Flynn
bf8107b247 LibJS: Update spec numbers for the Promise.withResolvers proposal
This proposal has been merged into the main ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/11cbf72
2023-12-26 12:07:50 -05:00
Timothy Flynn
edbc2a1031 LibJS: Update spec numbers for the Array Grouping proposal
This proposal has been merged into the main ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/3a9c9dc
2023-12-26 12:07:50 -05:00
Sam Atkins
4c17620712 LibWeb: Parse transform-origin property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
dd5adb28fd LibWeb: Parse transform property using TokenStream
While I'm at it, use the helper for "none", and remove the unnecessary
whitespace skipping.
2023-12-26 15:32:32 +00:00
Sam Atkins
6a6995cb12 LibWeb: Make text-decoration-line parsing match other properties 2023-12-26 15:32:32 +00:00
Sam Atkins
ed77dee405 LibWeb: Parse text-decoration property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
513dee04d4 LibWeb: Parse place-self property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
5a8f57f7b3 LibWeb: Parse place-items property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
61d6f611cb LibWeb: Parse place-content property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
4f773a7dae LibWeb: Parse overflow property using TokenStream
Also simplify it a bit. We don't need to handle 1 / 2 values separately,
but past Sam didn't realise that.
2023-12-26 15:32:32 +00:00
Sam Atkins
0578bec655 LibWeb: Parse math-depth property using TokenStream
We don't need to skip whitespace at the top level because that's already
done before we're called. But we do still have to skip it inside the
`add()` function
2023-12-26 15:32:32 +00:00
Sam Atkins
6e0a550a03 LibWeb: Parse list-style property using TokenStream 2023-12-26 15:32:32 +00:00
Sam Atkins
14e2e2bac4 LibWeb: Parse grid track placements using TokenStream
I'm not entirely happy with this, but I barely understand grid, and this
does still work.
2023-12-26 15:32:32 +00:00
Aliaksandr Kalenik
b172c29d9a LibWeb: Apply min/max-widths to block container during intrinsic layout
Fixes https://github.com/SerenityOS/serenity/issues/22430
2023-12-26 16:24:51 +01:00
Timothy Flynn
9258d7b98a LibJS+LibWeb: Implement resizable ArrayBuffer support for TypedArray
This is (part of) a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/a9ae96e
2023-12-26 11:16:10 +01:00
Timothy Flynn
c7fec9424c LibJS+LibWeb: Implement resizable ArrayBuffer support for DataView
This is (part of) a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/a9ae96e
2023-12-26 11:16:10 +01:00
Timothy Flynn
29ac6e3689 LibJS: Partially implement resizable ArrayBuffer objects
This is (part of) a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/a9ae96e

This implements just support for resizing ArrayBuffer objects. This does
not implement the SharedArrayBuffer changes, as we do not have enough
support to do so.
2023-12-26 11:16:10 +01:00
Timothy Flynn
a1e2f131c4 LibJS: Use existing AOs to validate bytecode/JIT TypedArray indices
The IsValidIntegerIndex AO performs the checks we are interested in. The
manual implementation we currently have will no longer compile once the
resizable ArrayBuffer spec is implemented. The AO will be updated with
the spec implementation, so let's use it now to avoid breakage.
2023-12-26 11:16:10 +01:00
Timothy Flynn
98cdf36fb0 LibJS: Rename TypedArray element get and set methods
This renames IntegerIndexedElementGet to TypedArrayGetElement, and
IntegerIndexedElementSet to TypedArraySetElement.

This also renames the indexedPosition variable inside these method
definitions to byteIndexInBuffer.

These are part of a couple editorial changes in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/03e4410
https://github.com/tc39/ecma262/commit/a1a4d48

The remainder of the changes in those commits apply to the resizable
ArrayBuffer spec, which is not implemented in LibJS as of this commit.
2023-12-26 11:16:10 +01:00
Timothy Flynn
4f32392426 LibJS: Update spec headers of ArrayBuffer, TypedArray, DataView, Atomics
After the resizable ArrayBuffer proposal was merged, a bunch of methods
had their spec numbers/headers changed. This patch just updates existing
methods to make future patches easier to grok.
2023-12-26 11:16:10 +01:00
Timothy Flynn
d053d6f7bb Meta: Add test262-runner to the GN build 2023-12-26 11:16:10 +01:00
Timothy Flynn
71222845bd Meta: Port recent changes to the GN build
3c74dc9f4d
2023-12-26 11:16:10 +01:00
Aliaksandr Kalenik
ed42b12123 LibWeb: Respect box-sizing in min-height calculation of grid container 2023-12-26 11:13:38 +01:00
Aliaksandr Kalenik
92ae90085d WebContent: Remove spammy debug message from paint handler
It polluted logs of headless-browser.
2023-12-26 11:11:31 +01:00
Aliaksandr Kalenik
8a4416837a LibWebView: Request repaint after replacing backing stores
Fixes a bug when the Qt client does not repaint after resizing
when the following sequence of IPC calls happens:

1. In the resize handler, the client sends set_viewport_rect to
   WebContent.
2. WebContent starts repainting in response to the changed viewport
   size.
3. In the resize handler, the client updates backing stores and sends
   new ids and shared bitmaps to WebContent using the add_backing_store
   call.
4. WebContent sends an acknowledgment to the client that painting
   finished using the old id.
5. The client discards the repaint because it expects a new backing
   store id.
2023-12-25 23:54:26 +01:00
Andrew Kaster
fd70e1a9ce LibWeb: Skip Worker-echo test again
Turns out it's still flaky in CI :(
2023-12-25 15:05:07 -05:00
Andrew Kaster
b10fee00eb LibWeb+WebWorker: Convert Workers to use MessagePorts for postMessage
This aligns Workers and Window and MessagePorts to all use the same
mechanism for transferring serialized messages across realms.

It also allows transferring more message ports into a worker.

Re-enable the Worker-echo test, as none of the MessagePort tests have
themselves been flaky, and those are now using the same underlying
implementation.
2023-12-25 12:09:11 +01:00
dependabot[bot]
37f2d49818 CI: Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-24 23:56:34 +01:00
dependabot[bot]
bbf37473b8 CI: Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-24 23:56:18 +01:00
Aliaksandr Kalenik
4969ad9d6b LibWeb: Limit scroll position by overflow area in Window::scroll()
This change fixes "vertical shift" in inspector.
2023-12-24 23:22:35 +01:00
Andreas Kling
de993be02f LibWeb: Return child navigable target name set with FlyString keys
Saves us some unnecessary conversion since we already have FlyStrings
in the first place.
2023-12-24 22:49:19 +01:00
Andreas Kling
ff63b2603d LibWeb: Use cached Element id attribute in HTMLCollection 2023-12-24 22:49:19 +01:00
Andreas Kling
41f56b0df9 LibWeb: Let supported_property_names() return Vector<FlyString>
Ultimately, this API should probably be replaced with something that
updates a cache on relevant DOM mutations instead of regenerating
the list of property names again and again.
2023-12-24 22:49:19 +01:00
Andreas Kling
0178929387 LibWeb: Use Element::id() in Window::supported_property_names()
We already have the `id` attribute cached on elements, so we don't
need to walk the attribute list to find it.
2023-12-24 22:49:19 +01:00
Andreas Kling
75d5429d66 LibWeb: Add fast_is<T> for form, embed, image, and object elements
These are used by Window::supported_property_names(), which can get
very hot.
2023-12-24 22:49:19 +01:00