Commit Graph

34117 Commits

Author SHA1 Message Date
Ali Mohammad Pur
3214f2c5bf LibCore: Handle destroyed owner when unregistering timers and notifiers
Cherry-picked from 9f4f319277
2024-06-27 14:32:48 -06:00
Tim Ledbetter
c4d5ae28ea LibWeb: Implement a minimal version of Window.find()
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.

This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
cda31615da LibWeb: Add WrapAround option to find in page
This allows `Page::find_in_page()` to optionally not return a result if
the start or end of the document has been reached.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
fee7b4147c LibWeb: Ensure layout is up to date before performing find in page query 2024-06-27 10:09:39 +02:00
Andrew Kaster
4b5541e1b7 Everywhere: Transition ImageDecoder to be single-instance, owned by UI
This is the same behavior as RequestServer, with the added benefit that
we know how to gracefully reconnect ImageDecoder to all WebContent
processes on restart.
2024-06-26 16:09:33 -06:00
Andrew Kaster
343a3a0d7e Ladybird+LibIPC: Move clearing FD_CLOEXEC helper logic to IPC::File 2024-06-26 16:09:33 -06:00
Andrew Kaster
54f66c574c LibWebView: Allow querying and iterating all extant WebContentClients
This is mostly useful when some application-level logic needs to
iterate over all child processes. A more robust Process abstraction
would make this easier.
2024-06-26 16:09:33 -06:00
Andrew Kaster
7c607a4749 WebContent: Remove stale on_webcontent_connection hook 2024-06-26 16:09:33 -06:00
circl
1f3285eb04 LibWeb: Restrict fetching file: and resource: URLs to internal pages
They are now blocked on pages which:
- Don't have an opaque origin (should be only user-initiated or about:)
- Aren't other file: pages
- Aren't other resource: pages
2024-06-26 12:15:33 -06:00
circl
d14888f31a LibWeb: Consider resource: URLs to be trustworthy and non-opaque
This makes icons once again load in the directory listings
2024-06-26 12:15:33 -06:00
Daniel La Rocque
cb629e18bb LibJS: Improve deep equals algorithm in tests
The `deepEquals` algorithm used for testing was naive, and incorrectly
evaluated equality of objects in some cases. The new algorithm considers
that the second object could have more keys than the first, and compares
the prototypes of the objects.
2024-06-26 12:13:08 -06:00
Tim Ledbetter
e9e195418e LibWeb: Fire a change event on mouseup of number input buttons
This matches the behavior of other browsers.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
b4b947c607 LibWeb: Update number input on mousedown of number input buttons
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
2a980816e7 LibWeb: Fire input event on user interaction with input element buttons
An input event is now fired when the step up or step down button of an
input element of type number is clicked.

This ensures that any associated <output> element is updated when these
buttons are clicked.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
a3d12e569c LibWeb: Deduplicate the firing of input events in HTMLInputElement
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.
2024-06-26 10:15:07 +02:00
Timothy Flynn
bd73dd316d LibTimeZone: Remove LibTimeZone and TZDB data
All users have been ported to the ICU implementation.
2024-06-26 10:14:02 +02:00
Timothy Flynn
672a555f98 LibCore+LibJS+LibUnicode: Port retrieving time zone offsets to ICU
The changes to tests are due to LibTimeZone incorrectly interpreting
time stamps in the TZDB. The TZDB will list zone transitions in either
UTC or the zone's local time (which is then subject to DST offsets).
LibTimeZone did not handle the latter at all.

For example:

The following rule is in effect until November 18, 6PM UTC.

    America/Chicago -5:50:36 - LMT 1883 Nov 18 18:00u

The following rule is in effect until March 1, 2AM in Chicago time. But
at that time, a DST transition occurs, so the local time is actually
3AM.

    America/Chicago -6:00 Chicago C%sT 1936 Mar 1 2:00
2024-06-26 10:14:02 +02:00
Timothy Flynn
1b2d47e6bb LibJS+LibUnicode: Port retrieving available regional time zones to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
4fc0fba646 LibCore+LibJS+LibUnicode: Port retrieving available time zones to ICU
This required updating some LibJS spec steps to their latest versions,
as the data expected by the old steps does not quite match the APIs that
are available with the ICU. The new spec steps are much more aligned.
2024-06-26 10:14:02 +02:00
Timothy Flynn
d3e809bcd4 LibJS+LibUnicode: Port retrieving the system time zone to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
89aa9a3af0 LibJS: Update Intl AO spec numbers
Otherwise, upcoming AO implementations will conflict with these.
2024-06-26 10:14:02 +02:00
Timothy Flynn
c379b35798 LibUnicode: Move helper to convert StringEnumeration to a list to ICU.h
This will be needed outside of UnicodeKeywords.cpp.
2024-06-26 10:14:02 +02:00
Luke Warlow
a65f1ecc37 LibWeb: Implement stub for ElementInternals
This implements a stub ElementInternals object which implements the
shadowRoot getter only.

Also implement attachInternals function.
2024-06-26 06:30:40 +02:00
Luke Warlow
ce8d3d17c4 LibWeb: Implement unsafe HTML parsing methods
Both Element's and ShadowRoot's setHTMLUnsafe, and Document's static
parseHTMLUnsafe methods are implemented.
2024-06-26 06:13:29 +02:00
Ali Mohammad Pur
920f470735 LibCore: Fix some thread-related memory/object leaks 2024-06-26 05:47:16 +02:00
Luke Warlow
9171c35183 LibWeb: Refactor DOM parsing APIs
Multiple APIs have moved from the DOM Parsing and Serialization spec to
HTML.

Updates spec URLs and comments.

