Commit graph

64604 commits

Author SHA1 Message Date
Jelle Raaijmakers
76e638b4ca LibWeb: Use right interface for custom SVG and MathML elements
The DOM spec gets overridden by both the SVG2 and MathML core specs in
that unknown elements should not inherit DOM::Element, but
SVG::SVGElement and MathML::MathMLElement respectively.
2024-10-31 09:58:59 +00:00
Jelle Raaijmakers
84fe8d675b LibWeb: Implement HTMLOrSVGElement.nonce
There are two FIXMEs remaining that depend on a functional
PolicyContainer, which we ignore for now and always behave like a CSP is
set.
2024-10-31 10:46:21 +01:00
Jelle Raaijmakers
8dcab69779 LibWeb: Remove unused includes from HTMLElement and SVGElement 2024-10-31 10:46:21 +01:00
Jelle Raaijmakers
5f84c2c3af LibWeb: Factor out HTMLOrSVGElement
This is a mixin in the IDL, so let's treat it as a mixin in our code and
let both SVGElement and MathMLElement reuse the implementations that we
wrote for HTMLElement.
2024-10-31 10:46:21 +01:00
sideshowbarker
d9124c8058 GitHub: Fix grammar error/typo in bug_report.yml issue template 2024-10-31 10:25:27 +01:00
stelar7
f9b511a7d6 LibWeb: Implement X25519.exportKey 2024-10-31 09:52:24 +01:00
stelar7
b281fa2b24 LibWeb: Implement X25519.importKey 2024-10-31 09:52:24 +01:00
stelar7
5e98c3f763 LibTLS: Add support for parsing curve25519 and curve448 2024-10-31 09:52:24 +01:00
stelar7
944f00c489 LibWeb: Implement X25519.generateKey 2024-10-31 09:52:24 +01:00
stelar7
8c5e5adc8a LibWeb: Implement X25519.deriveBits 2024-10-31 09:52:24 +01:00
Christoffer Sandberg
84c881fc66 LibJS: Count code-points instead of bytes for syntax highlight
This fixes issue #1847, a crash on view-source
for https://chalmers.se
2024-10-31 08:43:14 +00:00
Pavel Shliak
c78c706422 WebAudio: Initialize BiquadFilterNode properly
That helps to pass WPT tests
under webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html
2024-10-31 09:18:54 +01:00
sideshowbarker
51912bf0da Documentation: Make updates to align better with new issue template 2024-10-31 09:18:08 +01:00
sideshowbarker
8d52c72b3a GitHub: For issue reports, move to using structured template
This change helps to ensure issue authors include the details needed to
reproduce problems — including repro steps, expected behavior, a reduced
test case, and logs/backtrace.
2024-10-31 09:18:08 +01:00
Gingeh
4ecf56cadf LibWeb: Allow calculated values in css filters 2024-10-31 08:19:46 +01:00
stelar7
af3383df09 LibWeb: Implement AES-CTR.decrypt 2024-10-31 08:15:00 +01:00
stelar7
74403d7f1e LibWeb: Implement AES-CTR.encrypt 2024-10-31 08:15:00 +01:00
stelar7
55ef1c758a LibWeb: Implement AES-CTR.generateKey 2024-10-31 08:15:00 +01:00
stelar7
4b2120d919 LibWeb: Implement AES-CTR.exportKey 2024-10-31 08:15:00 +01:00
stelar7
030cbef532 LibWeb: Implement AES-CTR.getKeyLength 2024-10-31 08:15:00 +01:00
stelar7
0864436383 LibWeb: Implement AES-CTR.importKey 2024-10-31 08:15:00 +01:00
Tim Ledbetter
21a32e4b6d LibWeb: Don't crash when parsing large floating point number values
Previously, attempting to parse a floating point number with an integer
part larger than `(2 ^ 31) - 1` would cause the browser to crash. We now
avoid this by converting the integer part of the number to a `double`
rather than an `i32`.
2024-10-31 08:05:25 +01:00
sideshowbarker
cf7a1f6a52 Meta: Make import-wpt-test.py resolve “..” parent refs in URLs/pathnames
This change makes the Meta/import-wpt-test.py script handle URLs such as
https://wpt.live//WebCryptoAPI/generateKey/../util/helpers.js and paths
containing, e.g., wpt-import/WebCryptoAPI/generateKey/../util/helpers.js
(that is, URLs and paths with “..” parent-directory references in them).

