Commit Graph

277 Commits

Author SHA1 Message Date
Timothy Flynn
a21998003c Ladybird/Qt: Make String allocation infallible 2023-12-04 12:03:48 -07:00
Timothy Flynn
82c827fc56 Ladybird/Qt: Support non-ASCII when converting a QString to a String
QString is UTF-16, thus QString::size returns the number of UTF-16 code
units. Thus, we would fail to perform, for example:

    ak_string_from_qstring(QString("😀"));

Which is 2 UTF-16 code units, but 4 UTF-8 code units.
2023-12-04 12:03:48 -07:00
Timothy Flynn
1aedb0ae5a Ladybird/Qt: Replace the QString-from-AK helpers with a single method
There's no need for 2 overloads for String and DeprecatedString, we can
just use a StringView. This also avoids some cases of needlessly
allocating a DeprecatedString from a StringView when calling this
method.
2023-12-04 12:03:48 -07:00
Timothy Flynn
582f19ba24 Ladybird: Allow opening the Inspector with both ctrl+shift+I and F12
Ladybird on Serenity currently only uses F12, and on other platforms
only uses ctrl+shift+I. Most browsers support both hotkeys, so let's do
the same for consistency.

Note that the AppKit chrome cannot support both shortcuts. macOS does
not allow setting multiple "key equivalent" strings on an action. There
are some questionable hacks we could do to support this eventually, but
for now, just ctrl+shift+I is supported on macOS.
2023-12-02 22:54:06 +01:00
Timothy Flynn
c4daaa9902 Ladybird/Qt: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Timothy Flynn
b5d5e48ffc Ladybird/Qt: Port the Inspector to the WebView property tables 2023-11-29 13:56:35 +01:00
Timothy Flynn
c03b69e664 LibWebView+Ladybird: Remove now-unused WebView TreeModel
This was used to provided base functionality for model-based chromes for
viewing the DOM and accessibility trees. All chromes now use the WebView
inspector model for those trees, thus this class is unused.
2023-11-24 08:37:19 +01:00
Timothy Flynn
52b5bcdb6d Ladybird/Qt: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn
0415d03b4f Ladybird: Register Ladybird as a browser-type application on macOS
This allows Ladybird to be the default browser on macOS, and allows for
opening some file types (.html, .svg, .md, etc.) with Ladybird.

Note this currently only works in the GN build (and thus the Qt chrome).
The CMake build does not set up the Resources directory properly for
macOS to run the Ladybird app without $SERENITY_SOURCE_DIR set.
2023-11-14 09:36:36 -05:00
Timothy Flynn
6732a38cf8 Ladybird/Qt: Implement pasting Web data to the clipboard 2023-11-11 08:54:37 +01:00
Timothy Flynn
9249f8bda8 Ladybird: Convert theme configuration to resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn
818471b7a7 BrowserSettings+Ladybird: Convert home / new tab page to resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn
1b30b510b9 Ladybird: Load all icons uses Core::Resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn
bb43bd2dee Ladybird: Remove the now-unused ModelTranslator 2023-11-05 09:11:23 +01:00
Timothy Flynn
55b53e98d7 Ladybird/Qt: Convert the inspector widget to the WebView model class
This creates a Qt-specific wrapper around the WebView model classes and
uses it for the inspector widget tree / table view models.
2023-11-05 09:11:23 +01:00
Timothy Flynn
c72b42ebb2 Ladybird/Qt: Add a couple of missing header includes
These are currently included implicitly, but this will no longer be the
case after upcoming refactoring.
2023-11-05 09:11:23 +01:00
Aliaksandr Kalenik
b6732b0234 Ladybird+WebContent: Add option to use GPU painter
Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
2023-10-29 17:13:23 +01:00
Andrew Kaster
810bbeaed1 Ladybird: Set Settings org to SerenityOS to load proper plist on macOS 2023-10-27 16:51:03 -06:00
Timothy Flynn
66c8400384 Ladybird/Qt: Add a context menu item to search for the selected text 2023-10-24 07:28:30 +02:00
Timothy Flynn
c8c3d00615 LibWebView: Rename find_search_engine to find_search_engine_by_name
We will also need to search by URL in the Serenity chrome.
2023-10-24 07:28:30 +02:00
Timothy Flynn
e7d977f58d Ladybird/Qt: Display drown-down settings using QPushButton
The default behavior of QPushButton is much closer to what we want from
a drop-down menu, as shown in the QPushButton::setMenu documentation:
https://doc.qt.io/qt-6/qpushbutton.html#setMenu

