Commit graph

2775 commits

Author SHA1 Message Date
Andreas Kling 870a954e11 LibWeb: Implement Element.outerHTML
This piggybacks on the same fragment serialization code that innerHTML
uses, but instead of constructing an imaginary parent element like the
spec asks us to, we just add a separate serialization mode that includes
the context element in the serialized markup.

This makes the image carousel on https://utah.edu/ show up :^)
2024-04-09 18:17:14 -04:00
Bastiaan van der Plaat 6f84f69677 LibWeb: Add select selected options collection getter 2024-04-09 09:23:57 +02:00
Bastiaan van der Plaat 7372c01786 LibWeb: Add select and options collection remove method 2024-04-09 09:23:57 +02:00
Bastiaan van der Plaat 5decf4b33c LibWeb: Add HTMLOptionsCollection selected index property 2024-04-09 09:23:57 +02:00
Bastiaan van der Plaat 5c277144d8 LibWeb: Add select and option collection set length 2024-04-09 09:23:57 +02:00
Bastiaan van der Plaat 4e5ce7b63e LibWeb: Add select element size property 2024-04-09 09:23:57 +02:00
Bastiaan van der Plaat 4408581ee0 LibWeb: Refactor SelectItem to allow selecting options without value
Currently the `<select>` dropdown IPC uses the option value attr to
find which option is selected. This won't work when options don't
have values or when multiple options have the same value. Also the
`SelectItem` contained so weird recursive structures that are
impossible to create with HTML. So I refactored `SelectItem` as a
variant, and gave the options a unique id. The id is send back to
`HTMLSelectElement` so it can find out exactly which option element
is selected.
2024-04-08 17:24:48 -04:00
Aliaksandr Kalenik 94d72c174a LibWeb: Allow executing scripts for iframes with src=about:blank
Fixes https://github.com/SerenityOS/serenity/issues/23836
2024-04-08 21:27:34 +02:00
stelar7 0e53b87261 LibCrypto: Add OAEP 2024-04-08 09:34:49 -06:00
stelar7 73a534494c LibCrypto: Add MGF1 2024-04-08 09:34:49 -06:00
Lucas CHOLLET 7f7119c78d LibWeb: Add a test for WindowOrWorkerGlobalScope.createImageBitmap 2024-04-08 14:25:36 +02:00
Shannon Booth db0519ddc1 LibWeb: Fire a pointer event on synthetic clicks 2024-04-08 14:25:08 +02:00
Shannon Booth 1e2ddf9848 LibWeb: Add a test for construction of a PointerEvent 2024-04-08 14:25:08 +02:00
MacDue d7b77d7695 LibWeb: Split SVGFormattingContext up into functions
Doing multiple `for_each_in_subtree()` passes was kind of a hack. We
can resolve everything in a single pass with a little more control over
the layout process. This also fixes a few minor issues like the sizing
of nested `<g>` elements.

More work is needed here though as this is still fairly ad-hoc.

Note: This does regress `css-namespace-tag-name-selector.html`,
previously SVG text within `<a>` elements would appear. However, this
was only because `for_each_in_subtree()` would blindly look through the
InlineNodes from the unimplemented `SVGAElement`s.
2024-04-08 14:24:35 +02:00
Aliaksandr Kalenik a3149c1ce9 LibWeb: Wait for initial navigation to complete before modifying iframe
If initial src of an iframe is "about:blank", it does synchronous
navigation that is not supposed to be interleaved by other navigation
or usage of Document.open().

Fixes crashing in navigation on https://twinings.co.uk/
2024-04-08 09:07:18 +02:00
Kenneth Myhra 29521b50e6 Tests/LibWeb: Verify we throw when trying to pipe through locked streams 2024-04-07 14:26:34 +01:00
Kenneth Myhra 9802cf07bd Tests/LibWeb: Add test to prove we can pipe through a transform stream 2024-04-07 14:26:34 +01:00
Kenneth Myhra a0802b6e29 Tests/LibWeb: Verify we throw when trying to pipe from/to locked streams 2024-04-07 07:01:52 +02:00
Kenneth Myhra 8ff52582ce Tests/LibWeb: Add test to prove we can pipe to a WriteableStream
This proves our ability to pipe the current ReadableStream to a given
WriteableStream.
2024-04-07 07:01:52 +02:00
Shannon Booth 18520561e7 LibWeb: Fix crash for calculated transition duration/delays
As the parser was trying to directly unwrap an unresolved duration.
Currently we are outputting the wrong results for the serialized
duration, but this is still a step forwards.

Fixes a crash seen on: https://evaparish.com/blog/how-i-edit
2024-04-06 19:35:27 +01:00
Nico Weber 2d4964b945 LibGfx/JBIG2: Support custom adaptive template pixels in refinement
The implementation is very similar to #23831.

