Commit Graph

1036 Commits

Author SHA1 Message Date
Tim Ledbetter
6c608bac65 UI/Qt: Don't change LocationEdit cursor position on right click
Previously, right clicking highlighted text in the location bar would
cause the current selection to be lost.
2024-09-10 07:39:29 +02:00
Timothy Flynn
9cd34a7d80 UI/AppKit: Re-order field designators to be in declaration order
This is required by C++, but for some reason, only started causing a
compiler error today.
2024-09-08 09:45:39 +02:00
Tim Ledbetter
7c953552b7 UI: Add the --disable-scripting option to disable scripting by default 2024-09-07 11:37:41 +02:00
Tim Ledbetter
256b56dde8 UI/AppKit: Disable popup blocking on startup if --allow-popups is set 2024-09-07 11:37:41 +02:00
Timothy Flynn
40db0848d5 UI/AppKit: Implement the Inspector's cookie context menu 2024-09-07 11:10:27 +02:00
Timothy Flynn
a011aceeba UI/Qt: Implement the Inspector's cookie context menu 2024-09-07 11:10:27 +02:00
Timothy Flynn
2c35e272ba LibWebView: Migrate the Inspector's HTML to its own HTML file
It's getting a bit unwieldy to maintain as an inlined string. Move it to
its own file so it can be edited with syntax highlighting and other IDE
features.
2024-09-07 11:10:27 +02:00
Aliaksandr Kalenik
0244859ab7 LibGfx+Ladybird: Remove unused Emoji.h and Emoji.cpp 2024-09-06 16:56:20 +02:00
Aliaksandr Kalenik
4e9d6a543a Everywhere: Remove bitmap emojis inherited from SerenityOS
These are no longer used since we switched to using the system emoji
font.
2024-09-06 08:30:30 -04:00
Aliaksandr Kalenik
22b8380e37 LibWeb: Include system emoji font in a font cascade list
Adds emoji rendering support on macOS and linux (if it has "Noto Color
Emoji" font).
2024-09-06 08:30:30 -04:00
Timothy Flynn
ed3c450359 LibWebView+UI: Move the database and cookie jar to WebView::Application
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00
Aliaksandr Kalenik
99f64139d0 LibGfx+WebContent: Load resource://fonts after FontDatabase construction
This is a preparation for upcoming changes where Gfx::Typeface will
depend on `FontDatabase::should_force_fontconfig()`, so we will no
longer be able to construct typefaces from FontDatabase constructor
because of circular dependency.
2024-09-05 19:21:52 +02:00
Timothy Flynn
6a0c67d5d2 UI/AppKit: Do not expose PUA key event code points to WebContent
AppKit uses Private Use Area code points for a large collection of
functional keys (arrows, home/end, etc.). Re-assign them to 0 to avoid
tripping up WebContent's key handler.
2024-09-05 14:37:57 +01:00
Timothy Flynn
bf2dad5d38 UI/AppKit: Implement download directory selection 2024-09-03 14:13:41 -04:00
Timothy Flynn
4147d771a6 UI/Qt: Implement download directory selection 2024-09-03 14:13:41 -04:00
Sam Atkins
da171c3230 Inspector: Add a basic style sheet inspector
Choosing options from the `<select>` will load and display that style
sheet's source text, with some checks to make sure that the text that
just loaded is the one we currently want.

The UI is a little goofy when scrolling, as it uses `position: sticky`
which we don't implement yet. But that's just more motivation to
implement it! :^)
2024-09-03 10:12:07 +01:00
Sam Atkins
421fb6309f UI/Qt: Assign dropdown handler for select in WebContentView, not Tab
This makes `<select>` elements also work outside of Tab content, for
example in the Inspector.

