1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00
Commit graph

130 commits

Author SHA1 Message Date
Timothy Flynn
985434ea10 headless-browser: Allow running LibWeb tests without specifying a path
Especially on new setups, it is handy for `headless-browser --run-tests`
to "just work". Anyone using ladybird.py will have LADYBIRD_SOURCE_DIR
set in their environment already.
2025-06-01 10:34:30 +12:00
Timothy Flynn
7ce88eb4cd Everywhere: Document use of ladybird.py over ladybird.sh 2025-05-29 16:24:17 -04:00
Dan Berglund
d9e90d4556 AppKit: Check availability before using macOS 15 API in TabController
This keeps the code building on older macOS versions.
2025-05-27 13:39:24 -06:00
Timothy Flynn
141afbc63d headless-browser: Allow specifying the path to the saved screenshot
This is to help make creating Screenshot tests a bit easier.
2025-05-20 10:48:03 -04:00
Timothy Flynn
7280ed6312 Meta: Enforce newlines around namespaces
This has come up several times during code review, so let's just enforce
it using a new clang-format 20 option.
2025-05-14 02:01:59 -06:00
Bastiaan van der Plaat
0b6f693636 UI/AppKit: Use webview layout event instead of window resize events
Currently the window resize events are used to resize the webview.
But when extra window items appear, for example: search or DevTools
Bar then the webview is clipped out of the window. This also happens
when the tab bar is opened and closed. Listening to layout events
resolves these clipping issues completely.
2025-05-08 11:23:21 +01:00
Bastiaan van der Plaat
5a3b98e0a9 UI/AppKit: Disable toolbar mode customization
Currently you can right click on the toolbar for a system
contextmenu. When you change the display mode
the toolbar goes into a weird smaller state.
2025-05-08 11:23:21 +01:00
enkvadrat
678c15a06a UI/Qt: Add Ctrl-R shortcut for page Reload
Keeping things consistent with other browsers
where both f5 and Ctr-R can be used to reload.
2025-05-07 10:20:51 +12:00
Timothy Flynn
7f8f72556a headless-browser: Implement a stubbed clipboard API
We currently rely on UI-specific APIs to interact with the system
clipboard from AppKit and Qt. We do not have access to these from
headless-browser.

We should ultimately implement these APIs without relying on the UI as
a middle-man. For now, store a clipboard item so that we may exercise
the clipboard WPT tests.
2025-05-02 17:46:16 -04:00
Timothy Flynn
61c0f67c8c LibWeb+LibWebVew+WebContent+UI: Add IPC to retrieve the system clipboard
We currently have a single IPC to set clipboard data. We will also need
an IPC to retrieve that data from the UI. This defines system clipboard
data in LibWeb to handle this transfer, and adds the IPC to provide it.
2025-05-02 17:46:16 -04:00
Timothy Flynn
234c07adc9 LibWebView: Split about:settings into modules
The about:settings page has gotten beefy enough that it is a bit of a
paint to manage in a single HTML file. This patch breaks the settings
into several modules to make this page easier to mantain.

