Commit Graph

215 Commits

Author SHA1 Message Date
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
Andrew Kaster
47d6a263d8 CMake: Move ladybird target creation to UI-specific CMakeLists 2024-06-05 13:56:46 -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
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
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
Tim Ledbetter
8c2f1fd68f Ladybird/Qt: Set find in page query to selected text on initial focus 2024-06-04 07:21:18 +02:00
Tim Ledbetter
b82eaad274 Ladybird: Move BrowserSettings/Defaults.h to Ladybird/DefaultSettings.h 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
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
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
MacDue
563d392db7 Ladybird: Ensure hamburger menu is placed within the browser window 2024-05-08 10:39:46 +02: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
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
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
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
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
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
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
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
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