Commit graph

747 commits

Author SHA1 Message Date
Timothy Flynn
2e5fbe8052 Ladybird: Add context menu items to directly open audio files
After commit 7ec7015, we can open audio documents directly. This adds
content menu items to do so, similar to images and videos.
2023-06-19 17:42:55 +02:00
Andreas Kling
9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
Timothy Flynn
9e95c9892c Ladybird+LibWeb+WebContent: Add context menu controls for muting audio 2023-06-16 19:34:42 +02:00
Timothy Flynn
b3bbdb1e2c Ladybird: Add a context menu for audio elements 2023-06-16 19:34:42 +02:00
Timothy Flynn
14ca04de25 Ladybird+LibWeb+WebContent: Generalize video context menus for all media
The data we want to send out of the WebContent process is identical for
audio and video elements. Rather than just duplicating all of this for
audio, generalize the names used for this IPC for all media elements.

This also encapsulates that data into a struct. This makes adding new
fields to be sent much easier (such as an upcoming field for muting the
element).
2023-06-16 19:34:42 +02:00
Timothy Flynn
d3b8d88598 LibWeb: Expose volume controls through the platform audio plugin 2023-06-16 13:50:15 +02:00
kamp
aa97c4675f Ladybird: Update screen rects on client creation
This makes pages that use CSS rules like '@media (max-device-width:
600px)' render more correctly.
Without this change device-width and height queries would return 0.
2023-06-13 16:11:33 +02:00
Timothy Flynn
a34e369252 Ladybird+LibWeb+WebContent: Create a platform plugin for playing audio
This creates (and installs upon WebContent startup) a platform plugin to
play audio data.

On Serenity, we use AudioServer to play audio over IPC. Unfortunately,
AudioServer is currently coupled with Serenity's audio devices, and thus
cannot be used in Ladybird on Lagom. Instead, we use a Qt audio device
to play the audio, which requires the Qt multimedia package.

While we use Qt to play the audio, note that we can still use LibAudio
to decode the audio data and retrieve samples - we simply send Qt the
raw PCM signals.
2023-06-13 06:14:01 +02:00
Tim Schumacher
85d14bdc5e Ladybird: Add Userland to the list of include directories
This now matches the Lagom-based Ladybird build and the SerenityOS
build.
2023-06-10 07:06:31 +02:00
Xexxa
5f39a3f911 Ladybird: Add "Open File..." to menu 2023-06-09 23:48:57 +02:00
Xexxa
e8af912e30 Ladybird: Add two separators to menus 2023-06-09 23:48:57 +02:00
implicitfield
71b184accf Meta+Lagom: Enable CMAKE_BUILD_WITH_INSTALL_RPATH
On macOS, CMake incorrectly tries to add and/or remove rpaths from files
that it has already processed when it performs installation. Setting the
rpaths during the build process ensures that they are only set once, and
as a bonus, makes installation slightly more performant.

Fixes #10055.
2023-06-08 17:59:53 +02:00
Timothy Flynn
529546e14f Ladybird: Use the same default new tab page URL as Browser 2023-06-08 07:22:00 +02:00
Timothy Flynn
5a3825b561 Browser+Ladybird+LibWebView: Consolidate title handling in LibWebView
Namely, let's have empty titles behave the same in both Browser and
Ladybird (display the URL).
2023-06-08 07:21:08 +02:00
networkException
0e5ec8c0ab Toolchain+Ladybird: Declare dependencies in correct nix file
The dependencies added in b5e9b9a939
are a better fit for Ladybird/ladybird.nix
2023-06-04 10:01:34 +02:00
networkException
cfd3f749b0 Ladybird: Sort packages in nativeBuildsInputs nix list 2023-06-04 10:01:34 +02:00
Shannon Booth
484635651c Ladybird: Assume file:// URL when URL starts with '/'
Allowing for easily pasting into ladybird the path to some HTML
file (as an example).

This behavior matches chrome and firefox handling.
2023-06-03 11:43:35 +01:00
Nico Weber
f3a58f3a5a Ladybird: Simplify ImageCodecPluginLadybird a bit
No behavior change.
2023-06-02 09:57:20 +01:00
Sigmund Lahn
3bc0e7a7ca Ladybird: Look for helper processes at {app_dir}/{helper}/{helper}
Currently, we only look at the relative path `./{helper}/{helper}`,
which fails if the working directory is not the same as the directory
where the ladybird binary lives.
2023-05-31 13:24:49 +02:00
Ali Mohammad Pur
e47f81d954 Ladybird+Browser: Add a 'Dump All Resolved Styles' debug option
This option dumps all styles for all elements in the document; very
helpful for finding properties that have changed unintentionally :^)
2023-05-29 05:35:41 +02:00
Andreas Kling
ad6027433d headless-browser: Print a diff when a test failure occurs
This will make it a lot easier to understand what went wrong, especially
when the failure occurs on CI but not at home.

And of course, use LibDiff to generate the diff! :^)
2023-05-28 22:03:57 +02:00
Rafał Babiarz
fb445fc523 Ladybird: Add placeholder to LocationEdit 2023-05-28 05:47:20 -06:00
Andreas Kling
f7eb8eed34 Ladybird: Run all layout & text tests in the same process
Instead of starting a new headless-browser for every layout & text test,
headless-browser now gets a mode where it runs all the tests in a single
process.

This is massively faster on my machine, taking a full LibWeb test run
from 14 seconds to less than 1 second. Hopefully it will be a similarly
awesome improvement on CI where it has been soaking up more and more
time lately. :^)
2023-05-27 21:28:05 +02:00
Andreas Kling
7603f8dcae Ladybird: Use the DALL-E ladybird globe as the application icon
This looks a lot more "at home" than usual pixel art logo on
non-SerenityOS systems. :^)

