Commit graph

63689 commits

Author SHA1 Message Date
Ben Wiederhake
6d5b1703a2 LibCrypto: Implement and test HKDF
(cherry picked from commit 8abd399a531a6beb864519fb0ae35d9c193cff03;
amended to use VERIFY instead of ASSERT in HKDF.h)
2024-11-12 07:14:25 -05:00
Ben Wiederhake
729b0e25be LibCrypto: Fix HMAC nullptr deref when key has length 0
While a key of length zero seems like a bad idea in general, the WPT
tests end up calling exactly this, so we need to support it one way or
another.

(cherry picked from commit e1c3e212defe92b4afe36e8184ffda5a08d0abdb)
2024-11-12 07:14:25 -05:00
sideshowbarker
6598ff9926 LibWeb: Ensure spaces get added where expected within accessible names
This change implements the https://w3c.github.io/accname/#comp_append
step in the “Accessible Name and Description Computation” spec — so that
when an accessible name is computed from multiple sources in a document
subtree, the parts of the computed text are joined together with spaces.

Otherwise without this change, in accessible names computed from
multiple sources in a document subtree, the parts of the computed text
are unexpectedly run together, with no spaces between the parts.

(cherry picked from commit 3ba7c536681e8471e9b53aaf8e5dd32d801e26e4)
2024-11-12 07:14:25 -05:00
Timothy Flynn
1a202901ba LibWebView: Auto-select subtext when editing DOM nodes/attributes
This adds the following behavior for the DOM node/attribute editor in
the Inspector:

* If the user double clicks on an attribute name, the name is selected.
* If the user double clicks on an attribute value, the value text (sans
  the surrounding quotes) is selected.
* Otherwise, double clicks select the entire text range.

(cherry picked from commit 7fff00972d667e7c83ed0336dc8e7f8ddbd91298)
2024-11-12 07:13:58 -05:00
Timothy Flynn
1402fe99d5 LibWeb: Do not assume the shadow root has a host when updating selection
For example, if the shadow root was detached from the document in some
manner, its host will be null.

(cherry picked from commit 8fb2cc2be1d7a63eba7b1ae5c93e3db181ca393f)
2024-11-12 07:13:58 -05:00
Timothy Flynn
1b958c9745 LibWeb: Convert internal test event coordinates to device pixels
This allows for coming up with coordinates that work on macOS with a DPR
of 2 more easily.

(cherry picked from commit 59fe7ca8300ca64ad92e47a694ee352e8f99a1f8)
2024-11-12 07:13:58 -05:00
Timothy Flynn
6cef8e5bfd LibWeb: Remove range-count filter from selection change handlers
The implementation of setBaseAndExtent will create a new range.

(cherry picked from commit 96ad310643ff90af557b9ca71db450ebd4d37ba5)
2024-11-12 07:13:58 -05:00
Timothy Flynn
af3222b686 LibWeb: Update the document cursor position when the selection changes
Otherwise, it looks a bit awkward where the cursor position does not
update while the selection is elsewhere.

Note that this requires passing along the raw selection positions from
`set the selection range` to the elements. Otherwise, consider what will
happen if we set the selection start and end to the same value. By going
through the API accessor, we hit the case where the start and end are
the same value, and return the document cursor position. This would mean
the cursor position would not be updated.

The test changes here more closely match what Firefox produces now. It
is not a 100% match; the `select event fired` test case isn't right. The
problem is the event fires for the input element, but we most recently
focused the textarea element. Thus, when we retrieve the selection from
the input element, we return the document's cursor position, which is
actually in the textarea element. The fix will ultimately be to fully
implement the following:

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-cursor

That is, each input / textarea element should separately track its own
text cursor position.

(cherry picked from commit fd289deb44e0fc26f54a133c637c136bf0716cd5)
2024-11-12 07:13:58 -05:00
Timothy Flynn
9f9c9c8bcb LibWeb+LibWebView+WebContent: Return a named enum from UI event handlers
UI event handlers currently return a boolean where false means the event
was cancelled by a script on the page, or otherwise dropped. It has been
a point of confusion for some time now, as it's not particularly clear
what should be returned in some special cases, or how the UI process
should handle the response.

