Commit graph

71645 commits

Author SHA1 Message Date
Callum Law
a805635e40 LibWeb: Compute dimension percentage mix as percentage where applicable
When we have a `calc` which is a mix of a dimension and a percentage, we
should use the percentage alone for the computed value if the dimension
component is 0 e.g. `calc(50% + 0px)` should use `50%` as it's computed
value.
2025-09-12 15:04:30 +01:00
Nico Weber
9272df7a86 Everywhere: Fix a few unreachable-return / unreachable-break warnings
I was playing with clang's -Wunreachable-code-aggressive a bit.
This fixes a handful uncontroversial things it flags.

No behavior change.
2025-09-12 14:33:14 +01:00
Sam Atkins
a139ad1c44 LibWeb/CSS: Implement CSSNumericValue.to()
Some checks are pending
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
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
Tries to convert the CSSNumericValue to a CSSUnitValue with the given
unit.

This gets us the remaining 11 WPT subtests for this method.
2025-09-12 13:45:41 +02:00
Sam Atkins
80abffd2e8 LibWeb/CSS: Implement "Create a sum value" 2025-09-12 13:45:41 +02:00
Sam Atkins
1c952b01ac LibWeb/CSS: Implement "Convert a CSSUnitValue" 2025-09-12 13:45:41 +02:00
Sam Atkins
050d3a58cf LibWeb/CSS: Generate canonical/compatible unit functions
These are used by `CSSNumericValue.to(unit)` which attempts to convert
to the provided unit.
2025-09-12 13:45:41 +02:00
Sam Atkins
5a42b7a40f LibWeb/CSS: Implement product_of_two_unit_maps()
Helper function for combining two UnitMaps.
2025-09-12 13:45:41 +02:00
Sam Atkins
e6e380b109 LibWeb/CSS: Implement "create a type from a unit map" 2025-09-12 13:45:41 +02:00
Sam Atkins
09a6b179d0 LibWeb/CSS: Take FlyString in NumericType::create_from_unit()
We only call this with FlyStrings, so we might as well.
2025-09-12 13:45:41 +02:00
Sam Atkins
995c19da56 LibWeb/CSS: Return unit names as FlyStrings
From the CSS token side, we already have these in FlyString form. From
the generated code side, we can easily return FlyStrings instead of
StringViews. So, let's do that, and save some work converting back and
forth.
2025-09-12 13:45:41 +02:00
Sam Atkins
59c4076066 LibWeb/CSS: Mark CSSStyleValue classes final where possible 2025-09-12 13:45:41 +02:00
Tim Ledbetter
3099459504 LibWeb: Return the same DataTransfer.types() array if unmodified 2025-09-12 12:30:33 +02:00
Tim Ledbetter
3fc7613bf1 LibWeb: Implement DataTransferItemList.clear() 2025-09-12 12:30:33 +02:00
Tim Ledbetter
0c1532626f LibWeb: Implement DataTransfer.clearData() 2025-09-12 12:30:33 +02:00
Tim Ledbetter
d9341adb1e LibWeb: Implement DataTransferItemList.remove() 2025-09-12 12:30:33 +02:00
Veeti Paananen
8ab3549585 LibWeb: Add support for HTMLHRElement size presentational hint 2025-09-12 11:23:38 +01:00
Zaggy1024
26a21f2070 LibMedia: Make MatroskaDemuxer::get_codec_id_for_string static 2025-09-12 11:23:47 +02:00
Zaggy1024
9077873803 LibMedia: Stop initializing an empty optional in MatroskaDemuxer
There was a warning for the Optional initializer having no effect, but
removing the initializer caused the call to add a track to the HashMap
to complain. A constructor looks a little nicer here anyway.
2025-09-12 11:23:47 +02:00
Zaggy1024
ae7f82591b LibMedia: Separate file duration from track duration in Demuxer
Most users will only care about the total file duration, and shouldn't
be required to determine the file duration from multiple track
durations. To facilitate that, add a total_duration() function that
returns the demuxer's duration not associated to any particular track.
2025-09-12 11:23:47 +02:00
Zaggy1024
6653b747ff LibMedia: Allow demuxers to specify a preferred track
...and return all tracks of a matching type from FFmpegDemuxer, rather
than only the single best one.
2025-09-12 11:23:47 +02:00
Zaggy1024
8d64e72655 LibMedia: Remove the duration field from Track::VideoData
Most demuxer users will only care about the whole file's duration
anyway, so this field doesn't really do us any good.
2025-09-12 11:23:47 +02:00
Aliaksandr Kalenik
db5fd614ac LibWeb: Require layout update for less properties in getComputedStyle()
Some properties like `justify-items`, `grid`, or `display` do affect
layout, but their used values can be obtained without performing a
layout calculation.

This change introduces a new helper,
`property_needs_layout_for_getcomputedstyle()`, specifically for use by
`CSSStyleProperties::property()`. It returns true only for properties
such as `width`, `height`, `margin`, `padding`, `top`, and `left`, where
an up-to-date layout is required to return the correct used value.
2025-09-12 11:06:16 +02:00
Callum Law
815e77c04d LibWeb: Respect text-underline-offset when rendering underlines 2025-09-12 07:07:15 +01:00
Callum Law
9aa2d1bd3e LibWeb: Make text-decoration lines entire width of fragment
This fixes an issue where text decorations (e.g. underlines) of text
split across multiple fragments would have unintended 1px gaps.

Gains us 2 WPT passes (imported)
2025-09-12 07:07:15 +01:00
Callum Law
858450922b LibWeb: Parse and compute text-underline-offset property 2025-09-12 07:07:15 +01:00
Zaggy1024
f9305e7e67 LibMedia: Format switch statements consistently in FFmpegVideoDecoder
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 18:41:58 -05:00
Zaggy1024
924ba6c1f4 LibMedia: Use FFmpeg's info to tell us if YUVJ is full-range
It reports this correctly for the video linked in #4993, and likely any
other videos using the YUVJ format, so we don't need this extra check.
2025-09-11 18:41:58 -05:00
Timothy Flynn
4a5c374084 UI/Qt: Place the "reset zoom" button to the left of the hamburger menu
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
It feels a bit awkward having this button displace the menu.
2025-09-11 14:23:45 -04:00
Timothy Flynn
9684e6dbc5 LibWebView+UI: Generate the zoom menu 2025-09-11 14:23:45 -04:00
Timothy Flynn
7d6ea99d0d LibWebView+UI: Generate the preferred color, contrast, and motion menus 2025-09-11 14:23:45 -04:00
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