Commit graph

8827 commits

Author SHA1 Message Date
Tim Ledbetter
39e17e83f9 headless-browser: Allow the -f argument to be used multiple times
A test path is now included if it matches any of the given globs.
2025-02-05 06:58:52 -05:00
Tim Ledbetter
c67035b9c1 LibCore/ArgsParser: Treat multi-use arguments as required 2025-02-05 06:58:52 -05:00
Timothy Flynn
0a46b5cbb1 LibWeb: Check for closed browsing contexts before dispatching actions
See: https://github.com/w3c/webdriver/commit/0ac18fa
2025-02-05 11:33:33 +00:00
Timothy Flynn
28fb30b22f LibWeb: Move AO to check if a browsing context is open to a helper file
This will be needed outside of WebDriverConnection.cpp.
2025-02-05 11:33:33 +00:00
Glenn Skrzypczak
0fe30886f5 LibWeb/CSS: Implement mix-blend-mode
This adds support for the `mix-blend-mode` CSS property.
2025-02-05 11:26:58 +00:00
Glenn Skrzypczak
8575bddfe6 LibWeb/Canvas: Support globalCompositionOperation
Canvas now supports compositing and various blending modes via the
`globalCompositeOperation` attribute.
2025-02-05 11:26:58 +00:00
Andreas Kling
b8537f760d Revert "LibWeb: Make "assign slottables for a tree" fast when there are no slots"
This reverts commit adc25af8e2.

This caused images to stop loading on https://reddit.com/ and needs
more investigation.
2025-02-04 22:19:25 +01:00
Tim Ledbetter
67c950b002 LibWeb: Update create_element() to follow the latest specification 2025-02-04 20:07:32 +00:00
Tim Ledbetter
08c68cf699 LibWeb: Set is value when creating a customized built-in element 2025-02-04 20:07:32 +00:00
Tim Ledbetter
70097a7141 LibWeb: Add missing elements to valid local name map
Previously, attempting to create a custom element that extended any of
these elements would fail.
2025-02-04 20:07:32 +00:00
Sam Atkins
6d0fcb8f9a LibWeb/SVG: Rename text-space-collapse to white-space-collapse
This is the current name for this property in CSS-Text-4. We don't
implement it, but at least our "missing property" message can be about
one we haven't implemented instead of one that's redundant. :^)
2025-02-04 12:25:08 +01:00
Sam Atkins
26b7946123 LibWeb: Add NavigateEvent.sourceElement
Corresponds to:
- https://github.com/whatwg/html/pull/10898
- https://github.com/whatwg/html/pull/10971

I've also updated the imported WPT test as it's been recently changed to
account for 10898 being merged.
2025-02-04 12:24:50 +01:00
Luke Warlow
62f4cebbee LibWeb: Fix dialog.requestClose() crash
The spec previously asserted that close watcher was not null.

This could lead to a crash in some situations,
so instead we skip to close the dialog.
2025-02-04 12:22:25 +01:00
Sam Atkins
6147557999 LibWebView: Normalize source-code text before highlighting it
The previous code to determine the SourceDocument's lines was too naive:
the source text can contain other newline characters and sequences, and
the HTML/CSS/JS syntax highlighters would take those into account when
determining what line a token is on. This disagreement would cause
incorrect highlighting, or even crashes, if the source didn't solely use
`\n` for its newlines.

In order to have everyone agree on what a line is, this patch first
processes the source to replace all newlines with `\n`. The need to
copy the source like this is unfortunate, but viewing the source is a
rare enough action that this should not cause any noticeable
performance problems.