Also, stop using site favicons as the app icon as that made it
annoyingly hard to find Ladybird in task switchers sometimes.
2023-05-27 17:26:29 +02:00
Andreas Kling
edbc732785 Ladybird+Tests/LibWeb: Add very basic text-only test harness
This allows us to create "text tests" in addition to "layout tests".
Text tests work the same as layout tests, but dump the document content
as text and exit upon receiving the window "load" event.
2023-05-27 14:03:49 +02:00
Xexxa
8f16d37f00 Ladybird: Add shortcut to "Close Current Tab" 2023-05-25 09:04:11 +01:00
Xexxa
850b713889 Ladybird: Move "Settings" from "File" to "Edit" 2023-05-25 09:04:11 +01:00
Xexxa
689954dfc1 Ladybird: Add missing icons 2023-05-25 09:04:11 +01:00
Karthik Karanth
8177ecb17f Ladybird: Use cursor position for context menu 2023-05-24 06:01:47 +02:00
Jelle Raaijmakers
f391ccfe53 LibGfx+Everywhere: Change Gfx::Rect to be endpoint exclusive
Previously, calling `.right()` on a `Gfx::Rect` would return the last
column's coordinate still inside the rectangle, or `left + width - 1`.
This is called 'endpoint inclusive' and does not make a lot of sense for
`Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would
return 4 as its right side. This same problem exists for `.bottom()`.

This changes `Gfx::Rect` to be endpoint exclusive, which gives us the
nice property that `width = right - left` and `height = bottom - top`.
It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly
the same.

All users of `Gfx::Rect` have been updated accordingly.
2023-05-23 12:35:42 +02:00
Andreas Kling
1a1ff8eb5e Ladybird: Default to HTTPS instead of HTTP if no protocol is specified 2023-05-23 11:16:36 +02:00
Rafał Babiarz
38a553e1ce Ladybird: Select all text in LocationEdit on click 2023-05-23 06:09:40 +02:00
Ben Wiederhake
4e101d1fa2 Ladybird: Remove unused IODevice.h include 2023-05-21 07:52:52 +02:00
Timothy Flynn
6970f1b6c1 Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebView
The goal here is to reduce the amount of WebContent client APIs that are
duplicated across every ViewImplementation. Across our three browsers,
we currently:

    Ladybird - Mix some AK::Function callbacks and Qt signals to notify
    tabs of WebContent events.

    Browser - Use only AK::Function callbacks.

    headless-browser - Drop most events on the floor.

Instead, let's only use AK::Function callbacks across all three browsers
to propagate events to tabs. This allows us to invoke those callbacks
directly from LibWebView instead of all three browsers needing to define
a trivial `if (callback) callback();` override of a LibWebView virtual
function. For headless-browser, we can simply not set these callbacks.

As a first pass, this only converts WebContent events that are trivial
to this approach. That is, events that were simply passed onto the tab
or handled without much fuss.
2023-05-17 19:47:05 +02:00
Timothy Flynn
c113d780c6 Ladybird: Move ownership of the JS console/inspector to the tab object
This is to match Browser, where ownership of all "subwidgets" is placed
on the tab as well. This further lets us align the web view callbacks to
match Browser's OOPWV as well, which will later let us move them into
the base LibWebView class.
2023-05-17 19:47:05 +02:00
Timothy Flynn
2d51b8c286 Browser+Ladybird+LibWebView: Virtualize computing content/widget points
This will allow moving some copy-pasted functionality from web view
implementations to the base LibWebView class.
2023-05-17 19:47:05 +02:00
Timothy Flynn
31d7565cf3 Ladybird: Remove unused JS console methods
Note that the real implementations of these functions are:
    notify_server_did_output_js_console_message
    notify_server_did_get_js_console_messages

Which have the same method bodies as these unused variants.
2023-05-17 19:47:05 +02:00
Timothy Flynn
d8b14da380 Browser+Ladybird+LibWebView: Move some common functions to LibWebView
The implementations of handle_web_content_process_crash and
take_screenshot are exactly the same across Browser and Ladybird. Let's
reduce some code duplication and move them to LibWebView.
2023-05-17 19:47:05 +02:00
MacDue
77008d4bac Ladybird: Fix context menus being in slightly the wrong position
Previously, we were doing mapToGlobal() via the Tab widget, but the
widget position was actually relative to the WebContentView. This
meant context menus appeared slightly vertically offset from where
you clicked.
2023-05-16 13:22:15 -07:00
Timothy Flynn
b0edc7b6e4 Ladybird: Add screenshot actions to the page context menu
Browser on Serenity has these actions already.
2023-05-16 19:47:18 +02:00
Timothy Flynn
e30dcc7391 Ladybird: Add a context menu for image elements 2023-05-16 12:48:39 +02:00
Timothy Flynn
0d1b5e7f7a Ladybird: Add a context menu for link elements 2023-05-16 12:48:39 +02:00
Timothy Flynn
1b2394d92e Ladybird: Add a context menu for video elements 2023-05-16 12:48:39 +02:00
Timothy Flynn
a0e31bf1de Ladybird: Move the page context menu from the BrowserWindow to the Tab
This will allow us to show different context menus depending on what
element is clicked, much like we do for Browser on Serenity.
2023-05-16 12:48:39 +02:00
Timothy Flynn
d8f03dda08 Browser+LibWeb+WebContent: Broadcast video element context menu requests
This just sets up the IPC to notify the browser process of context menu
requests on video elements. The IPC contains a few pieces of information
about the state of the video element.
2023-05-16 12:48:39 +02:00
Andreas Kling
85c542ab00 Ladybird+LibWebView: Move backing store management code to LibWebView
This lets us share this code on all platforms, and makes resizing the
window much faster on SerenityOS as well. :^)
2023-05-15 12:13:34 +02:00
Andreas Kling
ec2600f246 Ladybird: Make resizing the window a lot less laggy
While resizing, we now pad the shared bitmap allocations with 256 pixels
extra in both axes. This avoids churning through huge allocations for
every single resize step.

We also don't reallocate at all when making the window smaller.

3 seconds after the user stops resizing, we resize the backing stores
again so they fit the window perfectly.
2023-05-15 10:04:29 +02:00
Andreas Kling
984630845d Ladybird: Only request repaint for what's in the visible viewport
Before this change, we asked WebContent to fill the whole shared bitmap
with content, even if we couldn't show it all in the viewport.
2023-05-15 10:04:29 +02:00
Andreas Kling
def37e65f3 Ladybird+LibWebView: Remember the size of the last paint
This will allow us to change the size of the backing store bitmap
without conflating the size of the bitmap and the size of the paint.
2023-05-15 10:04:29 +02:00
Andreas Kling
68271c4fce Ladybird: Floor the WebContentView viewport offset at 0, 0
This fixes an unpleasant visual glitch when resizing the window.
When the user makes our QAbstractScrollArea larger, the scroll bars can
end up with negative values, which we were happily forwarding to the
WebContent process and asking it to paint the whole page at an offset.
2023-05-15 10:04:29 +02:00
Luke Wilde
3894a8b995 Ladybird: Send the double click event to WebContent 2023-05-14 13:51:05 +02:00
MacDue
404804db36 Ladybird: Add common handy actions to context menu
This commit adds the common actions you'd expect to the Ladybird context
menu, arranged like so:

	┌──────────────────────────────┐
	│  Go Back           Alt+Left  │
	│  Go Forward        Alt+Right │
	│  Reload            Ctrl+R    │
	│ ──────────────────────────── │
	│  Copy              Ctrl+C    │
	│  Select All        Ctrl+A    │
	│ ──────────────────────────── │
	│  View Source       Ctrl+U    │
	│  Inspect Element             │
	└──────────────────────────────┘
2023-05-13 15:54:34 +02:00
Andreas Kling
0db94daf5e Ladybird: Disable SQL database by default (until we can trust it)
The asynchronous query execution keeps causing bugs with document.cookie
so let's make the SQL database backend default off until we can trust it
to do what we need.
2023-05-13 07:52:22 +02:00
Lucas CHOLLET
8c34959b53 AK: Add the Input word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
MacDue
09773048b6 Ladybird: Allow right clicking and inspecting elements
This adds "Inspect Element" (currently the only entry) to the context
menu for the page, which will do what you expect (most of the time),
and bring up the Inspector with hovered element selected.
2023-05-09 06:16:58 +02:00
martinfalisse
f7c27556fa Documentation: Homogenize Ladybird build instructions
Change the file name so that it is similar to the other build
instructions and may be easier to find :^).
2023-05-08 20:53:25 -06:00
martinfalisse
c719a542c5 LibWeb: Add --layout-test-mode flag to HeadlessBrowser
The `layout-test-mode` flag changes the font to be SerenitySans as this
is the font used for layout tests for cross-platform compatibility of
tests.
2023-05-08 14:47:52 +02:00
martinfalisse
00e446facd Ladybird: Move arguments parsing before FontPluginQt init
In a future commit will pass arguments parsed to the FontPluginQt
constructor.
2023-05-08 14:47:52 +02:00
MacDue
b5e593d0e7 Ladybird: Don't ask Qt to decode any images for us
We should only rely on LibGfx to decode images for us, if LibGfx
can't decode an image that should be motivation to improve LibGfx,
not hidden by Qt picking up the slack :^)
2023-05-07 21:13:02 +02:00
Andreas Kling
af5d892a7e Ladybird: Don't ask Qt to decode SVG images for us
While it's nice to see <img src="foo.svg"> suddenly work in Ladybird
after linking with the Qt SVG module, this is cheating.

We should implement SVG-as-image ourselves instead of relying on 3rd
party code to do it. :^)
2023-05-07 09:06:48 +02:00
Andreas Kling
0eb7c24e7d Ladybird: Stop telling Qt to use HTTP pipelining
For some reason, this was causing incomplete HTTP loads in some cases.
As an example, we would only load half of the "Ahem" CSS font from the
wpt.live server when running Acid3.

I only enabled pipelining in the first place because I assumed it would
be a performance boost, but it appears to do more than that.

I suppose there's a reason it's off by default (and most Qt API users
don't bother enabling it.)
2023-05-06 12:49:12 +02:00
Andreas Kling
4b5cbe7931 Ladybird: Use vector icons in the browser toolbar
We now load SVG icons (via the Qt resource system) and render them into
a QIcon (with normal and disabled variants) using system colors.
We also re-render them if the system color theme changes.

This instantly makes Ladybird look less foreign on my Linux box.

I drew the icons myself, and they could definitely be more optimized,
but this was my first time using Inkscape. :^)
2023-05-05 16:58:08 +02:00
Andreas Kling
60312f2c83 Ladybird: Remove the "home" icon from the toolbar (and the concept)
This feature isn't really that useful in practice, so let's remove it.
(Other browsers haven't had this action for years either.)
2023-05-05 16:58:08 +02:00
Andreas Kling
72195ade9d Ladybird: Let WebContent know if the current system theme is dark
This means we now actually respect @media (prefers-color-scheme: dark)
by default when in dark mode. :^)
2023-04-30 00:27:28 +02:00
Timothy Flynn
4dcdc3bd25 Ladybird: Prohibit GUI interaction of the WebContent process on macOS
The WebContent process behaves a bit awkwardly on macOS. When we launch
the process, we have to create a QGuiApplication to access system fonts.
But on macOS, doing so creates an entry in the Dock, and also causes the
WebContent to be focused. So if you enter cmd+Q without first focusing
the Ladybird GUI, WebContent is closed, while the Ladybird process keeps
running.
2023-04-27 07:26:05 +02:00
Andreas Kling
f61947fa9e LibCore: Remove unused EventLoopManager::wake()
Only EventLoopImplementation needs to know how to wake up.
2023-04-26 19:17:04 +01:00
Andreas Kling
b61a87c03c LibCore: Move post_event() back to EventLoopImplementation
This shouldn't have been moved to EventLoopManager, as the manager is
global and one-per-process, and the implementation is one-per-loop.

This makes cross-thread event posting work again, and unbreaks
SoundPlayer (and probably other things as well.)
2023-04-26 19:17:04 +01:00
Timothy Flynn
61c0174fec Browser+Ladybird: Render text in the JS console with a monospace font 2023-04-26 15:43:57 +02:00
Timothy Flynn
d44df16704 Ladybird: Explicitly set the font family for CSS generic fonts
We currently query Qt for system fonts using QFont::setStyleHint(). The
docs from Qt have the following note regarding this API on X11:

    Qt does not support style hints on X11 since this information is not
    provided by the window system.

This prevents any monospace font from working on X11 systems. For now,
work around this by specifying the font-family for fonts which Qt has
listed as mapping to a CSS generic font-family.
2023-04-26 15:43:57 +02:00
Andreas Kling
7b963e1e98 LibCore+Ladybird: Add EventLoopManager interface for persistent state
Things such as timers and notifiers aren't specific to one instance of
Core::EventLoop, so let's not tie them down to EventLoopImplementation.

Instead, move those APIs + signals & a few other things to a new
EventLoopManager interface. EventLoopManager also knows how to create a
new EventLoopImplementation object.
2023-04-25 18:01:35 +02:00
Andreas Kling
c21eb30a2b Ladybird+LibCore: Use QCoreApplication to drive the main Qt event loop
Using QEventLoop works for everything but it breaks *one* little feature
that we care about: automatically quitting the app when all windows have
been closed.

That only works if you drive the outermost main event loop with a
QCoreApplication instead of a QEventLoop. This is unfortunate, as it
complicates our API a little bit, but I'm sure we can think of a way to
make this nicer someday.

In order for QCoreApplication::exec() to process our own
ThreadEventQueue, we now have a zero-timer that we kick whenever new
events are posted to the thread queue.
2023-04-25 18:01:35 +02:00
Andreas Kling
1c6c3685c4 Ladybird: Remove Web::Platform plugins for Qt in favor of LibCore
Now that the Core::EventLoop is driven by a QEventLoop in Ladybird,
we don't need to patch LibWeb with Web::Platform plugins.

This patch removes EventLoopPluginQt and TimerQt.

Note that we can't just replace the Web::Platform abstractions with
LibCore stuff immediately, since the Web::Platform APIs use
JS::SafeFunction for callbacks.
2023-04-25 14:48:40 +02:00
Andreas Kling
3494c2382d Ladybird: Run the Core::EventLoop with a Qt backend
This patch adds EventLoopImplementationQt which is a full replacement
for the Core::EventLoopImplementationUnix that uses Qt's event loop
as a backend instead.

This means that Core::Timer, Core::Notifier, and Core::Event delivery
are all driven by Qt primitives in the Ladybird UI and WC processes.
2023-04-25 14:48:40 +02:00
Andreas Kling
411d36719e LibCore: Simplify Core::Notifier by only allowing one event type
Not a single client of this API actually used the event mask feature to
listen for readability AND writability.

Let's simplify the API and have only one hook: on_activation.
2023-04-25 14:48:40 +02:00
Timothy Flynn
8fe846eb7f Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every file 2023-04-24 14:49:04 +02:00
Timothy Flynn
4aca24481e Ladybird: Implement the JavaScript console using a WebContentView
This aligns the Ladybird console implementation with the Browser console
a bit more, which uses OutOfProcessWebView for rendering console output.
This allows us to style the console output to try and match the system
theme.

Using a WebContentView is simpler than trying to style the old QTextEdit
widget, as the console output is HTML with built-in "-libweb-palette-*"
colors. These will override any color we set on the QTextEdit widget.
2023-04-23 14:30:23 +02:00
Timothy Flynn
5089766af6 Browser+Ladybird+LibWeb: Port content filters to String 2023-04-22 12:32:40 +02:00
Timothy Flynn
76ae60da15 Browser+Ladybird+LibWeb: Prevent infinite growth of content filters
We never clear content filters on either end of the Browser-WebContent
IPC connection. So when the filters change, we re-append all filters to
the Vector holding them. This incidentally makes it impossible to remove
a filter.

Change both sides to clear their filter lists when receiving a new set
of filters.
2023-04-22 12:32:40 +02:00
Sam Atkins
6d93e03211 LibWeb+Browser+Ladybird: Use JS::SafeFunction for EventLoop callbacks
This automatically protects captured objects from being GC'd before the
callback runs.
2023-04-21 20:44:47 +01:00
Timothy Flynn
3d0ac399c4 Ladybird: Add a command line flag to disable launching SQLServer 2023-04-21 07:56:14 +02:00
Timothy Flynn
1ffd533ea2 Ladybird: Propagate autoplay settings to the WebContent process 2023-04-18 16:30:02 +02:00
MacDue
0329ddf46a Ladybird+LibWebView: Add -P/--enable-callgrind-profiling option
This adds a -P option to run Ladybird under callgrind. It starts with
instrumentation disabled. To start capturing a profile (once Ladybird
has launched) run `callgrind_control -i on` and to stop it again run
`callgrind_control -i off`.

P.s. This is pretty much stolen from Andreas (and is based on the patch
everyone [that wants a profile] have been manually applying).
2023-04-15 06:37:51 +02:00
Srikavin Ramkumar
627d68acdf Ladybird: Display Qt cursors corresponding to missing CSS cursors 2023-04-14 09:57:49 +02:00
Cameron Youell
97cc2b33b7 Ladybird: Use FileSystem instead of DeprecatedFile 2023-04-09 20:58:54 -06:00
MacDue
7f3844c048 Ladybird: Add tooltip to reset zoom level button 2023-03-31 21:46:56 +01:00
MacDue
bdbea0baeb Ladybird: Add reset zoom level button to toolbar
This is a port of the Browser feature.
2023-03-29 07:17:35 +02:00
Andrew Kaster
4608e4143e Ladybird: Improve Xcode generator experience and copy helpers to bundle
We had a mismatch in the GUI Identifier property, causing warnings in
Xcode. It was also missing the Product Identifier Xcode property on
ladybird itself, causing another warning.

Copy all our helper processes to the ladybird.app bundle directory so
that they can be found by ``open ladybird.app`` and the Xcode debugger.

For the future, we should look in ../Resources for resources on macOS.
Copying resources to that directory requires more CMake-fu.
2023-03-28 09:18:50 +01:00
MacDue
ce8f1939e9 Ladybird: Don't update the zoom menu text for null tabs
This fixes an "Assertion `m_zoom_menu && m_current_tab' failed." error
when closing a window.
2023-03-27 18:50:01 +01:00
MacDue
9dbfba0879 Ladybird: Show current zoom level in view menu 2023-03-26 21:55:21 +01:00
Coderdreams
14c9ef2563 Ladybird: Open target _blank links in new tab 2023-03-26 21:22:58 +01:00
MacDue
95b6e57bfb LibCore: Use Core::Process::spawn to start WebDriver processes 2023-03-24 22:06:38 +00:00
Lucas CHOLLET
496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Timothy Flynn
f8b6369c23 WebContent+Everywhere: Add a WebContent IPC to activate a tab 2023-03-21 09:39:49 +00:00
Timothy Flynn
e6fc35897f WebContent+Everywhere: Add an option to not activate new tabs over IPC
WebDriver, for example, will want to create new tabs without activating
them.
2023-03-21 09:39:49 +00:00
Aliaksandr Kalenik
a2d13c47bd Ladybird: Fix build failure caused by missing WebDriver header
Fix the problem that `cmake --build Build/ladybird` started
failing with:

