Commit graph

1038 commits

Author SHA1 Message Date
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 b94ec419ac WebDriver: Use --allow-popups option when launching Ladybird
This prevents an "unable to find test window" error on tests that
attempt to open a new window.
2024-06-17 14:16:39 +03: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
Hugh Davenport cb657a038f UI/Qt: Update placeholder text if search disabled
The placeholder text is there to prompt the user as to what could be
added in the address bar. The current text tells the user that they can
"Search or enter web address" even when the search setting is disabled.
When attempting to "Search" the user is instead sent to page ":", with
an error in the console:
    WebContent(575249): (FIXME) Don't know how to navigate to :

This patch fixes this by checking whether the search feature is enabled
and setting the placeholder appropriately. This provides a slightly
better user experience.

Closes #132
2024-06-11 09:50:46 +02:00
Timothy Flynn 54183b8eef UI/AppKit: Display query results on the find-in-page panel 2024-06-11 09:50:13 +02:00
Tim Ledbetter 2ea680b5b3 UI/Qt: Display query results on find in page panel
The number of matches and current match index are now displayed to the
user when a find in page query is performed.
2024-06-09 21:12:33 -04:00
Tim Ledbetter 0a3203fa25 UI/Qt: Remove unused member variable from FindInPageWidget 2024-06-09 21:12:33 -04:00
Andreas Kling 260c5c50ad LibHTTP+RequestServer: Use HTTP::HeaderMap for request headers
No longer just for response headers! The same type is obviously useful
and ergonomic when making requests as well.
2024-06-09 15:34:02 +02:00
Andreas Kling 5ac0938859 LibHTTP+LibWeb: Stop bundling "Set-Cookie" headers as JSON
Before we had HTTP::HeaderMap (which preserves multiple headers with the
same name), we collected multiple "Set-Cookie" headers and bundled them
together as a JSON array.

This was a huge hack, and now we can stop doing that, since LibWeb gets
access to the full set of headers now.
2024-06-09 15:34:02 +02:00
Andreas Kling e636851481 LibHTTP+RequestServer: Add HTTP::HeaderMap and use for response headers
Instead of using a HashMap<ByteString, ByteString, CaseInsensitive...>
everywhere, we now encapsulate this in a class.

Even better, the new class also allows keeping track of multiple headers
with the same name! This will make it possible for HTTP responses to
actually retain all their headers on the perilous journey from
RequestServer to LibWeb.
2024-06-09 15:34:02 +02:00
Andreas Kling 2f68e36137 Ladybird: Use fontconfig to choose generic fonts on non-Apple systems
If we get a suggestion from fontconfig, we try those fonts first, before
falling back on the hard coded list of known suitable fonts for each
generic family.
2024-06-08 10:23:36 +02:00
Andrew Kaster 9f25dc6b09 CMake+CI: Remove BUILD_LAGOM=OFF option in favor of LAGOM_TOOLS_ONLY=ON
The far more common configuration for Ladybird is to always build the
Lagom libraries.
2024-06-08 07:58:11 +02: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
Timothy Flynn d61770c457 LibCore: Remove now-unused singleton process utilities 2024-06-06 11:27:03 -04:00
Timothy Flynn 8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
Timothy Flynn 30e745ffa7 LibWebView: Replace usage of LibSQL with sqlite3
This makes WebView::Database wrap around sqlite3 instead of LibSQL. The
effect on outside callers is pretty minimal. The main consequences are:

1. We must ensure the Cookie table exists before preparing any SQL
   statements involving that table.
2. We can use an INSERT OR REPLACE statement instead of separate INSERT
   and UPDATE statements.