As the callers have a String, and we want a String, this also changes
the function parameters to keep the source as a String instead of
converting it to StringView and back.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/3169
2025-02-04 08:49:25 +00:00
Felipe Muñoz Mazur
f6c4304e89 LibWeb: Check if event is not "beforeunload" before cancelling 2025-02-03 19:17:58 +00:00
Aliaksandr Kalenik
f5ba22d3e8 LibWeb/DOM: Don't use recursion for subtree traversal in Node.h
This change is mainly motivated by the fact that iterating in a loop
makes profiles easier to read and understand where time was spent in
traversal callback. Additionally, using a loop reduces function call
overhead and ensures constant stack usage.
2025-02-03 18:36:57 +01:00
Aliaksandr Kalenik
dfcee2bbdf LibWeb/DOM: Inherit Node from TreeNode
This allows to delete lots of tree helper functions duplicated between
Node and TreeNode.
2025-02-03 18:36:57 +01:00
Aliaksandr Kalenik
ec6201806f LibWeb: Delete tree treversal methods defined in Paintable.h
Those are duplicates of ones inherited from TreeNode.
2025-02-03 18:36:57 +01:00
Jelle Raaijmakers
314f4ff0da LibWeb: Prevent double page title update in DOM::Document
This ad-hoc code informs the client of a potentially changed page title.
But because we always update the title element (either the SVG or HTML
title) the client was already informed, causing the code to run twice.
2025-02-03 18:34:22 +01:00
Mehran Kamal
cfe6702767 LibWeb/CSS: Fix linear-gradient single color-stop usage
The Web::CSS::Parser's GradientParsing ignores color-stops if
it is only a single one. This change allows to have color-stops
with double positions against a single color.

Further, also allows for `linear-gradient(black)` and similar
other gradient functions
2025-02-03 17:24:10 +00:00
Andreas Kling
4fa372564d LibWeb: Support both ::before/::after pseudo elements on button elements
This was mainly a matter of deferring the wrapping of the button's
children until after its internal layout tree has been constructed.
That way we don't lose any pseudo elements spawned along the way.

Fixes #2397.
Fixes #2399.
2025-02-03 15:59:38 +01:00
Aliaksandr Kalenik
0f17ad9ebc LibWeb: Use fast CSS selector matching in default matches() code path
Before this change, checking if fast selector matching could be used was
only enabled in style recalculation and hover invalidation. With this
change it's enabled for all callers of SelectorEngine::matches() by
default. This way APIs like `Element.matches()` and `querySelector()`
could take advantage of this optimization.
2025-02-03 10:28:08 +01:00
Tim Ledbetter
6d7b7e7822 LibWeb: Use as to cast global object to WindowOrWorkerGlobalScopeMixin
No functional changes.
2025-02-02 17:18:56 +01:00
Sam Atkins
3794665b0b LibWeb/DOM: Add spec steps for WebDriver BiDi to document history algo
This is "update document for history step application" but that's too
long for the commit title. :^)