fatal error: 'WebContent/WebDriverConnection.h' file not found

after 11fe34ce0f
2023-03-19 09:53:57 -04:00
Andreas Kling
72d817d4ea LibWeb+Browser+Ladybird: Add menu action to dump paint tree 2023-03-18 20:23:35 +01:00
Timothy Flynn
6e1b5b541a LibWeb: Move initialization of the MainThreadVM to WebContent's main()
It is a fallible operation, so this lets us abort early if it fails.
2023-03-17 16:39:08 +00:00
Aliaksandr Kalenik
640864b32e Ladybird: Implement notify_request_open_new_tab 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik
a9f8d4eada LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tab 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik
4717d645d3 Ladybird: Generate window handle during client creation
Generate handle UUID for top-level context that is going to
run in created WebContent process and sent it over IPC.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-03-16 13:17:37 -04:00
Timothy Flynn
700ad6bf35 WebContent+LibWebView: Consolidate the way browsers connect to WebDriver
Currently, on Serenity, we connect to WebDriver from the browser-side of
the WebContent connection for both Browser and headless-browser.

On Lagom, we connect from within the WebContent process itself, signaled
by a command line flag.

This patch changes Lagom browsers to connect to WebDriver the same way
that Serenity browsers do. This will ensure we can do other initializers
in the same order across all platforms and browsers.
2023-03-16 15:02:41 +00:00
Andreas Kling
19b3d40ad2 Ladybird: Get the system's current color theme settings from Qt
There isn't a 1:1 equivalent for all ColorRoles between Qt and LibGfx,
but we can at least make an effort to translate the various QPalette
preferred colors.

This makes text selection look a lot more "native" in Ladybird. :^)
2023-03-15 23:29:00 +01:00
networkException
1a958633fa Ladybird: Rely on transparent text color for location highlighting
This patch replaces the usage of QPalette::PlaceholderText with
QPalette::Text with opacity reduced to roughly 50%. This fixes the non
highlighted spans having an extremely low contrast compared to the
background in dark mode.
2023-03-14 14:56:37 +01:00
Timothy Flynn
97536e4684 LibWeb+Ladybird+Userland: Port window.[alert,confirm,prompt] to String
LibGUI and WebDriver (read: JSON) API boundaries use DeprecatedString,
so that is as far as these changes can reach.

The one change which isn't just a DeprecatedString to String replacement
is handling the "null" prompt response. We previously checked for the
null DeprecatedString, whereas we now represent this as an empty
Optional<String>.
2023-03-13 22:05:22 +00:00
Timothy Flynn
b4d3fea002 Ladybird: Add a utility to create a QString from an AK::String 2023-03-13 22:05:22 +00:00
Timothy Flynn
50cef4708c Ladybird: Remove the mode to dump the layout tree
This use case is now handled by headless-browser.
2023-03-13 12:41:10 +00:00
Timothy Flynn
11fe34ce0f headless-browser: Re-implement headless-browser using an OOPWV
headless-browser currently uses its own PageClient to load web pages
in-process. Due to this, it also needs to set up a whole bunch of other
objects needed to run LibWeb, e.g. image decoders, request servers, etc.

This changes headless-browser to instead implement a WebView to launch
WebContent out-of-process. This implementation is almost entirely empty,
but can be filled in as-needed. For example, we may want to print
JavaScript console messages.
2023-03-13 07:21:00 +00:00
Timothy Flynn
add15a5f04 Ladybird+LibWebView: Move WebContent process launcher to LibWebView
This is to allow headless-browser to reuse this code. We have a similar
helper for launching SQLServer from Ladybird.
2023-03-13 07:21:00 +00:00
Aliaksandr Kalenik
3716e1b8a0 Ladybird: Delete unused ConsoleClient and ConsoleGlobalObject
After the separation of LibWeb into WebContent process, ConsoleClient
and ConsoleGlobalObject are no longer used.
2023-03-11 08:09:10 +01:00
Andrew Kaster
3d33217d60 Ladybird+CI: Move layout_test.sh test runner from CI yml into CMake
We should be able to run this locally, as long as ENABLE_LAGOM_LADYBIRD
is true, or if building ladybird from the ladybird source directory.

This removes a special case from the Lagom CI yml file.
2023-03-10 23:01:55 +00:00
Andreas Kling
a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Aliaksandr Kalenik
b51090e83e Ladybird: Send window size and position to WebContent process 2023-03-08 23:15:31 +01:00
Linus Groh
1ef03c9cc5 Ladybird: Add ccache to nativeBuildInputs in nix-shell script 2023-03-08 18:24:30 +00:00
Aliaksandr Kalenik
59752807c4 Ladybird: Handle close event in WebContentView 2023-03-07 11:34:11 +00:00
Aliaksandr Kalenik
cc41233be4 LibWebView+WebContent: Propagate close from WebContent to LibWebView 2023-03-07 11:34:11 +00:00
Andreas Kling
21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Timothy Flynn
9fb7f7fceb Ladybird: Specify the emoji image path in Ladybird's font plugin 2023-03-01 14:54:16 +00:00
Andreas Kling
1379720742 Ladybird: Consider HTTP response a success if it has a status code
The QNetworkReply::NetworkError enum mixes all kinds of errors into one
enum, HTTP errors, network errors, proxy errors, etc.

Instead of caring about it, we now say that HTTP requests were
successful if their response has any HTTP status code attached.

This allows LibWeb to display error pages when using Qt networking.
2023-02-24 19:15:49 +01:00
MacDue
40bfaff133 Ladybird: Support inspecting the accessibility tree
This allows viewing the ARIA accessibility tree Epigenetic added
in #16430, but now in Ladybird!
2023-02-22 22:00:40 +00:00
Andrew Kaster
f40094d014 LibWeb+LibJS: Format Console arguments with JS::Print
Instead of just calling JS::Value::to_string_without_side_effects() when
printing values to the console, have all the console clients use
the same JS::Print that the REPL does to print values.

This method leaves some things to be desired as far as OOM hardening
goes, however. We should be able to create a String in a way that
doesn't OOM on failure so hard.
2023-02-21 10:57:44 +01:00
Linus Groh
533f2a4980 Ladybird: Add qtwayland to QT_PLUGIN_PATH in nix-shell script
Otherwise Qt would not find the wayland plugin it is instructed to use
via QT_QPA_PLATFORM, and would fall back to the second option, xcb,
which looks rather sad in a modern Wayland environment :^)

This feels like something that should be addressed upstream in nixpkgs
eventually.
2023-02-19 00:37:51 +01:00
Linus Groh
5468e363fa Ladybird: Add libxcrypt to nativeBuildInputs in nix-shell script
This makes <crypt.h> available.
2023-02-19 00:37:51 +01:00
Federico Guerinoni
1296aa108b Ladybird: Close tab clicking wheel of the mouse 2023-02-16 11:26:44 +00:00
Tim Schumacher
43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher
874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher
606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Luke Wilde
c51026a855 Ladybird: Teach RequestManagerQt how to handle every valid HTTP method 2023-02-10 22:18:19 +00:00
MacDue
63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
MacDue
1c92e6ee9d Ladybird: Don't overwrite argv[0] in spawn_helper_process()
This is already set correctly at the caller.
2023-02-08 19:15:45 +00:00
Aliaksandr Kalenik
12eca612bc Ladybird: Specify window size in layout dump mode 2023-02-06 20:42:14 +01:00
MacDue
f4236e61bf LibCore: Add const qualifier to exec() argument spans 2023-02-05 16:40:51 +01:00
Aliaksandr Kalenik
1f4106842d LibGfx: Pass font width to FontDatabase::get()
Width need to be passed to `FontDatabase::get()` to resolve font name
unambiguously.
2023-02-05 08:06:06 +00:00
Federico Guerinoni
9f4bf1b04e Ladybird: Set fixed height for Settings 2023-02-03 05:10:51 -07:00
Federico Guerinoni
17e9db4fa1 Ladybird: Add setting for page to open on new tab 2023-02-03 05:10:51 -07:00
Federico Guerinoni
80da16e54a Ladybird: Design settings layout in horizontal 2023-02-03 05:10:51 -07:00
Guilherme Gonçalves
230c0b34d4 LibWeb+LibWebSocket: DOM WebSocket subprotocol support
This adds support for WebSocket subprotocols to WebSocket DOM
objects, with some necessary plumbing to LibWebSocket and its
clients.

