Commit graph

29 commits

Author SHA1 Message Date
Andreas Kling
2f0fe26ce9 UI/Qt: Preview non-prefix autocomplete suggestions
Allow highlighted rows that are not valid inline completions to preview
their full suggestion text in the location editor. This covers history
entries matched by title or URL substring, while ordinary typing stays
on the inline-only path.

Keep automatic inline autocomplete text when Escape closes the popup.
Escape still cancels hovered or keyboard-selected preview text.
2026-06-22 01:13:53 +02:00
Andreas Kling
3fcd9d83a1 UI/Qt: Avoid stale autocomplete activation
Remember which query produced the visible autocomplete popup rows, and
only activate selected rows when the visible popup still belongs to the
current query.

When Enter is pressed while fresh results are pending, rerun
autocomplete for the current query and activate once matching results
arrive. Ignore late completions after focus leaves. Avoid canceling
autocomplete while its completion callback activates the pending result.
2026-06-22 01:13:53 +02:00
Andreas Kling
375da3e66d UI/Qt: Show autocomplete when focusing location edit
Open the autocomplete popup when the location editor is focused
through the browser action, such as Cmd+L. Keep the selected URL text
intact by skipping inline completion for that explicit popup request.

Position the native popup again after its first show so Qt has realized
the tooltip window before the final placement, avoiding the brief macOS
Y-coordinate jump.
2026-06-22 01:13:53 +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
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
4f314b0aa0 UI/Qt: Unify browser chrome layout
Treat the toolbar, tab strip, and vertical sidebar as one browser
chrome surface. Add an explicit layout policy for platform window
controls and sidebar widths. This lets macOS use left-side traffic
lights while other platforms keep right-side custom controls.

Keep the macOS toolbar stable in vertical-tabs mode. Traffic lights and
navigation controls stay in the top row, and the sidebar sits below it.
Draw chrome/content separators explicitly so the content edge remains
clear without adding seams inside the chrome surface.

Retune tab, toolbar, and omnibox styling for the unified chrome. Tabs
use card-like selected states, quiet inactive states, and matching
horizontal and vertical geometry.

Make hover-expanded vertical tabs draw as a chrome overlay so the web
content does not relayout. Keep the overlay above native web views and
route macOS window drags through AppKit events for reliable dragging
from custom chrome.
2026-06-03 02:53:37 +02:00
Andreas Kling
9001bfe692 UI/Qt: Select URL after plain omnibox clicks
When focusing the omnibox with the mouse, keep delaying expansion from
the display URL to the serialized URL until mouse release.

If the release leaves only a caret instead of a selection, select the
full serialized URL so a plain click behaves like normal browser omnibox
behavior.
2026-06-01 10:00:19 +02:00
Andreas Kling
756be80c8e UI/Qt: Add a location zoom indicator
Show active page zoom as a muted pill inside the right side of the
location edit whenever zoom differs from 100%. Keep it next to the
bookmark action and reserve text margin space so the URL cannot render
under the controls.

Clicking the pill activates the existing reset zoom action, returning
the page to 100% and hiding the indicator again.
2026-05-31 19:46:21 +02:00
Andreas Kling
3f45f8cce0 UI: Shorten web URLs in location fields
Show web URLs without their scheme, a leading host www., or the
root slash while the location field is not being edited. Restore the
fully serialized URL while editing so the original scheme is preserved,
but keep mouse focus stable until release so clicks target the visible
text.

Keep the domain emphasis for shortened Qt location text by deriving the
highlight ranges from the serialized URL and remapping them to the
visible display form. Special URLs like about, data, and file remain
unchanged. Add LibWebView coverage for the shared display helper used by
both UI frontends.
2026-05-31 19:20:59 +02:00
Andreas Kling
7701f5e78f UI/Qt: Rework omnibox leading indicator
Stop mirroring the tab favicon and loading spinner inside the omnibox.
The tab already owns that state, so the leading omnibox control now
reflects the action or warning relevant to the field.