2024-06-06 11:27:03 -04:00
Timothy Flynn cd581e9502 Meta: Do not pass an empty --resources flag to headless-browser
The ${resource_base_dir} no longer exists in this context. Thus LibWeb
tests were no longer actually running.
2024-06-06 13:55:10 +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
Timothy Flynn 8641e78cdc Meta: Copy resources to the app bundle during create_ladybird_bundle()
For some reason, moving the UI-specific CMake to its own files prevents
resource files from being copied to the Resource directory in the macOS
application. I'm not sure what the difference here is, but doing this
step during create_ladybird_bundle() works.
2024-06-05 14:40:02 -06:00
Andrew Kaster 354b0062fa CMake: Simplify WebContent CMakeLists to always create a static lib 2024-06-05 13:56:46 -04:00
Andrew Kaster 47d6a263d8 CMake: Move ladybird target creation to UI-specific CMakeLists 2024-06-05 13:56:46 -04:00
Andrew Kaster ec6072e7cd Meta: Uncouple ladybird.sh run from a specific CMake configuration 2024-06-05 12:21:59 -04:00
Aliaksandr Kalenik 5285e22f2a LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
2024-06-05 07:03:42 +02:00
Andrew Kaster 66d91fa08c Meta: Add new top-level CMakeLists 2024-06-04 13:44:22 -06:00
Andreas Kling cd84d23afa Base+Tests+Ladybird: Remove bitmap fonts 2024-06-04 18:45:30 +02:00
Andreas Kling 04a6e2f83d LibWeb: Remove Gfx::BitmapFont
This class supported the binary bitmap font file format in SerenityOS,
and isn't something we need in Ladybird.
2024-06-04 18:45:30 +02:00
Andreas Kling 30a92911fa WebContent: Remove update_system_fonts() IPC message
This was no longer doing anything. We'll eventually want a way to pass
system default fonts to each WebContent process, but we don't need to
squeeze everything through this API that was really meant for Serenity's
very idiosyncratic font system.
2024-06-04 18:45:30 +02:00
Andreas Kling f78ed0600a LibGfx: Remove FontDatabase "default queries"
At last, nothing depends on these anymore.
2024-06-04 18:45:30 +02:00
Andreas Kling 966d442152 LibWeb+Ladybird: Remove FontPluginSerenity (+ use Ladybird::FontPlugin) 2024-06-04 18:45:30 +02:00
Andreas Kling fac126bce9 Ladybird+LibWeb: Stop using Gfx::FontDatabase default fonts
This closes the window at WebContent process startup where we were
relying on Gfx::FontDatabase having some resolvable value in its default
font query.
2024-06-04 18:45:30 +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
Andreas Kling f2fd8fc928 Everywhere: Remove LibGemini
This hasn't been maintained (or worked at all) for a long time,
and it's not a widely supported protocol, so let's drop it.
2024-06-04 09:19:39 +02:00
Tim Ledbetter 8c2f1fd68f Ladybird/Qt: Set find in page query to selected text on initial focus 2024-06-04 07:21:18 +02:00
easrng 251bb4b860 nix: Add python3 to nix devshell 2024-06-03 15:09:58 -06:00
Timothy Flynn bdbe2fdcc5 Everywhere: Replace SERENITY_SOURCE_DIR with LADYBIRD_SOURCE_DIR
In order to have checkouts of both SerenityOS and Ladybird, we need to
use a different environment variable for Ladybird.
2024-06-03 15:57:59 +02:00
Tim Ledbetter b82eaad274 Ladybird: Move BrowserSettings/Defaults.h to Ladybird/DefaultSettings.h 2024-06-03 10:53:53 +02:00
Tim Ledbetter 3e56835611 Everywhere: Remove references to non-existent paths 2024-06-03 10:53:53 +02:00
Andrew Kaster 6d3a54e4a8 Meta: Update Documentation and CI for repo move 2024-06-03 10:53:53 +02:00
Andreas Kling 09980af4ea LibWeb: Add Web::UIEvents::MouseButton enum, drop dependency on LibGUI
This was the only thing LibWeb needed from LibGUI, and we can just
duplicate the enum in LibWeb and get rid of a bogus dependency.
2024-06-02 20:24:42 +02:00
Timothy Flynn 634c4567fe Ladybird/Qt: Flatten the buttons in the find-in-page panel
The non-flat version of these buttons look a bit out-of-place.
2024-06-01 13:50:03 +01:00
Timothy Flynn 3b56be61dc Ladybird/AppKit: Add a checkbox to enable case-sensitive find-in-page 2024-06-01 07:37:54 +02:00
Timothy Flynn 778f323fc1 Ladybird/Qt: Add a checkbox to enable case-sensitive find-in-page 2024-06-01 07:37:54 +02:00
Timothy Flynn 7dbcbd95ee Ladybird/Qt: Add a placeholder to the find-in-page search box 2024-06-01 07:37:54 +02:00
Timothy Flynn d6732e5906 Ladybird/AppKit: Implement a basic find-in-page panel 2024-05-31 06:30:39 -04:00
Timothy Flynn 8d4cd15cb1 Ladybird/AppKit: Change "Select All" text to be titlecase
Matches the rest of the menu items and Safari.
2024-05-31 06:30:39 -04:00
Timothy Flynn a73ac6aa3f Ladybird/Qt: Find the previous search match when the shift key is held 2024-05-31 06:30:39 -04:00
Timothy Flynn b5d80013ea Ladybird/Qt: Add tooltips to the find-in-page widget 2024-05-31 06:30:39 -04: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
Jamie Mansfield b08d43a5d3 Ladybird/Qt: Calculate the 'physical pixels' for screens
This fixes a regression introduced by GH-23855 in [1], and re-applies
a previous change I made [2].

[1] https://github.com/SerenityOS/serenity/commit/dfc7534
[2] https://github.com/SerenityOS/serenity/commit/b7bd3fd
2024-05-30 07:09:03 +01:00
MacDue b3f63f35e5 Ladybird: Add --force-new-process option
This option skips attempting any chrome IPC which even with the
`--new-window` does not open a new browser process. This is annoying
when trying to compare browser options as opening a new window with
the currently running chrome ignores any options passed to the new
ladybird invocation.
2024-05-29 08:17:01 +02:00
MacDue 9c711bc868 LibWeb+Ladybird: Add option to enable the AffineCommandExecutorCPU
This adds a `--experimental-cpu-transforms` option to Ladybird and
WebContent (which defaults to false/off).

When enabled the AffineCommandExecutorCPU will be used to handle
painting transformed stacking contexts (i.e. stacking contexts where
the transform is something other than a simple translation). The regular
command executor will still handle the non-transformed cases.

This is hidden under a flag as the `AffineCommandExecutorCPU` is very
incomplete now. It missing support for clipping, text, and other basic
commands. Once most common commands have been implemented this flag
will be removed.
2024-05-29 08:17:01 +02:00
Shannon Booth cb9e0c4e64 Ladybird/Qt: Wire up screen added and removed events 2024-05-27 17:24:51 -06:00
Shannon Booth dfc7534eef Ladybird/Qt: Factor out a method to update the screen rects 2024-05-27 17:24:51 -06:00
Timothy Flynn 168d28c15f LibProtocol+Userland: Support unbuffered protocol requests
LibWeb will need to use unbuffered requests to support server-sent
events. Connection for such events remain open and the remote end sends
data as HTTP bodies at its leisure. The browser needs to be able to
handle this data as it arrives, as the request essentially never
finishes.

