Commit graph

95 commits

Author SHA1 Message Date
Tim Ledbetter 63632159ce UI: Add an option to enable autoplay globally 2024-09-24 23:50:54 +01:00
Timothy Flynn 9e21e44841 LibWebView+WebContent+UI: Remove cookie related WebView callbacks
There's no need for each individual chrome to implement the cookie
callbacks. We can handle these entirely within LibWebView.
2024-09-22 14:11:18 -04:00
Andreas Kling 6d91c42214 RequestServer: Remove "dump connection info" mechanism and UI
This is not relevant anymore when we use CURL.
2024-09-19 07:37:46 +02:00
Tim Ledbetter 7c953552b7 UI: Add the --disable-scripting option to disable scripting by default 2024-09-07 11:37:41 +02:00
Timothy Flynn ed3c450359 LibWebView+UI: Move the database and cookie jar to WebView::Application
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, 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
Push notes / build (push) Waiting to run
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00
Timothy Flynn 0464212f82 UI/Qt: Update the User-Agent to the provided UA override name 2024-08-29 13:05:47 +01:00
Jamie Mansfield 6133707df8 Ladybird/Qt: Display ampersands in tab titles
Qt reads ampersands as shortcut keys, so this escapes them (with &&) so
they display correctly :^)
2024-08-12 15:17:17 +02:00
Timothy Flynn 96bb8fe944 UI/Qt: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn 5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Sam Atkins e17362ab79 UI/Qt: Make TabWidget responsible for new-tab button positioning
Makes use of the fact that QTabWidget automatically reserves space
for "corner widgets", and gives us the ability to override their
location with a custom style.

Also, determine the height of the new-tab button using the height of the
tab bar, instead of a hard-coded 32px which was too tall on MacOS.
2024-07-29 12:02:02 +02:00
Tim Ledbetter 2d95cc01dc UI/Qt: Don't save size and location of popup windows on exit 2024-07-28 00:54:50 +01:00
Jamie Mansfield 132ab775d8 Ladybird/Qt: Add setting for preferred languages 2024-07-25 11:38:59 +01:00
lmutter abddd0ac1b UI/Qt: Move New Tab button in tab bar 2024-07-21 16:04:12 -06:00
Tim Ledbetter 11039085d0 UI/Qt: Pass WebContentOptions to TaskManagerWindow constructor
Previously, the browser would crash when opening a task manager window
with the `--enable-qt-networking` flag set because we were passing the
default WebContentOptions to the underlying WebContentView.
2024-07-10 16:29:27 +02:00
simonkrauter 82915e1914 Ladybird/Qt: Apply selected color scheme for new tabs
Previously, new tabs always had the `auto` color scheme, regardless of
what the user has selected before.
Replace the 3 individual slots with a `set_preferred_color_scheme`
method.
2024-07-06 20:32:33 +01:00
Jamie Mansfield 197f57f5d2 Ladybird/Qt: Add actions to set navigator compatibility mode 2024-07-05 07:14:03 +02:00
Jamie Mansfield e34254298a Ladybird/Qt: Add setting for sending DNT header 2024-07-04 16:42:34 +02:00
Tim Ledbetter b95c05b611 UI/Qt: Ignore tab bar middle clicks if the user didn't click on a tab
This avoids a segfault that would previously occur when middle clicking
to close a tab if only 1 tab was open.
2024-06-30 13:09:39 +02:00
Tim Ledbetter efce3d9671 UI/Qt: Don't hide the location bar URL when creating a tab from a URL
The location bar URL is no longer hidden when creating a new tab or
opening a new window that has an associated URL. Conversely, the
location bar is now always focused and the URL hidden when creating a
window or tab without an associated URL.

The location bar is focused when:
* Opening the browser from the command line with no URL arguments
* Opening a new tab (Ctrl+T)
* Opening a new window (Ctrl+N)

The location bar is not focused when:
* Opening the browser from the command line with one or more URLs
* Opening hyperlinks in a new tab
* Clicking a hyperlink with `target="_blank"`

