Commit graph

473 commits

Author SHA1 Message Date
Luke Wilde
8dc8835b64 LibWeb+LibWebView+WebContent: Allow muted media to autoplay by default
The autoplay setting was binary and its default blocked all media,
including muted video, leaving sites that rely on muted autoplay
visibly broken. Replace it with a tri-state user-agent autoplay
policy (allow audio and video, block audio, or block audio and video)
defaulting to allowing only inaudible media to autoplay.

This is enforced through the media element's "allowed to play" check,
so unmuting a muted autoplay or calling `play()` cannot slip audio
past the policy; audible playback is permitted once the document has
been activated by the user. The policy lives in a dedicated
AutoplaySettings consulted from HTMLMediaElement instead of the
Permissions Policy "allowed to use feature" check it was previously
conflated with.
2026-06-19 09:41:32 +02:00
Jelle Raaijmakers
d819152b4e LibGfx+LibWeb: Preserve text color for selections
Selecting text without custom ::selection styling changed the
foreground color of the selected content. This was especially visible
for links, where the text changed color but the underline did not.

The default selection style supplied both a selection background and a
foreground color from the palette or HighlightText system color. That
made ordinary selections behave as if the page had explicitly styled
::selection color.

Only provide a default selection background, so selected content keeps
its own foreground color unless CSS overrides it. Remove the now-unused
SelectionText palette role.
2026-06-18 22:43:26 +02:00
Tim Ledbetter
0db82b3133 LibWebView+UI/Qt: Reuse an existing history tab when viewing history
Previously, the "View History" action always opened a new tab. We now
switch to an existing `about:history` tab when one exists in the active
window and fall back to opening a new tab otherwise.
2026-06-17 12:31:07 +02:00
Tim Ledbetter
d4e15cb0af UI/Qt: Add keyboard shortcut to view history
Bind the canonical history shortcut for each platform to the
"View History" action: Ctrl+H on Linux and Windows, and Cmd+Y on
macOS.
2026-06-17 12:31:07 +02:00
Andreas Kling
19168446c6 UI/Qt: Add navigation history menus
Show native history menus when users right-click or long-press
the back and forward toolbar buttons. Populate entries from the
UI-process session history mirror, using saved history titles and
favicons when available and falling back to the URL and globe icon
otherwise.

Share the Qt base64 PNG icon helper so bookmark menus and navigation
history menus render stored favicons consistently.
2026-06-16 16:34:33 +02:00
Andreas Kling
24f37c6732 LibWebView: Keep browser history in the UI process
Use the LibWebView history mirror to preserve traversable session
history across WebContent process swaps. WebContent reports snapshots to
the UI process, and new renderers can be seeded from the mirror.

Browser back and forward now resolve through the UI-owned used history
steps. WebContent still runs the spec traversal path when the current
renderer has enough matching state to do so.

Handle canceled and no-op UI navigations without leaving speculative
history entries or pending WebDriver waits behind. Preserve traversal
precheck state across synchronous IPC shutdown, and avoid overwriting a
restored target entry's persisted scroll state before the document has
adopted that entry.
2026-06-14 17:38:44 +02:00
Timothy Flynn
7f3cb3efb6 Meta: Move Meta/Lagom/get_linked_lagom_libraries.cmake to Meta/CMake 2026-06-13 10:30:02 -04:00
Andreas Kling
347ac79e7b UI/Qt: Preserve bitmap fallback for Vulkan web view
Hide the native Vulkan child window whenever the current paintable
cannot be imported and rendered through the dmabuf path. This lets the
existing QWidget paint path remain visible for shareable bitmap frames
instead of covering it with a clear-only Vulkan frame.
2026-06-12 21:45:22 +02:00
Andreas Kling
f606ac3b92 UI/Qt: Show autocomplete above native web content
Make the address autocomplete popup a non-activating top-level window.
The Linux Vulkan web view is a native child window, so ordinary widgets
that overlap it can be obscured by native stacking. Keeping the popup as
a top-level tooltip-style window lets it appear above web content while
preserving keyboard focus in the location edit.
2026-06-12 21:45:22 +02:00
Andreas Kling
0607a181a8 UI/Qt: Present Linux DMABUF frames with QVulkanWindow
Use a native QVulkanWindow child for Linux DMABUF presentation instead
of making WebContentView itself a QRhiWidget. This keeps BrowserWindow
on Qt's normal QWidget backing store path while sampling compositor
DMABUF backing stores directly in Vulkan.

