Commit Graph

681 Commits

Author SHA1 Message Date
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
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
Timothy Flynn
5722d0025b Ladybird: Implement an AppKit chrome for macOS :^)
This adds an alternative Ladybird chrome for macOS using the AppKit
framework. Just about everything needed for normal web browsing has
been implemented. This includes:

* Tabbed, scrollable navigation
* History navigation (back, forward, reload)
* Keyboard / mouse events
* Favicons
* Context menus
* Cookies
* Dialogs (alert, confirm, prompt)
* WebDriver support

This does not include debugging tools like the JavaScript console and
inspector, nor theme support.

The Qt chrome is still used by default. To use the AppKit chrome, set
the ENABLE_QT CMake option to OFF.
2023-08-22 21:36:19 -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
Niklas Poslovski
9c3b0b367a Ladybird: Link libnsl and libsocket to RequestServer on Solaris 2023-08-19 18:25:56 -06:00
Andrew Kaster
99499a6fae Ladybird+Meta: Add ctest to run WPT in the Integration configuration
By running ctest -C Integration -R WPT, you can run WPT. Adding just
-C Integration will run all other tests *and* the WPT test.

Also add support for ./Meta/serenity.sh test lagom WPT to serenity.sh
2023-08-19 23:50:29 +02: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
Bastiaan van der Plaat
eafdb06d87 LibWeb: Add directory entries page when visiting a local directory 2023-08-15 10:41:54 +01:00
Bastiaan van der Plaat
e4c3a52cfa LibWeb: Add resource_directory_url for internal HTML pages
The error.html page now uses the resource_directory_url this
variable contains the relative path to /Base/res/ on the host
system as a file:// url. This is needed for future pages to load
resource files like icons. For the error.html page this was not
really needed because it lies over this own URL in FrameLoader.cpp.
2023-08-15 10:41:54 +01:00
Timothy Flynn
e6d04d29e8 Ladybird: Support non-Qt chromes on macOS
Non-Qt chromes will want to use the same Info.plist and bundle info as
the Qt chrome. This patch puts the CMake setup for the bundle into a
function that non-Qt chromes may call in their CMakeLists.txt. The Qt
chrome calls it automatically.
2023-08-14 13:36:00 -06:00
Timothy Flynn
553d35e503 Ladybird: Create a runtime error for unknown audio codec plugins
This will allow us to bring the WebContent process into non-Qt macOS
chromes. This branch is only reached when creating an <audio> element,
so while the chrome is heavily under development, we can just avoid
these elements.
2023-08-14 13:36:00 -06:00
Andrew Kaster
46b86ffcfc Ladybird: Add install rules to make app bundle on macOS relocatable
We were still missing the resources and the libraries inside the actual
bundle directory. Do it at install time to not make a mess of all the
rules. The gn build lists all the libraries in a massive list, which
is quite a pain. We can over-copy a few libraries like this to make the
install script a bit easier to follow.
2023-08-13 23:31:00 -06:00
Andrew Kaster
ea0e07ec8f Meta: Include RPATH rules at top level to share them with Ladybird
When using Ladybird/ as CMake source directory, the RPATH rules were
left at the default, which is almost never correct.
2023-08-13 23:31:00 -06: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
Daniel Bertalan
44365074fe CMake: Add UNDEFINED_BEHAVIOR_IS_FATAL configure option
This is mainly intended for use on CI, as UBSan instrumentation results
in a serious load and execution time penalty there. See the previous
commit for more details.

With this enabled, the size of LibWeb, built for x86-64 with Clang 17 as
of 0b91d36a is reduced as follows:

      FILE SIZE        VM SIZE
   --------------  --------------
     +18% +2.99Mi  [ = ]       0    .debug_info
     +14%  +758Ki  [ = ]       0    .debug_addr
    +2.6% +7.92Ki  [ = ]       0    .debug_abbrev
    +129% +2.66Ki  [ = ]       0    [Unmapped]
    -0.2%    -208  -0.2%    -208    .plt
    -0.2%    -312  -0.2%    -312    .rela.plt
    -0.1%    -336  -0.1%    -336    .dynsym
    -0.0%    -647  -0.0%    -513    [8 Others]
    -0.1% -1.14Ki  -0.1% -1.14Ki    .dynstr
   -20.1% -53.5Ki -20.1% -53.5Ki    .eh_frame_hdr
    -7.2% -56.8Ki  [ = ]       0    .debug_str_offsets
    -7.1%  -156Ki  [ = ]       0    .debug_str
   -15.0%  -160Ki  [ = ]       0    .symtab
   -63.6%  -245Ki -63.6%  -245Ki    .relr.dyn
   -25.4%  -357Ki -25.4%  -357Ki    .eh_frame
   -27.7% -1.09Mi  [ = ]       0    .strtab
   -59.3% -10.0Mi  [ = ]       0    .debug_rnglists
   -41.3% -11.0Mi  [ = ]       0    .debug_line
   -70.0% -12.0Mi -70.0% -12.0Mi    .rodata
   -65.2% -15.1Mi -65.2% -15.1Mi    .data
   -53.0% -15.7Mi -53.0% -15.7Mi    .text
   -41.7% -62.1Mi -57.7% -43.4Mi    TOTAL
