Commit graph

35530 commits

Author SHA1 Message Date
stelar7
193c0dcafc LibWeb: Parse mimetype when creating Blob and File 2024-10-04 20:03:49 +02:00
stelar7
0739f1b1e6 LibWeb: Iterate over utf8 codepoints when checking validity 2024-10-04 20:03:49 +02:00
Edwin Hoksberg
cbe4ba7f8c 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
2024-10-04 20:02:35 +02:00
Andreas Kling
cd0e4a49b8 LibWeb: Make SVGImageElement part of CanvasImageSource union
This is very janky at the moment but it also more correct. :^)
2024-10-04 20:01:22 +02:00
Andreas Kling
902586a21d LibWeb: Fail CSS color parse for "rgba(123, 123, 123, "
This matches the behavior of other browsers and fixes a WPT test.
2024-10-04 20:01:22 +02:00
Andreas Kling
4590c081c2 LibWeb+LibGfx: Serialize HTML canvas fill/strokeStyle colors correctly
Before this change we were serializing them in a bogus 8-digit hex color
format that isn't actually recognized by HTML.

This code will need more work when we start supporting color spaces
other than sRGB.
2024-10-04 20:01:22 +02:00
Tim Ledbetter
d0b97873d4 LibWeb: Follow spec steps to set the selectionDirection attribute value 2024-10-04 19:42:33 +02:00
Andreas Kling
cc4b3cbacc Meta: Update my e-mail address everywhere
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-04 13:19:50 +02:00
Jamie Mansfield
797e1d3ee6 LibWeb: Update spec comments for HostLoadImportedModule 2024-10-04 07:08:37 +02:00
Jamie Mansfield
d6db6edaf6 LibWeb: Remove 'classic' from 'default classic script fetch options'
See:
- https://github.com/whatwg/html/commit/5ee6b7b
2024-10-04 07:08:37 +02:00
Andrew Kaster
29416befe6 LibWeb: Add ServiceWorker job registration and execution
Now we can register jobs and they will be executed on the event loop
"later". This doesn't feel like the right place to execute them, but
the spec needs some updates in this regard anyway.
2024-10-04 07:08:08 +02:00
Aliaksandr Kalenik
4a43d0ac98 LibWeb: Move updating the rendering into HTML task
Implements https://github.com/whatwg/html/pull/10007 which basically
moves style, layout and painting from HTML processing task into HTML
task with "rendering" source.

The biggest difference is that now we no longer schedule HTML event loop
processing whenever we might need a repaint, but instead queue a global
rendering task 60 times per second that will check if any documents
need a style/layout/paint update.

That is a great simplification of our repaint scheduling model. Before
we had:
- Optional timer that schedules animation updates 60 hz
- Optional timer that schedules rAF updates
- PaintWhenReady state to schedule a paint if navigable doesn't have a
  rendering opportunity on the last event loop iteration

Now all that is gone and replaced with a single timer that drives
repainting at 60 hz and we don't have to worry about excessive repaints.

In the future, hard-coded 60 hz refresh interval could be replaced with
CADisplayLink on macOS and similar API on linux to drive repainting in
synchronization with display's refresh rate.
2024-10-04 07:07:01 +02:00
Aliaksandr Kalenik
9754b480fa LibWeb: Move update_layout() to happen earlier in find_matching_text()
update_layout() need to be invoked before checking if layout node is
present, because layout not being updated might be the reason why layout
node doesn't exist yet.
2024-10-04 07:07:01 +02:00
Aliaksandr Kalenik
32e79bd12e LibWeb: Invalidate animated style even if target doesn't have paintable
...otherwise animated style invalidation will be skipped.

