Commit graph

2155 commits

Author SHA1 Message Date
Timothy Flynn
c6a11a77b5 LibWebView+WebContent: Add a WebContent IPC to clone a DOM node 2023-12-07 23:16:34 +01:00
Timothy Flynn
111e53a2f6 LibWebView+WebContent: Add WebContent IPC to create children DOM nodes
This adds IPC to create append a child <div> element or a text node to
a DOM node.
2023-12-07 23:16:34 +01:00
Timothy Flynn
f7de1369d2 LibWebView+WebContent: Add a WebContent IPC to take DOM node screenshots 2023-12-07 10:53:12 +01:00
Timothy Flynn
a7b98a9761 LibWeb+WebContent+WebWorker: Add an option to skip painting the overlay
This will allow the Inspector to take a screenshot of a DOM node without
the overlay which renders the inspected node outline / box data.
2023-12-07 10:53:12 +01:00
Timothy Flynn
bea11f6d99 LibWebView+WebContent: Add a WebContent IPC to get a DOM node's HTML 2023-12-07 10:53:12 +01:00
Timothy Flynn
8162dc5ee6 LibWeb+LibWebView+WebContent: Separate tag/attribute in Inspector menu
It was a bit short-sighted to combine the tag and attribute names into
one string when the Inspector requests a context menu. We will want both
values for some context menu actions. Send both names, as well as the
attribute value, when requesting the context menu.
2023-12-07 10:53:12 +01:00
Timothy Flynn
9a5fe740c6 LibWebView: Make a best-effort attempt to not "shift" edited attributes
Currently, when editing a DOM attribute, the replacement method first
removes the attribute, then adds the replacement attributes. This
results in the edited attribute jumping to the end of the attribute
list in the Inspector.

This patch will try to avoid removing the attribute if one of the
replacements has the same name. This will keep the edited attribute in
the same location.
2023-12-06 13:04:50 +01:00
Timothy Flynn
777b4f7921 LibWebView+WebContent: Add a WebContent IPC to remove a DOM node
The FIXME added to ConnectionFromClient::remove_dom_node is copied from
Web::EditEventHandler. The same behavior is observed here, with many
lingering Layout::TextNodes, for example.
2023-12-06 13:04:50 +01:00
Timothy Flynn
86d90f324d LibWebView+WebContent: Add a WebContent IPC to add DOM attributes 2023-12-06 13:04:50 +01:00
Timothy Flynn
2cdad0f068 LibWeb+LibWebView+WebContent: Add an Inspector IPC to add DOM attributes 2023-12-06 13:04:50 +01:00
Timothy Flynn
2633ea8c79 LibWeb+LibWebView+WebContent: Add an Inspector IPC to open context menus
The Inspector will have context menu support to manipulate the DOM, e.g.
adding or removing nodes/attributes. This context menu will require some
detailed knowledge about what element in the Inspector has been clicked.
To support this, we intercept the `contextmenu` event and collect the
required information to be sent to the Inspector client over IPC.
2023-12-06 13:04:50 +01:00
Timothy Flynn
fff65046a3 WebWorker: Do not prefix WebWorker include with "Services/"
We don't do this elsewhere and this breaks the GN build.
2023-12-05 14:20:03 -05:00
Shannon Booth
0ae5c070c7 LibWeb: Make Web::Page GC-allocated
This is a first step towards removing the various Page& and Page*
we have littering the engine with "trust me bro" safety guarantees.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-05 09:38:32 +01:00
Shannon Booth
6e6f3a9a8f LibWeb: Make Web::PageClient GC-allocated
This is a first step towards simplifying the ownership model of
Web::Page. Soon Web::Page will store its WebClient as a
NonnullGCPtr to help solve lifetime issues of the client being
destroyed before the page.
2023-12-05 09:38:32 +01:00
Andrew Kaster
9f01e0f826 WebWorker: Log URL and reason for Worker script load failure 2023-12-04 19:59:10 -05:00
Timothy Flynn
1236cbd41a LibWeb+LibWebView+WebContent: Add Inspector IPCs to manipulate DOM nodes
This adds the IDL methods and IPC to forward DOM-editing events from the
Inspector WebView to the Inspector client.
2023-12-04 01:33:57 +01:00
Timothy Flynn
4cfeb41c4b LibWebView+WebContent: Add APIs to manipulate DOM nodes
This adds APIs to allow Ispector clients to:
* Change a DOM text or comment node's text data.
* Add, replace, or remove a DOM element's attribute.
* Change a DOM element's tag.
2023-12-04 01:33:57 +01:00
Shannon Booth
f976ec005c LibWeb: Port DOM::Document from DeprecatedString 2023-12-02 22:54:53 +01:00
Timothy Flynn
9f374a5d2a LibWeb+LibWebView+WebContent: Add an Inspector IPC to execute JavaScript
The Inspector will have an <input> element to execute user-provided JS.
This adds an IDL method and IPC to forward that JS from the Inspector
WebView to the Inspector client.
2023-12-02 10:34:22 +01:00
Timothy Flynn
8fc5c8b7df WebContent: Print a warning if GPU painting is enabled but not supported 2023-12-01 20:07:27 -05:00
Timothy Flynn
ea81470fc0 WebContent: Remove a bunch of unused includes from PageHost
Mostly just to narrow down where HAS_ACCELERATED_GRAPHICS is used, to
make it easier to see where it needs to be defined by the build system.
2023-12-01 20:07:27 -05:00
Andrew Kaster
fbfb70f81a LibWeb+WebContent: Plumb ability for WebContent process to hold N pages
In order for same-origin NavigableContainers (iframe, frame, embed, ...)
and window.open() WindowProxies to have the proper JS access to their
embedder/opener, we need to host multiple top level traversables in the
same WebContent process. As a first step, make WebContent::PageHost hold
a HashMap of PageClient objects, each holding their own Web::Page that
represents a TraversableNavigable's API surface with the UI process.
2023-12-01 20:47:44 +01:00
Shannon Booth
1b05598cd3 LibWeb: Port ParsedCookie from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Timothy Flynn
aa4dcda5dc LibWeb+LibWebView+Ladybird: Scale scroll-to CSS positions in PageHost
The `page_did_request_scroll_to` API takes a CSS position, and thus
callers should not scale to device pixels before invoking it. Instead,
align this API with (most) other PageHost APIs which scale to device
pixels before sending the corresponding IPC message.

