Commit graph

3730 commits

Author SHA1 Message Date
Gingeh
4ecf56cadf LibWeb: Allow calculated values in css filters 2024-10-31 08:19:46 +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
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
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
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
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
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
Florian Cramer
df7cac539e LibXML: Set the doctype when parsing via Parser::parse_with_listener
This fixes at least one WPT test under /domparsing
2024-10-30 14:53:36 +01:00
Gingeh
bd25d0b1b4 LibWeb: Parse drop-shadow filter with missing or starting color
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
2024-10-30 12:41:02 +01:00
Khaled Lakehal
14e1e55319 LibWeb: Implement HTML spec-compliant rules for floating-point parsing
Attempt to implement HTML specs for parsing floating-point number
https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values
2024-10-30 10:47:41 +01:00
Alan Kemp
d2fbbabd89 LibWeb: Pageshow event dispatched by the user agent should be trusted
The spec says that "isTrusted is a convenience that indicates whether
an event is dispatched by the user agent (as opposed to using
dispatchEvent())"

But when dispatching a pageshow event the flag was incorrectly set
to false.

This fixes https://wpt.fyi/results/html/syntax/parsing/the-end.html
2024-10-30 10:27:20 +01:00
Andreas Kling
64f18a93c2 LibWeb: Make align-content on flex container behave more correctly
In particular, this property now interacts correctly when the flex
container has flex-wrap: wrap-reverse.

This caused some "regressions" in WPT tests for negative overflow in
flex containers, but the previous behavior wasn't correct either,
it just happened to give false positives on tests.
2024-10-30 10:17:21 +01:00
Andreas Kling
abd24d001d Tests: Import a bunch of WPT tests from /css/css-flexbox 2024-10-30 10:17:21 +01:00
Andreas Kling
0ebdac0b35 Tests: Don't print full error messages in imported WPT tests
...when running in test mode. This cuts down on the time it takes to run
the imported WPT tests, and you can still get the full error by opening
tests in the browser.
2024-10-30 10:17:21 +01:00
Aliaksandr Kalenik
e95226839e LibWeb: Fix infinite recursion when max-width is min/max-content in GFC
Treat max-width as auto when it's specified to min/max-content and
available size is intrinsic constraint.

Fixes stack overflow on https://claude.ai/
2024-10-30 08:47:52 +01:00
sideshowbarker
58b07bc531 Tests: Import WPT html/dom/aria-attribute-reflection.html test
This change imports the WPT html/dom/aria-attribute-reflection.html test
into being an in-tree test — and deletes the related existing test
from https://github.com/LadybirdBrowser/ladybird/commit/a924e8747a4
previously “ported” from the WPT with changes to run under our (non-WPT)
in-tree test harness.
2024-10-30 08:47:23 +01:00
Andreas Kling
d78c81a9fd Tests: Import LICENSE.md from WPT 2024-10-30 08:28:51 +01:00
Nico Weber
421cf8d9bf LibWeb: Parse stroke-{linejoin,miterlimit} attributes
Some checks are pending
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
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
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
Similar to LadybirdBrowser/ladybird#1714.

We don't implement the linejoin values `miter-clip` and `arcs`, because
according to the SVG 2 spec:

> The values miter-clip and arcs of the stroke-linejoin property are at
> risk. There are no known browser implementations. See issue Github
> issue w3c/svgwg#592.

Nothing uses this yet. The next step is to change
SVGPathPaintable::paint() to read `graphics_element.stroke_linejoin()`
and `graphics_element.stroke_miterlimit()` when painting.
2024-10-29 22:37:00 +00:00
Sam Atkins
5723ed3443 Tests: Add clip-path to calc() coverage test 2024-10-29 16:05:16 +01:00
Sam Atkins
ec9d67ae17 Tests: Add filter and backdrop-filter to calc() coverage test
Neither of these currently work correctly. This is just so we keep track
of them.
2024-10-29 16:05:16 +01:00
stelar7
488436fb54 LibWeb: Parse the rotate css property 2024-10-29 14:40:40 +00:00
Pavel Shliak
f2ed59879f LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html
2024-10-29 13:31:52 +00:00
Shannon Booth
755b63132b LibWeb: Implement DedicatedWorkerGlobalScope postMessage(msg, transfer)
Unfortunately the added test (which passes locally) is skipped as it is
based off other Worker tests which are also skipped due to being flakey
in CI.
2024-10-28 22:56:39 +01:00
Grubre
95c511a3f6 LibWeb: Use the correct locale when applying titlecase
Previously with lang="nl" and text-transform: capitalize, inner text
"ijsland" would turn to "Ijsland" instead of "IJsland", now it's as it
should be.

This fixes:
https://wpt.fyi/results/css/css-text/text-transform/text-transform-tailoring-001.html
2024-10-28 17:55:05 -04:00
Kostya Farber
2f41be733f LibWeb: Add word spacing to tab size correctly
We should be adding the computed value for word spacing not letter
spacing twice.
2024-10-28 22:53:37 +01:00
Jelle Raaijmakers
1b82cb43c2 LibWeb+LibGfx: Fix SVG userSpaceOnUse gradient coordinate transformation
We were transforming coordinates for SVG gradients in a pretty
convoluted way: an inverse, unscaled transformation matrix was set up in
order to work around some (old?) technical limitations.