This change is a preparation before applying latest HTML event loop
procesing spec changes to avoid regressing our tests.
2024-10-04 07:07:01 +02:00
Aliaksandr Kalenik
dc1a646764 LibWeb: Remove layout node check in EventHandler::handle_keydown()
This function does not rely on having a layout node.
2024-10-04 07:07:01 +02:00
Andreas Kling
0b403d30d7 LibWeb: Don't swallow args when forwarding cross-origin WindowProxy call
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
Fixes at least one WPT test that was previously timing out:
- html/semantics/document-metadata/the-base-element/base_target_does_not_affect_iframe_src_navigation.html
2024-10-03 20:49:45 +02:00
ronak69
8cfe51cef4 LibWeb: Make horizontal scrollbar start from the left edge of viewport
Horizontal scrollbar has to leave space at right edge for the vertical
scrollbar to fully extend from top-to-bottom edge of viewport. Before,
this was done by just moving it leftward beyond the edge of viewport.

Now, it gets scaled down appropriately to fit between left edge of
viewport & vertical scrollbar without clipping.
2024-10-03 19:43:08 +02:00
Kostya Farber
09aec4be71 LibWeb/CSS: Implement delete method for FontFaceSet
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-03 16:36:44 +02:00
Timothy Flynn
f56b33f8d5 headless-browser: Add a flag to rebaseline executed layout / text tests
The existing rebaseline script is a bit limiting in that it can only
rebaseline a single test at a time. When making sweeping changes, this
patch will let us rebaseline any number of tests at once.
2024-10-03 09:15:45 -04:00
Timothy Flynn
bf668696de LibWeb+WebContent: Do not include DOM HTML in text test expectations
For example, in the following abbreviated test HTML:

    <span>some text</span>
    <script>println("whf")</script>

We would have to craft the expectation file to include the "some text"
segment, usually with some leading whitespace. This is a bit annoying,
and makes it difficult to manually craft expectation files.

So instead of comparing the expectation against the entire DOM inner
text, we now send the inner text of just the <pre> element containing
the test output when we invoke `internals.signalTextTestIsDone`.
2024-10-03 07:07:28 -04:00
Andrew Kaster
3ecf6de652 LibMedia+Ladybird: Use pkg_check_modules to find pulseaudio
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-02 20:23:03 -04:00
Jelle Raaijmakers
2106617f5b LibWeb: Implement history.scrollRestoration 2024-10-02 17:08:17 -06:00
Andrew Kaster
1322a7e917 LibGfx: Use more Span methods in BitmapSequence instead of memcpy
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
And a few assorted cleanups to use more moves() to avoid copying Vectors
and NonnullRefPtrs.
2024-10-02 16:37:19 -06:00
Zachary Huang
e0bd42be95 ImageDecoder+LibGfx: Collate decoded bitmaps before sending over IPC
There is an issue where gifs with many frames cannot be loaded, as each
bitmap is sent over IPC using a separate file descriptor, and there is
limit on the maximum number of descriptors per IPC message. Thus, trying
to load gifs with more than 64 frames (the current limit) causes the
image decoder process to die.

This commit introduces the BitmapSequence class, which is a thin wrapper
around the type Vector<Optional<NonnullRefPtr<Gfx::Bitmap>>> and
provides an IPC encode/decode routine that collates all bitmap data into
a single buffer so that only a single file descriptor is required per
IPC transfer, even if multiple frames are being sent.
2024-10-02 15:57:41 -06:00
Kemal Zebari
b8a5e18a01 LibWeb/MimeSniff: Update the MIME type sniffing algo to meet specs
The spec moved/added the xml and html checks to the beginning and
removed sniffing resource feeds.
2024-10-02 16:15:23 -04:00
Arhcout
c31f9815b4 LibWeb: Readonly input element's arrow buttons don't change the value 2024-10-02 16:04:00 -04:00
Andrew Kaster
ebaba7fb7b LibMedia: Mark ffmpeg as required, and reorganize CMakeLists
Now it should be clearer looking at the build scripts what options
are available for building LibMedia, and what packages are required.
2024-10-02 16:03:33 -04:00
Jelle Raaijmakers
768d814ffd LibGfx: Set correct alpha type for webp decoding
The libwebp decoder gives us unpremultiplied color data, so mark our
bitmaps as such.
2024-10-02 16:37:22 +01:00
Sam Atkins
07300a5bb4 headless-browser: Clean up unused includes 2024-10-02 16:36:10 +01:00
Sam Atkins
ae2959959b headless-browser: Use ByteString for paths 2024-10-02 16:36:10 +01:00
Sam Atkins
260074af87 headless-browser: Ensure test path is always absolute
Previously, if you ran with a relative path, then everything would run
fine except that the test name would be blank in the output, eg:

  1/1234:

instead of:

  1/1234: Text/input/canvas/export.html
2024-10-02 16:36:10 +01:00
Sam Atkins
c4b62ab04d headless-browser: Add a --dry-run flag
--dry-run causes headless-browser to collect and then list tests,
without running them.
2024-10-02 16:36:10 +01:00
Sam Atkins
c497e5f850 LibWeb: Serialize more @font-face descriptors
Adapt the existing `font-face-src-local-serialization.html` test into a
more general test for these.
2024-10-02 16:28:55 +01:00
Sam Atkins
e43f3e4808 LibWeb/CSS: Parse font-[feature,variation]-settings descriptors 2024-10-02 16:28:55 +01:00
Sam Atkins
95c17dfab5 LibWeb/CSS: Parse and propagate font-feature-settings property 2024-10-02 16:28:55 +01:00
Sam Atkins
55812aaed2 LibWeb/CSS: Parse and propagate font-variation-settings property 2024-10-02 16:28:55 +01:00
Sam Atkins
1a127c9d37 LibWeb/CSS: Expand single-none-parsing helper to parse any keyword
Multiple font properties are either the `normal` keyword or some
non-keyword value, so this lets us avoid some boilerplate for those, at
the cost of the existing `none` users having marginally more verbose
code.
2024-10-02 16:28:55 +01:00
Sam Atkins
cd13b30fb8 LibWeb/CSS: Add parsing for <opentype-tag>
This is a special form of `<string>` so doesn't need its own style value
type. It's used in a couple of font-related properties. For completeness
it's included in ValueType.
2024-10-02 16:28:55 +01:00
Sam Atkins
f7f8d2fe0d LibWeb/CSS: Return StringStyleValue's FlyString by reference
Most of the time this copy is completely unnecessary, so let's avoid it!
2024-10-02 16:28:55 +01:00
Sam Atkins
2516297c86 LibWeb/CSS: Return StringStyleValue from parse_string_value()
Callers already relied on this being true, so let's make it contractual.
2024-10-02 16:28:55 +01:00
Sam Atkins
c22a2d8f2b LibWeb/CSS: Introduce OpenTypeTaggedStyleValue
Two font properties, font-feature-settings and font-variation-settings,
contain a list of values that are an `<opentype-tag>` followed by a
single value. This class is intended to fill both roles.
2024-10-02 16:28:55 +01:00
Aliaksandr Kalenik
94b3b84dd8 LibWeb: Make sure style is up-to-date in getAnimations()
StyleComputer is responsible for assigning animation targets, so we
have to make sure there are no pending style updates before querying
animations of an element.