Delete InnerHTML file:
- Make parse_fragment a member of Element, matching serialize_fragment
on Node.
- Move inner_html_setter inline into Element and ShadowRoot as per the
spec.

Add FIXME to Range.idl for Trusted Types createContextualFragment
2024-06-26 05:41:00 +02:00
Andrew Kaster
a587eafbf4 CMake: Consistently use imported targets for third party dependencies 2024-06-25 17:15:42 -04:00
Tim Ledbetter
0879489084 LibMedia: Hide Matroska debug message behind a flag 2024-06-25 19:25:34 +02:00
Andreas Kling
fb9f3f10f3 LibWeb: Add Element.getHTML() and ShadowRoot.getHTML() 2024-06-25 19:22:35 +02:00
Andreas Kling
0c47b3ff97 LibWeb: Update innerHTML & co IDL definition to match spec
This stuff has moved from a mixin defined by the DOM Parsing spec, over
to the HTML spec, where they are now defined as partial interfaces for
Element and ShadowRoot.

There's also some new functionality that we don't implement yet, so
patch marks them as FIXME properties.
2024-06-25 19:22:35 +02:00
Andreas Kling
f4bdf56212 LibWeb: Rename Element::shadow_root_internal() to shadow_root()
And let the old shadow_root(), which was only supposed to be used by
bindings, be called shadow_root_for_bindings() instead.

This makes it much easier to read DOM code, and we don't have to worry
about when to use shadow_root_internal() or why.
2024-06-25 19:22:35 +02:00
Andreas Kling
c7d9c1c0b2 LibWeb: Update DOM cloning algorithm for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
a0e1112209 LibWeb: Add HTMLTemplateElement IDL attrs for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
8e68215d33 LibWeb: Add ShadowRoot.clonable and ShadowRoot.serializable 2024-06-25 19:22:35 +02:00
Andreas Kling
e62db9c118 LibWeb: Update HTML fragment serialization for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
9eb4b91168 LibWeb: Parse declarative shadow DOM template elements
We now honor the shadowrootmode attribute on template elements while
parsing, and instantiate a shadow tree as required by the spec.
2024-06-25 19:22:35 +02:00
Andreas Kling
043ad0eb76 LibWeb: Refactor Element.attachShadow() after spec changes
The bulk of this function is moved to a new "attach a shadow root"
helper, designed to be used both from here and the HTML parser.
2024-06-25 19:22:35 +02:00
Andreas Kling
f3070118b1 LibWeb: Add "allow declarative shadow roots" flag to Document 2024-06-25 19:22:35 +02:00
simonkrauter
e9001da8d6 LibWeb: Initial support for dashed lines in Canvas
Implement setLineDash() and getLineDash() in CanvasPathDrawingStyles,
which write/read from the CanvasState object.
This doesn't implement the actual drawing of a dashed line, but at least
sites using the Chart.js library no longer fail with an exception.
Unfortunately the Painter classes don't support dashed/dotted lines
based on segments yet.
2024-06-25 09:47:17 +02:00
Zaggy1024
c4c91f02b3 LibMedia: Remove the home-grown VP9 decoder 2024-06-24 12:41:32 -06:00
Zaggy1024
3cc1187036 LibMedia: Move VideoSampleData out of the Video namespace 2024-06-24 12:41:32 -06:00
Zaggy1024
8848ee775b LibMedia: Flush the video decoder when seeking
This allows H.264 videos to seek correctly.
2024-06-24 12:41:32 -06:00
Zaggy1024
c128a19903 LibMedia: Add a function to flush persistent data from video decoders
Any data that sticks around in a decoder, especially frames that
haven't been retrieved, may cause issues for playback.

This is especially the case with H.264, since its arbitrary frame
ordering to allow reference frames to precede B-frames causes it to
hold onto frames, and causes the playback manager to get back a frame
at a completely wrong timestamp after seeking.
2024-06-24 12:41:32 -06:00
Zaggy1024
ef99e701b7 LibMedia/Matroska: Handle negative timestamp offsets correctly
The timestamp offset of a block was being converted from i16 to u64, so
negative values would overflow and cause timestamps that fall before
the cluster's timestamp from being close to the minimum representable
i64.

The math is also now done using saturating operations to prevent any
other similar issues from occurring.
2024-06-24 12:41:32 -06:00
Zaggy1024
f6a4973578 LibMedia: Give frame timestamps to FFmpeg decoders
H.264 in Matroska can have blocks with unordered timestamps. Without
passing these as the presentation timestamp into the FFmpeg decoder,
the frames will not be returned in chronological order.

VideoFrame will now include a timestamp that is used by the
PlaybackManager, rather than assuming that it is the same timestamp
returned by the demuxer.
2024-06-24 12:41:32 -06:00
Zaggy1024
084cf68dd5 Tests/LibMedia: Add a test for H.264 decoding through FFmpeg 2024-06-24 12:41:32 -06:00
Zaggy1024
32714878ad LibMedia/Matroska: Make SampleIterator getters const 2024-06-24 12:41:32 -06:00
Zaggy1024
457a69786b LibMedia: Pass Matroska codec private data to the FFmpeg decoder
This is necessary to give the H.264 decoder the data it needs to
initialize, including frame size and profile.
2024-06-24 12:41:32 -06:00
Zaggy1024
81001b37ce LibMedia: Use FFmpeg to decode more video formats
VP9 continues to function, but this also allows AV1 to be decoded. With
this commit, H.264 is still non-functional, as the decoder requires
some extra initial data from the track definition in the Matroska file.
2024-06-24 12:41:32 -06:00
Zaggy1024
bf1e0fac94 LibMedia/Matroska: Move the definition get_codec_id_for_track up
The function is separated from the string-to-enum function it uses, and
the order is also inconsistent with header.
2024-06-24 12:41:32 -06:00