Commit graph

63892 commits

Author SHA1 Message Date
Jelle Raaijmakers
57783eff24 LibMedia: Convert OggLoader into generic FFmpegLoader
This loader supports whatever format libavformat and libavcodec can
handle. Currently only seekable streams are supported, and we still have
some limitations as to the number of channels and sample format.

Plays all non-streaming audio files at:

  https://tools.woolyss.com/html5-audio-video-tester/
2024-09-30 18:48:12 +02:00
Sam Atkins
ec15f8fa62 LibWeb/HTML: Re-order promise resolution to match spec
Applies changes in https://github.com/whatwg/html/pull/10658 and also
whichever previous change split the step for firing the navigateerror
into two parts.
2024-09-30 13:05:37 +02:00
Sam Atkins
8c79edac08 LibWeb: Ensure Elements don't need style update after computing style
Previously, we set the "needs style update" flag to false at the
beginning of recomputing the style. This meant that if any code within
the cascade set this flag to true, then we would end style computation
thinking the element still needed its style updating. This could occur
when starting a transition, and would make TreeBuilder crash.

By ensuring that we always set the flag to false at the very end of
style computation, this is avoided, along with any similar issues - I
noticed a comment in `Animation::cancel()` which sounds like a
workaround was needed for a similar problem previously.
2024-09-30 13:04:51 +02:00
Gingeh
de588a97c0 LibRegex: Only search start of line if pattern begins with ^ 2024-09-30 12:28:22 +02:00
Sam Atkins
f0dd0c5107 LibWebView+UI: Highlight CSS in the style sheet inspector
Some checks failed
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Has been cancelled
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Has been cancelled
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Has been cancelled
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Has been cancelled
Run test262 and test-wasm / run_and_update_results (push) Has been cancelled
Lint Code / lint (push) Has been cancelled
Push notes / build (push) Has been cancelled
2024-09-30 08:53:25 +01:00
Sam Atkins
af23f3890b LibWebView: Move line-number styling into HTML_HIGHLIGHTER_STYLE 2024-09-30 08:53:25 +01:00
Sam Atkins
e03da0e600 LibWebView: Preserve whitespace in view-source 2024-09-30 08:53:25 +01:00
Sam Atkins
bd6fdbf312 LibWebView: Highlight CSS and JS in view-source
The colors and categories here could probably be better, but it works.
:^)
2024-09-30 08:53:25 +01:00
Sam Atkins
66c39f3da4 LibWebView: Use custom properties for syntax-highlighting colors 2024-09-30 08:53:25 +01:00
Sam Atkins
1db243c006 LibWebView: Use LibSyntax to highlight document source
This has no visible effect, but internally it's also highlighting any
CSS and JS embedded in the page, which will be made use of later. We'll
also be able to use this code for highlighting CSS or JS files directly
in the future.

It's not a perfect fit - the syntax highlighters give specific styles to
their spans, which we then ignore and just use their data integer to
figure out which CSS class to give to the span. It feels cleaner to me
to produce HTML styled that way, instead of every token having
`style="color: ...; font-weight: ...; text-decoration: ...;"` set on
it.

Most of this new `to_html_string()` code is adapted from Serenity's
`TextEditor::paint_event()`, so it should be pretty solid.
2024-09-30 08:53:25 +01:00
Sam Atkins
a231435321 LibWeb/HTML: Expose HTML syntax highlighter's token kinds
This will be used for outputting the highlighted document as HTML.
2024-09-30 08:53:25 +01:00
Sam Atkins
07f0d9209a LibWeb/HTML: Use unique offsets for nested highlighters' tokens
The code previously ensured that JS/CSS tokens did not share values with
the HTML tokens, but still let them share values with each other. The
numbers chosen (1000 and 2000) are somewhat arbitrary, but give us
plenty of room to avoid overlaps.
2024-09-30 08:53:25 +01:00
Sam Atkins
2b961f145c LibWeb/HTML: Remove unused SyntaxHighlighter fields 2024-09-30 08:53:25 +01:00
Aliaksandr Kalenik
f341af1d72 LibWeb: Forbid reentrancy of style-layout-repaint in EventLoop::process
Fixes crashing on https://playbiolab.com/ in
VERIFY(page.client().is_ready_to_paint()) caused by attempting to start
the next repaint before the ongoing repaint is done.
2024-09-30 08:10:51 +02:00
Aliaksandr Kalenik
5faca4f027 LibWeb: Resolve document.fonts.ready() after fonts defined in CSS loaded
This is an ad-hoc implementation that resolves the ready() promise once
the document and all fonts collected by the style computer are done
loading. A spec-compliant implementation would include creating a proxy
CSS::FontFace for each @font-face and correctly implementing the
specification steps for font fetching, but we are far from there yet.

