Commit Graph

649 Commits

Author SHA1 Message Date
Andrew Kaster
4dbb73b360 Meta+Documentation+Ladybird: Update places that use ladybird filename
Fallout from 01feae24b2

These places referred to the filename "ladybird" directly, but we
changed the OUTPUT_NAME of ladybird to "Ladybird".
2023-10-27 07:11:35 +02:00
David Lindbom
01feae24b2 Ladybird: Fix capitalization in AppKit menu bar 2023-10-26 18:02:21 -06:00
Timothy Flynn
1682e46df9 Ladybird+Meta: Make the AppKit chrome the default on macOS
The Qt chrome is still available and may be enabled with CMake.
2023-10-26 11:00:56 +02:00
Timothy Flynn
4c479b0aaa Ladybird/AppKit: Add a context menu item to search for the selected text 2023-10-24 07:28:30 +02: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
f885839ba5 Ladybird/AppKit: Support searching with a search engine in the URL bar
The setting for the search engine to use is currently ephemeral. Once we
have a settings dialog, we can implement this setting there, and persist
that setting.
2023-10-23 12:12:36 -04: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
573a2619a5 Ladybird/AppKit: Support highlighting the eTLD+1 in the location bar 2023-10-20 07:18:54 +02: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
Andrew Kaster
2e759656de Ladybird: Load fonts via Core::Resource URIs instead of filesystem paths 2023-10-17 11:02:01 -06:00
Timothy Flynn
aa5cd24c90 Ladybird/AppKit: Sanitize user-provided URLs with LibWebView 2023-10-13 13:37:11 -04:00
Timothy Flynn
f023e37de7 Ladybird/Qt: Sanitize user-provided URLs with LibWebView 2023-10-13 13:37:11 -04:00
Timothy Flynn
9d31fc3ea3 Ladybird: Implement content zooming in the AppKit chrome
This lets the user zoom in and out on a web page using the View menu or
keyboard shortcuts. This does not implement zooming with ctrl+scroll.

In the future, it'd be nice to embed the zoom level display inside the
location toolbar. But to do that, we will need to invent our own custom
search field and all of the UI classes (controller, cell, etc.) to draw
the field. So for now, this places the zoom level display to the right
of the location toolbar.
2023-10-13 07:51:53 +02: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
Junior Rantila
31ff752a10 Ladybird/AppKit: Update chrome color on theme color change 2023-10-03 16:17:43 -06:00
Andrew Kaster
4fd915b005 Ladybird/Android: Add EditText for URL bar and attach to native WebView 2023-09-29 15:58:55 -06:00
Andrew Kaster
a93507231c Ladybird/Android: Move JavaEnvironment helper to Ladybird namespace 2023-09-29 15:58:55 -06:00
Bastiaan van der Plaat
b32b277192 Ladybird/AppKit: Move frameAutosaveName inside if block 2023-09-29 07:21:31 -04:00
Bastiaan van der Plaat
0ce9dc4c8e Ladybird/AppKit: Add color picker support 2023-09-29 06:27:05 -04:00
circl
84f845494e Ladybird/Qt: Add support for color pickers 2023-09-27 12:16:41 +01:00
Bastiaan van der Plaat
04ee15a5ad Ladybird+LibWeb: Use old error.html template for navigation errors again 2023-09-24 19:59:00 -06:00
Bastiaan van der Plaat
8f2319e966 Ladybird+LibWeb: Rename FileDirectoryLoader to GeneratedPagesLoader 2023-09-24 19:59:00 -06:00
Bastiaan van der Plaat
6f8ceb49c2 Ladybird/AppKit: Fix scrolling with high dpi 2023-09-24 19:58:09 -06:00
Bastiaan van der Plaat
0574c0e474 Ladybird/AppKit: Listen for device pixel ratio changes 2023-09-24 19:58:09 -06:00
Andreas Kling
51caa14381 LibWeb: Remove FrameLoader
This class is no longer used, now that we've moved to navigables.
2023-09-20 18:29:17 +02:00
Bastiaan van der Plaat
69482f1f14 Ladybird/AppKit: Add mouse wheel events 2023-09-20 08:33:31 +02:00
Junior Rantila
f15d46fb8b Meta: Lint .mm files with lint-clang-format.sh 2023-09-19 11:37:48 -06:00
Timothy Flynn
ece9908070 Ladybird: Add context menu items to the AppKit chrome to inspect nodes 2023-09-18 11:11:23 -06:00
Timothy Flynn
bd1e35c726 Ladybird: Map the AppKit Inspector's DOM nodes to their IDs and parents
This is in the spirit of commit a4692a6c978a6e66d171e003063449790a6c5879
(and the history behind that commit).