This adds an enumeration with a few states that indicate exactly how the
WebContent process handled the event. This should remove all ambiguity,
and let us properly handle these states going forward.

There should be no behavior change with this patch. It's meant to only
introduce the enum, not change any of our decisions based on the result.

(cherry picked from commit 541968b30dc50208f473566498100769711f10c8;
amended to fix tiny conflict in ConnectionFromClient.h due to serenity
not having #1182 yet)
2024-11-12 06:45:27 -05:00
dependabot[bot]
1f509193ff CI: Bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.9
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.3 to 4.6.9.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.3...v4.6.9)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-12 04:59:57 -05:00
Gingeh
b571b4317c LibXML: Read code points when parsing names
(cherry picked from commit 453e0348010561b4de922ee37e49d324eeedf3ac)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
2717669104 LibWeb+LibXML: Cache the result of parsing the XHTML DTD and reuse it
There's no reason to parse this again and again every time we parse an
XHTML document.

(cherry picked from commit 24c2ad059b9523711bd468ef50d613366c557499)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
bee21d8b6b LibXML: Avoid allocating ByteStrings for AcceptedRule
These come from string literals and compiletime-known values, no need to
allocate a ByteString.

(cherry picked from commit fd5ee06bbf4e9872827ffb4324758e8beeb780de)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
6b460ca2d0 LibXML: Resolve the entity reference definition in DTDs
Fixes the rendering of `&lt;` in XHTML docs.

(cherry picked from commit 4d3f764d9572e7ccc3c2e5d2472a5a4fc9c83671)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
4847ec75a9 LibWeb: Assume XHTML <html> elements are in the HTML namespace
...unless specified otherwise explicitly.
This is dervied from an interpretation of a note in the html5 spec at
https://html.spec.whatwg.org/#xml

(cherry picked from commit 5c23ef1596b954da2515f00c7a939809cd7c4fb4)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
ae6627067d LibXML: Shift some rule acceptances to make errors nicer
Instead of saying "expected />", make the parser output the real cause
for the following ("unknown reference"):
    <foo>&unknown;</foo>

(cherry picked from commit 202bfabdc6c18d1dd760d5157a7a3269bb82cfd9)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
f325a5e18a LibXML: Avoid ByteString::formatted() on static "expected" errors
This is a fairly significant (~8%) speedup when parsing references.

(cherry picked from commit 70e769a18a2f7e6543f093cea2e94f2149bd2715)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
bc9e03ea38 AK: Cache all the line positions in LineTrackingLexer
Also updates a LibWeb text test that used to report the wrong line
number.

(cherry picked from commit 02b50d463b174e5d525c7ab8ce8dd173d550de28;
amended to exclude LineTrackingLexer from KERNEL, since that now use
make<>)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
2502b5713d AK: Make TemporaryChange not copy the old value twice
This is necessary for the next commit (and might even help performance
in some very weird cases).

(cherry picked from commit e5f87eb12bdad9dfbf8a825461ac17fdb8457f50;
amended to add a missing include of StdLibExtras.h for move())
2024-11-12 04:25:50 -05:00
Timothy Flynn
3aec9df468 LibWeb: Do not unconditionally prevent escape keys from being propagated
We should only block the escape key from being sent to the web page if
the CloseWatcherManager actually closed something.

We use the escape key in the Inspector to cancel editing a DOM field.
This unconditional early return broke this feature.

(cherry picked from commit 099956a7cd2bec55e7e0376d54525f8a3f7b1955)
2024-11-12 04:24:58 -05:00
Timothy Flynn
f9b74206ae LibWeb: Add a testing helper to send a single named key to an element
Unlike internals.sendText(), this allows sending keys like the escape
key.