This hackish implementation should yield good WPT progress because it
will actually start waiting for the Ahem font to load before capturing
layout measurements. For example, it makes
https://wpt.live/css/css-grid/abspos/positioned-grid-descendants-001.html
go from 0/100 to 36/100 passing subtests.
2024-09-30 08:07:59 +02:00
Aliaksandr Kalenik
814fa0682a LibWeb: Delete public constructor of FontFaceSet
The IDL definition in the spec does not have a public constructor, and
our test that relies on it was failing to run in other browsers.
2024-09-30 08:07:59 +02:00
Timothy Flynn
ee7b90b789 LibWeb: Disable worker-crypto test for now
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.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-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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 times out on macOS CI.
2024-09-29 16:51:52 -04:00
Timothy Flynn
dd5a0361f2 LibWeb: Dispatch click events using the correct button/buttons
We were generating click events always using the primary mouse button
instead of the provided button, and with the buttons field set to that
provided button.
2024-09-29 19:30:27 +02:00
Timothy Flynn
ae01904369 LibWeb: Use a named enum value to generate mousemove button events
Rather than having to know what 1 means, let's use the enum value.
2024-09-29 19:30:27 +02:00
Timothy Flynn
92a37b3b1a LibWeb: Implement getting a known connected element closer to the spec
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.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-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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
Namely, we must always return NoSuchError invalid element IDs, and we
must handle stale elements.
2024-09-29 11:48:40 +02:00
Timothy Flynn
264b2827cd WebContent: Create a temporary execution context to parse WebDriver JSON 2024-09-29 11:48:40 +02:00
Timothy Flynn
b5aa8f65b1 WebDriver: Ensure that the session's current window handle is valid
After closing a window, it is the client's job to switch to another
window before executing any other command. Currently, we will crash if
that did not happen when we try to send an IPC to a window handle that
we no longer hold. This patch makes us return a "no such window" error
instead.

The exceptions to this new check are the "Switch to Window" and "Get
Window Handles" commands.
2024-09-29 11:48:40 +02:00
Tim Ledbetter
4ccc52e921 LibWeb/WebSocket: Allow sending binary blob data over a websocket 2024-09-29 11:46:51 +02:00
Tim Ledbetter
6095aa3cc5 LibWebSocket: Don't allow a connection to be discarded more than once 2024-09-29 11:46:51 +02:00
Andreas Kling
f1be662f68 LibWeb: Always blockify the root element
This is what the spec tells us to do:

    The root element’s display type is always blockified,
    and its principal box always establishes an independent
    formatting context.

    Additionally, a display of contents computes to block
    on the root element.

Spec link: https://drafts.csswg.org/css-display/#root