This change also introduces a version of getAnimations() that does not
check style updates and used by StyleComputer to avoid mutual recursion.
2024-10-02 16:28:37 +01:00
Kostya Farber
68a28ff33a LibWeb/CSS: Parse the tab-size property 2024-10-02 10:27:15 +01:00
Tim Ledbetter
140dc95e67 LibWeb: Map dimension attributes for table elements 2024-10-02 09:50:54 +02:00
Tim Ledbetter
728236f4d2 LibWeb: Map embedded content element attributes to dimension properties 2024-10-02 09:50:54 +02:00
Tim Ledbetter
baca0e5e55 Libweb: Map marquee attributes to dimension properties 2024-10-02 09:50:54 +02:00
Tim Ledbetter
4c3101e021 LibWeb: Map hr width attribute to the width dimension property 2024-10-02 09:50:54 +02:00
Andrew Kaster
d96c7edfb6 LibWeb: Add more HTML tokenization states to Swift implementation
This patch adds support for start and end tags, as well as script tag
rules.
2024-10-02 09:44:38 +02:00
Andrew Kaster
7aa0165fe7 LibWeb: Deduplicate attributes when emitting start and end tags
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 (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
The HTML tokenizer specification says that we're supposed to do this
when leaving the Attribute name or when emitting the token, as
appropriate.

Hopefully 'as appropriate' can mean only when emitting the token, as
that's the easiest place to insert this logic without complicating the
tokenizer any more.
2024-10-01 11:04:28 +02:00
Timothy Flynn
b3f8d63372 WebContent: Implement the Release Actions endpoint 2024-10-01 11:02:27 +02:00
Timothy Flynn
709deeb482 LibWeb+WebContent+WebDriver: Implement the Perform Actions endpoint
Similar to script execution, this spins the WebDriver process until the
action is complete (rather than spinning the WebContent process, which
we've seen result in deadlocks).
2024-10-01 11:02:27 +02:00
Timothy Flynn
8000837f78 LibWeb: Implement WebDriver pointer action execution
This implements execution of the pointer up, pointer down, and pointer
move actions.

This isn't 100% complete. Pointer move actions are supposed to break
the move into iterations over the specified duration, which we currently
do not do.
2024-10-01 11:02:27 +02:00
Timothy Flynn
6cf7d07a98 LibWeb: Implement WebDriver action extraction
There's a lot of parsing involved in action extraction. So this patch
implements only that - actually executing actions will be a future
patch.
2024-10-01 11:02:27 +02:00
Timothy Flynn
0c98c7637e LibWeb: Begin implementing the WebDriver Input State and Input Source
These concepts are rather tightly coupled. This implements the types and
AOs needed to handle the Perform Actions endoint.
2024-10-01 11:02:27 +02:00
Timothy Flynn
94c243acd6 LibWeb+WebContent: Partially implement WebDriver's JSON deserialize AO
In particular, we need to convert web element references to the actual
element. The AO isn't fully implemented because we will need to work out
mixing JsonValue types with JS value types, which currently isn't very
straight forward with our JSON clone algorithm.
2024-10-01 11:02:27 +02:00
Timothy Flynn
434663b1c6 LibWeb: Ensure numbers provided to WebDriver are "safe"
Numbers are limited to JS's Number.MAX_SAFE_INTEGER.
2024-10-01 11:02:27 +02:00
Timothy Flynn
71c1a1d8f4 LibWeb: Add a few more helpers to extract WebDriver properties 2024-10-01 11:02:27 +02:00
Timothy Flynn
8944c6db3f LibWeb+WebContent: Move WebDriver property extraction to a helper file
This will be needed outside of WebContent.
2024-10-01 11:02:27 +02:00
Timothy Flynn
5e99715377 LibWeb: Add helpers to convert a MouseButton to/from its DOM event code
Move the helper to convert MouseButton to its DOM event code to a public
header. And add a helper to convert in the opposite direction.
2024-10-01 11:02:27 +02:00
Sam Atkins
1217e7733f LibCore: Add StandardPaths::system_data_directories()
This is only used for finding font directories for now, but having a
convenient function for it means if anyone needs to use XDG_DATA_DIRS
in future, they're less likely to implement it themselves and miss the
case of it being present but empty.

We also now canonicalize the data directory paths, as we do for the
other standard paths.
2024-09-30 18:48:45 +02:00
Sam Atkins
3a935aa076 LibCore: Clarify StandardPaths::data_directory() name
Let's make it clear that this is for user data.
2024-09-30 18:48:45 +02:00
Sam Atkins
8fd7dd44de LibCore: Treat empty XDG_* environment variables as not present
The XDG spec repeatedly says, for example:

> If $XDG_DATA_HOME is either not set or empty, a default equal to
  $HOME/.local/share should be used.
- https://specifications.freedesktop.org/basedir-spec/latest/index.html

It's rare in practice, but does happen, for example in #1507 where we
would fail to find any system fonts if `XDG_DATA_DIRS` was blank.

This code now treats whitespace-only variables as empty too, which may
be overkill, but seems better to me than not doing so.
2024-09-30 18:48:45 +02:00
Jelle Raaijmakers
233b4f2ca8 LibMedia+everywhere: Remove superfluous and unused audio code
We had numerous NiH-based implementations of audio formats and metadata
that we now no longer need because we either don't make use of the code,
or we replaced its implementation by FFmpeg.
2024-09-30 18:48:12 +02:00
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
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
Tim Ledbetter
579a289d3d LibWeb: Fire error event when script has an execution error
We now use the "report an exception" AO when a script has an execution
error. This has mostly replaced the older "report the exception" AO in
various specifications. Using this newer AO ensures that
`window.onerror` is invoked when a script has an execution error.
2024-09-27 07:02:20 -04:00
Andrew Kaster
994457d7af LibMedia: Use build-time rather than configure-time check for avcodec
Rather than checking the avcodec version in CMake, check it using the
avcodec version macros in the only source file that needs to know about
the AVFrame API/ABI change in version 59.24.100. This is friendlier to
other build systems that would rather avoid configure time checks.
2024-09-27 06:45:32 -04:00
Timothy Flynn
157d41bb0d LibWeb: Form the correct representation of a WebDriver element reference
We are currently returning a JSON object of the form:

    {
        "name": "element-6066-11e4-a52e-4f735466cecf",
        "value": "foo"
    }

Instead, we are expected to return an object of the form:

    {
        "element-6066-11e4-a52e-4f735466cecf": "foo"
    }
2024-09-27 09:46:55 +01:00
Timothy Flynn
7a15e3ee5c LibWeb: Do not break WebDriver errors into multiple socket writes
Very similar to commit e5877cda61.

By sending as much data as we can in a single write, we see a massive
performance improvement on WPT tests that hammer WebDriver with errors.

On my Linux machine, this reduces the runtime of:
    /webdriver/tests/classic/perform_actions/invalid.py
from 45-60s down to 3-4s.
2024-09-27 09:46:55 +01:00
Timothy Flynn
e436c31b97 LibWeb: Ensure WebDriver response headers are exactly to spec
We must send a Cache-Control header, which then also requires that we
respond with an HTTP/1.1 response (the Pragma cache option is HTTP/1.0).

We should also send the Content-Type header using the same casing as is
written in the WebDriver spec (lowercase).

Both of these are explicitly tested by WPT.
2024-09-27 09:46:55 +01:00
Andreas Kling
749cf2d1b5 LibJS: Cache the shape for normal ECMAScriptFunctionObject prototypes
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
Instead of creating a unique new prototype shape every time a function
object is instantiated, we now keep one cached with the intrinsics.

This avoids a whole lot of shape allocations, reducing GC pressure.
2024-09-26 20:23:43 +02:00
Andreas Kling
795471ce31 LibWeb: Render CSS and SVG masks on the GPU if possible
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 (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
Instead of converting images to alpha masks on the CPU, we now delegate
that work to the GPU if possible, by way of SkSL shaders.

This noticeably speeds up https://vercel.com/ which has a ton of SVG
masking going on. The old implementation used 15% of CPU time when
loading the page, this one uses basically none.
2024-09-26 16:30:50 +02:00
Andreas Kling
1a4b0ded1f LibWeb: Let determine_the_origin() take an optional URL after all
I originally believed that this could never receive a null URL and the
spec was inaccurate, but it seems like it can indeed.

I don't have a distilled test, but this makes logging in with GitHub
work on https://v0.dev/
2024-09-26 10:14:09 +02:00
Andreas Kling
ef9208047d LibJS: Don't infinite loop on unknown console.log formatting specifiers 2024-09-26 10:14:09 +02:00
Jamie Mansfield
84351dfa51 LibWeb/Fetch: Handle edge cases in 'get, decode, and split'
Some checks are pending
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (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 (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
See:
- https://github.com/whatwg/fetch/pull/1769
- https://github.com/whatwg/fetch/commit/3153e5e
2024-09-26 08:09:31 +02:00
Sam Atkins
dcf55dd492 LibWeb/CSS: Clarify comment about cascading presentational hints
The spec allows us to either treat them as part of the UA origin, or as
its own origin before author styles. This second behaviour turns out to
be what we are currently doing, which is nice!

Funnily enough this was clarified in the spec barely a month after this
original comment was written. :^)
2024-09-26 08:08:38 +02:00
Sam Atkins
bea47a2554 LibWeb/CSS: Correct behavior of revert inside a @layer
`revert` is supposed to revert to the previous cascade origin, but we
previously had it reverting to the previous layer. To support both,
track them separately during the cascade.

As part of this, we make `set_property_expanding_shorthands()` fall back
to `initial` if it can't find a previous value to revert to. Previously
we would just shrug and do nothing if that happened, which only works
if the value you want to revert to is whatever is currently in `style`.
That's no longer the case, because `revert` should skip over any layer
styles that have been applied since the previous origin.
2024-09-26 08:08:38 +02:00
Timothy Flynn
96fbb33b13 LibWeb: Log when document.execCommand and family are called
These are used by WPT. Log the commands so we know what we need to
implement.
2024-09-25 14:03:46 -04:00
Timothy Flynn
b035f0cd3d WebContent+WebDriver: Log all unimplemented WebDriver endpoints
It's difficult to know what we need to implement if we silently ignore
these endpoints. Let's log the endpoints and their parameters, and clean
up the wall of FIXME comments to be easier to grok.
2024-09-25 14:03:46 -04:00
Tim Ledbetter
63632159ce UI: Add an option to enable autoplay globally 2024-09-24 23:50:54 +01:00
Jamie Mansfield
973f774e56 LibWeb/WebVTT: Implement VTTCue idl interface 2024-09-24 23:48:56 +01:00
Jamie Mansfield
1a012f279a LibWeb/WebVTT: Implement VTTRegion idl interface 2024-09-24 23:48:56 +01:00
Jamie Mansfield
cfec88feb3 LibWeb/HTML: Implement TextTrackCueList idl interface 2024-09-24 23:48:56 +01:00
Jamie Mansfield
0b2449d8d2 LibWeb/HTML: Implement TextTrackCue idl interface 2024-09-24 23:48:56 +01:00
Timothy Flynn
e5877cda61 WebDriver: Do not break WebDriver responses into multiple socket writes
WPT uses Python's http.client.HTTPConnection to send/receive WebDriver
messages. For some reason, on Linux, we see an ~0.04s delay between the
WPT server receiving the WebDriver response headers and its body. There
are tests which make north of 1100 of these requests, which adds up to
~44s.

These connections are almost always going to be over localhost and able
the be sent in a single write. So let's send the response all at once.

On my Linux machine, this reduces the runtime of /cookies/name/name.html
from 45-60s down to 3-4s.
2024-09-24 23:43:22 +01:00
Andreas Kling
9765a733d0 LibWeb: Don't extrapolate transition properties for unknown properties
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
If we don't recognize a given transition-property value as a known CSS
property (one that we know about, not necessarily an invalid one),
we should not extrapolate the other transition-foo values for it.

Fixes #1480
2024-09-24 21:53:43 +02:00
Julius Elshoff
de31ea5852 LibWeb: Rename 'cross-origin opener policy' to 'opener policy'
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-24 12:30:21 +01:00
Sam Atkins
51f82c1d93 LibJS: Update wording from Console spec
https://github.com/whatwg/console/pull/240 is an editorial change to use
the term "implementation-defined" more consistently. This seems to be
the only instance in the spec text which we quote verbatim.
2024-09-24 10:19:19 +01:00
Daniel La Rocque
ed04124cbf LibWeb: Fix "attempt to update a history entry's document"
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 updates our implementation of
[attempt-to-populate-the-history-entry's-document](https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document)
after fixes were made to the logic inside the queued task in
cdd014ae84 (diff-41cf6794ba4200b839c53531555f0f3998df4cbb01a4d5cb0b94e3ca5e23947dL99534).
2024-09-23 16:49:40 -06:00
Daniel La Rocque
8b4dde0b09 LibWeb: Make make_unsalvageable a public field 2024-09-23 16:49:40 -06:00
Timothy Flynn
57e4fb0cae LibWeb: Clean up HTMLInputElement-related includes
This mainly uses forward declarations as appropriate for input element
related files. This reduces the number of targets being built when we
change HTMLInputElement.h from 430 to 44.
2024-09-23 13:31:41 -04:00
ChaseKnowlden
ee54f9ee95 LibWeb: Remove associated transitions when clearing transitions
This fixes a crash on nextjs.org
2024-09-23 16:08:49 +01:00
Bastiaan van der Plaat
9fbf5039a6 LibWeb: Apply input range accent color not when appearance: none; 2024-09-23 11:04:42 -04:00
Bastiaan van der Plaat
51f5c4a718 LibWeb: Make input color a rectangle shape like other browser engines 2024-09-23 11:04:42 -04:00
Tim Ledbetter
0c0595bb31 LibWeb: Allow WebSockets to be established within workers
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
Previously, we would crash when attempting to establish a web socket
connection from inside a worker, as we were assuming that the ESO's
global object was a `Window`.
2024-09-23 08:49:16 -04:00
Tim Ledbetter
8939ae8522 WebContent: Return errors from unimplemented WebDriver endpoints
Previously, some otherwise unimplemented WebDriver endpoints were
indicating that they had executed successful, this was causing a large
number of Web Platform Tests to time out when they should have failed.
2024-09-23 08:43:18 -04:00
Tim Ledbetter
583eef265f LibWeb: Update close_top_level_traversable() to match the spec 2024-09-23 14:38:17 +02:00
Timothy Flynn
76662d2f01 LibWebView+UI: Remove history traversal WebView callbacks
Some checks are pending
Run test262 and test-wasm / run_and_update_results (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
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
Lint Code / lint (push) Waiting to run
Push notes / build (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
We can handle these entirely within LibWebView.
2024-09-22 14:11:18 -04:00
Timothy Flynn
9e21e44841 LibWebView+WebContent+UI: Remove cookie related WebView callbacks
There's no need for each individual chrome to implement the cookie
callbacks. We can handle these entirely within LibWebView.
2024-09-22 14:11:18 -04:00
Aliaksandr Kalenik
74588a0a16 LibWeb: Remove all font loaders linked to a StyleSheet when it's deleted
When a style sheet is removed, all font loaders created from that style
sheet should also be removed.
2024-09-22 20:10:30 +02:00
Timothy Flynn
8472b2b1fb LibThreading: Remove the thread pool
The thread pool test is currently flakey and takes over 2 minutes to run
on CI. It also currently has no users now that RequestServer uses curl,
so let's just remove it for now. If we need it in the future, we can
revive it from git history.
2024-09-22 14:07:16 -04:00
Timothy Flynn
93ec010bee RequestServer: Remove unused threading-related includes 2024-09-22 14:07:16 -04:00
Andreas Kling
57e26ed6b9 LibWeb: Abort ongoing fetch before starting a new link element fetch
If we decide to fetch another linked resource, we don't care about the
earlier fetch and can safely abort it.

This fixes an issue on GitHub where we'd load the same style sheet
multiple times and invalidate style for the entire document every time
it finished fetching.

By aborting the ongoing fetch, no excess invalidation happens.
2024-09-22 18:42:40 +02:00
Andreas Kling
b8ce34068f LibWeb: Invalidate less style on textContent change and node removal
...unless there are :has() selectors present. Then we have to invalidate
everything for now.
2024-09-22 18:42:40 +02:00
Andreas Kling
7d644ecd50 LibWeb: Distinguish parent/child on style invalidation for DOM insertion 2024-09-22 18:42:40 +02:00
Andreas Kling
f351f75a34 LibWeb: Don't try to invalidate style for character data nodes
Character data nodes like text and HTML comments don't have style,
so let's just exit invalidation immediately for those.
2024-09-22 18:42:40 +02:00
Andreas Kling
8beb7c7700 LibWeb: Cache whether there are any :has() selectors present
As useful as they may be to web developers, :has() selectors complicate
the style invalidation process quite a lot.

Let's have StyleComputer keep track of whether they are present at all
in the current set of active style sheets. This will allow us to
implement fast-path optimizations when there are no :has() selectors.
2024-09-22 18:42:40 +02:00
Andreas Kling
df048e10f5 LibWeb: Include siblings+descendants when invalidating style
When an element is invalidated, it's possible for any subsequent sibling
or any of their descendants to also need invalidation. (Due to the CSS
sibling combinators, `+` and `~`)

For DOM node insertion/removal, we must also invalidate preceding
siblings, since they could be affected by :first-child, :last-child or
:nth-child() selectors.

This increases the amount of invalidation we do, but it's more correct.

In the future, we will implement optimizations that drastically reduce
the number of elements invalidated.
2024-09-22 18:42:40 +02:00
Timothy Flynn
5d71758742 LibWeb: Move initial creation of Unicode segmenters to the Document
The expensive part of creating a segmenter is doing the locale and UCD
data lookups at creation time. Instead of doing this once per text node,
cache the segmenters on the document, and clone them as needed (cloning
is much, much cheaper).

On a profile loading Ladybird's GitHub repo, the following hot methods
changed as follows:

    ChunkIterator ctor: 6.08% -> 0.21%
    Segmenter factory:  5.86% ->    0%
    Segmenter clone:    N/A   -> 0.09%
2024-09-22 18:42:31 +02:00
Andreas Kling
42a1a0bd73 LibWeb: Put CSS transitions debug spam behind CSS_TRANSITIONS_DEBUG
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-22 10:46:54 +02:00
Andreas Kling
e40ad73ae7 LibWeb: Allow setting shorthand CSS properties via CSSStyleDeclaration
We now expand shorthands into their respective longhand values when
assigning to a shorthand named property on a CSSStyleDeclaration.

We also make sure that shorthands can be round-tripped by correctly
routing named property access through the getPropertyValue() AO,
and expanding it to handle shorthands as well.

A lot of WPT tests for CSS parsing rely on these mechanisms and should
now start working. :^)

Note that multi-level recursive shorthands like `border` don't work
100% correctly yet. We're going to need a bunch more logic to properly
serialize e.g `border-width` or `border` itself.
2024-09-22 09:45:59 +02:00
Mohamed amine Bounya
6fe43e9f73 LibWeb/HTML: Select html input elements with selectable text
only select input elements that select applies to and has a
selectable text.
2024-09-22 06:43:57 +02:00
Andreas Kling
d77843e2f0 LibHTTP: Remove the now-unused job classes
The request/response classes are still used in a couple places and will
need more careful removal.
2024-09-22 06:43:12 +02:00