This also results in much less of a "squished" look than before.
2023-10-23 12:12:36 -04:00
Timothy Flynn
63577e8d1c Ladybird/Qt: Increase default size of the settings dialog
The current size is too small to be able to read the new tab URL. Use
the `resize` API rather than setting a fixed-size as well, to allow the
user to resize the dialog themselves.
2023-10-23 12:12:36 -04:00
Timothy Flynn
f8f0c5459d Ladybird/Qt: Migrate to LibWebView for search engines 2023-10-23 12:12:36 -04:00
Timothy Flynn
e7f48abb74 Ladybird/Qt: Use LibWebView to decide what parts of a URL to highlight 2023-10-20 07:18:54 +02:00
Timothy Flynn
f023e37de7 Ladybird/Qt: Sanitize user-provided URLs with LibWebView 2023-10-13 13:37:11 -04:00
Adam Harald Jørgensen
d6796d5123 Ladybird: Add keyboard shortcuts for jumping to a specific tab
It's now possible to open a specific tab by using Ctrl/Command plus the
number key corresponding to its position in the tab row.
2023-10-06 08:10:30 +02:00
circl
84f845494e Ladybird/Qt: Add support for color pickers 2023-09-27 12:16:41 +01:00
Aliaksandr Kalenik
3c675e3f25 Userland+Ladybird: Always specify url to be about:srcdoc in load_html()
After moving to navigables, we started reusing the code that populates
session history entries with the srcdoc attribute value from iframes
in `Page::load_html()` for loading HTML.

This change addresses a crash in `determine_the_origin` which occurred
because this method expected the URL to be `about:srcdoc` if we also
provided HTML content (previously, it was the URL passed along with the
HTML content into `load_html()`).
2023-09-17 21:08:59 +02:00
Aliaksandr Kalenik
aef4b84e22 LibWeb+WebContent: Add option to dump session history of a traversable 2023-09-16 16:53:32 +02:00
Bastiaan van der Plaat
836a7b00dd Ladybird+LibWeb: Add MouseEvent screenX and screenY support 2023-09-15 22:12:56 +02:00
implicitfield
63d09f6daf Browser+Ladybird: Let the list of user agent strings be shared 2023-09-13 19:33:07 -04:00
Adam Harald Jørgensen
7bf842a974 Ladybird: Allow opening multiple URLs at once from the command line
Each URL is opened in a separate tab on startup, and the active tab is
the first URL supplied.
2023-09-11 17:01:17 +01:00
Timothy Flynn
bc5b7aeffb Ladybird: Hide the WebDriver-to-WebContent IPC path from the help menu
This is never meant to be passed by a human, it is created and passed by
WebDriver only. Hide it from the --help menu to avoid confusion.
2023-09-05 06:51:16 -04:00
Andrew Kaster
7bc009d80f Ladybird: Add new template Kotlin Android application without Qt
This template app from Android Studio should hopefully be more fun to
work on than the Qt wrapped application we were using before. :^)