To support this, this make Protocol::Request operate in one of two
modes: buffered or unbuffered. The existing mechanism for setting up a
buffered request was a bit awkward; you had to set specific callbacks,
but be sure not to set some others, and then set a flag. The new
mechanism is to set the mode and the callbacks that the mode needs in
one API.
2024-05-26 18:29:24 +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
Ali Mohammad Pur 57714fbb38 RequestServer: Handle IPC requests on multiple threads concurrently
Previously RS handled all the requests in an event loop, leading to
issues with connections being started in the middle of other connections
being started (and potentially blowing up the stack), ultimately causing
requests to be delayed because of other requests.
This commit reworks the way we handle these (specifically starting
connections) by first serialising the requests, and then performing them
in multiple threads concurrently; which yields a significant loading
performance and reliability increase.
2024-05-20 08:03:35 +02:00
MacDue 563d392db7 Ladybird: Ensure hamburger menu is placed within the browser window 2024-05-08 10:39:46 +02:00
Andrew Kaster 77e890b15e Meta+Documentation+Ports: Move from C++20 to C++23
Now that oss-fuzz is on a clang commit > the 17.x release candidates,
we can start looking at some shiny new features to enable.
2024-05-06 11:46:28 -06: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
Andrew Kaster 68ec099b66 Ladybird: Update Android build to work with current LibWebView/LibCore
Also update to the latest gradle plugin versions and other dependencies
as recommended by Android Studio Jellyfish.
2024-05-06 09:31:32 -06:00
MacDue b562c9759d Ladybird: Remove menu indicator on hamburger icon 2024-05-06 09:11:12 -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
Timothy Flynn 398ae75f9a Ladybird+LibWebView: Introduce a cache for cookies backed by SQL storage
Now that the chrome process is a singleton on all platforms, we can
safely add a cache to the CookieJar to greatly speed up access. The way
this works is we read all cookies upfront from the database. As cookies
are updated by the web, we store a list of "dirty" cookies that need to
be flushed to the database. We do that synchronization every 30 seconds
and at shutdown.

There's plenty of room for improvement here, some of which is marked
with FIXMEs in the CookieJar.

Before these changes, in a SQL database populated with 300 cookies,
browsing to https://twinings.co.uk/ WebContent spent:

    19,806ms waiting for a get-cookie response
    505ms waiting for a set-cookie response

With these changes, it spends:

    24ms waiting for a get-cookie response
    15ms waiting for a set-cookie response
2024-05-01 07:06:26 +02:00
Andrew Kaster 37a0466285 CMake: Resolve FIXMEs related to CMake < 3.20
We already have required this version for quite a while for Lagom,
Ladybird and Serenity. Now that we require it in all of our CMakeLists,
let's scrub for better ways of writing things.
2024-04-30 07:14:17 -06:00
Andrew Kaster effd368b5b CMake: Remove redundant configuration options from Ladybird CMakeLists
These options are already specified in common_compile_options.cmake and
lagom_install_options.cmake
2024-04-30 07:14:17 -06:00
Timothy Flynn 1a1191cc6e Ladybird/AppKit: Add support for a singleton chrome process 2024-04-30 06:02:15 -06:00
Timothy Flynn bfb356fd6c Ladybird/AppKit: Track the currently active tab
Will be needed to open new tabs from other Ladybird processes from the
active tab.
2024-04-30 06:02:15 -06:00
Timothy Flynn 7ad7ec3c0c Ladybird/AppKit: Bring newly active windows/tabs to the front
This actually actives the underlying tab if needed. This wasn't an issue
previously, as new tabs were always created in already active windows.
But when new windows/tabs are requested from new Ladybird processes, we
need to actually activate those tabs.
2024-04-30 06:02:15 -06:00
Timothy Flynn 606df46e46 Ladybird/AppKit: Retrieve socket notifiers from the local thread data
For some reason, we occasionally receive a junk `info` pointer from the
CFSocketCallback we create for socket notifiers. Instead of capturing a
pointer to the local Core::Notifier for this `info` member, grab it from
the thread data instance based on the socket FD.

This was mostly seen when spamming new window requests to an existing
Ladybird process.
2024-04-30 06:02:15 -06:00
Timothy Flynn 478ceb71ec Ladybird/AppKit: Ensure LibCore events are processed
When we receive a LibCore event, we post an "application defined" Cocoa
event to the NSApp. However, we are currently only processing these from
`pump`, which is only invoked manually.

Instead, we should listen for the event that we've posted and process
the event queue at that time. This is much closer to how Qt's event loop
behaves as well with EventLoopImplementationQtEventTarget.
2024-04-30 06:02:15 -06: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
Jamie Mansfield 56ed3d5e21 Ladybird: Increase minimum tab width to 128
This is double what the previous minimum is, and is more helpful when
lots of tabs are open.
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
Andrew Kaster 2bb0f65309 Ladybird: Add singleton process logic for Qt chrome
This only adds the new tab behavior, as handling multiple windows in
the same process needs some extra help.
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
Timothy Flynn 56e0cd0b1a Ladybird: Restore ability to run WebContent under callgrind
This broke due to the way we now use posix_spawn under the hood. This
moves the handling of the callgrind option to the launcher helper where
we iterate over the candidate process paths, as we need to augment the
way we fork the process for callgrind based on those paths.

