Commit graph

850 commits

Author SHA1 Message Date
Nico Weber bb2d80a2bb Everywhere: Gently remove the ladybird android port
With Ladybird now being its own repository, there's little reason
to keep the Ladybird Android port in the SerenityOS repository.

(The Qt port is useful to be able to test changes to LibWeb in lagom
so it'll stay around. Similar for the AppKit port, since getting
Qt on macOS is a bit annoying. But if the AppKit port is too much
pain to keep working, we should toss that too.

Eventually, the lagom browser ports should move out from Ladybird/
to Meta/Lagom/Contrib, but for now it might make sense to leave them
where they are to keep cherry-picks from ladybird easier.)
2024-06-11 19:40:08 -04:00
Andreas Kling 8994dcb4f9 Everywhere: 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.

(cherry picked from commit 260c5c50ad19f19d0d4c30984e512f56c055ecff)

Updated various SerenityOS components to make it build.
2024-06-10 12:01:57 +02:00
Andreas Kling bec8d73cb3 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.

(cherry picked from commit 5ac093885922246529a467054888e598f8832450)
2024-06-10 12:01:57 +02:00
Andreas Kling c9a1eebcb9 Everywhere: 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.

(cherry picked from commit e636851481eabdf00953573a5eb459ee52feeacc)

Updated various SerenityOS components to make it build.

Fetch: Make sure we iterate over HeaderMap's headers()

This fixes a build failure when built with CMake option
'-DENABLE_ALL_THE_DEBUG_MACROS=ON'.

(cherry picked from commit c51d01bea712d75f9b2cd700be942935044e49b4)
2024-06-10 12:01:57 +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