It currently builds the native code using gradle rules, and has a stub
WebViewImplementationNative class that will wrap a c++ class of the same
name that inhertis from WebView::ViewImplementation. Spawning helper
processes and creating proper views in Kotlin is next on the list.
2023-09-03 11:38:51 +02:00
Andreas Kling
2e45306d42 Ladybird: Update set of User-Agent spoofs to current versions 2023-09-01 09:16:55 +02:00
Timothy Flynn
e26ead0995 Ladybird+LibWebView: Move creation of the SQL client to LibWebView
This lets us remove the direct dependency from Ladybird to LibSQL.
2023-08-31 19:19:45 +02:00
Timothy Flynn
5c5a00dd3a Ladybird+LibWebView: Move CookieJar, Database, and History to LibWebView
These classes are used as-is in all chromes. Move them to LibWebView so
that non-Serenity chromes don't have to awkwardly reach into its headers
and sources.
2023-08-31 19:19:45 +02:00
Bastiaan van der Plaat
43f81f1d0c Ladybird: Remove save button from settings dialog
Save new tab page value on change when valid and
show red error border when URL is not valid
2023-08-31 15:46:21 +02:00
Bastiaan van der Plaat
9510df6eab Ladybird: Move new_tab_page along to set_new_tab_page 2023-08-31 15:46:21 +02:00
Timothy Flynn
204a6f9241 Ladybird+LibWebView: Move console history tracking to ConsoleClient
This will allow other chromes to make use of history in their console
implementations.
2023-08-31 12:20:10 +02:00
Timothy Flynn
bf59e06d2a Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be
common to the JS consoles of all Ladybird chromes. This will let each
chrome focus on just the UI.

Note that this includes the `console.group` functionality that only the
Serenity chrome previously had. This was a FIXME in the Qt chrome, and
it is implemented such that all chromes will receive this functionality
for free.
2023-08-30 09:24:59 +02:00
Timothy Flynn
a6bdf8c2a9 Ladybird: Use a web view for the Qt chrome's View Source action
Unlike the existing popup window, this will provide syntax highlighting.
2023-08-29 08:11:11 -04:00
Timothy Flynn
a718a1f3a6 Ladybird: Allow creating new tabs with plain HTML
This will allow us to internally create a new tab with HTML, to be used
by the View Source command.
2023-08-29 08:11:11 -04:00
Timothy Flynn
9c4ce1b80b Ladybird: Do not enable the reload button if history is empty
Not much of an issue currently, but will be once tabs are used to render
plain HTML.
2023-08-29 08:11:11 -04:00
Timothy Flynn
0f9c088302 Ladybird: Install the native style sheet into the JS console web view
Without this, we are unable to render the web view in dark mode.
2023-08-26 15:32:36 -04:00
Timothy Flynn
d56f127c80 Ladybird+LibWebView: Rename some "on get" notifications to "on received"
The old names sounded like awkward English to me, as they implied the
WebContent process is asking for information. In reality, WebContent is
*providing* the information.
2023-08-23 12:07:02 -04:00
Timothy Flynn
edec5b1d91 Ladybird+LibWebView: Migrate input completions to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
5116e97a9d Ladybird+LibWebView: Migrate tooltip changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
78d9339aa9 Ladybird+LibWebView: Migrate scrolling changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
00fe122b0a Ladybird+LibWebView: Migrate cursor changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
bf464665a7 Ladybird+LibWebView: Migrate layout notification to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
682a5f9b70 Ladybird+LibWebView: Move APIs which only repaint to LibWebView
We can easily add hooks to notify the browsers of these events if any
implementation-specific handling is needed in the future, but for now,
these only repaint the client, which we can do in ViewImplementation.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ea7e1b5f53 Ladybird+LibWebView: Move most of paint handling to LibWebView
Storing the backup bitmap is the same across Browser and Ladybird. Just
peform that work in LibWebView, and handle only the implementation-
specific nuances within the browsers.
2023-08-23 09:59:04 -04:00
Timothy Flynn
15da77f4c4 Ladybird+LibWebView: Migrate file APIs to LibWebView callbacks
This also sets the default callback to do what every non-Serenity
browser is doing, rather than copy-pasting this callback into every
implementation. The callback is still available for any platform which
might want to override the default behavior. For example, OOPWV now
overrides this callback to use FileSystemAccessClient.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ebdcba8b3b Ladybird+LibWebView: Migrate dialog APIs to LibWebView callbacks 2023-08-23 09:59:04 -04:00
Bastiaan van der Plaat
abf0c8f1a6 Ladybird: Use pixelDelta() on supported platforms for better scrolling 2023-08-20 12:17:58 -06:00
Bastiaan van der Plaat
0facfd3257 LibWeb: Make handle_mousewheel wheel delta use pixels 2023-08-20 12:17:58 -06:00
Timothy Flynn
9608bfb576 LibWebView+Ladybird: Remove duplicate WebContent callback
We have on_navigate_back + on_back_button and on_navigate_forward +
on_forward_button. Remove the *_button variants.
2023-08-19 05:15:35 +02:00
Aliaksandr Kalenik
24edb7c97f Ladybird, WebContent: Add option in debug menu to output GC graph dump 2023-08-17 18:27:02 +02:00
Andreas Kling
258af0fb1b Ladybird/Qt: Turn off web search and autocomplete by default
Anyone who wants this can enable it in the settings window.
2023-08-17 16:49:22 +02:00
Cameron Youell
d68433653a Ladybird: Add autocomplete to LocationEdit 2023-08-17 15:30:23 +01:00
Cameron Youell
c53d3e7aa4 Ladybird: Simplify the LocationEdit constructor 2023-08-17 15:30:23 +01:00
Cameron Youell
0da5af0eff Ladybird: Pass QIcon by reference in tab_favicon_changed 2023-08-17 15:30:23 +01:00
Cameron Youell
6e40e8316e Ladybird: Convert Browser::Settings to a singleton 2023-08-17 15:30:23 +01:00
Shannon Booth
c25485700a AK: Port URL scheme from DeprecatedString to String 2023-08-13 15:03:53 -06:00
Timothy Flynn
ccf2597bd3 Ladybird: Remove unused LoadType parameter from Tab::navigate
The only non-default use of this parameter was removed in 980e7164fe.
2023-08-13 21:49:06 +01:00
0x6D70
980e7164fe Ladybird: Add initial page to history
This fixes a bug where the reload button does not work on the page that
was initially opened
2023-08-13 09:24:19 -04:00
Bastiaan van der Plaat
b7b02693b9 Ladybird: Remember window position and size on close 2023-08-09 13:47:44 +01:00
Timothy Flynn
93ffa77370 Ladybird: Remove workaround for initial page load for WebDriver
The issue noted in the removed comment no longer seems to apply. The URL
loaded here is triggered before WebDriver even issues the POST /session
command.
2023-08-09 05:33:24 +02:00
Timothy Flynn
6c7422e8b7 Ladybird: Only load a single URL at launch
When we launch Ladybird, we currently:

1. Create a BrowserWindow, whose constructor navigates to the configured
   new tab page URL.
2. Then navigate to either "about:blank" or whatever URL is provided via
   the command line.

This patch removes step 2 and forwards the URL from the command line (if
any) to BrowserWindow. BrowserWindow's constructor then either navigates
to that URL or the new tab page URL.
2023-08-09 05:33:24 +02:00
Timothy Flynn
601da7e5bd Ladybird: Add the select-all action to the JS console
Also clarify a comment, because it wasn't immediately clear to me what
wouldn't work without the code below it.
2023-08-09 05:13:24 +02:00
Timothy Flynn
59b583329a Ladybird: Close the current tab even if we're closing the window
Currently, if the JS console is open and tied to the last opened tab in
the browser window, it will prevent the main process from exiting when
the last tab is closed. This change explicitly closes that tab before
closing the window (if it's the last tab), allowing Qt to delete the
Tab object.
2023-08-09 05:13:24 +02:00
Andreas Kling
99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
e769776bdd Ladybird: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andrew Kaster
82495083c3 Ladybird: Ensure selected new tab URL is a valid URL before saving 2023-08-07 22:17:40 -04:00
Andrew Kaster
391beef707 Ladybird: Move Qt-specific classes and functions to a Qt subdirectory
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
2023-08-07 14:58:04 -06:00