This also opens the door for running other processes under callgrind in
the future.
2024-04-27 15:17:31 +02:00
Timothy Flynn 8588008d42 Ladybird: Use RequestServer for networking by default
This really only affects headless-browser when it is linked with Qt. In
that case, it currently uses Qt networking by default and does not have
a flag to use RequestServer instead. Change the default to use RS so it
can undergo sanitized testing in CI.
2024-04-26 09:48:20 +02:00
Andrew Kaster ce9eed918f ImageDecoder: Schedule decode jobs on the LibThreading background thread
This allows the ImageDecoder service to handle new IPC requests while
decoding in parallel.
2024-04-26 09:41:24 +02:00
Timothy Flynn c11019ebc1 Ladybird: Use Core::Process facilities to spawn singleton processes 2024-04-24 15:51:58 -06:00
Timothy Flynn 9fb84e4693 Ladybird: Use Core::Process facilities to spawn helper processes
Note that WebContent now also uses launch_generic_server_process()
instead of its own implementation.
2024-04-24 15:51:58 -06:00
Timothy Flynn ec492a1a08 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-18 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")

There are a couple of weird cases where clang-format now thinks that a
pointer access in an initializer list, e.g. `m_member(ptr->foo)`, is a
lambda return statement, and it puts spaces around the `->`.
2024-04-24 16:50:01 -04:00
Andrew Kaster 39dfb659cf LibWeb+WebContent: Convert ImageCodecPlugin to use the promise-based API 2024-04-23 12:32:04 -06:00
Andrew Kaster 28fcf64835 Documentation: Update Ladybird README with more descriptive information 2024-04-23 11:24:14 -06:00
Jamie Mansfield b7bd3fd920 Ladybird: Calculate the 'physical pixels' for screens
Previously the 'device independent pixels' (which consider scaling)
were used, and then scaling would be applied again when calculating the
screen width for CSS.
2024-04-23 16:25:20 +02:00
Timothy Flynn 771054bff7 Ladybird: Slightly increase the size of the Task Manager window
This adds a bit more room to see most titles on one line.
2024-04-22 14:46:10 -06:00
Timothy Flynn d2bd692bbe Ladybird: Register RequestServer with the chrome's mach server on macOS
This ensures we register RequestServer with the appropriate mach server
name.
2024-04-22 14:46:10 -06:00
Timothy Flynn b83babdf8b Ladybird: Register SQLServer with the task manager 2024-04-22 14:46:10 -06:00
Timothy Flynn 278fc8e57f Ladybird: Return a reference to the mach server name
Rather than a copy, return a reference so that it's a bit safer to use
the result as a StringView within the calling scope.
2024-04-22 14:46:10 -06:00
Timothy Flynn f16f89eb32 Ladybird+LibWebView: Move SQLServer launcher to Ladybird
It previously resided in LibWebView to hide the details of launching a
singleton process. That functionality now lives in LibCore. By moving
this to Ladybird, we will be able to register the process with the task
manager.
2024-04-22 14:46:10 -06:00
Timothy Flynn 5dd3b91f0e LibCore+LibWebView: Move process statistics to LibCore
This will be needed to collect statistics from processes that do not
have anything to do with LibWebView. The ProcessInfo structure must be
virtual to allow callers to add application-specific information.
2024-04-22 14:46:10 -06:00
Shannon Booth 5bf34ecc32 Ladybird: Add an option to enable internals object outside of test mode
Sometimes I like to play around with running Ladybird tests using full
blown Ladybird instead of just headless browser to interactively mess
around with the test page. One problem with this is that the internals
object is not exposed in this mode.

This commit supports this usecase by adding an option to specifically
expose the internals object without needing to run headless-browser
in test mode.
2024-04-22 08:10:08 +02:00
Shannon Booth 1ec6399c00 Everywhere: Remove uneeded short option argument where possible 2024-04-22 08:10:08 +02:00
Andrew Kaster 5e1d678bae Ladybird+Userland: Remove use of unnecessary fd passing socket concept
Now that LibIPC is using SCM_RIGHTS properly, we can go back to only
having one socket laying around when needing to transfer fds to peers.
2024-04-19 16:38:55 -04:00
Andrew Kaster c87e32154a Ladybird+headless-browser: Make RequestServer single instance on Lagom
Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
2024-04-17 10:09:49 -04:00
Andrew Kaster 336b661835 Ladybird: Move QApplication class to its own file
We'll attach some global data to it in an upcoming commit, so it needs
to be accessible outside of main.cpp.
2024-04-17 10:09:49 -04:00
Andreas Kling 1cb5385a29 LibCore: Stop obsessing about tiny OOMs in Core::Timer
Work towards #20405
2024-04-17 07:16:52 +02:00
Andreas Kling f4f4f7781d Ladybird+LibWeb: Add optional IDL call tracing
When launched with the new --enable-idl-tracing option, we now log
every call to web platform APIs declared via IDL, along with the
arguments passed.

This can be very helpful when trying to figure out what a site is
doing, especially if it's not doing what you'd expect.
2024-04-16 16:57:06 +02:00
Andreas Kling 5f9a905793 Ladybird+LibJS: Add optional logging of *all* JS exceptions
When running with --log-all-js-exceptions, we will print the message
and backtrace for every single JS exception that is thrown, not just
the ones nobody caught.

This can sometimes be very helpful in debugging sites that swallow
important exceptions.
2024-04-16 16:57:06 +02:00
Timothy Flynn e5c5dcca6a Ladybird/AppKit: Use LibWeb's history state for history navigation 2024-04-14 18:53:58 -07:00
Timothy Flynn 7c54b15d6d Ladybird/Qt: Remove unused history-related includes 2024-04-14 18:53:58 -07: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
Aliaksandr Kalenik a8cf1aca7c LibWeb: Rename did_update_url() to did_history_api_push_or_replace()
The previous name was extremely misleading, because the call is used for
pushing or replacing new session history entry on chrome side instead of
only changing URL.
2024-04-14 02:42:53 -07:00
Aliaksandr Kalenik a71b2e5fd9 Ladybird/Qt: Use reload() IPC call for reload button
Instead of treating reloading as a regular navigation by using
load_url(), now we invoke a navigable reloading algorithm implemented
from the spec.