In the AppKit chrome, convert the provided device pixel position to a
widget position.
2023-11-24 17:19:08 -05:00
Andrew Kaster
1602663b9e LibWeb+WebWorker: Implement a first cut of post_message for Workers
This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
2023-11-24 08:41:38 +01:00
Andrew Kaster
05ec93e276 WebWorker: Reuse main thread VM for DedicatedWorker realms
While creating a new VM feels warm and fuzzy from an isolation
perspective, having multiple JS heaps in the same process is a footgun
waiting to happen. Additionally, there are still many places in LibWeb
that reach for the main thread VM to check for the current realm to do
things, such as Web::HTML::incumbent_settings_object().
2023-11-24 08:41:38 +01:00
Andrew Kaster
e30ecacb71 WebWorker: Exit the event loop when the connection from the client dies
This mimics the behavior of other services, and prevents zombie service
processes from sticking around when no longer needed.
2023-11-24 08:41:38 +01:00
Aliaksandr Kalenik
5f7ac559a7 LibAccelGfx+LibWeb: Add support for stacking context opacity
For each stacking context with an opacity less than 1, we create a
separate framebuffer. We then blit the texture attached to this
framebuffer with the specified opacity.

To avoid the performance overhead of reading pixels from the texture
into Gfx::Bitmap, a new method that allows for direct blitting from
the texture is introduced, named blit_scaled_texture().
2023-11-24 08:39:55 +01:00
Aliaksandr Kalenik
d5630fedf1 LibAccelGfx+WebContent: Introduce Canvas that represents framebuffer 2023-11-24 08:39:55 +01:00
Timothy Flynn
ffdc2d8add LibWeb+LibWebView+WebContent: Add an Inspector IDL object to the Window
This is an internal object that must be explicitly enabled by the chrome
before it is added to the Window. The Inspector object will be used by a
special WebView that will replace all chrome-specific inspector windows.
The IDL defines methods that this WebView will need to inform the chrome
of various events, such as the user clicking a DOM node.
2023-11-24 08:37:19 +01:00
Timothy Flynn
30e96749de LibWebView+WebContent: Remove unused did_get_dom_node_properties IPC
This is never invoked. The functionality it provides is implemented by
the return value of the `inspect_dom_node` IPC.
2023-11-24 08:37:19 +01:00
Shannon Booth
6c42de3e8b LibWeb: Port XMLSerializer from DeprecatedString to String 2023-11-20 15:00:19 +01:00
Shannon Booth
e28fb5c64c LibWeb: Port Cookie from DeprecatedString to String 2023-11-20 15:00:19 +01:00
Shannon Booth
6aff55d655 LibWeb: Port NavigatorID from DeprecatedString to String 2023-11-20 15:00:19 +01:00
Liav A
b9141d85d8 WindowServer: Introduce the window roll-up feature
The roll-up feature allows the user to set the window content to be
hidden, while retaining the window title bar visibility.
While in roll-up mode, the window height size is not changeable.
However, tiling the window or maximizing (as well as unmaximize) it will
instruct exiting the roll-up mode.
2023-11-17 17:31:51 +00:00
Andrew Kaster
124c378472 LibWeb+WebWorker: Move worker execution into a new WebWorker process
We now create a WorkerAgent for the parent context, which is currently
only a Window. Note that Workers can have Workers per the spec.