See the associated pull request for how this was tested.
2023-02-02 14:41:34 +01:00
Andrew Kaster
7598a99ef3 Ladybird: Spawn ladybird and headless-browser using helpers in WebDriver
This allows the WebDriver to take advantage of the common helper process
spawning code when launching ladybird, and to not assume a particular
directory layout.
2023-02-02 05:35:44 -07:00
Andrew Kaster
0d5d3f12e2 Ladybird: Clean up install rules for executables
Use a list of executables to make sure that we don't miss any of the
applications used by Ladybird and its friends like WebDriver, and make
sure to install include all executables and their runtime dependencies.
2023-02-02 05:35:44 -07:00
Andrew Kaster
ae9dc95b1f LibSQL+Ladybird: Accept a list of paths for spawning SQLServer in Lagom
Use the new get_paths_for_helper_process method in Ladybird to query
Qt for the runtime path of the current executable as well as the build
directory paths.
2023-02-02 05:35:44 -07:00
Andrew Kaster
3e6d790cf0 Ladybird: Abstract spawning helper processes into separate methods
This will let us use the same path discovery methods for WebContent,
SQLServer, and any other helper processes we need to launch.
2023-02-02 05:35:44 -07:00
martinfalisse
f0312de7eb Ladybird: Left-align long url in address bar
Previously when there was a very long url that spanned outside of the
address bar, the text shown would be the one starting from the very end
of the url instead of from the beginning, so you would be seeing the
query parameters for example, instead of the domain.
2023-02-02 12:10:31 +00:00
martinfalisse
24ab91f4d3 Ladybird: Go to homepage on init
If a url wasn't passed in as a parameter to Ladybird, go to the homepage
as defined in the settings on init.
2023-02-01 19:14:20 +00:00
martinfalisse
abf8dd96de Ladybird: Refactor navigating to url on startup
These changes will prevent duplication of code later when there will
also be the possibility to navigate to the homepage url as defined in
the settings on startup.
2023-02-01 19:14:20 +00:00
martinfalisse
65cf562a71 Ladybird: Add ak_string_from_qstring function
This will be used later when doing the conversion from the QString in
QSettings for the homepage URL.
2023-02-01 19:14:20 +00:00
Timothy Flynn
093e7e2a86 Ladybird: Exit Ladybird normally during dump-layout-tree mode
Don't use _exit() - this is a forceful exit that will bypass all exit
handlers. This includes AddressSanitizer, and will prevent ASan from
exiting the app with a fatal error code.
2023-02-01 14:04:44 +00:00
Timothy Flynn
9fd54e1f90 Ladybird: Store the WebContent QSocketNotifier on the stack
This was being heap allocated with naked-new and never freed. Caught by
AddressSanitizer.
2023-02-01 14:04:44 +00:00
Timothy Flynn
ac80475a1f Ladybird: Initialize boolean command line argument
This being uninitialized was caught by AddressSanitizer.
2023-02-01 14:04:44 +00:00
Tim Schumacher
093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher
8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Aliaksandr Kalenik
c05fcd54bb Ladybird: Do not connect SQL server in layout dump output mode 2023-01-29 11:33:33 +00:00
Aliaksandr Kalenik
0c6b942ca9 Ladybird: Flush stdout before exit in layout dump output mode 2023-01-29 11:33:33 +00:00
Timothy Flynn
2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
Timothy Flynn
ad8183beb4 Meta: Support running ladybird with arguments from serenity.sh
You may now, for example, run:

    ./Meta/serenity.sh run lagom ladybird https://serenityos.org
2023-01-27 08:14:24 -05:00
Sam Atkins
a5db4a0551 Ladybird: Replace uses of JsonObject::get_deprecated() 2023-01-27 08:07:24 -05:00
Andreas Kling
ddbdeb3ca0 Ladybird: Add --dump-layout-tree mode that dumps layout tree and exits 2023-01-27 10:41:24 +01:00
Andreas Kling
90fee39290 Ladybird: Fire the WebContentView::on_load_finish hook if set 2023-01-27 10:33:18 +01:00
Tim Schumacher
82a152b696 LibGfx: Remove try_ prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit
it.
2023-01-26 20:24:37 +00:00
Cameron Youell
3bd96f29d2 Ladybird: Add LocationEdit Highlighting 2023-01-22 21:15:22 -07:00
Cameron Youell
b97f9f5809 Ladybird: Make LocationEdit its own class
Also make return key behave more like other browsers when editing
2023-01-22 21:15:22 -07:00
Karol Kosek
f3c6510b83 Ladybird: Accept file drops 2023-01-19 19:22:03 +00:00
Karol Kosek
731fec525e Ladybird: Add URL and 'open in background' parameters to new_tab()
This will avoid loading starting about:blank page in places when we know
exactly what we want to load.

The opening in background part might be useful for future things like
file drops and right-click open in new tab.
2023-01-19 19:22:03 +00:00
Karol Kosek
194ddca24f Ladybird: Move the initial blank page load to BrowserWindow
Takes care of a FIXME :^)
2023-01-19 19:22:03 +00:00
Karol Kosek
5e89773937 Ladybird: Don't prepend 'about:' urls with an http:// scheme 2023-01-19 19:22:03 +00:00
Karol Kosek
4f36893fda Ladybird: Set initial page when NOT connected to WebDriver
This flips an if check condition, making the JS console work in new tabs
again.
2023-01-19 19:22:03 +00:00
Liav A
649f78d0a4 LibGfx+Ladybird+Userland: Don't sniff for TGA images with only raw bytes
Because TGA images don't have magic bytes as a signature to be detected,
instead assume a sequence of ReadonlyBytes is a possible TGA image only
if we are given a path so we could check the extension of the file and
see if it's a TGA image.

When we know the path of the file being loaded, we will try to first
check its extension, and only if there's no match to a known decoder,
based on simple extension lookup, then we would probe for other formats
as usual with the normal sniffing method.
2023-01-18 21:48:35 +01:00
Sam Atkins
1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00
Linus Groh
f183745f4e LibWebView+Ladybird: Move preferred color scheme to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5bf5697f16 LibWebView+Ladybird: Move text selection to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
8c11a2c253 LibWebView+Ladybird: Move running JavaScript to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
55609f744d LibWebView+Ladybird: Move debug request to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
de1c0c87fe LibWebView+Ladybird: Move page loading to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
2428e3e675 LibWebView+Ladybird: Move DOM inspection helpers to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
f313708237 LibWebView+Ladybird: Move get source request to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5d9f4b2ffc LibWebView+Ladybird: Move zoom logic to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5411adca22 LibWebView+Ladybird: Begin de-duplicate WebView implementations
This starts moving code equally shared between the OOPWV and Ladybird
WebContentView implementations to WebView::ViewImplementation, beginning
with the client state.
2023-01-12 23:39:36 +01:00
Andreas Kling
2eaebdea5b Ladybird: Add Ctrl+= as an alternate "zoom in" shortcut
On many keyboards, Ctrl++ is actually Ctrl+Shift+=, and Ctrl+= makes
more sense as it's symmetric with Ctrl+-.

Both Firefox and Chrome already support this alternate shortcut,
so let's be nice and support it in Ladybird as well. :^)
2023-01-12 19:05:07 +00:00
Andreas Kling
c8ea23a4fe Ladybird: Use QKeySequence::StandardKey as much as possible
Let Qt pick the most appropriate native shortcut when it knows one.
2023-01-12 19:05:07 +00:00
Andreas Kling
9c7e26b8d4 Ladybird: Add "Copy" and "Select All" actions to the Edit menu 2023-01-12 19:55:10 +01:00
Linus Groh
966d808135 Ladybird: Replace ColorScheme enum with Web::CSS::PreferredColorScheme
This matches OutOfProcessWebView::set_preferred_color_scheme().
2023-01-12 18:27:34 +00:00
Linus Groh
0cc151bc1c Ladybird: Implement zoom :^) 2023-01-12 15:14:09 +00:00
Linus Groh
05ef6c9b64 Ladybird: Set 'device pixels per CSS pixel' to device pixel ratio :^) 2023-01-12 15:14:09 +00:00
Linus Groh
f49a65cb28 Ladybird: Use standard font paths in FontPluginQt
This makes vector fonts load on macOS, where /usr/share/fonts doesn't
exist and Ladybird would only load the bitmap fonts from ./res/fonts
in the SerenityOS resource root directory.
Additionally, fonts in {/usr/share/local,~/.local}/fonts are now loaded
on Linux.
2023-01-11 20:54:49 +00:00
Karol Kosek
e3d9a3426e Ladybird: Port to Core::Stream::File 2023-01-09 22:50:53 +00:00
Andreas Kling
f476b827de Ladybird: Let Qt pick the reload shortcut
This fixes an issue on platforms where Ctrl+R is the preferred native
shortcut, and we were effectively trying to set it twice.
2023-01-09 17:32:00 +01:00
Karol Kosek
01a786310d Ladybird: Add Qt's standard refresh key (F5) to reload shortcuts 2023-01-08 19:38:35 +01:00
Jonah
367b1634fd LibWebView+WebContent: Expose the Accessibility Tree to Other Processes
This patch also stubs out notify_server_did_get_accessiblity_tree in
ladybird since ViewImplementation now has it. However, this feature
is still immature, so just stubbing out in ladybird for now. Once we
have more robust support in Serenity (namely ARIA properties/state
and accessible names and descriptions) we can port this
functionality over.
2023-01-07 10:51:53 +00:00
Davide Cavalca
1fc7740152 Ladybird: Install SQLServer binary
Install the SQLServer binary added in 2cb3ae1 so that it's actually
available on the target system when doing a standalone build of
Ladybird.
2023-01-03 09:32:07 -05:00
networkException
4c7a99fe06 Ladybird: Remove separate LICENSE file
Since ladybird is part of the serenity monorepo now there's no need to
keep a separate LICENSE file around :^)
2023-01-03 12:37:18 +01:00
Luke Wilde
b85f4ab66a Ladybird: Tell Qt that we manually handle the Cookie header
In some cases, Qt would silently drop the Cookie header and start
causing Cookie authenticated requests to start failing.
2022-12-30 23:52:09 +01:00
Nico Weber
ac039d93f0 Ladybird: Fix typos 2022-12-30 17:21:57 +01:00
MacDue
678dfa8f75 Ladybird: Close inspector and JS console when tab closes
Keeping these around can lead to use-after-frees and crashes.
2022-12-25 15:30:08 -07:00
MacDue
33249c727a Ladybird: Add the node properties tabs to the inspector
This now allows you to view the computed and resolved style values,
along with the CSS variables of a node.
2022-12-25 15:30:08 -07:00
MacDue
aa85a88158 Ladybird: Reimplement the DOM inspector :^)
This has been broken since the switch to the multiprocess architecture
(and even before then was very limited).