Now both reloading triggered from UI and location.reload() will use the
same code path.
2024-04-14 02:42:53 -07:00
Timothy Flynn 3ab5ecb671 Ladybird/AppKit: Implement a simple TaskManager window
Unlike the Inspector window, this is owned by the ApplicationDelegate as
there should be only a single task manager for the entire application.
2024-04-12 09:08:16 +02:00
Andrew Kaster 3b5ac433ef Ladybird: Use MachPortServer to get WebContent Mach ports on macOS 2024-04-09 16:43:27 -06:00
Andrew Kaster 8c5e64e686 Ladybird+LibWebView: Add mechanism to get Mach task port for helpers
On macOS, it's not trivial to get a Mach task port for your children.
This implementation registers the chrome process as a well-known
service with launchd based on its pid, and lets each child process
send over a reference to its mach_task_self() back to the chrome.

We'll need this Mach task port right to get process statistics.
2024-04-09 16:43:27 -06:00
Bastiaan van der Plaat 820f966b33 Ladybird: Add indentation to options in optgroup in select dropdown 2024-04-08 17:24:48 -04:00
Bastiaan van der Plaat 1475c1810f LibWeb: Add support for select options disabled state 2024-04-08 17:24:48 -04:00
Bastiaan van der Plaat 4408581ee0 LibWeb: Refactor SelectItem to allow selecting options without value
Currently the `<select>` dropdown IPC uses the option value attr to
find which option is selected. This won't work when options don't
have values or when multiple options have the same value. Also the
`SelectItem` contained so weird recursive structures that are
impossible to create with HTML. So I refactored `SelectItem` as a
variant, and gave the options a unique id. The id is send back to
`HTMLSelectElement` so it can find out exactly which option element
is selected.
2024-04-08 17:24:48 -04: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 d6c8218089 Ladybird/Qt: Show the tab bar by default
We currently only show the tab bar when we have more than one tab open.
This has caused confusion in the past, as it's a bit less obvious that
the browser supports tabs. For example:

https://hackaday.com/2023/10/10/jennys-daily-drivers-serenityos-and-in-particular-ladybird/
"it’s a single window with no tabs"
2024-04-03 20:56:04 +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 b577782247 Ladybird/Qt: Move the TVG icon loader to a utility file
It will be needed outside of Tab.
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 fa8b64d59a LibWebView+WebContent: Notify UI process about WebContent PID explicitly
On Serenity, it's not trivial to extract the peer pid from a socket that
is created by SystemServer and then passed to a forked service process.
This patch adds an API to let the WebContent process notify the UI
directly, which makes the WebContent process show up in the Serenity
port's TaskManagerWidget. It seems that we will need to do something of
this sort in order to properly gather metrics on macOS as well, due to
the way that self mach ports work.
2024-04-02 09:52:34 -06: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
Andrew Kaster 096feaaeb8 Ladybird+LibWebView: Add ProcessManager to track live processes
This model will be used to add a Processes tab to the inspector.
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
Timothy Flynn 3e659b10f0 Ladybird/Qt: Reference the correct tab when handling the audio icon
We were errantly always referring to the active tab when the audio play
state changed, and when clicking a tab's audio state button, by way of
BrowserWindow::view().

It turns out we also can't copy / rely on the tab index provided to the
signal in any asynchronous context. If the tabs are rearranged, so are
their indices. Instead, capture a pointer to the tab of interest - this
should be safe as we wouldn't be able to click a tab's audio button if
that tab no longer exists.

With this change, we can click the audio button from any tab in the Qt
chrome, and re-arrange tabs at will. The AppKit and Serenity chromes do
not have this issue.
2024-03-31 14:29:17 +02:00
Timothy Flynn f374e64dfc Ladybird/AppKit: Display a tool tip on the tab mute button 2024-03-30 19:28:20 +01:00
Timothy Flynn 9e4ffbcf70 Ladybird/AppKit: Support muting an entire page
We already display a speaker icon on tabs which are playing audio. This
allows the user to click that icon to mute the tab, at which point the
icon is replaced with a muted speaker icon.

We would previously hide the icon when audio stopped playing. We now do
this only if the tab isn't muted. If it is muted, the muted speaker icon
remains on the tab so that the page isn't stuck in a muted state.
2024-03-30 19:28:20 +01:00
Timothy Flynn 0da5d5a0d0 Ladybird/Qt: Display a tool tip on the tab mute button 2024-03-30 19:28:20 +01:00
Timothy Flynn 45b03bf75d Ladybird/Qt: Support muting an entire page
We already display a speaker icon on tabs which are playing audio. This
allows the user to click that icon to mute the tab, at which point the
icon is replaced with a muted speaker icon.