The WorkerAgent spawns a WebWorker process to hold the actual
script execution of the Worker. This is modeled with the
DedicatedWorkerHost object in the WebWorker process.
A start_dedicated_worker IPC method in the WebWorker IPC creates the
WorkerHost object. Future different worker types may use different IPC
messages to create their WorkerHost instance.

This implementation cannot yet postMessage between the parent and the
child processes.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-11-15 12:56:33 +01:00
Tim Ledbetter
1793f51bc6 LibDNS: Make DNS packet parsing fallible
Previously, a DNS packet containing an invalid name would be returned
with an empty name. With this change, an error is returned if any error
is encountered during parsing.
2023-11-14 10:12:44 +01:00
Aliaksandr Kalenik
6d1a1daff9 LibAccelGfx+LibWeb: Use framebuffer object instead of EGLs PBuffer
Framebuffer object is allocated using OpenGL's API and is not platform
specific which means it could be used on both macOS and Linux unlike
EGL specific PBuffer.
2023-11-11 22:19:43 +01:00
Timothy Flynn
306850652f LibWebView+WebContent: Add an IPC hook to insert data into the clipboard 2023-11-11 08:54:37 +01:00
david072
7f501d4d8a Taskbar/QuickLaunchWidget: Ensure config backwards compatibility
The QuickLaunchWidget can now also parse the old config format, so that
we stay compatible with the old format. After loading, it deletes the
old config values and saves them in the new format.
2023-11-09 23:35:52 +01:00
david072
620b3bd492 Taskbar/QuickLaunchWidget: Show a tooltip with the entry's name on hover 2023-11-09 23:35:52 +01:00
david072
2d29a96dbe Taskbar/QuickLaunchWidget: Small cleanup 2023-11-09 23:35:52 +01:00
david072
e100c1458a Taskbar/QuickLaunchWidget: Reorder methods to make .cpp and .h match
This makes it a bit easier to find things in my opinion.
2023-11-09 23:35:52 +01:00
david072
13b98d01c0 Taskbar/QuickLaunchWidget: Properly save Quick Launch Entries
The entries in the QuickLaunchWidget are now saved properly. This means
that the format with which they are saved needed to be changed, since we
now also need to store the order of the entries. To do this, the entries
are now saved using the following value format: "<index>:<path>". When
loading, we simply parse this structure out and sort by the index,
before parsing the path into `QuickLaunchEntry`s.
2023-11-09 23:35:52 +01:00
david072
84340c4ca7 Taskbar/QuickLaunchWidget: Allow reordering the entries :^)
You can now drag the entries in the QuickLaunchWidget to reorder them!
2023-11-09 23:35:52 +01:00
david072
63cac2839d Taskbar/QuickLaunchWidget: Do rendering ourselves
The QuickLaunchWidget now renders the buttons on its own, in preparation
for allowing the user to reorder the widget's entries.
2023-11-09 23:35:52 +01:00
david072
70f7c10ab9 Taskbar+WindowServer: Adding to Quick Launch via windows :^)
You can now add applications to Quick Launch via the context
menu option of their windows. Clicking it creates an event with the
stored PID of the process that created the window. The Taskbar receives
the event and tells the QuickLaunchWidget to add the PID, which then
gets the executable using /sys/kernel/processes. It also looks for an
AppFile using the name from the process object and if there is one, it
uses that, since it should contain a better formatted name.
2023-11-09 23:35:52 +01:00
david072
4386182be1 LibGUI+WindowServer: Store the source process' PID in the Window classes
The "Window" classes in LibGUI and WindowServer now store the PID of the
process that created the window. LibGUI's Window obtains the PID in the
constructor via getpid(), and passes it in Window::show() to
WindowServer via the create_window() IPC route. WindowServer then saves
it in its own Window class.
This allows us to find the process that created a window in order to add
process-specific actions to the window.
2023-11-09 23:35:52 +01:00
Tim Schumacher
a2f60911fe AK: Rename GenericTraits to DefaultTraits
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05:00
Tim Ledbetter
4e3b59a4bb LibDNS: Prefer spans over raw pointers when parsing DNS packets
This means we don't have to keep track of the pointer and size
separately.
2023-11-08 09:38:36 +01:00