I created the test exactly like in #23713, except that I replaced the
last four lines in the ini file with:

```
-txt -Param -rATX1 10
-txt -Param -rATY1 -1
-txt -Param -rATX2 4
-txt -Param -rATY2 15
```
2024-04-05 21:32:18 +02:00
Nico Weber 200e36aad3 Tests/JBIG2: Remove test_jbig2_size
It's redundant with test_jbig2_decode nowadays.
2024-04-05 21:32:18 +02:00
Aliaksandr Kalenik 188775c4e3 LibWeb: Add a test for history.pushState() that uses setTimeout() 2024-04-05 21:28:41 +02:00
Timothy Flynn 5d5b69578f LibWeb: Handle <input> element type changing to the image button state
The spec has special steps specific to the image button state to load
the element's image URL.
2024-04-04 21:06:45 +02:00
Timothy Flynn 0e774fe780 LibWeb: Recreate the <input> shadow tree when the type attribute changes
This is often used on login forms, for example, to toggle the visibility
of a password. The site will change the <input> element's type to "text"
to allow the password to show.
2024-04-04 21:06:45 +02:00
Timothy Flynn 06a3ca734e LibWeb: Handle changes to an input element's "multiple" attribute
Update the shadow tree so that the attribute is reflected on the page.
2024-04-04 21:06:45 +02:00
Timothy Flynn 6af7f7e0f5 LibWeb: Update placeholder visibility when the placeholder value changes
Otherwise, setting a placeholder on an element that previously did not
have a placeholder would have no visible effect.
2024-04-04 21:06:45 +02:00
stelar7 19bb62d60e LibWeb: Implement PBKDF2 deriveBits for SubtleCrypto 2024-04-04 21:00:40 +02:00
Nico Weber b17a9ad82a Tests/JBIG2: Add test cases for custom adaptive template pixels
I manually wrote a bunch of .ini files and ran this script to
produce the files:

    #!/bin/bash
    set -eu

    J=$HOME/Downloads/T-REC-T.88-201808-I\!\!SOFT-ZST-E/Software
    J=$J/JBIG2_SampleSoftware-A20180829/source/jbig2

    for t in '' template1- template2- template3-; do
      for p in '' '-tpgdon'; do
        i=${t}customat$p
        echo $i.ini
        cat $i.ini
        $J -i Tests/LibGfx/test-inputs/bmp/bitmap -f bmp -o bitmap-$i \
            -F jb2 -ini $i.ini
        cp bitmap-$i.jb2 Tests/LibGfx/test-inputs/jbig2/bitmap-$i.jbig2
      done
    done

The script's output (which shows the .ini file contents) was:

```
% ./make-custom-at.sh
customat.ini
-Gen -Seg 1
-Gen -Param -ATX1 -4
-Gen -Param -ATY1 -5
-Gen -Param -ATX2 6
-Gen -Param -ATY2 -7
-Gen -Param -ATX3 -8
-Gen -Param -ATY3 -9
-Gen -Param -ATX4 10
-Gen -Param -ATY4 -11
ENC Start ===>complete
customat-tpgdon.ini
-Gen -Seg 1
-Gen -Param -ATX1 -4
-Gen -Param -ATY1 -5
-Gen -Param -ATX2 6
-Gen -Param -ATY2 -7
-Gen -Param -ATX3 -8
-Gen -Param -ATY3 -9
-Gen -Param -ATX4 10
-Gen -Param -ATY4 -11
-Gen -Param -TpGDon 1
ENC Start ===>complete
template1-customat.ini
-Gen -Seg 1
-Gen -Param -Template 1
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
ENC Start ===>complete
template1-customat-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 1
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
-Gen -Param -TpGDon 1
ENC Start ===>complete
template2-customat.ini
-Gen -Seg 1
-Gen -Param -Template 2
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
ENC Start ===>complete
template2-customat-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 2
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
-Gen -Param -TpGDon 1
ENC Start ===>complete
template3-customat.ini
-Gen -Seg 1
-Gen -Param -Template 3
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
ENC Start ===>complete
template3-customat-tpgdon.ini
-Gen -Seg 1
-Gen -Param -Template 3
-Gen -Param -ATX1 17
-Gen -Param -ATY1 -2
-Gen -Param -TpGDon 1
ENC Start ===>complete
```
2024-04-04 11:44:50 -04:00
Timothy Flynn 23b25333a5 LibCrypto: Avoid needless ByteString usage in unit tests 2024-04-04 11:23:21 +02:00
Timothy Flynn c23060e21b Userland: Avoid some now-unneeded explicit conversions to Bytes 2024-04-04 11:23:21 +02:00
Timothy Flynn 69b5d7c0e6 LibWeb: Avoid UAF when encoding a fetch request body via URLSearchParams 2024-04-03 17:14:01 -04:00
stelar7 35676491ec LibWeb: Implement ED25519 verify for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7 9ad10566b2 LibWeb: Implement ED25519 sign for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7 ae230c9150 LibWeb: Implement most of ECDSA verify for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7 bc2a5e24bc LibWeb: Implement skeleton of ECDSA sign for SubtleCrypto 2024-04-03 13:10:01 -06:00
Nico Weber 44d3fd0546 Tests/JBIG2: Add tests for transposed non-topleft text reference corners
This needed the same `jbig2` changes as for the non-transposed ones,
and the changes to it mentioned on #23780.