No code changes, just adding more FIXME comments for the new steps.
(And indented step 7's substeps for clarity.)

Corresponds to https://github.com/whatwg/html/pull/10910
2025-02-01 23:32:39 +01:00
Aliaksandr Kalenik
0c5b61b7e1 LibWeb: Fix infinite repaint loop when cached display list is used
Before this change, `m_needs_repaint` was reset in
`Document::record_display_list()` only when the cached display list was
absent. This meant that if the last triggered repaint used the cached
display list, we would keep repainting indefinitely until the display
list was invalidated (We schedule a task that checks if repainting is
required 60/s).

This change also moves `m_needs_repaint` from Document to
TraversableNavigable as we only ever need to repaint a document that
belongs to traversable.
2025-02-01 23:31:16 +01:00
Aliaksandr Kalenik
0cfe90b59e LibWeb: Don't allow "display: none" start CSS animations
This is both a correctness fix and a performance optimization.
2025-02-01 13:42:00 +01:00
Gingeh
93f9ed72d2 LibWeb/SVG: Skip unwanted transformations on clip-path 2025-02-01 13:38:56 +01:00
Gingeh
3f8d4c2c92 LibWeb/SVG: Make SVGClipPathElement inherit from SVGGraphicsElement 2025-02-01 13:38:56 +01:00
Ali Mohammad Pur
08ebfaff17 LibRegex: Take trailing inversion state into account in block comparison
Fixes #3421.
2025-02-01 11:30:02 +01:00
Gingeh
59ba2fb2ee LibWeb: Clear stylesheet pointer when disabling link element
This fixes a crash when enabling an already disabled link element.
Fixes a crash when changing mdbook themes.
2025-02-01 08:11:37 +00:00
Sam Atkins
1bd73184da LibWeb/HTML: Update get_an_elements_noopener() to current spec
Note that this preemptively includes this fix to step 3:
https://github.com/whatwg/html/pull/10962
2025-01-31 17:27:03 +00:00
Sam Atkins
6bc38832af LibWeb/HTML: Update follow_the_hyperlink() to current spec 2025-01-31 17:27:03 +00:00
Sam Atkins
7fcd8df49b LibWeb/HTML: Update submit_form() to current spec 2025-01-31 17:27:03 +00:00
Sam Atkins
9254994687 LibWeb/HTML: Update get_an_elements_target() to current spec 2025-01-31 17:27:03 +00:00
Tim Ledbetter
8dfd382e12 LibWeb: Use as_if instead of dynamic_cast in a few places 2025-01-31 14:29:48 +01:00
Sam Atkins
6ebe19d13b LibWeb/CSS: Correct "percentages-resolve-to" data for properties
These were missing for properties that take a `<position>`, and were
incorrectly present for opacity-related properties.
2025-01-31 14:24:39 +01:00
Sam Atkins
d15e1eb9f6 LibWeb/CSS: Don't multiply non-canonical dimensions in calc()
This fixes the layout of tweakers.net, which regressed when calc
simplification was added in ee712bd98f.
2025-01-31 14:24:39 +01:00
Luke Wilde
6701aaf1cd LibWeb/CSS: Make inline-size a logical alias for the height property 2025-01-31 14:18:21 +01:00
Luke Wilde
010cdd8f90 LibWeb/CSS: Implement the ({min,max}-)block-size properties
These are heavily used by morrisons.com, using them in place of the
usual properties these map to.
2025-01-31 14:18:21 +01:00
Jelle Raaijmakers
f204970052 LibWeb: Ignore fragments with pointer-events: none in hit-testing 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
e7add9abc6 LibWeb: Remove unnecessary const_casts from TextPaintable 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
cbe78454fc LibWeb: Remove unused includes from PaintableFragment 2025-01-31 13:37:15 +01:00
Jelle Raaijmakers
342cb7addf LibGfx+LibWeb: Reuse DisplayListPlayer and PaintingSurface when possible
Previously, we were reinstantiating the DisplayListPlayer and
PaintingSurface on every paint.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
a4639b3d8e LibGfx: Remove superfluous Gfx::s from PaintingSurface
No functional changes.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
7b3d4a9edb LibWeb: Cache Skia backend context in TraversableNavigable
We just need to create the backend context once and let Skia handle the
context's state.

On my machine, this reduces the load time for https://tweakers.net from
7.5s to 3.5s.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
1d81c4d8eb LibGfx: Use same order for macOS and Vulkan specific code
No functional changes.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
4fbeea6482 LibWeb+Services: Remove unused #includes
No functional changes.
2025-01-31 13:28:09 +01:00
Jelle Raaijmakers
20fbd38b77 LibWeb: Remove MetalContext from TraversableNavigable
There's no need for TraversableNavigable to keep track of the
MetalContext; our SkiaBackendContext keeps a reference to it.
2025-01-31 13:28:09 +01:00
sideshowbarker
738cb24691 LibWeb: Fire keypress event for Enter, Shift+Enter, and Ctrl+Enter keys
For web compat and interop with other engines, this change makes us fire
“keypress” events for the Enter key and for the combination of the Enter
key with the Shift or Ctrl keys — despite the fact the UI Events spec
states at https://w3c.github.io/uievents/#event-type-keypress it must be
fired “if and only if that key normally produces a character value”.

See https://github.com/w3c/uievents/issues/183#issuecomment-448091687
and https://github.com/w3c/uievents/issues/266#issuecomment-1887917756.
2025-01-31 12:07:17 +00:00
Feng Yu
30d1eb4caf LibWeb/Fetch: Sync with spec update (whatwg/fetch#1569)
This patch synchronizes changes from whatwg/fetch#1569 and
resolves a related FIXME: "Refactor this to the new version of the
spec introduced with whatwg/fetch@464326e.”
2025-01-30 16:24:50 -07:00