This restores the previous functionally and also implements the ability
to inspect individual elements (by selecting them in the tree view).
The inspector also now correctly updates when navigating between pages.
2022-12-25 15:30:08 -07:00
MacDue
0313814d3b Ladybird: Allow replacing underlying model of ModelTranslator 2022-12-25 15:30:08 -07:00
Andrew Kaster
e79e7dc3b9 Documentation: Move Ladybird BuildInstructions to Documentation
Update Ladybird/README.md at the same time to reflect its new monorepo
status.
2022-12-25 07:58:58 -07:00
Andrew Kaster
b4d80f92ec Ladybird: Support building Ladybird as a non-top-level project
The implementation assumes that Lagom is either the top level project,
or included before Ladybird is.
2022-12-25 07:58:58 -07:00
Timothy Flynn
03294b0177 Ladybird/WebDriver: Retrieve process environment in an OS-dependent way 2022-12-25 07:58:58 -07:00
Timothy Flynn
e5192073d9 Ladybird/WebDriver: Move to using local socket files for WebDriver IPC
This allows us to use standard Serenity IPC infrastructure rather than
manually creating FD-passing sockets. This also lets us use Serenity's
WebDriver Session class, removing the copy previously used in Ladybird.
This ensures any changes to Session in the future will be picked up by
Ladybird for free.
2022-12-25 07:58:58 -07:00
Andreas Kling
ea26e45594 Ladybird: Fix build after Gfx::load_system_theme() return type change 2022-12-25 07:58:58 -07:00
Timothy Flynn
4c1f414713 Ladybird: Migrate SQLServer to be launched as a singleton process
Rather than manually launching the SQLServer process, use SQLClient's
new functionality to launch the server just once for all Ladybird
instances. Quit the SQLServer process when it no longer has any
connected clients.
2022-12-25 07:58:58 -07:00
Timothy Flynn
1dd14e1324 Ladybird: Quit SQLServer when its connected client exits
When Ladybird exits, SQLServer can get stuck spinning at 100% CPU after
the socket connection is closed. This changes the client to quit the
event loop when that disconnect happens to ensure that SQLServer is
properly destroyed.
2022-12-25 07:58:58 -07:00
Andreas Kling
e54932ee73 Ladybird: Fix build after ConsoleGlobalEnvironmentExtensions rename 2022-12-25 07:58:58 -07:00
Timothy Flynn
2cb3ae132a Ladybird: Implement SQLServer for Ladybird :^)
This adds a SQLServer binary for Ladybird to make use of Serenity's SQL
implementation. This has to use the same IPC socket handling that was
used to make WebContent and WebDriver work out-of-process.

Unlike Serenity, Ladybird creates a new SQLServer instance for each
Ladybird instance. In the future, we should try to make sure there is
only one SQLServer instance at a time, and allow multiple Ladybird
instances to communicate with it.
2022-12-25 07:58:58 -07:00
Timothy Flynn
a0cd260410 Ladybird: Do not domain match on cookie updates
This matches a corresponding change to Serenity's Browser.
2022-12-25 07:58:58 -07:00
Thitat Auareesuksakul
5b8d1a6f61 Ladybird/Documentation: Add cmake to macOS dependencies 2022-12-25 07:58:58 -07:00
MacDue
d768abffa0 Ladybird: Pass Gfx::IntPoint by value 2022-12-25 07:58:58 -07:00
MacDue
4709f5961b Ladybird: Pass Gfx::IntSize by value 2022-12-25 07:58:58 -07:00
Aliaksandr Kalenik
88667ce9f0 Ladybird: Fix build with JS::MarkupGenerator's new string type usage
Fix to build after JS::MarkupGenerator got converted to use
new string type:
112b3f7342
2022-12-25 07:58:58 -07:00
Linus Groh
5a5c4f079b Ladybird: Update for AK::{String => DeprecatedString} rename 2022-12-25 07:58:58 -07:00
Baitinq
97dd5a085f Ladybird: Replace history entry if loading URL because of a redirect
We now replace the current history entry if the page-load has been
caused because of a redirect. This makes it able to traverse the
history if one of the entries redirects you, which previously
caused an infinite history traversion loop.

Depends on https://github.com/SerenityOS/serenity/pull/16004
2022-12-25 07:58:58 -07:00
Sam Atkins
ec55b13e96 Ladybird: Add stub for notify_server_did_finish_handling_input_event
This doesn't need to do anything yet, but will do once we start passing
events to web content *before* they're passed to our GUI.
2022-12-25 07:58:58 -07:00
Timothy Flynn
a1e380cc38 Ladybird/WebDriver: Support running headless WebDriver sessions
This adds a dependency from WebDriver to Lagom's headless-browser to be
used if the client's required capabilities indicate to do so.
2022-12-25 07:58:58 -07:00
Timothy Flynn
69cd0d6599 Ladybird: Update stored URL when a page starts/finishes loading
Similar to https://github.com/SerenityOS/serenity/commit/9782660. Unlike
Serenity's browser, this doesn't affect reloading the page, as Ladybird
refers to the History object for reloading (which is updated already on
page load). However, this URL is used for e.g. crash reporting, so let's
update it here as well.
2022-12-25 07:58:58 -07:00
Timothy Flynn
9a5f9c101c Ladybird: Implement updated alert/confirm/prompt IPC methods
WebContent now needs to interact with these dialogs asynchronously. This
updates WebContentView to hold a pointer to whatever dialog is open, and
implements the methods to interact with that dialog.
2022-12-25 07:58:58 -07:00
Idan Horowitz
fad3fbfe26 Ladybird: Add block pop-ups checkbox to debug menu 2022-12-25 07:58:58 -07:00
Timothy Flynn
948c4ba102 Ladybird/WebDriver: Implement the cookie endpoints for Ladybird 2022-12-25 07:58:58 -07:00
Timothy Flynn
9e0db602ca Ladybird: Implement WebDriver for Ladybird :^)
This adds a WebDriver binary for Ladybird to make use of Serenity's
WebDriver implementation. This has to use the same IPC socket handling
that was used to make WebContent work out-of-process. Besides that, we
are able to reuse almost everything from Serenity.
2022-12-25 07:58:58 -07:00
Timothy Flynn
54321f49ad Ladybird: Implement WebDriver's navigation and window control endpoints 2022-12-25 07:58:58 -07:00
Timothy Flynn
4031630b49 Ladybird: Construct a WebDriverConnection when instructed to do so
The WebDriver will pass the --webdriver-fd-passing-socket command line
option when it launches Ladybird. Forward this flag onto the WebContent
process, where it will create the WebDriverConnection for IPC.
2022-12-25 07:58:58 -07:00
Timothy Flynn
7021d30288 Ladybird: Foward the WebContent passing socket FD by command line
Rather than needing to set another environment variable for WebDriver's
passing socket, let's forward these FDs by command line. This also moves
the creation of the WebContent connection to a helper function so that
the WebDriver connection can re-use it.
2022-12-25 07:58:58 -07:00
Timothy Flynn
39954f9e7f Ladybird: Give the WebContent socket a descriptive name
WebContent's main() will soon take over multiple sockets. Give the
existing WebContent socket a descriptive name to avoid confusion.
2022-12-25 07:58:58 -07:00
Baitinq
e74dff7697 Ladybird/Misc: Add ladybird.nix for nix-shell support 2022-12-25 07:58:58 -07:00
Marco Cutecchia
5a9b891268 Ladybird: Stub out notify_server_did_request_fullscreen_window 2022-12-25 07:58:58 -07:00
Timothy Flynn
e592c7691e Ladybird: Stub out history navigation WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Timothy Flynn
fcc0530e26 Ladybird: Stub out new cookie WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Baitinq
e80147afba Ladybird: Fix reloading functionality
Previously, reloading went back to the first page loaded by
WebView::load() or WebView::load_html(), as they are the only methods
that modify m_url, which is what the reload loaded. Now we handle
reloads in Tab.cpp by simply loading the last entry in the m_history.
2022-12-25 07:58:58 -07:00
Timothy Flynn
0b15fd4a12 Ladybird: Stub out new WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Baitinq
15e4d151c3 Ladybird: Don't add initial about:blank load to history
The hackish initial loading of about:blank was previously added to the
history, so you could go back to it (which wasn't very ergonomic). Now
we set the m_is_history_navigation flag before loading it so it doesn't
get added to the history.
2022-12-25 07:58:58 -07:00
Timothy Flynn
5d0ab45ff4 Ladybird: Add new WebContent source file for WebDriver endpoints 2022-12-25 07:58:58 -07:00
Andreas Kling
385c12c8b6 Ladybird: Add subclass of WebSocket::WebSocketImpl using Qt networking 2022-12-25 07:58:58 -07:00
Gunnar Beutner
acd70f44c2 Ladybird: Don't change window icons when background tabs change icons 2022-12-25 07:58:58 -07:00
Gunnar Beutner
5f3b82dcba Ladybird: Don't update window titles when background tabs change titles
Steps to reproduce:
1. Open the Cookie Clicker game in a tab.
2. Open another website in another tab and make that the current tab.
3. Observe how the window's title mentions Cookie Clicker.
2022-12-25 07:58:58 -07:00
Baitinq
eaff4a1d65 Ladybird: Don't push to history when loading through history navigation
Previously we were always pushing to history on the on_load_start
callback. Now we only do that if we are NOT navigating through the
history navigation (loading pages by going back/forward). This is what
the SerenityOS browser does:^)
2022-12-25 07:58:58 -07:00
Baitinq
982174706b Ladybird: Handle forward and backward mouse buttons
We now emit a new signal for backward mouse button's mouseup and forward
mouse button's mouseup which is handled by going back and forward in the
history respectively:))
2022-12-25 07:58:58 -07:00
Andreas Kling
ef553a4b76 Ladybird: Don't burn 100% CPU in EventLoopPluginQt::spin_until()
There's no point in busy-waiting for the condition to come true.
By passing the `WaitForMoreEvents` flag to `processEvents()`, we allow
Qt to block until it has something for us to react to.