Otherwise, without this change, when the import-wpt-test.py script tries
a URL like https://wpt.live//WebCryptoAPI/generateKey/../util/helpers.js
which contains a “..” parent-directory reference, the script fails with
a “urllib.error.HTTPError: HTTP Error 404: Not Found” error message.
2024-10-31 07:04:18 +00:00
Timothy Flynn
f064c6e930 LibWeb+WebContent+WebDriver: Make the screenshot endpoints asynchronous
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
These were the last WebDriver endpoints spinning the event loop.
2024-10-31 02:39:36 +00:00
Timothy Flynn
d9e5ae66a7 LibWeb: Allocate AnimationFrameCallbackDriver on the JS heap
This avoids needing to creating root handles for each heap-allocated
object captured in the animation callback. An upcoming commit would add
several of these.
2024-10-31 02:39:36 +00:00
justus2510
144907f5bd LibGfx: Apply Exif orientation for PNG images
Fixes wpt/png/exif-chunk.html.

At some point there should probably be some mechanism to handle this
outside of the individual decoder plugins. The TIFF decoder seems to
have its own version of this, and as far as I can tell, the JPEG decoder
doesn't handle this at all, even though that's probably the most common
use case for Exif orientations. :^)
2024-10-31 02:18:08 +00:00
sideshowbarker
120bc52f23 Tests: Import WPT accname/name/comp_embedded_control.html test
This change imports the WPT accname/name/comp_embedded_control.html
test, along with related resources files it depends on.

Note that in the wai-aria/scripts/aria-utils.js file, this changes the
get_computed_label call to use our window.internals.getComputedLabel.
2024-10-31 01:16:47 +00:00
sideshowbarker
1b4e609eb2 LibWeb: Expose Node::accessible_name via window.internals
This adds window.internals.getComputedLabel, for exposing
Node::accessible_name (for accessibility-testing purposes).
2024-10-31 01:16:47 +00:00
sideshowbarker
65bda00274 LibWeb: Support getting accessible name for labeled form controls
This change implements the “C: Embedded Control” step at
https://w3c.github.io/accname/#step2C in the “Accessible Name and
Description Computation” spec — to compute the accessible names for
labeled form controls.
2024-10-31 01:16:47 +00:00
Timothy Flynn
e8cd3749c8 LibWeb: Implement WebDriver shadow references according to the spec
Similar to commit a9c858fc78, this patch
implements the WebDriver spec concept of shadow references grouped
according to their browsing context groups.
2024-10-31 00:42:29 +00:00
Timothy Flynn
ad9d623664 WebContent+WebDriver: Make the element locator endpoints asynchronous
We currently spin the event loop to wait for the specified element to
become available. As we've seen with other endpoints, this can result
in dead locks if another web component also spins the event loop.

This patch makes the locator implementations asynchronous.
2024-10-31 00:42:29 +00:00
Timothy Flynn
80b3de8f9e Meta: Ignore virtual Python environments 2024-10-31 00:42:29 +00:00
Jelle Raaijmakers
a0ee86db04 LibWeb: Prevent painting grid items twice as a stacking context
We paint grid item nodes as a stacking context when they have no
`z-index` style set. However, a grid item could already have a stacking
context established - for example, when the `filter` style is applied.
This causes these nodes to be drawn twice.