Modules have some nice benefits over classic scripts, such as enabling
strict mode by default, and allowing each module to function without
polluting the global object.
2025-04-23 19:58:58 -04:00
Timothy Flynn
9ef3fd0922 headless-browser: Disable viewport scrollbar painting for tests
This allows us to update how the viewport scrollbar is painted without
breaking every screenshot test.
2025-04-22 11:29:06 -04:00
Shannon Booth
8d0fb91450 Headless: Remove uneeded URL validity check
All of the URLs in the browser options must be valid.
2025-04-19 07:18:43 -04:00
Shannon Booth
00bbb2105b LibURL: Port create_with_file_scheme to Optional
Removing one of the main remaining users of URL valid state.
2025-04-19 07:18:43 -04:00
Shannon Booth
2072eee83d LibURL: Implement create_with_file_scheme using URL Parser
Creating a URL should almost always go through the URLParser to
handle all of the small edge cases involved. This reduces the
need for URL valid state.
2025-04-19 07:18:43 -04:00
Andrew Kaster
6ff0373556 UI: Pass parent WebView by non-const ref when creating children
We need to call non-const methods on this guy and access its members in
a non-const way.
2025-04-16 10:41:44 -06:00
Andrew Kaster
5c4b65996e UI/Qt: Store TVG Image Data in a RefPtr to const
We don't need to mutate this data after it's loaded.
2025-04-16 10:41:44 -06:00
Andrew Kaster
91b549f797 LibGfx+LibWebView+UI: Store Gfx::Bitmap in RefPtr to const 2025-04-16 10:41:44 -06:00
stasoid
a821fc03be Headless: Compile on Windows 2025-04-13 10:19:23 -06: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
a3ea4881e7 LibWeb+LibWebView+UI: Migrate to LibWebView's language settings 2025-04-04 10:16:32 +02:00
Timothy Flynn
f242920cc9 LibWebView: Add language settings to about:settings
This implements a setting to change the languages provided to websites
from `navigator.language(s)` and the `Accept-Language` header. Whereas
the existing Qt settings dialog allows users to type their language of
choice, this setting allows users to select from a predefined list of
languages. They may choose any number of languages and their preferred
order.

This patch only implements the persisted settings and their UI. It does
not integrate the choses languages into the WebContent process.
2025-04-04 10:16:32 +02:00
Timothy Flynn
920170f60a LibWebView+UI: Remove native do-not-track setting 2025-04-02 14:16:18 -04:00
Timothy Flynn
c1fe912bf9 UI/AppKit: Implement an autocomplete view for the location bar 2025-04-02 08:52:45 -04: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
a87c264088 UI/Qt: Add a couple of missing includes
These are currently being transitively included. This will no longer be
the case in a future patch.
2025-04-02 08:52:45 -04:00
Timothy Flynn
b23b21fa4a UI/AppKit: Restore custom cursor shown on link hover
This seems to have broken in some recent-ish AppKit update. When we add
the status label to the view hierarchy / change its visibility state,
the NSApp is resetting the cursor to the standard cursor. By overriding
the cursorUpdate method to do nothing, we prevent this from happening.
2025-04-01 23:10:14 +02:00
Timothy Flynn
ed265b568d LibWebView+WebContent+UI: Migrate to the new autoplay settings
This removes the old autoplay allowlist file in favor of the new site
setting. We still support the command-line flag to enable autoplay
globally, as this is needed for WPT.
2025-03-30 16:18:57 +01:00
Jelle Raaijmakers
91d6902725 UI: Add Cmd+U as a shortcut for "View Source" to AppKit
This mirrors the shortcut we have in our Qt UI.
2025-03-25 17:08:42 -04:00
Timothy Flynn
9bdd22c6b1 UI/Qt: Add a menu item to open about:settings
This replaces the existing menu item that would open the Qt settings
dialog. That menu item still exists, but is no longer the default
settings action.
2025-03-22 17:27:45 +01:00
Timothy Flynn
7a5387b0ab UI/AppKit: Add a menu item to open about:settings 2025-03-22 17:27:45 +01:00
Timothy Flynn
b169a98495 LibWeb+LibWebView+WebContent: Introduce a basic about:settings page
This adds a basic settings page to manage persistent Ladybird settings.
As a first pass, this exposes settings for the new tab page URL and the
default search engine.

The way the search engine option works is that once search is enabled,
the user must choose their default search engine; we do not apply any
default automatically. Search remains disabled until this is done.

There are a couple of improvements that we should make here:

* Settings changes are not broadcasted to all open about:settings pages.
  So if two instances are open, and the user changes the search engine
  in one instance, the other instance will have a stale UI.