This was extremely noticeable when waiting for large resources to
finish loading.
2022-12-25 07:58:58 -07:00
Andreas Kling
bc6a6190d8 Ladybird: Disable HTTP2 as it's significantly slower
The slowdown is sometimes 5x, possibly more.

This is trivially confirmed by adding a large JS file to a page and
comparing the load time with a simple wget.
2022-12-25 07:58:58 -07:00
Linus Groh
216192143e Ladybird: Clean up linked libraries
- Add Qt::Core, Qt::Gui, LibGfx, LibIPC, and LibJS to the ladybird
  target, remove LibGL, LibSoftGPU, and LibWebSocket
- Add LibJS to the WebContent target, remove LibWebView
- Order them properly :^)

Regressed in https://github.com/SerenityOS/serenity/pull/15746.
Fixes #108.
2022-12-25 07:58:58 -07:00
Linus Groh
66c69654a6 Ladybird/Documentation: Bump GCC requirement to >= 12
See https://github.com/SerenityOS/serenity/pull/15797
2022-12-25 07:58:58 -07:00
Gunnar Beutner
dd20b34acb Ladybird: Ignore SIGINT when we're being debugged
Let's ignore SIGINT if we're being debugged because GDB incorrectly
forwards the signal to us even when it's set to "nopass". See
https://sourceware.org/bugzilla/show_bug.cgi?id=9425 for details.
2022-12-25 07:58:58 -07:00
Linus Groh
11b730fccb Ladybird: Use Browser's History.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.
2022-12-25 07:58:58 -07:00
Linus Groh
c91978baa6 Ladybird: Use Browser's CookieJar.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.

This fixes a build issue introduced by https://github.com/SerenityOS/serenity/pull/15736.
2022-12-25 07:58:58 -07:00
networkException
fb71dc5141 Ladybird/CMake: Launch gdb with follow fork mode to debug WebContent 2022-12-25 07:58:58 -07:00
networkException
d1b2c2977e Ladybird/CMake: Add options for enabling {A,M,UB}SAN
This patch adds convenient flags for enabling ASAN, MSAN and UBSAN.
2022-12-25 07:58:58 -07:00
Andreas Kling
8b593c9884 Ladybird: Add Ctrl+Shift+G shortcut to force a garbage collection 2022-12-25 07:58:58 -07:00
Andrew Kaster
ccf95631ba Ladybird: Add Userland/ subdirs of Lagom binary dir to include path
Recent Serenity changes put generated files for libraries in
_deps/lagom-build/Userland/Libraries rather than lagom-build/Libraries.
2022-12-25 07:58:58 -07:00
Andreas Kling
6d1db6801c Ladybird/RequestManagerQt: Unwrap multiple cookies masquerading as one
Qt can wrap any number of cookies into a single Set-Cookie header in the
network responses it gives us. We now use the QNetworkReply::header()
API to get a "cooked" list of the cookies, and then rewrap them in a
format suitable for LibWeb.

Sites that send multiple Set-Cookie headers in one response now work
a lot better. :^)
2022-12-25 07:58:58 -07:00
Andreas Kling
195cdb33de Ladybird/WebContentView: Make Tab and Shift+Tab work
These didn't work, for two reasons:

1. Qt swallows all Tab key presses by default. We have to override
   the event() function in order to receive them.

2. Qt transforms Shift+Tab into a fake "Backtab" key. We have to
   undo this transformation and send Shift+Tab to WebContent.
2022-12-25 07:58:58 -07:00
Andreas Kling
c154d94964 Ladybird/WebContentView: Accept focus and notify WebContent on change 2022-12-25 07:58:58 -07:00
Andreas Kling
71dadabfaa Ladybird: Hook up the CookieJar again after WebContent introduction 2022-12-25 07:58:58 -07:00
Idan Horowitz
775332e179 Ladybird: Accept file paths, domains, and URLs as an argument
This makes opening test files much more ergonomic :^)
2022-12-25 07:58:58 -07:00
Andreas Kling
52a7282c64 Ladybird: Close the other side's file descriptors after forking
When spawning a WebContent process, we have to close the file
descriptors belonging to the "other side" in both processes, or they
will not get naturally "cleaned up" when one of the processes exits.

Fixes #93
2022-12-25 07:58:58 -07:00
Andreas Kling
7362755f30 Ladybird: Implement EventLoopPluginQt::quit()
This breaks out of the main Qt event loop.
2022-12-25 07:58:58 -07:00
Andrew Kaster
6fff03713c Ladybird: Ensure that installed ladybird can launch WebContent process
Always call platform_init after there's a QApplication, because in the
installed configuration that's how we find the resources.

Try QCoreApplication::applicationDirPath() after looking in ./WebContent
for the WebContent process. In an installed configuration, ladybird and
WebContent will both be in $PREFIX/bin.

Add install rules for WebContent and its linked libraries, for if they
ever differ from ladybird's.
2022-12-25 07:58:58 -07:00
Andreas Kling
bbb08c1912 Ladybird: Remove some unnecessary includes in main.cpp 2022-12-25 07:58:58 -07:00
Andreas Kling
0a8c86a9d9 Ladybird: Load about:blank in new tabs
This makes the JS console usable in new tabs, without having to load
something first.
2022-12-25 07:58:58 -07:00
Luke Wilde
e9135583bd Ladybird: Make ladybird depend on WebContent
This causes CMake to output a WebContent build, without this it would
not build WebContent and Ladybird would be unusable since it couldn't
find the WebContent executable.
2022-12-25 07:58:58 -07:00
Andreas Kling
2b1d294dc6 Ladybird: Let Lagom build the IPC endpoints for WebContent 2022-12-25 07:58:58 -07:00
Andreas Kling
6d189696da Ladybird: Remove PageClientLadybird as it's no longer used 2022-12-25 07:58:58 -07:00
Andreas Kling
1298baa9ad Ladybird: Port over ConsoleWidget from the SerenityOS Browser
While this adds a fair bit of widget code, we're also increasing code
sharing by using the same bits in WebContentClient for interacting with
the JS console.

That said, we should look for more ways to share code here.
2022-12-25 07:58:58 -07:00
Andreas Kling
26a7ea0e0f Ladybird: Render web content in a separate process :^)
This patch brings over the WebContent process over from SerenityOS
to Ladybird, along with a new WebContentView widget that renders
web content in a separate process.

There's a lot of jank and FIXME material here, notably I had to re-add
manually pumped Core::EventLoop instances on both sides, in order to get
the IPC protocol running. This introduces a lot of latency and we should
work towards replacing those loops with improved abstractions.

The WebContent process is built separately here (not part of Lagom) and
we provide our own main.cpp for it. Like everything, this can be better
architected, it's just a starting point. :^)
2022-12-25 07:58:58 -07:00
Andreas Kling
2451a447f5 Ladybird/Meta: Split out build instructions to a separate document 2022-12-25 07:58:58 -07:00
Sam Atkins
acec34351f Ladybird/ConsoleClient: Implement console message styling with %c
This matches the changes made to Serenity in:
7a2da4cabf
2022-12-25 07:58:58 -07:00
Andrew Kaster
0bf79b1f3b Ladybird/CMake: Enable compile_commands.json by default
This should help IDEs have an easier time indexing serenity files.
2022-12-25 07:58:58 -07:00
Andrew Kaster
fb1ca02a74 Ladybird/SimpleWebView: Install and check for content filters in res/
This allows installed ladybird and Andriod ladybird to find the content
filters without copying all of Base/home/anon into the install tree.
2022-12-25 07:58:58 -07:00
Itamar
02b3a89d96 Ladybird/WebView: Fix size calculation in update_viewport_rect()
size() may include the dimensions of the scrollbars, so we now use
viewport() instead.
2022-12-25 07:58:58 -07:00
Moustafa Raafat
22c3b8be7b Ladybird/Tab: Handle "Dump History" action 2022-12-25 07:58:58 -07:00
Moustafa Raafat
612f7daf05 Ladybird/SimpleWebView: Add debug logging for unhandled debug requests 2022-12-25 07:58:58 -07:00
Moustafa Raafat
9854feb263 Ladybird/Tab: Update history title when tab title changes 2022-12-25 07:58:58 -07:00
Moustafa Raafat
a39f0d472a Ladybird/History: Ignore title updates when history has no current item 2022-12-25 07:58:58 -07:00
Moustafa Raafat
742c4767df Ladybird/BrowserWindow: Make "View Source" a separate window
View Source was a subwindow which made it cover part of the browser with
no way for closing it.
2022-12-25 07:58:58 -07:00
Andreas Kling
c2230d5fe8 Ladybird: The JS console widget should be a standalone window
...not part of the WebView. Its lifetime is managed by a QPointer.
2022-12-25 07:58:58 -07:00
Andrew Kaster
b2ba91123b Ladybird/ConsoleClient: Get the current ESO from new HostDefined helper 2022-12-25 07:58:58 -07:00
Andrew Kaster
2ff37d7e13 Ladybird/Everywhere: Ensure that Qt objects are created with parents
This prevents memory leaks detected by both Valgrind and ASAN/LSAN.

Valgrind is still suspicious of the leaked JS::VM from
Web::Bindings::main_thread_vm() but there's other issues with leak
checking all the GC'd objects.

Co-Authored-By: Diego Iastrubni <diegoiast@gmail.com>
2022-12-25 07:58:58 -07:00
Jonas Kvinge
f9af2832c8 Ladybird: Fix typo in README.md 2022-12-25 07:58:58 -07:00
Luke Wilde
e04ec39984 Ladybird: Start applying the default content filter
For the first cut, the file path is not configurable and the content
filter cannot be toggled on or off. If we fail to apply the content
filters for any reason (e.g. the filter file doesn't exist), we simply
just stop loading the content filters to allow using Ladybird without
content filters.
2022-12-25 07:58:58 -07:00
networkException
f1c7ee2810 Ladybird/Everywhere: Replace "protocol" with "scheme" url helpers
See 4230dbbb21
2022-12-25 07:58:58 -07:00
Idan Horowitz
bf26b52ac6 Ladybird/BrowserWindow: Port user agent spoofing from Browser 2022-12-25 07:58:58 -07:00
Idan Horowitz
edd1e770d9 Ladybird/BrowserWindow: Give color scheme action group a detailed name
'group' is not very specific.
2022-12-25 07:58:58 -07:00
Andreas Kling
5ac5fef468 Ladybird: Add a very simple DOM inspector
We use a ModelTranslator to expose a DOMTreeModel from LibWebView :^)
It allows you to select the currently inspected node, which causes
the engine to render a little box model overlay above the web content.
2022-12-25 07:58:58 -07:00
Andreas Kling
98b6aea234 Ladybird: Add a ModelTranslator to translate a GUI::Model to a Qt model
This will be used to expose the DOMTreeModel from LibWebView :^)
2022-12-25 07:58:58 -07:00
Andreas Kling
2a021084e5 Ladybird: Rename WebView to SimpleWebView
This will allow us to share code with LibWebView from SerenityOS.
(This would otherwise not work, since its "WebView" namespace collides
with our "WebView" class.)