Co-authored-by: Tim Flynn <trflynn89@serenityos.org>
2024-09-03 10:12:07 +01:00
Olekoop
bf84a681a5 Android: Use LibWebView for command line flags
On Android there's really no real way to provide command line flags.
We are using a dummy Main::Argument that only contains "ladybird"
as a name of the program.
The strings of Main::Argument cannot be empty, otherwise the program
throws an error. However the argc and argv can be set to 0 and nullptr
2024-09-03 00:17:49 -06:00
Olekoop
7cee53fad6 Android: Write prototypes to satisfy compiler 2024-09-03 00:17:49 -06:00
Timothy Flynn
c36a7ed4c3 WebContent: Do not use IOSurface on Intel macOS for now
For some reason, IOSurface results in a completely blank render on Intel
machines. It's not clear why, so do not use IOSurface for now in order
to allow Intel users to run the browser.
2024-08-30 15:08:15 -04:00
Timothy Flynn
cbf1fd3e61 UI/Qt: Prevent division by zero in tab width calculation
On macOS, the first time TabBar::tabSizeHint is called, the count is
reportedly zero, and results in a floating point exception on x64.
2024-08-30 15:08:15 -04:00
Timothy Flynn
e2ff234ac2 UI/AppKit: Update the User-Agent to the provided UA override name 2024-08-29 13:05:47 +01:00
Timothy Flynn
0464212f82 UI/Qt: Update the User-Agent to the provided UA override name 2024-08-29 13:05:47 +01:00
sideshowbarker
ff170de49d Ladybird: Remove unnecessary copy of decoded images
This also eliminates the clang-tidy warning “Std::move of the const
expression has no effect”.
2024-08-26 00:10:42 -06:00
Jamie Mansfield
b0fc8b67d6 Ladybird/Qt: Rename convert functions to reflect their new types
This is a follow up to GH-1111 to reflect the new signatures that these
functions have.
2024-08-20 21:40:36 +01:00
Sidicer
c380dcf15e UI/Qt: Move cursor to the front
Fix long URLs showing the end instead of domain
2024-08-20 19:51:14 +01:00
Andreas Kling
7cf7a4d7aa Ladybird/AppKit: Use sRGB color space when blitting web content
Before this change, we were passing CGColorSpaceCreateDeviceRGB() to
CGImageCreate(), causing the system to assume that the image data is
in a device-specific RGB space without any color profile adjustments.

If your monitor is more vibrant than the assumed profile (for example,
a wide-gamut display), colors may appear over-saturated as there's no
correction applied for how the display actually renders those colors.

We now pass CGColorSpaceCreateWithName(kCGColorSpaceSRGB) instead,
which makes colors look the same in Ladybird as in other browsers. :^)
2024-08-20 20:31:10 +02:00
Andreas Kling
dd1b8de671 Ladybird+LibWeb+LibGfx: Add option to force use of fontconfig
This allows us to get identical metrics on macOS and Linux. Without
this, Skia will use CoreText on macOS and give us slightly different
text metrics. That causes layout tests to be slightly different on
different platforms, which is a huge headache. So let's not do that.

You can now launch Ladybird and headless-browser with --force-fontconfig
to load fonts through fontconfig. Tests run in this mode by default.
2024-08-20 09:30:05 +02:00
Andreas Kling
0c7670b226 LibGfx: Rename Painter => DeprecatedPainter 2024-08-20 09:30:05 +02:00
Timothy Flynn
a46edc2f8b UI/AppKit: Remove workaround for Protocol naming conflict
The AppKit Application class is responsible for launching all helper
processes. This had to be moved to a .cpp file because we were unable to
include headers with the Protocol namespace in .mm files, as they would
conflict with the Protocol interface defined by Apple.

Now that this namespace has been renamed to Requests, we can remove this
workaround.
2024-08-20 09:29:12 +02:00
Timothy Flynn
3ec5c1941f LibWeb+LibWebView: Add a button to the Inspector to export its contents
When working on the Inspector's HTML, it's often kind of tricky to debug
when an element is styled / positioned incorrectly. We don't have a way
to inspect the Inspector itself.

This adds a button to the Inspector to export its HTML/CSS/JS contents
to the downloads directory. This allows for more easily testing changes,
especially by opening the exported HTML in another browser's dev tools.

We will ultimately likely remove this button (or make it hidden) by the
time we are production-ready. But it's quite useful for now.
2024-08-20 09:28:25 +02:00
Timothy Flynn
4833ba06ea UI/Qt: Process drag-and-drop events through the web view
This forwards all drag-and-drop events from the UI to the WebContent
process. If the page accepts the events, the UI does not handle them.
Otherwise, we will open the dropped files as file:// URLs.
2024-08-19 13:29:19 +02:00
Timothy Flynn
ac062d0c97 UI/AppKit: Process drag-and-drop events through the web view
This forwards all drag-and-drop events from the UI to the WebContent
process. If the page accepts the events, the UI does not handle them.
Otherwise, we will open the dropped files as file:// URLs.
2024-08-19 13:29:19 +02:00
Andrew Kaster
804729fe37 Libraries+Ladybird: Rename LibProtocol -> LibRequests
The identifier "Protocol" is claimed by Objective-C and Swift for use
by the language's built-in protocol conformance feature, which is
similar to Rust traits or Java interfaces.