We will need to perform lookups from an integral node ID to the JSON for
that node frequently in the Inspector. We will also need to traverse the
DOM tree from a node, through its ancestors, to the root node. These are
essentially the same maps stored by the Qt Inspector widget.
2023-09-18 11:11:23 -06:00
Timothy Flynn
6304abf94c Ladybird: Add a table to display CSS properties to the AppKit Inspector 2023-09-18 11:11:23 -06:00
Timothy Flynn
4483204c9c Ladybird: Implement a basic Inspector window for the AppKit chrome
This commit includes only fetching the DOM tree from the WebContent
process and displaying it in an NSOutlineView. The displayed tree
includes some basic styling (e.g. colors).
2023-09-18 11:11:23 -06:00
Timothy Flynn
33b006f157 Ladybird: Add a helper to deserialize a JSON string to an NSDictionary
The steps here are a tad verbose, and will be needed several times in
the Inspector window.
2023-09-18 11:11:23 -06:00
Timothy Flynn
507dea5fdd Ladybird: Add an AppKit NSString category to hold common utilities
This currently holds a helper to create a new string which collapses all
consecutive whitespace to a single ASCII space.
2023-09-18 11:11:23 -06:00
Junior Rantila
1f07a18f4e Ladybird: Add tooltips for buttons in AppKit version 2023-09-18 11:10:31 -06:00
Andrew Kaster
de1bcf3597 Ladybird/Android: Enable content filters and Autoplay allowlist
Copy these over from the standard main.cpp for WebContent. The ideas are
already starting to come together on how to unify these main files.
2023-09-17 19:22:29 -06:00
Andrew Kaster
27fda83dcf Ladybird/Android: Add window options to night theme
These were added to the non-night theme to accomodate our custom action
bar. Add them to the night theme to make it actually usable.
2023-09-17 19:22:29 -06:00
Andrew Kaster
642a2570a8 Ladybird/Android: Explicitly schedule Core::EventLoop in main activity
Instead of having an annoying loop that constantly reschedules a
Core::EventLoop trigger, have the ALooperEventLoopManager do it itself
in the did_post_event() function.

We cannot simply re-use the Unix implementation directly because that
implementation expects to actually be called all the time in order to
service timers. If you don't call its' pump() method, timers do not get
triggered. So, we do still need the seconary thread for Timers that was
added earlier.
2023-09-17 19:22:29 -06:00
Andrew Kaster
ff0494c63b Ladybird/Android: Bind WebSocketService for WebSocket purposes
Similar to the RequestServer, bind this from the WebContentService
implementation and have it work the same way. Deduplicate some code
while we're here.
2023-09-17 19:22:29 -06:00
Andrew Kaster
a243bc465f Ladybird/Android: Bind a RequestServerService for networking needs
Add a RequestServerService class that uses the LadybirdServiceBase class
added previously. Bind to it from the WebContentService's service_main()
during startup.
2023-09-17 19:22:29 -06:00
Andrew Kaster
da8f450335 Ladybird/Android: Move common service functionality to a base class
Create LadybirdServiceBase to hold the standard "set resource dir" and
"init ipc sockets" service functionality that will be common between the
WebContent, RequestServer, and WebSocket services.