(cherry picked from commit 53f775afb959b1912aca70c98bfbee90e2fcd07c)
2024-11-12 04:24:58 -05:00
Timothy Flynn
9c512129f7 LibWeb: Add a helper to lookup a key code from its string name
(cherry picked from commit f14e7c7261a41d1843610167cdf8e3cd671f403a;
amended to resolve conflict due to #25060)
2024-11-12 04:24:58 -05:00
stelar7
816e658dfd LibWeb: Bring performance.now() closer to spec
(cherry picked from commit f6991a29559add9f0b3b4dee4a9ace2338a25511)
2024-11-12 04:24:21 -05:00
Shannon Booth
57cec9ba63 LibWeb: Avoid potential infinite recursion in Document::update_layout
(cherry picked from commit aa585c4182b8755f01118062c6ea54f5739fffcd)
2024-11-12 04:24:21 -05:00
Shannon Booth
001db03171 LibWeb: Ensure fully active document before appending to an iframe
(cherry picked from commit 15c15116dd3d62c5a9ee17f6c80e1782cd2a1a96)
2024-11-12 04:24:21 -05:00
Shannon Booth
78651dda36 LibWeb: Avoid possible infinite recursion in Document::is_fully_active
(cherry picked from commit bfc28bd62157507db711ffab7ae2683cd466da51)
2024-11-12 04:24:21 -05:00
Pavel Shliak
3bbceb3a79 WebAudio: Initialize BiquadFilterNode properly
That helps to pass WPT tests
under webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html

(cherry picked from commit c78c7064228d41d2afddeba3a3900f0c772d7be4)
2024-11-12 04:24:21 -05:00
Piotr
850692f6c1 LibWeb: Set textarea rows and cols default value if 0
The cols and rows attributes are limited to only positive numbers with
fallback. The cols IDL attribute's default value is 20. The rows IDL
attribute's default value is 2.

The default value was returned only for the negative number. I added an
additional check for the case when the attribute is 0 to match the
specification.

(cherry picked from commit 205155a7abb9b9754cd0917901cfc04d86291820)
2024-11-12 04:24:21 -05:00
Pavel Shliak
a757259f32 LibAudio: Manage channelCount in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit 8ac60273a69cd900e744c375a5650438e9692b05)
2024-11-12 04:24:21 -05:00
Pavel Shliak
8818cca08a LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit f2ed59879f7781019152a18740fc5743cc513016)
2024-11-12 04:24:21 -05:00
Nico Weber
871003161e Meta: Add PerformanceEventTiming to GN build
Makes Tests/LibWeb/Text/input/all-window-properties.html pass with GN
again.
2024-11-11 19:54:09 -05:00
Sam Atkins
20610c8589 Documentation: Stop telling people to get gn from homebrew
Homebrew doesn't have an entry for gn, so this was confusing.

(cherry picked from commit de1552342b7c4f3a998d45fe4e819ebac2cdb91d)
2024-11-11 19:54:09 -05:00
Sam Atkins
3af997c4b2 LibWeb/DOM: Update a spec comment in Range::create_contextual_fragment()
Corresponds to https://github.com/whatwg/html/pull/10732

(cherry picked from commit 1777ddc5e2647d43e65d92da2203fb295ff7a92e)
2024-11-11 19:54:09 -05:00
Totto16
c1b0ac6376 LibWeb: Reject Promise in createImageBitmap for Not Implemented Types
If we don't reject the Promise, it lasts forever,
so rejecting non implemented Promises is essential,
to not timeout in e.g. WPT tests

(cherry picked from commit aab5a9e944f8b1c1a9de321047556bbcaa282a56)
2024-11-11 19:54:09 -05:00
Ali Mohammad Pur
d823e90f37 LibRegex: Restore checkpoints when restoring the state post-fork
Fixes the lockup/OOM in #968.

(cherry picked from commit cc1f0c3af2c2a237a317202ee844b97783de61ce)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
07b7693349 LibWeb: Implement AudioNode.channelCount
(cherry picked from commit cb212015505f9a029c282d13697c9bd7e33df513)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
8c86f9ad75 LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs
(cherry picked from commit 7b4f0d13eede588368189bb612ca9c90e2d56894)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
7189d342f5 LibWeb: Forward declare AudioDestinationNode to break header loop
(cherry picked from commit d7a3bad2b4c08b02c3df73e6c344c6bf7dadcbeb)
2024-11-11 19:54:09 -05:00
Andreas Kling
1600dcaf19 LibWeb: Ignore boxes wholly in the negative scrollable overflow region
This fixes an issue where https://hey.com/ was horizontally scrollable
even though it shouldn't be.