Rename LibProtocol -> LibRequests, and its namespace from Protocol to
Requests to accomodate this.
2024-08-19 12:56:55 +02:00
Jelle Raaijmakers
7e57cc7b09 UI/Qt: Enable basic IME keyboard input for WebContentView
This makes dead keys work (e.g. typing ' and e results in é).
2024-08-12 17:27:29 +01:00
Jamie Mansfield
df34ee058b Ladybird/Qt: Don't change to new tab with 'Open in New Tab'
It now just opens a new tab, without changing the current tab.
2024-08-12 15:25:02 +02:00
Jamie Mansfield
6133707df8 Ladybird/Qt: Display ampersands in tab titles
Qt reads ampersands as shortcut keys, so this escapes them (with &&) so
they display correctly :^)
2024-08-12 15:17:17 +02:00
Jelle Raaijmakers
b193fe658d LibGfx: Store alpha type information in Gfx::Bitmap
We use instances of `Gfx::Bitmap` to move pixel data all the way from
raw image bytes up to the Skia renderer. A vital piece of information
for correct blending of bitmaps is the alpha type, i.e. are we dealing
with premultiplied or unpremultiplied color values?

Premultiplied means that the RGB colors have been multiplied with the
associated alpha value, i.e. RGB(255, 255, 255) with an alpha of 2% is
stored as RGBA(5, 5, 5, 2%).

Unpremultiplied means that the original RGB colors are stored,
regardless of the alpha value. I.e. RGB(255, 255, 255) with an alpha of
2% is stored as RGBA(255, 255, 255, 2%).

It is important to know how the color data is stored in a
`Gfx::Bitmap`, because correct blending depends on knowing the alpha
type: premultiplied blending uses `S + (1 - A) * D`, while
unpremultiplied blending uses `A * S + (1 - A) * D`.

This adds the alpha type information to `Gfx::Bitmap` across the board.
It isn't used anywhere yet.
2024-08-07 18:51:12 +02:00
Timothy Flynn
96bb8fe944 UI/Qt: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn
b1433a8097 UI/AppKit: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn
62fa84865d UI/Qt: Unregister WebContentView instances just once
We already unregister the view in the ViewImplementation destructor. We
do not need to do so again in the WebContentView destructor.
2024-08-03 15:53:07 -04:00
Tim Ledbetter
6a19cffdde WebDriver: Add a --force-cpu-painting option
This launches the browser withb the `--force-cpu-backend` option, which
forces Skia to use the CPU backend rather than the GPU.
2024-08-01 23:26:45 +01:00
Tim Ledbetter
2854113ee6 LibWebView+WebContent: Add a --force-cpu-painting option
This option forces Skia to use the CPU backend rather than using the
GPU.
2024-08-01 23:26:45 +01:00
Tim Ledbetter
3eb5c63df3 WebContent: Remove the --use-skia-painting option
This has been umused since Skia became the default painter.
2024-08-01 23:26:45 +01:00
Tim Ledbetter
ae51fbd5de WebDriver: Use correct WebDriver IPC path argument name
Previously, the incorrect name for this argument  was being used when
attempting to launch `headless-browser`.
2024-08-01 16:40:19 -04:00
Timothy Flynn
ce5f2861d8 LibWebView+UI: Allow profiling any helper process
This removes the --enable-callgrind-profiling flag, and replaces it with
a --profile-process=<process-name> flag. For example:

    ladybird --profile-process=WebContent
    ladybird --profile-process=RequestServer

This allows profiling any helper process with callgrind.
2024-08-01 15:40:49 +02:00
Timothy Flynn
7106a7bd58 LibWebView+UI: Allow debugging any helper process
This removes the --debug-web-content flag, and replaces it with a
--debug-process=<process-name> flag. For example:

    ladybird --debug-process=WebContent
    ladybird --debug-process=RequestServer

This allows attaching gdb to any helper process.
2024-08-01 15:40:49 +02:00
Timothy Flynn
5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Andrew Kaster
07d387af96 Meta: Create a common Swift settings flow 2024-07-30 18:38:02 -06:00
Andrew Kaster
7f8103da7a CMake: Move GenerateSwiftHeader.cmake to Meta/CMake 2024-07-30 18:38:02 -06:00