Fixes #1562
2024-09-29 11:46:13 +02:00
Aliaksandr Kalenik
f377bf862a LibWeb: Removed unused is_fixed_position flag from PushStackingContext
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-22.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-22.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (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 flag is no longer needed after we switched to using scroll frames
to account for fixed position.
2024-09-28 19:42:25 +02:00
Andreas Kling
061ad33705 Revert "LibJS: Cache the shape for normal ECMAScriptFunctionObject prototypes"
This reverts commit 749cf2d1b5.

This broke pinterest.com
2024-09-28 19:41:30 +02:00
Sam Atkins
20af2eb2b0 LibWeb/CSS: Parse the font-language-override descriptor
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.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-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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-09-28 14:42:26 +02:00
Sam Atkins
1d8867d9ae LibWeb/CSS: Parse and propagate the font-language-override property 2024-09-28 14:42:26 +02:00
Sam Atkins
b1870e7029 LibWeb/CSS: Parse font-width descriptor and its font-stretch alias 2024-09-28 14:42:26 +02:00
Sam Atkins
4a67b28600 LibWeb/CSS: Make font-stretch a legacy alias for new font-width
CSS Fonts level 4 renames font-stretch to font-width, with font-stretch
being left as a legacy alias. Unfortunately the other specs have not yet
been updated, so both terms are used in different places.
2024-09-28 14:42:26 +02:00
Sam Atkins
7c50a31402 LibWeb/CSS: Parse font-named-instance descriptor 2024-09-28 14:42:26 +02:00
Sam Atkins
3eb6d510fd LibWeb/CSS: Parse font-display descriptor 2024-09-28 14:42:26 +02:00
Sam Atkins
19cb3d4c81 LibWeb/CSS: Sort Keywords.json 2024-09-28 14:42:26 +02:00
Sam Atkins
2f7d18865d LibWeb: Parse ascent-, descent-, and line-gap-override descriptors 2024-09-28 14:42:26 +02:00
Aliaksandr Kalenik
3a5e78780e LibWeb: Implement "The percentage height calculation quirk" in BFC
See https://quirks.spec.whatwg.org/#the-percentage-height-calculation-quirk

Basically, it means that in quirks mode, percentage height needs to be
resolved against nearest ancestor in the containing block chain that
does not have height=auto.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/365
2024-09-28 14:41:26 +02:00
Gingeh
2e5edcf27e LibWeb: Use substring matching for content filters 2024-09-28 14:40:48 +02:00
Kostya Farber
14d62d7f31 LibWeb/CSS: Implement add for FontFaceSet
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.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-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.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-22.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
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.
2024-09-27 14:49:27 -06:00
Aliaksandr Kalenik
9098e39a43 LibWeb: Resolve not auto height before child box layout in BFC
It's possible to resolve box's height without doing inner layout, when
computed value is not auto. Doing that fixes height resolution, when box
with percentage height has containing block with percentage height.

Before:
- resolve used width
- layout box's content
- resolve height

After:
- resolve used width
- resolve height if treated as not auto
- layout box's content
- resolve height if treated as auto
2024-09-27 20:25:25 +02:00
Sam Atkins
fdcece2e88 LibWeb/CSS: Implement legacy name aliases for properties
When a property is a "legacy name alias", any time it is used in CSS or
via the CSSOM its aliased name is used instead.
(See https://drafts.csswg.org/css-cascade-5/#legacy-name-alias)

This means we only care about the alias when parsing a string as a
PropertyID - and we can just return the PropertyID it is an alias for.
No need for a distinct PropertyID for it, and no need for LibWeb to
care about it at all.

Previously, we had a bunch of these properties, which misused our code
for "logical aliases", some of which I've discovered were not even
fully implemented. But with this change, all that code can go away, and
making a legacy alias is just a case of putting it in the JSON. This
also shrinks `StyleProperties` as it doesn't need to contain data for
these aliases, and removes a whole load of `-webkit-*` spam from the
style inspector.
2024-09-27 17:16:23 +01:00
Andrew Kaster
2b13079b35 Meta: Update Ladybird and services to build again with gn 2024-09-27 10:15:08 -06:00
Andrew Kaster
7880b2fba9 Meta: Update LibWeb to build again with gn 2024-09-27 10:15:08 -06:00
Andrew Kaster
9bcdf8eafe Meta: Update non-LibWeb libraries in gn build 2024-09-27 10:15:08 -06:00
Andrew Kaster
e53ad772f3 Meta: Update LibUnicode gn build to depend on icu 2024-09-27 10:15:08 -06:00
Andrew Kaster
4348efd078 Meta: Update LibMedia gn build to depend on ffmpeg 2024-09-27 10:15:08 -06:00
Andrew Kaster
b395e6a6a6 Meta: Update LibGfx gn build for removed files and added Libraries
LibGfx depends on a lot of third-party libs now.
2024-09-27 10:15:08 -06:00
Andrew Kaster
a1e2437b21 Meta: Add missing files and libraries to LibCore in gn build 2024-09-27 10:15:08 -06:00
Andrew Kaster
8aac8f25ba Meta: Handle removed and renamed libraries in gn build 2024-09-27 10:15:08 -06:00
Andrew Kaster
8636a49f47 Meta: Update AK gn build for new files and dependencies 2024-09-27 10:15:08 -06:00
Andrew Kaster
0fefcbcf5e Meta: Handle removal of emoji files in gn build
Also add inspector.html to the file sets that are copied to the build
directory and macOS bundle.
2024-09-27 10:15:08 -06:00