Also, we should eventually move towards a more sophisticated
multi-process WebView like OOPWV.
2022-12-25 07:58:58 -07:00
Aaron Dewes
eecee7369f Ladybird: Clean up tab bar autohide
Qt has this feature built-in, so there's no need to create a custom
implementation
2022-12-25 07:58:58 -07:00
Aaron Dewes
bdce860ac5 Ladybird: Make Tab.cpp directly take a BrowserWindows as m_window 2022-12-25 07:58:58 -07:00
Linus Groh
445cc7c97d Ladybird: Remove redundant use of impl()
This blocks us from removing it upstream in LibWeb.
2022-12-25 07:58:58 -07:00
davidot
fdf69720d4 Ladybird/PageClient: Initialize the js console earlier during page setup 2022-12-25 07:58:58 -07:00
davidot
07a500e923 Ladybird/WebView: Ensure a console widget exists before storing messages
This makes sure that any console.log (and friends) called before ever
opening the JS Console are not lost.
2022-12-25 07:58:58 -07:00
Andreas Kling
3610ac5e19 Ladybird/WebView: Close top-level BC when the WebView is destroyed 2022-12-25 07:58:58 -07:00
Niek van der Maas
f043d4b654 Ladybird: Add macOS build instructions
Remove release build info, as per request of @bgianfo
2022-12-25 07:58:58 -07:00
ylluminate
ff9dfc89cc Ladybird: Add link to Serenity's LibWeb
library path for easier reference and finding.
2022-12-25 07:58:58 -07:00
Diego Iastrubni
8acdb403c3 Ladybird: Add instructions for building on Fedora
closes #49
2022-12-25 07:58:58 -07:00
Diego Iastrubni
d579ed7e46 Ladybird: Don't propagate unrecognized button clicks to the web engine
There are a lot of unsupported mouse click events that the engine
cannot handle. It such event (0) reaches the web engine - it will
assert.

Don't even propagate them - this is the safe way. As of today!

I also added back/forward buttons to the translation.

Should fix #27
2022-12-25 07:58:58 -07:00
Andreas Kling
561303829e Ladybird/WebView: Plumb visibility state changes from Qt to LibWeb 2022-12-25 07:58:58 -07:00
Matheus Vinicius
d007160ad6 Ladybird: Add --needed option on pacman dependencies command 2022-12-25 07:58:58 -07:00
Andreas Kling
e73c2c7029 Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00
Andreas Kling
4cc82ac638 Ladybird/WebView: Move our PageClient to its own file
And rename it to PageClientLadybird while we're at it, it's not
"headless" by any means.
2022-12-25 07:58:58 -07:00
Andreas Kling
97964bc710 Ladybird/BrowserWindow: Add UI for switching preferred CSS color scheme 2022-12-25 07:58:58 -07:00
Julen Ruiz Aizpuru
98bf0107ce Ladybird/Tab: Conditionally enable back/forward buttons 2022-12-25 07:58:58 -07:00
Julen Ruiz Aizpuru
ea3e9a3102 Ladybird/Tab: Make back/forward keyboard shortcuts platform-specific
This commit changes how we set the back and forward button key bindings
to use platform-specific standard key sequences.

For example, in Mac OS X, the back action will be now triggered via
Cmd+← and Cmd+[, whereas previously the action was mapped to Alt+←,
which is not standard in Mac OS X.
2022-12-25 07:58:58 -07:00
Andreas Kling
617aba2420 Ladybird/FontPluginQt: Initialize the default fixed-width font 2022-12-25 07:58:58 -07:00
Andreas Kling
3628eda0db Ladybird/FontPluginQt: Implement default font virtuals 2022-12-25 07:58:58 -07:00
Andreas Kling
c230264c63 Ladybird/WebView: Ensure JS console is initialized before handling input 2022-12-25 07:58:58 -07:00
Andreas Kling
6ee92a1fd0 Ladybird/WebView: Implement page_did_request_scroll_into_view()
This makes #foo links actually scroll the #foo element into view.
2022-12-25 07:58:58 -07:00
Andreas Kling
345faff586 Ladybird/WebView: Notify LibWeb whenever the viewport is scrolled 2022-12-25 07:58:58 -07:00
Andrew Kaster
488da351c0 Ladybird/CMake: Install resources and Lagom libraries alongside ladybird
This setup should allow the package maintainers who are looking to
distribute ladybird on their distributions to use CMake to install
ladybird using cmake install rules rather than having to write their own
2022-12-25 07:58:58 -07:00
Andrew Kaster
3403b1fd77 Ladybird/WebView: Search for resources using installed location
Reorganize the logic for initializing s_serenity_resource_root.

Now, we initialize it in platform_init(), and move platform_init to the
top of initialize_web_engine.

Add a branch at the end of the function to check
``QApplication::applicationDirPath()`` for the location of the
executable, and base the location of resources on that.
In an installed configuration, this will be /some/path/bin, with the
resource root set to /some/path/share/, looking for files in
/some/path/share/res/resource-type.

This matches up with some upcoming CMake changes to install resources in
CMAKE_INSTALL_DATADIR.
2022-12-25 07:58:58 -07:00
Diego Iastrubni
0a38d246f9 Ladybird: Fix some crashes related to keyboard events
Don't try to get the unicode value of an empty string.
2022-12-25 07:58:58 -07:00
Andreas Kling
ef757f33da Ladybird: Implement the Web::Platform::ImageCodecPlugin interface
...and move it to separate files while we're at it.
2022-12-25 07:58:58 -07:00
Andrew Kaster
4334929323 Ladybird/CMake: Link against LibSoftGPU to fix WebGL with serenity LibGL
In the future, ladybird should probably use a QOpenGLWidget or similar
platform plugin to use the native GL implementation instead of the one
in serenity.
2022-12-25 07:58:58 -07:00
Timothy Flynn
4850a2d272 Ladybird: Update pointer to current tab when the selected tab changes
This allows requests like dumping the DOM tree to be forwarded to the
correct tab. Otherwise, the event would be forwarded to the most
recently created tab.
2022-12-25 07:58:58 -07:00
Timothy Flynn
e04db5efed Ladybird: Hook up the dump-cookies debug request to the cookie jar 2022-12-25 07:58:58 -07:00
Andreas Kling
0f1644f62d Ladybird: Switch to next/previous tab with Ctrl+PageDown/PageUp 2022-12-25 07:58:58 -07:00
Andreas Kling
27b9cd13ee Ladybird: Focus the location editor when creating a new tab
This lets you start typing a new URL right after pressing Ctrl+T.
2022-12-25 07:58:58 -07:00
Andreas Kling
031005de2d Ladybird: Remove some awkward camelCase signal names
We use snake_case for everything except when we're forced by Qt to use
their camelCase names.
2022-12-25 07:58:58 -07:00
Andreas Kling
0c4ae810d7 Ladybird: Hide the hovered URL label on startup 2022-12-25 07:58:58 -07:00
Andreas Kling
4e3e5149d5 Ladybird: Show tooltips for <a title> text 2022-12-25 07:58:58 -07:00
Andreas Kling
ce38528fff Ladybird: Allow scrolling with arrow keys and PageUp/PageDown
This will need further work to integrate well with content that listens
for key events, but at least this is better than doing nothing.
2022-12-25 07:58:58 -07:00
Andreas Kling
f4a9b382b1 Ladybird: Remove spacing between toolbar and web view 2022-12-25 07:58:58 -07:00
Andreas Kling
d74802e4e2 Ladybird: Show hovered link URLs in a conditional UI label
The tooltips for hovered links were super awkward when in a tooltip
2022-12-25 07:58:58 -07:00
Andreas Kling
aa27112d78 Ladybird: Tweak the QTabWidget look 2022-12-25 07:58:58 -07:00
Andreas Kling
8a657eaa34 Ladybird: Add a FontPlugin and try much harder to find suitable fonts
Instead of only looking at the SerenityOS default fonts, we now also
look recursively in /usr/share/fonts for suitable fonts that we can
load and use.
2022-12-25 07:58:58 -07:00
Andreas Kling
37d844fd66 Ladybird: Use only the Qt event loop to speed everything up :^)
This patch removes the dual-event-loop setup, leaving only the Qt event
loop. We teach LibWeb how to drive Qt by installing an EventLoopPlugin.