Rework this so the coordinate transformation no longer needs to be
inversed. This fixes gradients with "userSpaceOnUse" for its
gradientUnits attribute, which might cause coordinates to lie outside of
the bounding box of the gradient.

Two tests have updated reference screenshots with minor pixel updates;
this is probably the result of floating point precision improvements by
not inversing the matrix.

One test (svg-text-effects) has a bigger change: the gradient stops seem
to have moved along the text. This does seem to match other browsers
slightly better, so I'm moving forward with this ref update.
2024-10-28 22:53:17 +01:00
Ben Wiederhake
3553861046 LibWeb: Omit padding in WebCrypto AES-CBC exportKey 2024-10-28 21:15:59 +01:00
Andreas Kling
c5a54f1166 LibWeb: Allow intrinsic size keywords for min-height and max-height 2024-10-27 21:02:54 +01:00
Andreas Kling
5a9d538acc LibWeb: Disallow none for min-width and min-height 2024-10-27 21:02:54 +01:00
Andreas Kling
ce6a7ba050 Tests: Import WPT tests from /css/css-sizing/parsing 2024-10-27 21:02:54 +01:00
Andreas Kling
037c034468 Tests: Remove an imported WPT test we can't run without WebDriver
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
We can bring this back if we gain the necessary faculties later.
2024-10-27 18:40:20 +01:00
Andreas Kling
6c75a93ec0 LibWeb: Fix select element state update in three ways
1. We were not propagating selectedness updates from option to select
   if the option was inside an optgroup.

2. When two or more options were selected, we were always favoring the
   last one in tree order, instead of the last one that got checked.

3. We were neglecting to return in the `display size is 1` case when
   all elements were disabled.

This was covered by some of the :has() selector tests. :^)
2024-10-27 18:40:20 +01:00
Andreas Kling
6dad8ea584 LibWeb: Move pessimistic :has() invalidation hack to invalidate_style()
We basically need to do this for every invocation of invalidate_style()
right now, so let's just do it inside invalidate_style() itself.

Fixes one missing invalidation issue caught by a WPT test. :^)
2024-10-27 18:40:20 +01:00
Andreas Kling
a640fcc693 LibWeb: Import a bunch of :has() selector tests from WPT 2024-10-27 13:33:46 +01:00
Andreas Kling
ec0838b84e LibWeb: Implement HTMLElement.innerText closer to spec
And here's the wild part: instead of cloning WPT tests, import the
relevant WPT tests that this fixes into our own test suite.

This works by adding a small Ladybird-specific callback in
resources/testharnessreport.js (which is what that file is meant for!)

Note that these run as text tests, and so they must signal the runner
when they are done. Tests using the "usual" WPT harness should just
work, but tests that do something more freestyle will need manual
signaling if they are to be imported.

I've also increased the test timeout here from 30 to 60 seconds,
to accommodate the larger WPT-style tests.
2024-10-27 12:10:28 +01:00
stelar7
23fc04d264 LibWeb: Implement RSAOAEP.decrypt() 2024-10-27 11:26:12 +01:00
stelar7
378808f6ba LibCrypto: Implement OAEP decode from newer spec 2024-10-27 11:26:12 +01:00
stelar7
48bd094712 LibWeb: Implement RSAOAEP.encrypt() 2024-10-27 11:26:12 +01:00
stelar7
b2b500ba82 LibCrypto: Extend OAEP test with RSA example 2024-10-27 11:26:12 +01:00
Kostya Farber
2dc788df00 LibWeb: Bring tab-size closer to the spec
When the css tab-size property is a number, we need to add
the associated letter-spacing and word-spacing to it's width.
2024-10-27 11:03:35 +01:00
Magnus Johansson
c6f77f4818 LibWeb: Fallback to auto when aspect ratio is degenerate as per spec
When aspect-ratio is degenerate (e.g. 0/1 or 1/0) we should
fallback to the same behaviour as `aspect-ratio: auto` according to spec
This commit explicitly handles this case and fixes five WPT test in
css/css-sizing/aspect-ratio (zero-or-infinity-[006-010])
2024-10-27 10:56:17 +01:00
Ankush Chatterjee
85356094b5 LibWeb/CSS: Add math expression support for transform-origin 2024-10-27 10:21:22 +01:00
Ben Wiederhake
ff3d78f369 LibWeb: Integration test for WebCrypto AES-CBC
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
2024-10-26 17:50:22 +02:00
Ben Wiederhake
92d4cb7b09 LibCrypto: Fix and test CBC with CMS and ZeroLen padding 2024-10-26 17:50:22 +02:00
Jelle Raaijmakers
29974de852 LibWeb: Parse and store filter property
This shares its implementation with `backdrop-filter`.
2024-10-26 11:26:42 +02:00
Kostya Farber
44b1c4f2b5 LibWeb: Parse the word-break css property
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
2024-10-26 00:18:02 +02:00
Ben Wiederhake
124bd115a1 LibWeb: Fix crash when importing malformed RSAOAEP key
This fixes a crash in WPT:
WebCryptoAPI/import_export/rsa_importKey.https.any

This allows us to pass 240 tests!
2024-10-26 00:14:42 +02:00