HTTP pages show a compact Not secure pill, edited URL-like input shows
the globe, and edited search input shows the search icon. Current
non-HTTP pages leave the leading edge quiet so ordinary navigation does
not look like a security status surface.
2026-05-31 19:20:59 +02:00
Andreas Kling
effedec392 UI/Qt: Refine compact chrome appearance
Normalize generated chrome icon weights and alignment, tune dark and
light chrome surface layering, and move the compact palette toward a
quieter neutral treatment. Keep the compact tab strip and toolbar
heights while making the toolbar, tab surfaces, omnibox, and navigation
cluster feel more balanced.

Use tonal dark-mode seams instead of bright separator lines, quiet the
resting omnibox border, and keep background tabs full-strength while
using shape and layering to distinguish the selected tab.
2026-05-31 19:20:59 +02:00
Andreas Kling
1516560bc6 UI/Qt: Tighten browser chrome spacing
Reduce the Qt tab strip, navigation toolbar, and location edit heights
so the combined chrome takes less vertical space while the toolbar
buttons keep comfortable 36 px targets. Keep glyph sizes unchanged and
use inset toolbar button styling so the painted hover surfaces feel
lighter than the clickable area.
2026-05-31 19:20:59 +02:00
Andreas Kling
5805a374d4 UI/Qt: Preserve hidden omnibox edits on new tabs
Keep late about:newtab load notifications from clearing hidden location
text after the user has started typing. Let LocationEdit own cursor
placement for normal URL display so load-start updates do not disturb
inline autocomplete selection.
2026-05-26 17:37:40 +02:00
Andreas Kling
14ac01b0ce UI/Qt: Refine chrome layout spacing
Keep active and hovered tabs on the same geometry while tightening the
surrounding chrome rhythm. Reduce tab and toolbar padding, shorten the
navigation toolbar and omnibox, center the new tab button, and enlarge
tab close buttons to match the refined tab sizing.
2026-05-26 15:20:59 +02:00
Andreas Kling
5e42dd0e26 UI/Qt: Keep chrome style refreshes coalesced
Keep the pending chrome style refresh marker set while the deferred
refresh runs. Applying the refreshed stylesheet can synchronously
deliver palette/style change events, and clearing the marker first lets
those self-induced events enqueue another immediate refresh.

This prevents the Qt chrome from spinning through repeated stylesheet
updates and repainting the location field shadow at idle.
2026-05-26 02:03:43 +02:00
Andreas Kling
7a4a633d04 UI/Qt+WebContent: Refresh theme colors live
Refresh Qt chrome palettes from the current color scheme when the
application palette changes. Recompute autocomplete and location field
colors and repaint WebContent immediately so theme changes do not
require another interaction or restart.
2026-05-26 01:18:51 +02:00
Andreas Kling
3adeed9581 UI/Qt: Polish browser chrome appearance
Refine the material colors, tab integration, toolbar spacing, and
custom glyphs used by the Qt browser chrome. Keep the visual density
compact while making the controls feel clearer and less toolkit-like.
Mark the window opaque and show resize cursors for frameless chrome.
2026-05-26 01:18:51 +02:00
Andreas Kling
328d89f3c1 UI/Qt: Draw custom browser window chrome
Add shared chrome styling helpers and use them to paint the Linux
browser tab strip and surrounding toolbar widgets. Make the browser
window frameless on Qt so the tabs, toolbar, and window controls can
share one integrated chrome surface.
2026-05-26 01:18:51 +02:00
Andreas Kling
9f8d4fdb3b UI: Mirror loading state in tab icons
Show visible tab icons as loading while the focused location field
keeps its existing page-level loading state. Cache the favicon under the
spinner so each tab restores its page icon when loading finishes.