* Adding an IPC per setting is going to get annoying. It would be nice
  if we can come up with a smaller set of IPCs to send only the relevant
  changed settings.
2025-03-22 17:27:45 +01: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
Timothy Flynn
a69ecc3943 UI: Add a default CSS file for internal Ladybird pages
In order to maintain a consistent look and feel between internal about:
pages going forward, let's use a central CSS file to define Ladybird
colors and some common form control styles.
2025-03-22 17:27:45 +01:00
Timothy Flynn
9b6ae962d0 LibWebView+UI: Handle DPR for select elements like other menus
The select dropdown was doing its own ad-hoc method of handling DPR. We
now handle it just like other context menus. Previously, the drop down
in the AppKit chrome was twice as large as it should be.
2025-03-22 17:27:45 +01:00
Jelle Raaijmakers
acc9499c5d UI: Show "Disable" title in DevTools disable button
The "disable DevTools" button looked like a "close this notification"
button to me, and although a tooltip was set, it only showed up
immediately on the AppKit UI and not the Qt version.

This makes the behavior of clicking the disable button a lot clearer by
showing a button with "Disable" as its title.
2025-03-20 17:44:07 -04:00
Timothy Flynn
9214322129 UI/Qt: Do not make assumptions about autocomplete response types
For example, we expect a JSON array from Google. Let's not crash if we
get a JSON object or some other unexpected type.
2025-03-20 10:50:24 +01:00
Timothy Flynn
8847079d8a UI/Qt: Invert check for DuckDuckGo autocomplete parse results 2025-03-20 10:50:24 +01:00
Timothy Flynn
86a93b9b47 UI/Qt: Prevent UAF while parsing autocomplete response data
JsonParser only holds a view into the provided string, the caller must
keep it alive. Though we can actually just use JsonValue::from_string
here instead.
2025-03-20 10:50:24 +01:00
Timothy Flynn
45d8cd5c9f UI/Qt: Replace the Task Manager window with about:processes 2025-03-19 10:03:17 -04:00
Timothy Flynn
67a1dd72db UI/AppKit: Replace the Task Manager window with about:processes 2025-03-19 10:03:17 -04:00
Timothy Flynn
843209c6a9 LibWeb+LibWebView+WebContent: Add an about:processes page
The intent is that this will replace the separate Task Manager window.
This will allow us to more easily add features such as actual process
management, better rendering of the process table, etc. Included in this
page is the ability to sort table rows.

This also lays the ground work for more internal `about` pages, such as
about:config.
2025-03-19 10:03:17 -04:00
Aliaksandr Kalenik
259d39cbad UI/Headless: Wait for "reftest-wait" class removal before screenshotting
Resolves https://github.com/LadybirdBrowser/ladybird/issues/3984
2025-03-18 20:09:46 +01:00
Aliaksandr Kalenik
394073f611 LibWeb: Rename internals.signalTextTestIsDone() to signalTestIsDone()
In upcoming change this function will be used for ref-tests as well.
2025-03-18 20:09:46 +01:00
Timothy Flynn
e20d7be15f LibWeb+UI: Rename ChromeInputData to BrowserInputData 2025-03-15 19:57:27 -04:00
Timothy Flynn
47d6747945 LibWebView+UI: Rename ChromeProcess to BrowserProcess 2025-03-15 19:57:27 -04:00
Timothy Flynn
e00c0c176e LibWebView+UI: Rename ChromeOptions to BrowserOptions 2025-03-15 19:57:27 -04:00
Timothy Flynn
0065dde749 UI/Qt: Add UI components to enable DevTools at runtime 2025-03-15 19:09:40 +01:00
Timothy Flynn
28574e2812 UI/AppKit: Add UI components to enable DevTools at runtime 2025-03-15 19:09:40 +01:00
Timothy Flynn
810d04b3f4 LibWeb+LibWebView+WebContent: Remove the built-in Inspector 2025-03-15 19:09:40 +01:00