2023-08-13 05:14:07 +02:00
Andrew Kaster
2299fe1481 Ladybird: Install headers for WebContent when used externally 2023-08-11 20:09:20 -06:00
Andrew Kaster
e28d883f8d Ladybird: Link libraries to WebContent impl lib to add dependencies 2023-08-11 19:26:21 -06:00
Andrew Kaster
88082bfada Ladybird: Install an impl library for WebContent when ENABLE_QT=OFF
This should allow out of tree chromes to prototype other LibWeb platform
plugins easier when using Lagom as a find_package dependency.
2023-08-11 19:07:45 -06:00
Andrew Kaster
92214b59ab CMake: Make sure to install generated sources and header files
We weren't installing a lot of generated sources for the top level Lagom
build or for LibWeb, making it impossible to use LibWeb from a
find_package. ...And also Kernel/API/KeyCode.h, which is included by
no less than 8 different files in Userland/Libraries. We also weren't
installing any Ladybird header files.
2023-08-10 20:10:05 -06:00
Andrew Kaster
79108f615d Ladybird: Add configuration option to build without Qt
This should open the door for adding more GUI chromes to the repository
2023-08-10 20:10:05 -06:00
Bastiaan van der Plaat
b7b02693b9 Ladybird: Remember window position and size on close 2023-08-09 13:47:44 +01:00
Timothy Flynn
3e2449d1fe Browser+WebDriver: Set the initial URL to about:blank from WebDriver
We already do this for headless-browser. There's no need to open any URL
other than about:blank when starting a WebDriver session. We should also
do this from WebDriver code, rather than in special logic in Browser's
main.cpp.
2023-08-09 05:33:24 +02: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
Sebastian Zaha
216667368d LibCore+Ladybird: Extract helper into generic Process::is_being_debugged 2023-08-07 13:16:28 -06:00
Andrew Kaster
167eb501d9 Ladybird: Copy cacert.pem into the expected build-time path on macOS
With the CMake build, the ladybird binary ends up in
$build/bin/ladybird.app/Contents/MacOS. Which is a bit unfortunate for
a few reasons, but the main one is that --enable-lagom-networking
doesn't work with ./Meta/serenity.sh run lagom ladybird.

Let's copy the file to the expected location. There's very likely better
solutions we can use in the future.
2023-08-07 10:34:26 -06:00
Andreas Kling
ddbe6bd7b4 Userland: Rename Core::Object to Core::EventReceiver
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Andreas Kling
ec24d7555a LibWeb: Add a simple internals objects only available during testing
This object is available as `window.internals` (or just `internals`) and
is only accessible while running in "test mode".

This first version only has one API: gc(), which triggers a garbage
collection immediately.

In the future, we can add more APIs here to help us test parts of the
engine that are hard or impossible to reach via public web APIs.
2023-08-06 15:26:34 +02:00
MacDue
7b7ba38655 Ladybird: Fix scroll step size
The Qt docs are not that clear, but to get the number of steps the
wheel was scrolled you divide by 120 (which when multiplied by
wheelScrollLines() gives the scroll offset).
2023-08-05 19:50:17 +02:00
Aliaksandr Kalenik
ac2d9d9273 Ladybird: Do not try to use pixelDelta() to calculate wheel offset
Documentation says that pixelDelta() is not reliable across platforms
so always using angleDelta() should produce more predictable scrolling
behaviour.
2023-08-05 13:22:59 +02:00
Aliaksandr Kalenik
6631314874 Ladybird: Send mouse wheel events to WebContent process
Rather than directing mouse wheel events to the QAbstractScrollArea,
send them to the WebContent process, allowing it to determine if they
should be consumed by the element or used for page scrolling.
2023-08-05 04:47:46 +02:00
Bastiaan van der Plaat
059857d26f Ladybird: Add app icon for macOS 2023-08-04 15:36:37 -06:00
Zaggy1024
ad440f9e9a LibWeb/Ladybird: Use the abstract audio output in a new audio plugin
The implementation of this plugin is meant to eventually replace all
current audio plugins in Ladybird. The benefits over the current Qt-
based audio playback plugin in Ladybird are:

- Low latency: With direct access to PulseAudio, we can ask for a
specific latency to output to allow minimal delay when pausing or
seeking a stream.
- Accurate timestamps: The Qt audio playback API does not expose audio
time properly. When we have access directly to PulseAudio APIs, we can
enable their timing interpolation to get an accurate monotonically-
increasing timestamp of the playing audio.
- Resiliency: With more control over how the underlying audio API is
called, we have the power to fix most bugs we might encounter. The
PulseAudio wrappers already avoid some bugs that occur with QAudioSink
when running through WSLg.
2023-08-04 13:49:36 -06:00
Zaggy1024
78e1defbfe Ladybird: Allow posting events to the Qt event loop from other threads
Previously, a QTimer was used to start processing of our event queue in
the main Qt event loop. Unfortunately, QTimers are not thread-safe, and
disallow starting of a timer from a different thread than it was
created in.

Instead, use a dummy QObject to post a custom QEvent to the main loop
from whatever thread we like, and process our event queue when it is
received by our dummy object.
2023-08-04 13:49:36 -06:00
Zaggy1024
6131d879f7 Ladybird: Process Qt event queue when polling the event loop
The logic for `EventLoopImplementationQt::pump()` caused calls to
`EventLoop::pump(PumpMode::DontWaitForEvents)` to not consume events
posted to the Qt event queue. This caused the window to be unresponsive
even when polling the event loop, if waiting was not desired.
2023-08-04 13:49:36 -06:00
Karol Kosek
49df2e1e3a Ladybird+Browser: Update zoom text on menu after clicking zoom button 2023-08-04 15:16:48 +02:00
MacDue
abd53a8719 Ladybird: Use AK::Url rather than prefix list to check if URL is valid
If a URL is not valid we try navigating to https:// + the url. It's
better to ask AK::Url if it thinks the url is valid than put a big list
of prefixes here, with this obscure protocols like Gemini are now
recognised and with `--enable-lagom-networking` can be viewed in
Ladybird (thanks to #2218).
2023-08-03 15:02:47 +02:00
Andrew Kaster
7d7c419ce6 Ladybird: Add WebSocket server for use by Lagom networking
Hide its use behind the same flag as RequestServer in WebContent.
2023-08-03 09:55:20 +02:00
Andrew Kaster
a1e5a6ac40 Ladybird: Remove Qt dependency from RequestServer
This requires two parts: Core::System::current_executable_path(), and
passing the serenity-resource-root as an argument to the process.
2023-08-03 09:55:20 +02:00
Andrew Kaster
88ccaae11e Ladybird: Rename classes ending with Ladybird
Now that all the classes for Ladybird are in the Ladybird namespace, we
don't need them named as Ladybird::FooBarLadybird. For the Qt-specific
classes, we can tack on a Qt at the end for clarity, but FontPlugin and
ImageCodecPlugin no longer have anything to do with Qt.
2023-08-03 09:55:20 +02:00
Andrew Kaster
506b03740c Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in
the Ladybird namespace, while "old" ones were in the global namespace,
or even sitting in the Browser namespace.
2023-08-03 09:55:20 +02:00
Timothy Flynn
58e3b8cf58 Ladybird: Ensure RequestServer depends on its generated sources
Ladybird's RequestServer needs to depend on its generated IPC header
files to ensure they are generated before RequestServer is compiled,
which we currently bundle into LibWebView.
2023-08-02 12:35:05 -04:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Andrew Kaster
3be71a81bb Ladybird: Don't link SQLServer against Qt when it doesn't need it 2023-08-02 05:44:43 +02:00
Andrew Kaster
172fba4582 Ladybird: Don't prefix application files with Applications/
This was the only instance of this pattern in all of Ladybird
2023-08-02 05:44:43 +02:00
Sebastian Zaha
fd86509ef8 Ladybird: Remove unused spawn helper
The spawn_helper_process method was introduced together with
get_paths_for_helper_process but was only ever used briefly to spawn
WebContent. Other helper processes (SqlServer, headless_browser etc)
are either execed or spawned with their own helpers & custom arguments.
2023-08-01 07:36:15 +02:00