Keep WebContentView's paintEvent as fallback for builds without Vulkan
DMABUF support and for cases where the Vulkan instance or window cannot
be created. Set an explicit Vulkan API version before creating the
shared QVulkanInstance so validation layers do not reject Qt defaults.
2026-06-12 21:45:22 +02:00
Andreas Kling
7b6e94a445 UI/Qt: Add tab hover previews
Show a delayed preview popup when hovering background tabs. Build the
thumbnail from the cached front or backup WebContent bitmap so chrome
does not need a fresh screenshot request or WebContent repaint on hover.

Tie the popup to the tab hover lifecycle and hide it on current-tab
hovers, tab presses, drags, layout changes, and tab strip exits.
2026-06-11 13:09:32 +02:00
Andreas Kling
ca6911bacf UI/Qt: Use Ctrl+, for Settings outside macOS 2026-06-11 11:15:53 +02:00
Andreas Kling
b348f141d2 UI/Qt: Draw a border around frameless windows
When using client-side decorations, the window was a flat rectangle
with no outline, so its edge disappeared against similarly colored
backgrounds. Paint a 1px border in a new chrome window outline color
and reserve a matching 1px contents margin so child widgets do not
cover it.

The outline color matches chrome_border() in dark mode, but is darker
in light mode, since the window edge has to hold up against arbitrary
backdrops behind the window rather than our own chrome surfaces.

The border is skipped when the window is maximized or fullscreen, and
on macOS, where frameless windows already get rounded corners and a
native shadow.
2026-06-11 11:15:35 +02:00
Andreas Kling
8d4493a789 UI/Qt: Tint missing find-in-page results
Mark the search field with a dynamic property when a find-in-page query
has zero matches, and let the chrome stylesheet show a red-tinted
background. Clear the state immediately for empty searches.
2026-06-11 11:15:25 +02:00
Timothy Flynn
1a99bdad29 LibWebView+UI: Add a small history application menu
This currently just contains a menu item to open about:history. But in
the future, we can add a list of recently closed / recently visited
pages as well.
2026-06-10 20:27:36 +02:00
Timothy Flynn
f72a18095d LibWebView+UI: Remove the clear-everything history store API
This was only used by the AppKit UI's history menu. We have more fine-
grained control over deleting history in about:settings#privacy.
2026-06-10 20:27:36 +02:00
Timothy Flynn
496c88d0c9 LibWebView: Add about:history to view, query and mangage browser history
This adds a WebUI to view the local browsing history, with controls to
search and delete entries. The APIs used to search history are paginated
to prevent excessive query sizes.
2026-06-10 20:27:36 +02:00
Timothy Flynn
409e5edbf1 LibURL+LibWeb+LibWebView: Move internal URLs to their own header
This nearly eliminates the compilation impact of adding a new WebUI URL.
2026-06-10 20:27:36 +02:00
sideshowbarker
a82c7939d9 LibWeb+UI/AppKit: Implement macOS IME support
This makes macOS IME input in web content work as expected.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/9712
2026-06-08 10:23:14 +09:00
Shannon Booth
2dc3e3da55 Meta: Remove obsolete Lagom host-tools build 2026-06-08 01:11:40 +02:00
Callum Law
e2277e2e8a UI/GTK: Avoid nested event loop when waiting for download path
We no longer support more than one event loop per process as of 02b2053
so this was causing a crash when taking a screenshot. We now spin the
main event loop until a "done" flag is set.
2026-06-07 00:26:30 +02:00
Callum Law
728e6b010a UI/GTK: Avoid nested event loop when waiting for clipboard text
We no longer support more than one event loop per thread as of 02b2053
so this was causing a crash when pasting. We now spin the main event
loop until a "done" flag is set.