Refactor the handler class slightly to avoid the HandlerLeak lint by
making the class a static class inside the companion object and use a
WeakReference to the service instead of a strong one.
2023-09-17 19:22:29 -06:00
Andrew Kaster
315ad2d391 Ladybird/Android: Move JNI functions into their own files
This should be easier to work on, and keeps the layers of the native
code nice and clean cut.
2023-09-17 19:22:29 -06:00
Bastiaan van der Plaat
274fd88242 Ladybird/AppKit: Remember last window position and size 2023-09-17 18:10:42 -06:00
nipos
2691c079d4 Meta+Ladybird: Link to libnetwork on Haiku 2023-09-17 13:38:12 -06:00
nipos
e345085329 Meta+Ladybird: Add some extra definitions for Haiku 2023-09-17 13:38:12 -06: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
Andrew Kaster
78ebeb6a5a Ladybird/Android: Move gradle files to Ladybird/Android directory
And add documentation for how to use the thing
2023-09-15 14:18:52 -06:00
Andrew Kaster
ec05b4bc0a Ladybird/Android: Post timer events to the correct event loop
The FIXME at the bottom of Timer.nativeRun was on the money, and was
the cause of some leaked timers. Solve the issue by passing the
EventLoopImplementation to the JVM Timer object and retrieving it's
thread_local timer list, and posting the events to the Impl rather than
trying to invoke the receiver's timer event callback directly in
the Timer thread. Because the implementation of
ALooperEventLoopManager::did_post_event() reaches for
EventLoop::current(), we also need to make sure that the timer thread
acutally *has* an EventLoop, even if we don't expect to use it for
anything. And we need to make sure to pump it to clear out any of the
poke() invocations sending 4 bytes to the wake pipe for that thread.
2023-09-15 14:18:52 -06:00
Andrew Kaster
3c39579510 Ladybird/Android: Revive extract_tar_archive function
This function used to live in AndroidPlatform.cpp, but was removed
during the transition to the new app. We still need to extract the
assets from the tarball that CMake creates. At least, until we come
up with a generic "Resource" concept in LibCore.
2023-09-15 14:18:52 -06:00
Andrew Kaster
a58ee0ecd2 Ladybird/Android: Implement enough of WebContent to load local files
The local files can only be loaded by calling loadURL on the WebView,
but it's a start.
2023-09-15 14:18:52 -06:00
Bastiaan van der Plaat
836a7b00dd Ladybird+LibWeb: Add MouseEvent screenX and screenY support 2023-09-15 22:12:56 +02:00
implicitfield
bac4fc1b73 Ladybird: Add more items to the debug menu of the AppKit chrome 2023-09-13 19:33:07 -04:00
implicitfield
63d09f6daf Browser+Ladybird: Let the list of user agent strings be shared 2023-09-13 19:33:07 -04:00
Andrew Kaster
d93911928b Ladybird/Android: Add EventLoopImplementation for ALooper
Timers run in their own thread, to take advantage of existing Java
Executor features. By hooking into ALooper, we can spin the main
Activity's UI thread event loop without causing a fuss, or spinning the
CPU by just polling our event loop constantly.
2023-09-13 15:00:56 -06: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
e8f14f8cd0 Ladybird: Add an audio context menu to the AppKit chrome 2023-09-11 06:52:37 -04:00
Timothy Flynn
2eb9f3f639 Ladybird: Install the Audio Unit plugin on macOS 2023-09-09 13:03:36 -04:00
Andrew Kaster
6952de73dc Ladybird: Add WebContentService for Android port
This will let us spawn a new process for an Android Service to handle
all our WebContent needs. The ServiceConnection is manged by each
WebView. The lifecycle of the Service is not quite clear yet, but each
bindService call will get a unique Messenger that can be used to
transfer the WebContent side of the LibIPC socketpair we use in other
ports.
2023-09-09 10:53:30 -06:00
Andrew Kaster
920dc1ba53 Ladybird/Android: Move host build into its own shell script
This lets us select a proper host compiler version if cc/cxx are not
suitable for building Lagom.
2023-09-08 09:01:34 -06:00
Andreas Kling
4da1f4e836 LibWeb: Make FontPlugin::generic_font_name() return FlyString 2023-09-06 11:29:03 -04:00
Andreas Kling
13db3c5ce0 LibGfx: Convert FontDatabase APIs to use FlyString 2023-09-06 11:29:03 -04:00
Andreas Kling
545d8336b8 LibGfx: Convert Font APIs to return String instead of DeprecatedString 2023-09-06 11:29:03 -04:00
Andrew Kaster
4e9dc127ae Meta: Run Android CI via gradle wrapper instead of via CMake 2023-09-06 11:26:20 -04:00
Andrew Kaster
0a05440220 Ladybird: Target JDK 11 instead of 1.8, which was the default
Also use CMake >=3.23.0 instead of 3.27.4, which is much more reasonable
for diverse host systems.
2023-09-06 11:26:20 -04:00
Niklas Poslovski
c223b65a69 Ladybird: Fix the include of use_linker in CMakeLists.txt 2023-09-05 17:12:05 -06:00
Andrew Kaster
52d6c49ccc Ladybird: Add Espresso test on Android to verify we can load our views
The simple smoke test makes sure that we can boot up an android emulator
with our package in it, and that the WebView is visible on boot.