This matches the behavior of other major browsers.
2024-06-21 07:31:53 +02:00
Luke Warlow 099b77d60f LibWeb: Add motion preference
This adds a motion preference to the browser UI similar to the existing
ones for color scheme and contrast.
Both AppKit UI and Qt UI has this new preference.
The auto value is currently the same as NoPreference, follow-ups can
address wiring that up to the actual preference for the OS.
2024-06-18 10:31:54 -04:00
Tim Ledbetter 808784092c UI/Qt: Don't show URL when a new tab is initially focused
The URL is now not shown when a new tab is initially activated until
the location bar loses focus. This allows the user to see the location
bar placeholder text when opening a new tab. It also makes it easier to
paste URLs into the location bar after opening a new tab.
2024-06-17 17:26:55 +02:00
Tim Ledbetter 577a7610fb UI/Qt: Add --allow-popups option to disable popup blocking by default 2024-06-17 14:16:39 +03:00
Tim Ledbetter 88d134a4da UI/Qt: Add standard shortcuts for find in page actions
This commit adds the standard shortcuts for the Find Next and Find
Previous buttons on the find in page panel. These shortcuts are usually
F3 and Shift+F3 respectively, although Qt standard shortcuts may vary
across platforms.
2024-06-14 14:11:19 +02:00
Luke Warlow ee64684565 LibWeb: Add Contrast preference 2024-06-13 11:18:38 +02:00
Tim Ledbetter ebfb847d34 UI/Qt: Ensure we don't add the same zoom shortcut key more than once
On my system `QKeySequence::StandardKey::ZoomIn` includes both `Ctrl++`
and `Ctrl+=`, so explicitly adding the secondary `Ctrl+=` shortcut
ourselves results in an ambiguous shortcut error message being shown.

According to the Qt documentation the key bindings returned by
`QKeySequence::StandardKey::*` are platform specific, so we may still
need to add the secondary shortcut on some systems. Therefore, we now
check whether our secondary shortcut is already in the shortcut list
before adding it.
2024-06-11 09:19:01 -04:00
Andrew Kaster d90a9ab70c LibWeb: Add Web::UIEvents::KeyCode and KeyModifier enums, drop Kernel
This was the last Kernel header we had. Move the definitions we need
into a UIEvents header similar to MouseButton.
2024-06-07 09:44:41 +02:00
Tim Ledbetter fdd2f9ebbd UI/Qt: Spoof user agent across all tabs 2024-06-06 10:07:57 +02:00
Tim Ledbetter 99555f19f4 UI/Qt: Set debug menu checkbox options across all tabs
The "Enable Scripting", "Block Pop-ups" and "Enable Same-Origin Policy"
options are now set for every tab when toggled. They are also applied
to new tabs when they are created.
2024-06-06 10:07:57 +02:00
Tim Ledbetter d480355b57 Ladybird/Qt: Draw line box borders for all tabs when option is toggled
Previously, line box borders were only set for the current tab when the
option was toggled.
2024-06-04 17:22:07 +02:00
Andrew Kaster c4f2ff44a5 Ladybird: Respect window.open() features in Qt chrome 2024-05-30 16:16:33 -04:00
Tim Ledbetter 389a55fe36 Ladybird/Qt: Add a find in page widget 2024-05-30 16:30:11 +02:00
Timothy Flynn 086ddd481d Ladybird+LibWeb: Move User-Agent definitions to their own file
This is to avoid including any LibProtocol header in Objective-C source
files, which will cause a conflict between the Protocol namespace and a
@Protocol interface.

See Ladybird/AppKit/Application/ApplicationBridge.cpp for why this
conflict unfortunately cannot be worked around.
2024-05-26 18:29:24 +02:00
MacDue 563d392db7 Ladybird: Ensure hamburger menu is placed within the browser window 2024-05-08 10:39:46 +02:00
MacDue 5bb37caf9e Ladybird: Add the "Debug" category back to the menubar
This was accidentally removed in 5da9af4.
2024-05-06 13:42:43 -04:00
Jamie Mansfield 5da9af435e Ladybird/Qt: Introduce a hamburger menu and use by default
There is an option to show the menubar, if desired (similar to KDE
software).
2024-05-06 08:24:56 -04:00
Jamie Mansfield d9f8203021 Ladybird/Qt: Move "About Ladybird" action to Help menu 2024-05-06 08:24:56 -04:00
Jamie Mansfield 17fc995ee4 Ladybird: Add a context menu to the tab bar
This shows the following actions:

* Reload Tab
* Duplicate Tab
* Move Tab
  * Move to Start
  * Move to End
* Close Tab
* Close Other Tabs
  * Close Tabs to Left
  * Close Tabs to Right
  * Close Other Tabs