Skip painting grid item nodes if a stacking context is already present.
2024-10-31 00:59:32 +01:00
Jelle Raaijmakers
185335ac63 LibWeb: Remove superfluous VERIFY from StackingContext
We just checked if it's an SVG box, let's not do it again.
2024-10-31 00:59:32 +01:00
Sam Atkins
760943d584 LibWeb/CSS: Correct matching of calc() against <number-percentage>
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This seems to have vanished from the spec, but in any case, we still
need it. Without this change we erroneously thought that calculations
that match <percentage> did not match <number-percentage>.
2024-10-30 20:58:16 +01:00
Shannon Booth
797b0d0f43 LibJS+LibWeb: Remove remaining use and reference to SafeFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
716e86f042 LibJS: Use HeapFunction for async body closure in Array.fromAsync 2024-10-30 20:55:45 +01:00
Shannon Booth
e6d1123ce8 LibWeb: Make ResourceLoader callbacks HeapFunctions 2024-10-30 20:55:45 +01:00
Shannon Booth
1c18b900e2 LibWeb: Port EventLoop::spin_XXX to HeapFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
29cea5bd24 LibWeb: Make EventLoopPlugin::deferred_invoke take a HeapFunction 2024-10-30 20:55:45 +01:00
Shannon Booth
7487a782db LibWeb: Use HeapFunction for EventLoopPlugin::spin_until 2024-10-30 20:55:45 +01:00
Shannon Booth
de1a805898 LibWeb: Use HeapFunction for Platform::Timer 2024-10-30 20:55:45 +01:00
Shannon Booth
ede3c91688 LibWeb: Make Platform::Timer GC-allocated
This will allow us to remove the use of SafeFunction in it's
implementation. This requires a fair amount of plumbing to wire up the
GC heap to the appropriate places in order to create the timers.
2024-10-30 20:55:45 +01:00
Shannon Booth
e44702f090 LibWeb: Construct ResourceLoader with a GC Heap
This will allow us to easily make use of HeapFunctions instead of
SafeFunction for all of the callbacks in ResourceLoader.
2024-10-30 20:55:45 +01:00
Aliaksandr Kalenik
a8077f79cc LibWeb: Separate text control input events handling from contenteditable
This input event handling change is intended to address the following
design issues:
- Having `DOM::Position` is unnecessary complexity when `Selection`
  exists because caret position could be described by the selection
  object with a collapsed state. Before this change, we had to
  synchronize those whenever one of them was modified, and there were
  already bugs caused by that, i.e., caret position was not changed when
  selection offset was modified from the JS side.
- Selection API exposes selection offset within `<textarea>` and
  `<input>`, which is not supposed to happen. These objects should
  manage their selection state by themselves and have selection offset
  even when they are not displayed.
- `EventHandler` looks only at `DOM::Text` owned by `DOM::Position`
  while doing text manipulations. It works fine for `<input>` and
  `<textarea>`, but `contenteditable` needs to consider all text
  descendant text nodes; i.e., if the cursor is moved outside of
  `DOM::Text`, we need to look for an adjacent text node to move the
  cursor there.

With this change, `EventHandler` no longer does direct manipulations on
caret position or text content, but instead delegates them to the active
`InputEventsTarget`, which could be either
`FormAssociatedTextControlElement` (for `<input>` and `<textarea>`) or
`EditingHostManager` (for `contenteditable`). The `Selection` object is
used to manage both selection and caret position for `contenteditable`,
and text control elements manage their own selection state that is not
exposed by Selection API.

This change improves text editing on Discord, as now we don't have to
refocus the `contenteditable` element after character input. The problem
was that selection manipulations from the JS side were not propagated
to `DOM::Position`.

I expect this change to make future correctness improvements for
`contenteditable` (and `designMode`) easier, as now it's decoupled from
`<input>` and `<textarea>` and separated from `EventHandler`, which is
quite a busy file.
2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
380907cd48 LibWeb: Allow TextCursor hit-testing mode select empty contenteditable 2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
20852443d3 LibWeb: Clamp end offset in CharacterData::replace_data()
Makes this method to not fail if updating of start offset (which happens
before update of the end offset) already moved end offset to the end of
string on the following step:

> 1. If range’s root is not equal to node’s root, or if bp is after the
     range’s end, set range’s end to bp.
2024-10-30 19:29:56 +01:00
Aliaksandr Kalenik
da26941b50 LibWeb: Use cached word segmenter for word selection in EventHandler 2024-10-30 19:29:56 +01:00
Andreas Kling
33507578e0 Tests: Skip css/css-flexbox/abspos/position-absolute-001.html for now
This test is too slow for our GCC CI :^(
2024-10-30 18:45:14 +01:00
Sam Atkins
51fc87bc1b LibWeb/CSS: Return 0 from CSSRule.type for non-spec types
We use the CSSRule::Type enum for identifying the type of a CSSRule, but
the spec requires that only some of these types are exposed via the
`type` attribute. For the rest, we're required to return 0, so let's do
so. :^)
2024-10-30 17:30:58 +01:00