Reuse the Qt spinner drawing for the location field and tab strip, and
draw the AppKit spinner into the attributed tab title.
2026-05-20 09:37:33 +02:00
Andreas Kling
0a70dadfb1 UI: Show page loading state in the location field
Use the leading icon in the location field as a contextual page
indicator. While a page is loading, the field shows an indeterminate
activity indicator. Once loading finishes, it shows the page favicon
when available and falls back to the generic page icon where the toolkit
has one.

Keep the GTK implementation aligned with the other frontends by using
that slot only for loading and favicon state, without a separate
security icon.

This keeps single-tab windows from losing all visual feedback when the
tab bar is hidden, without adding a fake progress bar.
2026-05-20 09:37:33 +02:00
Timothy Flynn
fdbdb0ecd2 LibWebView+UI: Show an error page when we cannot sanitize a URL
Previously, if search was disabled, entering non-URL text would just
silently drop the search query (and on Qt, we would reload the current
URL). We now detect that the query did not result in a navigation and
load an error page instead, which directs the user to enable search.
2026-04-24 20:17:23 +02:00
Andreas Kling
bb9f789eae UI/Qt: Show rich, history-backed address bar autocomplete
Replace the old QCompleter-based popup with a custom list that renders
AutocompleteSuggestion rows with titles/URLs/section headers/favicons.

Parent the popup inside the window so it does not steal focus, route
keyboard and mouse activation through WebView::Autocomplete, and add
inline completion with backspace suppression and top-row selection.
2026-04-16 21:01:28 +02:00
sideshowbarker
16fd2ccee0 UI/Qt: Restore address bar URL when pressing Escape
When the user focuses the address bar and presses Escape, the original
URL is now restored. Previously, the address bar would show whatever
text the user had typed, or be empty if they had cleared it.

This matches the AppKit implementation and Chrome/Firefox behavior.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/7264
2026-01-06 06:37:19 -05:00
Timothy Flynn
dbf4b189a4 LibWebView: Do not use AK::format to format search engine URLs
This is to prepare for custom search engines. If we use AK::format, it
would be trivial for a user (or bad actor) to come up with a template
search engine URL that ultimately crashes the browser due to internal
assertions in AK::format. For example:

    https://example.com/crash={1}

Rather than coming up with a complicated pre-format validator, let's
just not use AK::format. Custom URLs will signify their template query
parameters with "%s". So we can do the same with our built-in engines.
When it comes time to format the URL, we will do a simple string
replacement.
2025-04-06 13:45:10 +02:00
Timothy Flynn
60dd5cc4ef UI/Qt: Migrate to LibWebView's autocomplete engine
As a result, we now no longer depend on Qt::Network.
2025-04-02 08:52:45 -04:00
Timothy Flynn
e084a86861 LibWebView+UI: Introduce a persistent settings object
This adds a WebView::Settings class to own persistent browser settings.
In this first pass, it now owns the new tab page URL and search engine
settings.

For simplicitly, we currently use a JSON format for these settings. They
are stored alongside the cookie database. As of this commit, the saved
JSON will have the form:

    {
        "newTabPageURL": "about:blank",
        "searchEngine": {
            "name": "Google"
        }
    }

(The search engine is an object to allow room for a future patch to
implement custom search engine URLs.)

For Qt, this replaces the management of these particular settings in the
Qt settings UI. We will have an internal browser page to control these
settings instead. In the future, we will want to port all settings to
this new class. We will also want to allow UI-specific settings (such as
whether the hamburger menu is displayed in Qt).
2025-03-22 17:27:45 +01:00
Rok Povsic
026fc6c1ca UI/Qt: Add '.com' to the URL if CTRL is held while pressing return 2025-01-20 19:21:56 +00:00
Timothy Flynn
db47cc41f8 Everywhere: Move the Ladybird folder to UI 2024-11-10 12:50:45 +01:00
Renamed from Ladybird/Qt/LocationEdit.cpp (Browse further)