(cherry picked from commit 94721385ceb17e20428b94a946d39828bdd5b74e)
2024-11-11 19:54:09 -05:00
Tim Ledbetter
f9158f4210 LibWeb: Fire iframe load event on document close
This matches the behavior of other browsers.

(cherry picked from commit e1eeb93cc6095a47371d23db0bbf55eb30215cee)
2024-11-11 19:54:09 -05:00
Noah Bright
8725bb12f2 LibWeb: Define PerformanceEventTiming
https://www.w3.org/TR/event-timing/#sec-performance-event-timing

Add idl, header and stubs for PerformanceEventTiming interface.

Two missing `PerformanceEntry` types that have come up in issues
are the `first-input` and the `event` entryTypes. Those are both
this.

Also, because both of those are this same interface, the static
methods from the parent class are difficult to implement because
of instance-specific details. Might either need subclasses or to
edit the parent and also everything that inherits from it :/

(cherry picked from commit d30ae92b82d997bc4db407c563c88f90d8260093)
2024-11-11 19:54:09 -05:00
Tim Ledbetter
c8319c9166 LibWeb: Don't print messages from workers to the console twice
Previously, any message logged to the console within a worker with a
log level greater than trace was printed twice.

(cherry picked from commit d0008ae5e0100984f3188c32a67008a03c05bea8)
2024-11-11 19:54:09 -05:00
Timothy Flynn
85c6ca8417 LibWeb: Remove debug spam from Navigator methods
These are logged ~1000 times on fast.com.

(cherry picked from commit 76152845fdb74d4881c6d8e43790146780fbe7b3)
2024-11-11 19:54:09 -05:00
stelar7
2ba1e4083b LibWeb: Parse mimetype when creating Blob and File
(cherry picked from commit 193c0dcafcb81052694e9d95078f5efba0aacae6)
2024-11-11 19:54:09 -05:00
stelar7
ed7af71508 LibWeb: Iterate over utf8 codepoints when checking validity
(cherry picked from commit 0739f1b1e6ec09250b415e1efa3cdf6a038e2181)
2024-11-11 19:54:09 -05:00
Edwin Hoksberg
94d2315a59 LibWeb: Handle Refresh header
Fixes a bunch of tests in:
- https://staging.wpt.fyi/results/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh

(cherry picked from commit cbe4ba7f8c825d9732346964c8f1f1f8eec00eac)
2024-11-11 19:54:09 -05:00
rmg-x
7f96fb2c1f UI/Qt: Simplify link context menu and update keyboard shortcuts
Removes the unnecessary separator, redundant open action, and changes
shortcuts to match other browsers.

(cherry picked from commit 1f365ba44a2f95006121f689429e2f58db30bc5b)
2024-11-11 19:54:09 -05:00
Kostya Farber
02797c6e8e LibWeb/CSS: Implement delete method for FontFaceSet
(cherry picked from commit 09aec4be7165f27d65caf614b097ec2ff11ad9c0)
2024-11-11 19:30:05 -05:00
Kostya Farber
3b7adbca69 LibWeb/CSS: Implement add for FontFaceSet
There is still some work to do with some of the underying methods
called inside this method (e.g is_css_connected) but this is a start.

(cherry picked from commit 14d62d7f31e49e021332f3e64e6ea4b285dcdd15)
2024-11-11 19:30:05 -05:00
Carwyn Nelson
7a76f8b265 LibWeb: Skip transitions for pseudo elements
Transitions are currently not implemented for pseudo elements which
causes the transition to be applied to the "real"/"parent" element. When
a transition adjusts width/height on a pseudo element this causes the
real elements layout to break.

As a quick fix we just skip doing transitions when they are against
pseudo elements.

(cherry picked from commit 30f59cfe1aec0b385631a40da8b2447eed62ad79)
2024-11-11 17:22:42 -05:00