This removes the 50ms latency on all UI interactions (and network
requests, etc.)
2022-12-25 07:58:58 -07:00
Andreas Kling
dcab11f5e9 Ladybird: Fix build after LibWeb+LibJS GC changes 2022-12-25 07:58:58 -07:00
Luke Wilde
9789d8b769 Ladybird: Turn initialize_global_object() into a regular initialize()
See: https://github.com/SerenityOS/serenity/commit/cfa5885
2022-12-25 07:58:58 -07:00
Luke Wilde
1e7d4bc089 Ladybird: Retrieve console object from the realm's intrinsic
See: https://github.com/SerenityOS/serenity/commit/867ad03
2022-12-25 07:58:58 -07:00
Andreas Kling
ced442f426 Ladybird: Remove obsolete call to set_associated_realm() 2022-12-25 07:58:58 -07:00
Kemal Zebari
80edd654fa Ladybird: Fix a few typos in README 2022-12-25 07:58:58 -07:00
Luke Wilde
c9e6967d7b Ladybird: Update for LibJS realm changes 2022-12-25 07:58:58 -07:00
Andreas Kling
a14b00e046 Ladybird: Remove redundant subtraction of scrollbar from viewport rect 2022-12-25 07:58:58 -07:00
Andreas Kling
b1acf17d3c Ladybird: Simplify awkward keyboard mapping code 2022-12-25 07:58:58 -07:00
Andreas Kling
90c0ae5e63 Ladybird: Update for LibJS global object construction changes 2022-12-25 07:58:58 -07:00
Andreas Kling
b1cc1bd47b Ladybird: Remove unused PageClient override 2022-12-25 07:58:58 -07:00
Xexxa
5a5473a38e Ladybird/Meta: Use reverse domain name notation in property list files 2022-12-25 07:58:58 -07:00
Filiph Sandström
7ddb433f99 Ladybird/Meta: Enable macOS high-dpi support
This also adds an Info.plist file required to properly
build macOS applications.
2022-12-25 07:58:58 -07:00
Andreas Kling
da23456f9e Ladybird: Try decoding images with Qt if LibGfx fails us
We might as well ask Qt if it can decode images in case our own decoders
don't succeed.
2022-12-25 07:58:58 -07:00
Andreas Kling
11e5be050f Ladybird: Enable HTTP pipelining 2022-12-25 07:58:58 -07:00
Andreas Kling
9073d60f00 Ladybird: Actually add request headers to outgoing HTTP requests 2022-12-25 07:58:58 -07:00
Filiph Sandström
d60f8807e3 Ladybird: Allow for setting the hompage through SettingsDialog 2022-12-25 07:58:58 -07:00
Filiph Sandström
91e5b6d4f5 Ladybird: Add SettingsDialog stub 2022-12-25 07:58:58 -07:00
Filiph Sandström
a838004725 Ladybird: Add Settings class 2022-12-25 07:58:58 -07:00
Andreas Kling
1b682e4b2c Ladybird: Don't rewrite file:// URLs to HTTP 2022-12-25 07:58:58 -07:00
Andreas Kling
c216e714c7 Ladybird: Tweak inaccurate copyright year :^) 2022-12-25 07:58:58 -07:00
Diego Iastrubni
2905bda0f2 Ladybird: Add a protocol to the URL, when one is not set
When a http(s):// is not written by the user - lets manually add one.
2022-12-25 07:58:58 -07:00
Alec Murphy
700c709c00 Ladybird: Add Ctrl-W action to close current tab (#28) 2022-12-25 07:58:58 -07:00
Diego Iastrubni
35eb696884 Ladybird: Basic keyboard input (#31)
This handles most (?) of keyboard input. For some reason, "Ctrl+A"
and Enter are not working on google.com.

It can handle plain ASCII, I tested also Hebrew input,
and https://playbiolab.com/ (which is playable now!)
2022-12-25 07:58:58 -07:00
Andrew Kaster
1002de086e Ladybird/Docs: Document Android build steps 2022-12-25 07:58:58 -07:00
Andrew Kaster
261f078a28 Ladybird/Meta: Add Android build
Build an Android APK file that, when configured properly in Qt Creator,
can be used to deploy the browser to an Android device.

The current build requires NDK 24, targets no less than Android API 30,
and Qt Creator 6.4.0.
2022-12-25 07:58:58 -07:00
Andreas Kling
7e42eae1a2 Ladybird: Add a separate license file 2022-12-25 07:58:58 -07:00
Andreas Kling
73c15ef56d Ladybird: Don't try to append to the JS console before it's instantiated 2022-12-25 07:58:58 -07:00
Andreas Kling
45c6a8c479 Ladybird: Add files I forgot to commit :^) 2022-12-25 07:58:58 -07:00
Andreas Kling
79ce12a363 Ladybird: Remove debug spam about non-existent console messages 2022-12-25 07:58:58 -07:00
Andreas Kling
f2b126f4d7 Ladybird: Basic support for window.alert() and window.confirm() 2022-12-25 07:58:58 -07:00
Andreas Kling
aa5f886128 Ladybird: Add quick & dirty port of the JS console from Browser :^) 2022-12-25 07:58:58 -07:00
Daniel Bertalan
af5250b2cb Ladybird: Fix compilation on macOS/Clang
- Silences the -Wuser-defined-literals warning which is triggered by our
  use of the `sv` suffix for StringView
- Removes an unused captured `this` pointer [-Wunused-lambda-capture]
- Changes a JSONArray.h include to JSONObject.h to get the definition
  for `JSONValue::serialize`. This is needed because template functions
  are not exported for dylibs on macOS. This is a hack; the JSON headers
  should be refactored so that each one includes the definition of
  the template functions it sees. -- Maybe we should build with
  -fvisibility-inlines-hidden on Linux to catch issues like this?
2022-12-25 07:58:58 -07:00
Filiph Sandström
d1d6a204fc Ladybird: Replace StatusBar with ToolTip
This gives the actual webcontent more space to work with,
it also emulates how other browsers does it.

In the future we'd like to do something else since only ToolTip
can be visible at the same time.
2022-12-25 07:58:58 -07:00
Andreas Kling
bfc9057638 Ladybird: Tell Qt to let us manage HTTP redirects ourselves 2022-12-25 07:58:58 -07:00
Andreas Kling
2bbf2dfb9a Ladybird: Update for removal of StringView(char const*) 2022-12-25 07:58:58 -07:00
Andreas Kling
80636d6779 Ladybird: Implement basic cookie support
We import the CookieJar class from Browser to do the work. Long-term
we should look for a way to share this code with Browser.
2022-12-25 07:58:58 -07:00
Filiph Sandström
ea7e637b6e Ladybird: Fix title branding when switching tabs 2022-12-25 07:58:58 -07:00
Filiph Sandström
ace44dc13b Ladybird: Hide TabBar if count <= 1 2022-12-25 07:58:58 -07:00
Andreas Kling
74c71804c7 Ladybird: Add "View Source" menu action (Ctrl+U) 2022-12-25 07:58:58 -07:00
Thitat Auareesuksakul
1400a160bc Ladybird: Set singleStep for scroll bars in WebView
Sets singleStep to 24px, this allows you to scroll using your mouse
scroll wheel :^)
2022-12-25 07:58:58 -07:00
Thitat Auareesuksakul
d89fbf3aa0 Ladybird: Set pageStep for scroll bars in WebView
This allows PageUp/PageDown keys to scroll 1 viewport size at a time.
This also fixes the scroll bar drag handle to be a correct length.
2022-12-25 07:58:58 -07:00
Andreas Kling
096164ea1a Ladybird: Revert accidentally commited local settings 2022-12-25 07:58:58 -07:00
Andreas Kling
487544d7b4 Ladybird: Port over part of the "Debug" menu from the SerenityOS browser
This is pretty messy, but we have to start somewhere. Eventually we
should find a way to share this code with SerenityOS.
2022-12-25 07:58:58 -07:00
David Gannerud
eea012472e Ladybird: Prevent loading of invalid URL
Loading invalid URL will result in a crash.
2022-12-25 07:58:58 -07:00
Andreas Kling
b97c74331c Ladybird: Don't include scrollbars in viewport rect size 2022-12-25 07:58:58 -07:00
Andreas Kling
a08e83e2cc Ladybird: Check for errors while decoding favicons 2022-12-25 07:58:58 -07:00
Andreas Kling
50b3672f52 Ladybird: Add keyboard shortcut for focusing the location edit (Ctrl+L) 2022-12-25 07:58:58 -07:00
Andreas Kling
303fda074a Ladybird: Fix build with Qt 6.2.4 2022-12-25 07:58:58 -07:00
Matthew Costa
7681ef25da Ladybird: Expanded toolbar with browser history and home button
This patch takes the browser history code from the Serenity browser and
wires it up to the QT interface. This is tied in with a few extra
toolbar buttons associated with each tab.
2022-12-25 07:58:58 -07:00
Matthew Costa
67ab6dd2e6 Ladybird: Allow browser tabs to be closed
This is a small patch which wires up the tab close button.
2022-12-25 07:58:58 -07:00
Matthew Costa
8af5b49cba Ladybird: Rudimentary tabbed browsing support
This patch removes the browser WebView from the window and places it
inside a Tab object, all wrapped up in a QT tab control. So far you can
create tabs, but can't close them.
2022-12-25 07:58:58 -07:00
Thitat Auareesuksakul
ec44691b56 Ladybird: Add basic cursor shape support in WebView 2022-12-25 07:58:58 -07:00
Andreas Kling
a7cb558783 Ladybird: Fix broken favicon conversion from Gfx::Bitmap to QPixmap 2022-12-25 07:58:58 -07:00
Alfonso Saavedra "Son Link
48de1fb1b1 Ladybird: Added Arch Linux/Manjaro required packages to build 2022-12-25 07:58:58 -07:00
Andreas Kling
f96b53f118 Ladybird: Stop using deprecated Qt API and re-enable deprecated warnings 2022-12-25 07:58:58 -07:00
Andreas Kling
419d3ec646 Ladybird: Use QtNetwork for HTTP and HTTPS requests
Until we can get our own RequestServer infrastructure up and running,
running the TLS and HTTP code in-process was causing lots of crashes
due to unexpected reentrancy via nested event loops.

This patch adds a simple backend for HTTP and HTTPS requests that simply
funnels them through QNetworkAccessManager.
2022-12-25 07:58:58 -07:00
Andreas Kling
69d264828f Ladybird: Add a "Reload" action to reload the current URL 2022-12-25 07:58:58 -07:00
Matthew Costa
7bf3010185 Ladybird: Trigger browser to quit when the main window is closed
This patch adds an event handler to the main window which allows it to
respond to a user closing the window. This event is then passed on to
the LibCore event loop, which allows the application quit itself.
Previously the application would hang, only running in the background,
until killed by an external force.
2022-12-25 07:58:58 -07:00
Keir Davis
95e3e06a1e Ladybird: Add Favicon to the window 2022-12-25 07:58:58 -07:00
Matthew Costa
47d7f1efec Ladybird: Apply inverse image scaling to ensure WebView renders at 1:1
On high-dpi systems QT will automatically scale up painting operations.
This results in an ugly blurry browser window surrounded by a nicely
scaled window frame. This patch applies an inverse scale to the WebView
widget, ensuring the painting and mouse events are lined up and draw
with a 1:1 pixel ratio with respect to the display's device pixels.
2022-12-25 07:58:58 -07:00
Timothy Flynn
9edd334beb Ladybird/Meta: Add libgl1-mesa-dev to build dependencies
Without this package, CMake fails with the error:

    Could NOT find OpenGL (missing: OPENGL_INCLUDE_DIR)

This package is listed in Qt's requirements here:
https://doc.qt.io/qt-6/linux.html#requirements-for-development-host
2022-12-25 07:58:58 -07:00
Andreas Kling
874e73e0c9 Ladybird/WebView: Apply viewport scroll offset to mouse event coordinate 2022-12-25 07:58:58 -07:00
Andreas Kling
96170a4f24 Ladybird/Meta: QT => Qt in the README :^) 2022-12-25 07:58:58 -07:00
Andrew Kaster
74fda4aff5 Ladybird/Meta: Convert to CMake build 2022-12-25 07:58:58 -07:00
Andreas Kling
da19b78dea Ladybird: Don't set a fixed height on the location edit 2022-12-25 07:58:58 -07:00
Andreas Kling
f5d033b8ba Ladybird: Show the web page title in the window titlebar :^) 2022-12-25 07:58:58 -07:00
Andreas Kling
8b7000e151 Ladybird: Add a location bar and allow navigating to new pages :^) 2022-12-25 07:58:58 -07:00
Andreas Kling
88d256c109 Ladybird: Show hovered link URLs in the status bar :^) 2022-12-25 07:58:58 -07:00
Andreas Kling
9b8fe16e3d Ladybird: Plumb Qt mouse events into LibWeb 2022-12-25 07:58:58 -07:00
Andreas Kling
f16ba7945a Ladybird: Make HTTPS loads default to port 443 instead of 80 :^) 2022-12-25 07:58:58 -07:00
Andreas Kling
80526625e8 Ladybird: Basic scrolling support 2022-12-25 07:58:58 -07:00
Andreas Kling
1eb653115b Ladybird: Initial import :^) 2022-12-25 07:58:58 -07:00