Fixes #9928
2026-06-07 00:26:30 +02:00
Andreas Kling
83b293e4f2 LibCore: Keep main event loops alive
Add an explicit initializer for process-lifetime event loops and use it
for browser, helper service, and utility main loops. This preserves weak
event loop references for cross-thread users while making main thread
loop lifetime independent of normal program teardown.
2026-06-05 09:18:39 +02:00
Timothy Flynn
85c7620805 UI/Qt: Collapse hover-expanded vertical tabs after leaving window
When collapsed vertical tabs are expanded on hover, the collapse check
used QCursor::pos() against the vertical tabs rect. On some platforms,
after the cursor leaves the browser window entirely, that position can
remain at the last in-window coordinate, so the tabs stay expanded.
2026-06-04 22:16:16 +01:00
Timothy Flynn
d0bb0deff4 UI/Qt: Focus the location bar when the browser first opens with no URLs
When no URLs are provided on the command line, LibWebView actually adds
about:newtab to the initial URL list. The only time this list is empty
is when we open a popup window.
2026-06-04 08:30:49 -04:00
Timothy Flynn
7fc71e563b LibWebView+UI: Reduce boilerplate to update the bookmarks bar display
We currently use LibWebView's Application as the entry point to learn
about the bookmarks bar being shown/hidden, and propagate that through
virtual methods. At the time this was added, AppKit's Tab window and
Qt's BrowserWindow did not have a settings observer. They do now, so
let's skip a couple of middle-men.

For AppKit, we change the settings observer to just (weakly) store the
Tab instance so that we don't have to add callback functions for each
setting.
2026-06-03 18:14:12 -04:00
Timothy Flynn
83105b8349 LibWebView+UI/Qt: Move the show menu bar setting to LibWebView settings 2026-06-03 18:14:12 -04:00
Timothy Flynn
0e8a4f9747 UI/Qt: Cache the Application as a local in the BrowserWindow constructor 2026-06-03 18:14:12 -04:00
Timothy Flynn
80554dc914 LibWebView+UI/Qt: Move the vertical tab width to LibWebView settings
Let's store this alongside all other vertical tab settings.
2026-06-03 18:14:12 -04:00
Timothy Flynn
1d36fc2997 UI/Qt: Let fullscreen content occupy the whole window
Hide fullscreen chrome at the TabWidget level instead of hiding the
current tab's toolbar child directly. This lets the toolbar container
and reserved verticaltabs space stop contributing to layout while
fullscreen content is shown.

Also keep the exit fullscreen button above native web content on macOS
and center it using the fullscreen screen geometry rather than a
potentially stale parent widget size.
2026-06-03 13:39:11 -04:00
Timothy Flynn
e18cd253f0 UI/Qt: Add an advanced setting to enable server-side decorations
This adds a setting to disable our custom window decorations and let the
system's window server paint the window instead.
2026-06-03 17:30:26 +01:00
Andreas Kling
d9d8c5ce89 LibWeb: Allow Option-generated text insertion
Track whether a keydown should perform text insertion separately from
the delivered code point. Native frontends and text-oriented test paths
can now mark events that came from text input, while shortcut-style key
events keep Alt-modified default insertion suppressed.

This lets macOS Option-generated text such as Option+A and Option+Space
insert into editable controls without making plain Alt shortcuts insert
their base character. Add coverage for Alt text, Ctrl+Alt text,
separator text, Ctrl-only shortcuts, and Alt shortcuts.
2026-06-03 13:51:32 +02:00
Christian Frey
c8556c166a UI/Qt: Prevent autocomplete highlight flicker while typing
While typing in the location bar, intermediate autocomplete updates
caused the highlighted suggestion to flicker.

These updates trigger on each keystroke and lead to unnecessary
selection changes.

Skip intermediate popup updates while it is visible and rely on final
results to update both suggestions and selection atomically.
2026-06-03 13:50:01 +02:00
Christian Frey
a8cb27ddd0 UI/AppKit: Prevent autocomplete highlight flicker while typing
While typing in the location bar, intermediate autocomplete updates
caused the highlighted suggestion to flicker.

These updates trigger on each keystroke and lead to unnecessary
selection changes.

Skip intermediate popup updates while it is visible and rely on final
results to update both suggestions and selection atomically.
2026-06-03 13:50:01 +02:00
Timothy Flynn
388189d979 UI/Qt: Tweak the color used for the collapsed tab close button
The previous color was a bit jarringly bright.
2026-06-03 13:48:44 +02:00
Andreas Kling
530c71a2c1 UI/Qt: Put vertical tabs below bookmarks bar
Anchor the vertical tab sidebar to the full toolbar container height so
it starts below the bookmarks bar when that bar is visible. This keeps
the navigation toolbar and bookmarks bar unified, with the separator at
the content edge.