We would previously hide the icon when audio stopped playing. We now do
this only if the tab isn't muted. If it is muted, the muted speaker icon
remains on the tab so that the page isn't stuck in a muted state.
2024-03-30 19:28:20 +01:00
Timothy Flynn 8ff3cd6d76 Ladybird: Reset the default favicon when starting a new page load
This matches the AppKit chrome. This resets the favicon so that we do
not keep using the previous site's favicon if the new site does not have
one.
2024-03-29 08:52:01 -04:00
Timothy Flynn 45c4e1c446 Ladybird/AppKit: Implement history state change mechanics
We now appropriately update the current history item or create a new
history item in the chrome process.
2024-03-29 08:52:01 -04:00
Timothy Flynn 258b1f30b4 Ladybird/AppKit: Remove an unused property from Tab
This was added for a feature that has since been removed, and is now
unused.
2024-03-29 08:52:01 -04:00
Timothy Flynn 2830bdf04a Ladybird/Qt: Implement history state change mechanics
We now appropriately update the current history item or create a new
history item in the chrome process.
2024-03-29 08:52:01 -04:00
Timothy Flynn 8d765f1084 Ladybird/AppKit: Display an audio button on tabs that are playing audio
When audio begins playing, add a button as an accessory view with a
speaker icon to indicate which tab is playing audio. This button is
currently disabled, but in the future may be used to mute the tab.
2024-03-28 21:08:23 +01:00
Timothy Flynn 18821d3509 Ladybird/Qt: Display an audio button on tabs that are playing audio
When audio begins playing, add a button to the left of the favicon with
a speaker icon to indicate which tab is playing audio. This button is
currently disabled, but in the future may be used to mute the tab.
2024-03-28 21:08:23 +01:00
Timothy Flynn 8503bcb897 Ladybird/Qt: Display a default favicon and title
This ensures we consistently show a favicon and that we update the title
to at least display the page URL when there isn't a <title> tag. We
would otherwise continue displaying the previous page's title.
2024-03-28 21:08:23 +01:00
RGBCube 720feaa658 nix: Clean up files, use good practices 2024-03-25 14:19:34 -06:00
Timothy Flynn ed24d8f2b5 Ladybird/AppKit: Implement pasting content from the clipboard 2024-03-25 08:14:00 +01:00
Timothy Flynn 8af140fd7b Ladybird: Use Core::Resource to locate the emoji lookup path
The path we were using is no longer correct, and we've been silently
dropping this error. Use Core::Resource instead, which we use for most
other Ladybird resources. This would have made it much more obvious that
emoji were not installed with the application.
2024-03-23 17:26:31 -04:00
Timothy Flynn 7463b31754 Ladybird: Ensure emoji files are installed into the Ladybird bundle
Otherwise, we are unable to render emoji on websites.
2024-03-23 17:26:31 -04:00
Timothy Flynn 2f85620b43 Meta: Ensure we install resource files when those resource files change 2024-03-23 17:26:31 -04:00
Aliaksandr Kalenik 561e011e07 LibWeb+WebContent+Ladybird: Add ability to paste text from clipboard
Text can be pasted by pressing Ctrl/Cmd+V or by using button in the
context menu. For now only the Qt client is supported.
2024-03-22 15:47:33 -04:00
Shannon Booth e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00
Timothy Flynn a68b134e6d Meta: Do not place headless-browser and WebDriver in libexec
These are standalone applications meant to be run by the user directly,
as opposed to other libexec processes which are programmatically forked
by the browser. To do this, we simply remove these processes from the
`ladybird_helper_processes` list. We must also explicitly list the
dependencies for these processes.
2024-03-16 19:44:40 -04:00
Timothy Flynn 3a8bde9ef2 Ladybird/AppKit: Implement <input type=file> file type filtering 2024-03-16 08:42:33 +01:00
Timothy Flynn a0e6c7457a Ladybird/Qt: Implement <input type=file> file type filtering 2024-03-16 08:42:33 +01:00
Timothy Flynn 6760d236e4 Ladybird+LibWeb+WebContent: Parse the <input type=file> accept attribute
This parses the accept attribute value for file input types and passes
it along to the browser chromes.
2024-03-16 08:42:33 +01:00
Andrew Kaster 1d70306c41 Meta: Handle output directories for multi-config CMake generators
For Ninja Multi-Config, Xcode and Visual Studio, the way we set up our
output directories would result in exectuables that can't run from the
build directory. Add the same sauce that we added to Jakt to insert
``$<CONFIG>`` where appropriate.
2024-03-14 17:05:05 -06:00
Bastiaan van der Plaat 16fdb005f0 Ladybird/Qt: Allow CR inside of elements title attributes 2024-03-13 07:58:36 -04:00
Timothy Flynn 3e1ffc03c4 Ladybird/Qt: Adjust the Inspector context menu by the device pixel ratio
Otherwise, the context menu is very out of position on devices with a
device pixel ratio other than 1.
2024-03-11 16:49:20 +01:00
Timothy Flynn b5e8f0ebfe Ladybird/Qt: Move positional device pixel ratio adjustment to a helper
The code to convert a Gfx::IntPoint to a QPoint adjusted for the device
pixel ratio is a bit of a mouthful, and will be needed outside of Tab,
so move it to a helper that can be reused.
2024-03-11 16:49:20 +01:00
Andrew Kaster 096ddb0021 Ladybird: Include Userland/ in for Applications that use LibWeb
After ea682207d0, we need Userland/
included directly in these application executables. This only impacts
the build with Ladybird/CMakeLists.txt as the top level CMakeLists, as
the Lagom/ directory includes Userland/ globally.
2024-03-06 19:50:00 -05:00
Timothy Flynn 8a602876d7 Ladybird/Qt: Explicitly ignore wheel events with the ctrl key pressed
This allows ctrl+wheel events to zoom in and out of the page. This was
ported incorrectly in commit c1476c3405.
2024-03-06 11:20:38 -05:00
Ali Mohammad Pur 6dfb2f9dc8 Everywhere: Merge the WebSocket service into RequestServer
This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
2024-03-06 10:07:27 +01:00
Andrew Kaster 4dd2ec68fc RequestServer: Transfer ownership of Protocols to all_protocols map
It's no change in application behavior to have these objects owned by
the function-scope static map in Protocol.cpp, while allowing us to
remove some ugly FIXMEs from time immemorial.
2024-03-06 08:15:03 +00:00
Timothy Flynn 2c31ef11bc Ladybird/AppKit: Handle input events through LibWebView
The AppKit chrome currently handles all input events before selectively
forwarding those events to WebContent. This means that WebContent does
not see events like cmd+c.

