Commit graph

71665 commits

Author SHA1 Message Date
Timothy Flynn
9c99c48f47 LibWebView+UI: Generate the application debug menu
By migrating the debug menu to LibWebView, the AppKit and Qt UIs are now
in sync - the AppKit UI was previously missing some actions.

Further, this inadvertently fixes bugs around applying debug settings to
new web views, especially across site-isolated processes. We were
previously not applying settings appropriately; this now "just works" in
the LibWebView infra.
2025-09-11 14:23:45 -04:00
Timothy Flynn
5d8d9b337a LibWebView+UI: Generate application context menus
This migrates all duplicated context menus from the UIs to LibWebView.
The context menu actions are now largely handled directly in LibWebView,
with some UI-specific callbacks added to display e.g. confirmation
dialogs.

Actions that only ever apply to a specific web view are stored on the
ViewImplementation itself. Actions that need to be dynamically applied
to the active web view are stored on the Application.
2025-09-11 14:23:45 -04:00
Timothy Flynn
a5be0f0a18 LibWebView+UI: Add structures to hold context menu and action data
We currently duplicate a lot of code to handle application/context menus
and actions. The goal here is to hold the data for the menus and actions
in LibWebView. Each UI will then be able to generate menus from the data
on-the-fly.

The structures added here are meant to support generic and checkable
actions, action groups, submenus, etc.
2025-09-11 14:23:45 -04:00
Timothy Flynn
2632b1375b LibWebView+UI: Extract some UI-specific displays to Application helpers
This is preparation for moving application menus to LibWebView. We will
need a way to display these dialogs from outside of the UI layer.
2025-09-11 14:23:45 -04:00
Timothy Flynn
95dca6c787 UI/Qt: Clean up some manual forward declarations
Several are unused, and there's certainly no need for the `using`
declaration.
2025-09-11 14:23:45 -04:00
Timothy Flynn
171937cc72 LibWebView: Return a ByteString from WebView::url_text_to_copy
The result is currently only used as a StringView, but a future commit
will place the result in Web::Clipboard::SystemClipboardRepresentation,
which requires a ByteString (there's no UTF-8 clipboard requirement).
2025-09-11 14:23:45 -04:00
Sam Atkins
524a161a51 LibWeb: Take AbstractElement in start_a_transition() 2025-09-11 18:45:35 +02:00
Sam Atkins
e6bb0ab000 LibWeb/CSS: Take AbstractElement in compute_transitioned_properties() 2025-09-11 18:45:35 +02:00
Sam Atkins
77f1057992 LibWeb/CSS: Take AbstractElement in cascade_custom_properties() 2025-09-11 18:45:35 +02:00
Sam Atkins
b49d00996b LibWeb/CSS: Take AbstractElement in compute_text_align() 2025-09-11 18:45:35 +02:00
Sam Atkins
fa790e5095 LibWeb/CSS: Take AbstractElement in for_each_matching_rules() 2025-09-11 18:45:35 +02:00
Sam Atkins
cdc4f7c989 LibWeb/CSS: Take AbstractElement to compute alias mapping contexts 2025-09-11 18:45:35 +02:00
Sam Atkins
cdbaa73576 LibWeb/CSS: Take AbstractElement in box-type transformation functions 2025-09-11 18:45:35 +02:00
Sam Atkins
44e70d9087 LibWeb/CSS: Take AbstractElement in compute_cascaded_values() 2025-09-11 18:45:35 +02:00
Sam Atkins
82d194ba99 LibWeb/CSS: Take AbstractElement in start_needed_transitions() 2025-09-11 18:45:35 +02:00
Sam Atkins
acb211174d LibWeb/CSS: Take AbstractElement in MatchingRule collection 2025-09-11 18:45:35 +02:00
Sam Atkins
50c0b4549c LibWeb/CSS: Take AbstractElement in collect_animation_into() 2025-09-11 18:45:35 +02:00
Sam Atkins
b2ee4a9444 LibWeb/CSS: Take AbstractElement in StyleComputer::compute_properties()
As noted, the chunk of this method that deals with animations could do
with some helpers on AbstractElement, but I'm leaving that until it's
clearer how animations and pseudo-elements should interact.
2025-09-11 18:45:35 +02:00
Sam Atkins
0293176429 LibWeb/CSS: Take AbstractElement in StyleComputer::get_*_inherit_value() 2025-09-11 18:45:35 +02:00
Sam Atkins
64c3319147 LibWeb/CSS: Take AbstractElement in font computation methods 2025-09-11 18:45:35 +02:00
Sam Atkins
263c51f6ac LibWeb/CSS: Take AbstractElement in compute_pe_style_if_needed() 2025-09-11 18:45:35 +02:00
Sam Atkins
cee84d22a0 LibWeb/CSS: Take AbstractElement in cascade_declarations() 2025-09-11 18:45:35 +02:00
Sam Atkins
8706a6165d LibWeb: Take AbstractElement in compute_style_impl() 2025-09-11 18:45:35 +02:00
Sam Atkins
d0b6fadb6d LibWeb/DOM: Add CascadedProperties accessors to AbstractElement 2025-09-11 18:45:35 +02:00
Sam Atkins
27aab90e66 LibWeb: Take AbstractElement in StyleComputer::compute_style() 2025-09-11 18:45:35 +02:00
Sam Atkins
1667d6d4da LibWeb/CSS: Use AbstractElement in CSSStyleProperties::property()
Avoids duplicating the "get layout node" logic.
2025-09-11 18:45:35 +02:00
Sam Atkins
916e24de30 LibWeb/CSS: Take AbstractElement in resolve_unresolved_properties() 2025-09-11 18:45:35 +02:00
Sam Atkins
83aee2c7fc LibWeb: Take AbstractElement in resolve_unresolved_style_value() 2025-09-11 18:45:35 +02:00
Sam Atkins
40ab71e41e LibWeb/DOM: Expose AbstractElement outside of LibWeb
This ends up used by the WebContent service's ConnectionFromClient in a
later commit.
2025-09-11 18:45:35 +02:00
Sam Atkins
583d74e3a9 LibWeb/DOM: Reduce AbstractElement.h's includes
This doesn't need all of Selector.h and its various includes, it just
needs the PseudoElement enum.

StringStyleValue.h was transitively including ComponentValue.h through
this, so it now includes it directly.
2025-09-11 18:45:35 +02:00
Sam Atkins
5534ed6715 LibWeb/CSS: Use generated code to convert between dimension units 2025-09-11 17:06:44 +01:00
Sam Atkins
82f5be871a LibWeb: Generate the "Numeric Factory" OM methods on the CSS namespace
Generating boilerplate is nice! This also has the bonus that we're more
correct: I included all the units listed in the spec before,
(see https://drafts.css-houdini.org/css-typed-om-1/#numeric-factory )
but we're supposed to exactly include ones for the units we support:

> If an implementation supports additional CSS units that do not have a
  corresponding method in the above list, but that do correspond to one
  of the existing CSSNumericType values, it must additionally support
  such a method, named after the unit in its defined canonical casing,
  using the generic behavior defined above.

> If an implementation does not support a given unit, it must not
  implement its corresponding method from the list above.

Now, our factory functions will exactly match the units we support.

The changed test result is partly the order being different, and partly
that the container-query units are no longer included as we don't
actually support them.
2025-09-11 17:06:44 +01:00
Sam Atkins
66710f0065 LibIDL: Support extended attributes on namespace members
Specifically, this is so that ImplementedAs can be used on them.
2025-09-11 17:06:44 +01:00
Sam Atkins
6e3cd7dd06 LibIDL: Support partial namespaces 2025-09-11 17:06:44 +01:00
Sam Atkins
b3c099bd68 LibWeb/CSS: Use dimension_for_unit() when we don't need the exact unit
A small code reduction, and means that NumericType will catch if new
dimensions are added, and attr() will just work in that case.
2025-09-11 17:06:44 +01:00
Sam Atkins
b3e32445d3 LibWeb/CSS: Use generated FooUnit types instead of Foo::Type
I've also renamed the `m_type` and `type()` members to be `m_unit` and
`unit()` instead, to match what they actually are.
2025-09-11 17:06:44 +01:00
Sam Atkins
bda4f8cbe8 LibWeb/CSS: Use raw_value() to bounds-check all dimension types
This avoids constructing temporary objects to compare against, and
reduces the amount of code. Also, a few of these were actually wrong!
2025-09-11 17:06:44 +01:00
Sam Atkins
cbc019350b LibWeb/CSS: Generate code for CSS dimension units 2025-09-11 17:06:44 +01:00
Veeti Paananen
5e23df7d8a LibWeb: Fix case insensitivity for HTMLElement "hidden" attribute 2025-09-11 15:20:18 +02:00
Tim Ledbetter
bf8b8c260a LibWeb: Simplify interpolation of mixed percentage-dimension values
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-09-11 06:10:23 +01:00
Callum Law
a46453f234 LibWeb: Map logical alias transition properties to physical counterparts
Transitions apply after logical properties are mapped to their physical
counterparts so we should apply this mapping to `transition` properties

Gains us 20 WPT tests.
2025-09-11 06:08:07 +01:00
Callum Law
62176391dd LibWeb: Include z-index in transition: all
Gains us 37 WPT tests.
2025-09-11 06:08:07 +01:00
Callum Law
0209e502cf LibWeb: Use expanded longhands when computing transition properties
Using longhands rather than expanded longhands meant for instance that
we wouldn't transition `border-top-width` if we had `border` as the
transition property.
2025-09-11 06:08:07 +01:00
Callum Law
af431d800b Tests: Import/create tests related to transition property handling
Done in a distinct commit to see progress over following commits
2025-09-11 06:08:07 +01:00
Callum Law
6453c2cf71 LibWeb: Use correct animation type for fill property
This was incorrectly marked as `none` when it should be
`by-computed-value`.

Gains us 103 WPT tests.
2025-09-11 05:31:27 +01:00
Psychpsyo
c04f83f5f4 LibWeb: Add view transition related user relevancy
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-09-10 17:37:41 +01:00
Tim Ledbetter
9c062d9d4e LibWeb: Improve interpolation of mixed percentage-dimension values
If we are interpolating between a dimension and a percentage value and
the dimension component is 0, we now return a percentage value rather
than a `calc()` value.
2025-09-10 17:00:20 +01:00
Pratyush Nair
01be928a16 LibWeb: Avoid dereferencing a null pointer to document 2025-09-10 16:57:36 +01:00
Feng Yu
66d18170c6 LibWeb: Add activeElement attribute in ShadowRoot 2025-09-10 16:52:39 +01:00
Psychpsyo
0989c3cdaf LibWeb: Keep view transition pseudo styles in sync with new element
This makes it so that view-transition pseudo-element styles are
updated before returning them from window.getComputedStyle(). This
is necessary because they could be outdated, in case JS has
modified the styles of the elements they are trying to stay in sync
with since last frame.

The corresponding WPT test has not been imported, since it still
fails for unrelated reasons.
2025-09-10 16:39:43 +01:00