Update the sidebar geometry whenever the toolbar container resizes so
toggling the bookmarks bar moves the vertical tab chrome immediately.
2026-06-03 12:10:39 +02:00
Tim Ledbetter
462cd59f58 UI/Qt: Keep location bar selection when right-click context menu opens
Previously, selecting all or part of the URL in the location bar, then
right clicking it would cause the URL to become deselected.
2026-06-03 10:26:03 +02:00
Andreas Kling
51c9ffc8d8 UI/Qt: Submit autocomplete selections directly
When Return is pressed while the autocomplete popup is visible, submit
the location edit directly instead of falling through to QLineEdit's
default key handling after closing the popup. This keeps the omnibox
responsive to Return after chrome layout changes rebuild nearby widgets.
2026-06-03 02:53:37 +02:00
Andreas Kling
9551af9a28 UI/Qt: Keep autocomplete popup above web content
Make the autocomplete popup a native child widget on macOS so it can
receive mouse events while overlapping the native QRhiWidget web content
view. Keep it parented to the top-level browser widget so showing the
popup does not steal keyboard focus from the address bar.
2026-06-03 02:53:37 +02:00
Andreas Kling
4f411dce7b UI/Qt: Remove omnibox hover styling
Make hovering the location editor use the same fill and border as its
normal state in both light and dark mode. Focus still uses the focused
border, with a subtle focused fill retained for dark mode.
2026-06-03 02:53:37 +02:00
Andreas Kling
7cd93753c4 UI/Qt: Keep light-mode omnibox bright on focus
Use the normal light chrome surface for the focused location editor
background instead of reusing the hover fill. Dark mode keeps its
slightly distinct focused fill so the input remains readable there.
2026-06-03 02:53:37 +02:00
Andreas Kling
78887566f1 UI/Qt: Align horizontal New Tab spacing with tabs
Bring horizontal tab cards one pixel closer together and make the
horizontal New Tab button a square with the same height as tabs.
Remove the layout gap between the tab bar and New Tab button so the
painted card gap matches the gap between adjacent tabs.
2026-06-03 02:53:37 +02:00
Andreas Kling
15eec69341 UI/Qt: Use tab card styling for horizontal New Tab
Use the same icon-only card-shaped New Tab button in horizontal tab mode
that collapsed vertical tabs use. This keeps the New Tab affordance in
the same visual language as the tab cards instead of using a standard
flat tool button.
2026-06-03 02:53:37 +02:00
Andreas Kling
e783e99861 UI/Qt: Tighten horizontal tab card spacing
Bring horizontal tab card visuals one pixel closer together by reducing
the painted card inset by half a pixel on each side. Keep vertical tab
geometry unchanged.
2026-06-03 02:53:37 +02:00
Andreas Kling
a1bb958419 UI/Qt: Remove obsolete vertical toolbar layout branch
Vertical tab mode always keeps the toolbar in the full-width chrome row.
Remove the older split path that could place the toolbar in the page
column, and simplify the window-control visibility checks around that
single layout model.
2026-06-03 02:53:37 +02:00
Andreas Kling
79b892ec7c UI/Qt: Add breathing room around the omnibox
Add fixed empty toolbar gaps on both sides of the location editor. This
slightly reduces the omnibox width and leaves reliable toolbar chrome
space next to it for window dragging.
2026-06-03 02:53:37 +02:00
Andreas Kling
456d94cb5b UI/Qt: Align vertical tab chrome across platforms
Use the full-width toolbar layout for vertical tabs on every platform.
Also use the same collapsed vertical tabs width everywhere so collapsed
tab shapes remain square.
2026-06-03 02:53:37 +02:00
Andreas Kling
f03b675c2a UI/Qt: Keep vertical tab overlays native only on macOS
Make the vertical tab overlay column and resize handle native only on
macOS. This preserves stacking over native web views there without
breaking input routing on non-macOS platforms.
2026-06-03 02:53:37 +02:00
Andreas Kling
a310091402 UI/Qt: Avoid native churn while resizing chrome
Do not clear the Qt window mask from the non-macOS corner update path.
The custom rounded-corner implementation is macOS-only, so the Linux
resize path should not touch native mask state on every resize event.

Also make dynamic property updates idempotent for tab chrome widgets.
Vertical tab resize and hover updates now only repolish when a property
actually changes, and avoid reapplying unchanged New Tab button text,
style, and size.
2026-06-03 02:53:37 +02:00
Andreas Kling
807efef7e6 UI/Qt: Guard macOS window helpers
Declare the AppKit window-drag and window-control helpers only on
macOS. The implementation is already compiled only for Apple targets,
and call sites are guarded, so keep the header aligned with that
platform boundary.
2026-06-03 02:53:37 +02:00