I used the same .ini files as for the non-transposed ones, except
that I added `-txt -Param -Transposed 1` as last line to each of them.

All three new files display fine in Chrome.
They all look busted in Firefox.
I think this is likey a bug in pdf.js that I'll report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Nico Weber 67875ecb6f Tests/JBIG2: Add tests for non-topleft text segment reference corners
This already worked fine. Now it's tested.

I did have to teach `jbig2` to correctly generate test files for this.
See the PR adding these tests for local changes.

I used the script from #23659 to create these images, but I replaced
these lines:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `bottomleft`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 137 50 -ID 3 294 60 -ID 1 199 135 -ID 0 319 232
-txt -Param -RefCorner 0
```

For `bottomright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `topright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 79 -ID 3 265 89 -ID 1 100 234 -ID 0 70 351
-txt -Param -RefCorner 3
```

All three new files display fine in Chrome.
The bottomleft one displays fine in Firefox, while the other two
look compressed in X. I think this is a bug in pdf.js that I'll
report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Luke Wilde facece1a2a LibWeb: Implement PerformanceObserver.supportedEntryTypes 2024-04-03 07:55:51 +02:00
Tim Ledbetter 3876875bd8 LibWeb: Stub out missing cross origin properties on the window object
Previously, trying to access the `close`, `closed` or `blur` properties
on a cross origin window would cause a crash.
2024-04-02 07:46:16 +02:00
Tim Ledbetter 558fef237c LibWeb: Use the global object to access the performance object
Previously, we were accessing the performance through the current
window object. Thus caused a crash when `animate()` was called on an
element within a document with no associated window object. The global
object is now used to access the performance object in places where
a window object is not guaranteed to exist.
2024-04-02 07:46:16 +02:00
Tim Ledbetter eebdc7bc88 LibWeb: Allow the Performance object to be used by workers 2024-04-02 07:46:16 +02:00
Timothy Flynn b6501adef8 LibWeb: Use the proper in-flight request to check if a stream is closing 2024-04-01 21:11:01 +02:00
Nico Weber ce11a34fc6 Tests/LibGfx: Add a jbig2 test for transposed text segments
See the PR adding this test for local changes to `jbig2`.
I used the shell script mentioned in #23659, except I added the line
`-txt -Param -Transposed 1` at the very end of the .ini file.

As with all the symbol test cases, after running

    Meta/jbig2_to_pdf.py -o foo.pdf foo.jb2 399 400

the file opens up ok in Chrome and Firefox (but not Safari), so
maybe it's not completely broken.
2024-04-01 14:41:17 +02:00
Shannon Booth 851114e462 LibWeb/Tests: Add a basic set of tests for document.all 2024-04-01 14:41:00 +02:00
Aliaksandr Kalenik 9098fa23a2 LibWeb: Catch up with the spec on document destroy, abort and unload
These changes do not solve hanging `location.reload()` and
`location.go()` but only align implementation with the latest edits in
the specification.

`WindowProxy-Get-after-detaching-from-browsing-context` test output is
affected because `iframe.remove();` no longer synchronously does
destruction of a document, but queues a task on event loop.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-04-01 13:23:58 +02:00
MacDue 06ed56f4f6 LibWeb: Paint SVGDecodedImageData via Navigable::paint()
Going via the `ViewportPaintable` missed some steps (in particular
computing clip rects), which meant nested SVGs within SVGs-as-images
were completely clipped.
2024-03-30 21:35:22 +01:00
Shannon Booth 9dc2b0bba3 LibWeb: Add a basic test for [EnforceRange]
This is a basic test - but does cover the two bugs in the previous
two commits.
2024-03-30 21:21:23 +01:00
Kenneth Myhra c17171b86c LibWeb: Add ImageData constructor with data 2024-03-30 19:29:14 +01:00
Matthew Olsson c7c7ed780b LibWeb: Make request-animation-frame-order test async
Even though this test worked fine, it does use requestAnimationFrame
callbacks, so lets make it async to ensure it doesn't timeout.
2024-03-30 19:26:58 +01:00