More tests to come with more features :^)
2023-09-05 19:17:48 +02:00
Andrew Kaster
f87388ff72 Ladybird: Force-add the .gitkeep file for the assets folder on Android
This folder is gitignored because we copy a generated tar file to it
during the build so that the android build tools will add it to our
APK file. However, the gitkeep was not re-added when the folder moved.
2023-09-05 19:17:48 +02:00
Andrew Kaster
1d369cb722 Ladybird: Add Android View for WebView and paint into it from bindings
This allows our WebViewImplementationNative class to paint into an
Android Bitmap class from the onDraw() view event. We also set the
viewport geometry from the view since we're setting the Kotlin Bitmap
at the same time.
2023-09-05 19:17:48 +02:00
Daniel Bertalan
dac443fbff Meta: Link Lagom with LLD by default and allow configuring the linker
This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
2023-09-05 14:50:36 +02: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
2418a033d4 Ladbird: Remove LibSQL dependency from Ladybird's WebContent
It is not used in WebContent or any of its dependencies.
2023-08-31 19:19:45 +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
8d66b9ea3f Ladybird: Hook up console history into the AppKit console 2023-08-31 12:20:10 +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
4d26e4650f Ladybird: Implement a JavaScript console for the AppKit chrome
This adds menu items to open an interactive JavaScript console for a web
page. This more or less mimics the Qt implementation of the console.
Hooks are included to tie the lifetime of the console window with the
tab it belongs to; if the tab is closed, the console window is closed.
2023-08-30 09:24:59 +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
c9b9278092 Ladybird: Do not assume the web view is embedded in a normal tab
The LadybirdWebView currently assumed it is viewed with a Tab instance.
This will not be true with the JavaScript console. This patch removes
this assumption by plumbing WebContent callbacks through a new protocol.
The Tab interface then implements this protocol.
2023-08-30 09:24:59 +02:00
Timothy Flynn
85b2782052 Ladybird: Do not scroll the AppKit web view beyond its document rect
For example, the JavaScript console will invoke window.scrollTo(0, INF)
to scroll to the bottom of the console after updating its contents. The
NSScrollView being scrolled here seems to behave oddly if we scroll
beyond its limit (e.g. mouse events stop working). Prevent this by
limiting scrolling to the NSScrollView's document rect.
2023-08-30 09:24:59 +02:00
Timothy Flynn
1ffe0d3590 Ladybird: Explicitly handle setting the AppKit web view's first viewport
We were relying on TabController setting the web view's initial viewport
in [TabController windowDidResize], which has been triggered when the
Tab is first created. However, it turns out that only happens due to the
toolbar being added to the Tab window, causing a resize event. When the
web view is embedded in a window without a toolbar, this resize event is
not triggered. Therefore, we must set the viewport ourselves when the
web view is added to a window.
2023-08-30 09:24:59 +02:00
Timothy Flynn
390da2985f Ladybird: Implement the View Source action for the AppKit chrome
This opens a new tab to display the current tab's source as HTML.
2023-08-29 08:11:11 -04: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
70830b711e Ladybird: Protect some application commands against non-Tab key windows
Currently, the only NSWindow type in the AppKit chrome is the Tab. Once
we have other window types (e.g. Inspector), commands which assume they
are used on a Tab will either crash or behave weirdly.

This changes the createNewTab: command to accept the tab from which the
new tab is created, rather than assuming that tab is the key window. So
if some JS on a page calls window.open() while a non-Tab window is key,
the new tab will be opened within the same tab group.

This also changes closeCurrentTab: to work on any key window. Regardless
of whether the key window is a Tab or some other window, pressing cmd+W
should just close that window.
2023-08-29 08:11:11 -04:00
Timothy Flynn
e981c13a4f Ladybird: Use the correct theme file for the current AppKit theme 2023-08-29 08:11:11 -04:00
Timothy Flynn
6e3177e2fc Ladybird: Add a menu item to the AppKit chrome to choose a color scheme
This lets the user choose a color scheme which differs from the active
system theme. Upon changing the color scheme, the scheme is broadcast to
all active tabs, and will be used in new tabs.
2023-08-28 11:17:48 -04:00
Timothy Flynn
3fc0c21b6c Ladybird: Inform WebContent whether the AppKit chrome is in dark mode 2023-08-28 11:17:48 -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
5291d516c0 LibWeb: Ensure layout/text/ref tests run with the desired default theme
Without setting the --resources flag, headless-browser defaults to /res
for all resources it tries to find, including the theme. It will not
find this path on Lagom, so our attempt to load the default theme does
not accomplish anything.
2023-08-25 19:48:55 +02:00
Timothy Flynn
4f563e346d Ladybird: Ensure we release CoreFoundation references
Once we are done with our references to some CoreFoundation types, we
must be sure to manually release those references.
2023-08-23 19:16:53 -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