Here, we make use of LibWebView's input handling and wait for LibWebView
to inform the chrome that it should handle the event itself.
2024-03-06 07:46:18 +01:00
Timothy Flynn c1476c3405 Ladybird/Qt: Handle input events through LibWebView
The Qt chrome currently handles all input events before selectively
forwarding those events to WebContent. This means that WebContent does
not see events like ctrl+c.

Here, we make use of LibWebView's input handling and wait for LibWebView
to inform the chrome that it should handle the event itself.
2024-03-06 07:46:18 +01:00
Filiph Siitam Sandström fd694e8672 AK+Lagom: Make it possible to build for iOS
This commit makes it possible to build AK and most of Lagom for iOS,
based on the work for the Ladybird build demoed on discord:
https://discord.com/channels/830522505605283862/830525031720943627/1211987732646068314
2024-03-03 13:13:42 -07:00
Sam Atkins 163a40c539 Ladybird: Use Core::Environment instead of Core::System::*env() 2024-02-27 08:33:48 +00:00
Tim Ledbetter a968bc6f80 Ladybird/Qt: Use a precise timer for event loop timer events
This improves the accuracy of `setTimeout()`.
2024-02-26 16:12:20 -07:00
Andrew Kaster ea59bfaae7 Ladybird: Move helper processes to CMAKE_INSTALL_LIBEXECDIR
It aligns better with the Filesystem Heirarchy Standard[1] to put our
program-specific helper programs that are not intended to be executed by
the user of the application in $prefix/libexec or in whatever the
packager sets as the CMake equivalent. Namely, on Debian systems this
should be /usr/lib/Ladybird or similar.

[1] https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrlibexec
2024-02-26 13:16:27 -07:00
Andrew Kaster 68402bec12 Ladybird: Remove $SERENITY_SOURCE_DIR from resource root candidates
Now we will only load resources from $build/share/Lagom. On macOS, we
load from the bundle directory Contents/Resources instead. This
simplifies the commands and environment variables needed to execute
Ladybird from the build directory, and makes our install setup less
awkward for distributions and packagers.
2024-02-26 13:16:27 -07:00
Andrew Kaster 0a55749a39 Ladybird+Userland: Use ByteString for candidate server paths
We've adopted a stance that paths should be ByteStrings rather than
UTF-8 strings, so apply that to the Ladybird helpers.
2024-02-26 13:16:27 -07:00
Andrew Kaster 1e0dd9aa8c Ladybird: Copy resources into the build directory
This will let us remove the dependence on SERENITY_SOURCE_DIR
2024-02-26 13:16:27 -07:00
Andrew Kaster 86c1d97e3c Ladybird: Always place helper processes in bundle directory on macOS
Don't put them in bin/ and then copy them to the bundle dir later, as
this means that they only get updated in the bundle directory if the
Ladybird binary itself needs updated. Which is not a fun workflow if you
are working on WPT and want to hack on the WebDriver binary.
2024-02-26 13:16:27 -07:00
Timothy Flynn a346f14fb4 Ladybird/AppKit: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Timothy Flynn 834f76ef24 Ladybird/Qt: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Dan Klishch b77996884e LibCore+Ladybird: Don't force timer ids to be integer just to remap them
If we don't force event loop to fit timer id into integer, we can
eliminate awkward IDAllocator inside EventLoopImplementations.
2024-02-25 17:24:36 -07:00
Dan Klishch bed4af6fef LibCore+Ladybird: Make unregistering timer infallible
Let's force calling code to provide valid timer ids. No code changes are
required since, surprise, nobody used this obscure functionality.
2024-02-25 17:24:36 -07:00
Dan Klishch 21097d1c9e LibCore+Ladybird: Don't store timer_id in Core::TimerEvent 2024-02-25 17:24:36 -07:00
Shannon Booth 9ce8189f21 Everywhere: Use unqualified AK::URL
Now possible in LibWeb now that there is no longer a Web::URL.
2024-02-25 08:54:31 +01:00
Simon Wanner 81d1b129f7 Ladybird/QT: Avoid incorrect round trip via QUrl
QUrl::toString reverses the Unicode->ASCII conversion that already
occurred here. The text of m_location_edit is already in the format we
expect, so let's just convert QString->AK::URL directly, instead of
taking the detour QString->QUrl->AK::URL
2024-02-21 09:25:12 -05:00
Simon Wanner cac23820c5 Ladybird/QT: Avoid constructing AK String types from char* without size
While QByteArray::data does return a null-terminated char* it's nicer to
avoid strlen() when we already know the size
2024-02-21 09:25:12 -05:00
Bastiaan van der Plaat 656f764b1b Ladybird/AppKit: Convert select dropdown position to correct scale 2024-02-19 13:36:58 -05:00
Andrew Kaster ff9eb62f3d WebDriver: Add commandline option to pass extra certificates
This is useful for running WPT
2024-02-14 06:55:40 +01:00
Andrew Kaster bb9da0ed8d Ladybird: Plumb overriding root certificate paths through the chromes 2024-02-08 08:49:32 -07:00
Andrew Kaster 080aa567a5 RequestServer+LibTLS: Allow applications to specify multiple root certs 2024-02-08 08:49:32 -07:00
Andrew Kaster f739e976a4 Tests: Pass App Bundle path to WebDriver to WPT CTest test on macOS
The WebDriver binary in ${CMAKE_CURRENT_BINARY_DIR}/bin doesn't actually
have access to the Ladybird binary in the default CMake setup.
2024-02-08 15:53:46 +01:00
Dan Klishch 38164411f0 Ladybird/Qt: Properly listen for DPI changes on Wayland
Some Wayland compositors have support of fractional-scale-v1 protocol.
The protocol allows compositor to announce a preferred fractional scale
on a per-wl_surface basis. Qt forwards these Wayland events to an
application using a usual DevicePixelRatioChange event. However, in
contrast to the other platforms, this DevicePixelRatioChange event is
issued directly on widgets and not screens. Additionally, the exact
fractional scale is stored in QWindow object and not the current screen.