2024-04-29 08:11:21 +02:00
Andrew Kaster 6b5deb2259 Ladybird: Support multiple browser windows in Qt chrome
This also moves the ownership of the TaskManger to the Application.
2024-04-27 20:32:12 -04:00
Jamie Mansfield c2829ce2a0 Ladybird: Retreive the tab title from the underlying Tab
Rather than getting the tab name from the tab container. This resolves
an issue where ampersands were being introduced to the window title
when changing tabs.
2024-04-27 13:39:47 -04:00
Aliaksandr Kalenik 78af6ca971 Ladybird/Qt: Add icon for "Dump Session History Tree" action 2024-04-14 02:42:53 -07:00
Aliaksandr Kalenik 882904b4bf Ladybird/Qt: Stop using history to drive navigation
Before this change we had to keep session history on browser side to
calculate a url for back/forward/reload action.
Now, with a mature enough implementation of navigation algorithms from
the specification, there is no need to use
history on the browser side to calculate navigation URLs because:
- Traversable navigable owns session history that is aware of all
  navigations, including those initiated by History API and Navigation
  API
- TraversableNavigable::traverse_the_history_by_delta() uses
  traversable's history to calculate the next URL based on delta, so
  there is no need for UI to keep sesion history.

In the future, we will likely want to add a way to pull session history
from WebContent to make it browsable from the UI.
2024-04-14 02:42:53 -07:00
Timothy Flynn f3053f1d01 Ladybird/Qt: Add a "new tab" button to the Qt chrome
This adds a button on the right side of the location bar to create a new
tab.

Ideally, we would actually use QTabWidget::setCornerWidget to put this
button in the tab bar. But it is surprisingly difficult to make that
look nice on all platforms. Even if we ignore macOS, the CSS to make the
button look right on KDE Plasma may not work well on Gnome. So for now,
this location next to the location bar is horizontally the same that it
would be in the tab bar at least.
2024-04-05 15:27:29 +02:00
Timothy Flynn 795efea64f Ladybird/Qt: Close the browser when the last tab's close button is used
We currently do this already when the last tab is closed via the ctrl-W
shortcut. Move the logic for this to BrowserWindow::close_tab so that we
also close the window when the tab is closed via its close button.
2024-04-05 15:27:29 +02:00
Timothy Flynn ecce4ad426 Ladybird/Qt: Set the tab tooltip to its full title
If a tab's title is cut off due to its size, setting a tool tip will
allow for viewing the full title.
2024-04-03 20:56:04 +02:00
Timothy Flynn 2713d4651d Ladybird/Qt: Specify a minimum and maxium tab width
By default, Qt will grow the width of a tab button to fit the title text
of the tab. For long titles or file:// URLs, this looks rather bad. This
sets a min/max tab width to prevent such infinite growth.

To do this, we have to subclass both QTabWidget and QTabBar, because the
functions to be called/overridden are protected.
2024-04-03 20:56:04 +02:00
Timothy Flynn 0234add5fa Ladybird/Qt: Replace the default tab close icon with a vector icon
The default icon used by Qt is a bit jarring. Replace it with an icon
that resembles our other homemade icons.
2024-04-03 20:56:04 +02:00
Timothy Flynn 1fc995d4aa Ladybird/Qt: Add a hover effect to the audio play state button
By default, a flat QPushButton does not have a hover effect. Add a small
subclass to provide such an effect to make it clearer it is a button.
2024-04-03 20:56:04 +02:00
Timothy Flynn c1c1ad8678 Ladybird/Qt: Prevent adding multiple audio state buttons
If the left-hand side of the tab is already occupied with an audio state
button, we would add a second button to the right-hand side. Prevent
that by checking if the occupant is our audio state button.
2024-04-02 15:00:15 -04:00
Andrew Kaster 31c0d00ab1 Ladybird: Add a simple TaskManager window for tracking child processes
This implementation uses a really basic WebView to update stats once
a second. In the future it might make more sense to both move the
details into LibWebView, and to create a native widget for each platform
to remove the overhead of having an extra WebView.
2024-04-02 09:52:34 -06:00
Timothy Flynn dd54780d5e Ladybird/Qt: Place the tab audio state button on the right on macOS
On macOS, the "close tab" button is on the left, so we should place the
audio state button on the right to avoid conflict. Rather than an OS
ifdef, we do this by detecting if the left side is occupied.
2024-03-31 14:29:17 +02:00