Note that in theory it is possible to obtain per-screen fractional
scaling on Wayland by interpolating data provided by wl_output and
xdg_output events but qtwayland does not do that.

If fractional-scale-v1 is not available, qtwayland will still fire
per-Widget DevicePixelRatioChange events, but, obviously, with the
per-screen possibly larger ceiled scaling.

This whole thing makes handling DPI changes on Wayland really simple.
All we need to do is to intercept DevicePixelRatioChange events firing
on QWindow objects and call the old device_pixel_ratio_changed handler
with the window's devicePixelRatio(). The only caveat here is not forget
to always set QWidget's parent before calling devicePixelRatio() on it.
2024-02-06 09:59:17 -07:00
Tim Ledbetter 8320faf052 Ladybird/Qt: Map Enter keypresses to the code point '\n'
Previously, on systems where pressing Enter would generate "\r\n", only
the '\r' character was being sent to the event handler. This change
ensures consistent behavior across platforms regardless of their native
line ending characters.
2024-02-05 16:52:03 -05:00
Andrew Kaster 36cd2fb7c5 Ladybird+WebContent: Update IPC calls to handle multiple traversables
The IPC layer between chromes and LibWeb now understands that multiple
top level traversables can live in each WebContent process.

This largely mechanical change adds a billion page_id/page_index
arguments to make sure that pages that end up opening new WebViews
through mechanisms like window.open() still work properly with those
extra windows.
2024-02-03 20:51:37 -05:00
Andrew Kaster 677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Andrew Kaster 7245f6f11c Ladybird: Open files from the open files dialog as a QURL
This prevents us from needing to properly prepend file:// to the
returned filename.
2024-02-03 20:51:37 -05:00
Andrew Kaster c75bd4ed15 Ladybird/Qt: Rename new_tab to new_tab_from_url and make it take AK::URL
Instead of having QString be the API for these load() calls, just pipe
AK::URL throughout the UI.
2024-02-03 20:51:37 -05:00
Andrew Kaster a91680dd55 Ladybird/Qt: Rename new_tab(StringView) to new_tab_from_content
Having an overload of new_tab with StringView and QString that each do
very different things is uncomfortable, to say the least.
2024-02-03 20:51:37 -05:00
Andrew Kaster 48ce8fb4e9 Ladybird: Add ability to create a tab without creating a new WebContent 2024-02-03 20:51:37 -05:00
Dan Klishch 77e4f0d7d8 LibCore: Allow listening for multiple conditions using a single Notifier
While on it, implement currently unused Notifier::set_type correctly
(but not efficiently) by re-registering Notifier in the EventLoop.
2024-02-03 16:43:13 -07:00
Timothy Flynn 85b8971a80 Ladybird+LibWeb+WebContent: Port the did_request_cookie IPC to String 2024-01-26 20:22:39 +01:00
Timothy Flynn 5945cdc054 Ladybird+Meta: Extract AK into its own library on Lagom
We currently bundle AK with LibCore on Lagom. This means that to use AK,
all libraries must also depend on LibCore. This will create circular
dependencies when we create LibURL, as LibURL will depend on LibUnicode,
which will depend on LibCore, which will depend on LibURL.
2024-01-22 08:48:34 -05:00
Bastiaan van der Plaat dc2233ef7a Ladybird+WebContent: Add chrome command line and exe path passing 2024-01-17 17:32:05 +01:00
Nico Weber 398f34bb81 Ladybird/AppKit/CMake: Use a more civilized way of finding Cocoa
Finding Cocoa.framework is the linker's job, not CMake's.

No behavior change.
2024-01-15 11:18:55 -07:00
Nico Weber d324517ed7 Ladybird/AppKit: The "Window" menu should be called "Window"
...not "Windows".
2024-01-15 12:15:16 -05:00
Bastiaan van der Plaat cde14901bc Ladybird+LibWeb: Add initial about:version internal page 2024-01-13 13:41:09 -05:00
Andrew Kaster 02edd240ae LibWeb+WebContent: Spawn Worker processes from the chrome
Instead of spawning these processes from the WebContent process, we now
create them in the Browser chrome.

Part 1/N of "all processes are owned by the chrome".
2024-01-12 15:53:11 -07:00
Timothy Flynn 7db8b206a8 Ladybird/AppKit: Show an informational dialog after taking a screenshot
The dialog displays where the screenshot is saved and presents an option
to open its containing folder.
2024-01-06 20:11:12 +00:00