Commit Graph

87 Commits

Author SHA1 Message Date
Andreas Kling
651f30dfbe WebContent: Coalesce paint invalidations to avoid spamming client
Some content cause a lot of paint invalidations (e.g someone drawing to
a <canvas> repeatedly) and we don't need to spam the client about this.
Instead, accumulate a dirty rect, and send it once per event loop step.
2021-09-28 22:53:59 +02:00
Andreas Kling
0af0ee4293 LibWeb: Fire "keyup" events as well :^)
This was easy, now that we have KeyboardEvent.
2021-09-28 16:56:24 +02:00
Andreas Kling
a79bdd2bd5 LibWeb+Browser: Make ad blocking work in the multi-process world
We now send the list of content filters over to new WebContent processes
after creating an OutOfProcessWebView. :^)
2021-09-27 11:40:56 +02:00
Karol Kosek
620e4fd0d2 WebContent: Pass an empty bitmap object if the pointer is null
Prior this commit we were always dereferencing the image bitmap pointer,
even if it was null, which resulted in a crash when trying to open
the context menu when an image wasn't loaded.

Closes: #10178
2021-09-22 22:10:11 +02:00
Andreas Kling
19de6bb1cc LibWeb+Browser: Add Debug menu action for toggling Same-Origin Policy
Sometimes it's useful to turn off the SOP for testing purposes.
Let's make that easy by having a Debug menu item for it. :^)
2021-09-12 02:13:28 +02:00
Timothy Flynn
1139aa45b6 WebContent: Use ErrorType::NotAnObjectOfType instead of NotA 2021-09-12 00:16:39 +02:00
Sam Atkins
83414af9f3 LibWeb+WebContent: Add WebContentClient::did_request_scroll_to() call
This call sets the absolute scroll position for the window.
2021-09-11 15:51:05 +01:00
Sam Atkins
a09219159c LibWeb+WebContent: Modify did_request_scroll() IPC to take x&y deltas
This is in preparation for implementing JS scrolling functions, which
specify both x and y scrolling deltas. The visible behavior has not
changed.

Also, moved the "mouse wheel delta * 20" calculation to the
`EventHandler` since the JS calls will want to work directly in pixels.
2021-09-11 15:51:05 +01:00
Andreas Kling
90cdeebfb3 LibWeb: Rename DOM::Window::document() => associated_document()
Match the spec nomenclature.
2021-09-09 21:25:10 +02:00
Andreas Kling
84fcf879f9 LibWeb: Rename BrowsingContext::document() => active_document()
This better matches the spec nomenclature. Note that we don't yet
*retrieve* the active document according to spec.
2021-09-09 21:25:10 +02:00
Andreas Kling
e91edcaa28 LibWeb: Rename InitialContainingBlockBox => InitialContainingBlock
The "Box" suffix added nothing here.
2021-09-08 11:27:46 +02:00
Andreas Kling
9d9500989a LibWeb: Remove unused PageClient::is_multi_process() 2021-09-08 11:07:14 +02:00
Andreas Kling
9d03ea6f74 LibWeb+WebContent: Port DumpLayoutTree to OutOfProcessWebView
This required adding a simple OOPWV::dump_layout_tree() API that
synchronously requests a dump of the layout tree from the WebContent
process.
2021-09-08 11:07:14 +02:00
Sam Atkins
e255b5dd31 LibWeb+WebContent: Remove old console-logging IPC calls
This patch removes the following WebContent IPC calls, which are no
longer used:

- `Server::js_console_initialize()`
- `Client::did_js_console_output()`
2021-09-06 18:20:26 +02:00
Sam Atkins
95aa6562db Browser+WebContent: Initialize WebContentConsoleClient earlier
With this patch, we now initialize the `WebContentConsoleClient` as soon
as the Page has loaded, instead of waiting for the Console Window to be
shown. This finally lets us see log messages that happened before the
window was opened! :^)

However, it is not perfect. Waiting until the page has loaded means we
lose any messages that happen *during* page load. Ideally we would
initialize the WCCC when the page *starts* loading instead, but it
requires that the page has a document and interpreter assigned and
accessible. As far as I can tell with my limited knowledge, this is not
the case until the page has completed loading.
2021-09-06 18:20:26 +02:00
Sam Atkins
f6a927fa20 WebContent: Store messages in WebContentConsoleClient
The `WebContentConsoleClient` now keeps a list of console messages it
has received, so these are not lost if the ConsoleWidget has not been
initialized yet.

This change does break JS console output, but only until the next
commit. :^)
2021-09-06 18:20:26 +02:00
Sam Atkins
c619a57cf8 LibWeb+WebContent: Add new console-message IPC calls
This patch introduces three new IPC calls for WebContent:

- `Client::did_output_js_console_message(index)`:
  Notifies the client that a new console message was logged.

- `Server::js_console_request_messages(start_index)`:
  Ask the server for console messages starting at the given index.

- `Client::did_get_js_console_messages(start_index, types, messages)`:
  Send the client the messages they requested.

This mechanism will replace the current
`Client::did_js_console_output()` call in the next few commits. This
will allow us to display messages in the console that happened before
the console was opened.
2021-09-06 18:20:26 +02:00
Sam Atkins
5220d6d2e5 WebContent: Implement $0 special variable in Browser JS Console
`$0` is a helpful variable in other browsers' JS consoles, which points
to whichever DOM Node is currently selected in the DOM Inspector. And
now we have it too! :^)
2021-09-06 18:20:26 +02:00
Sam Atkins
7838eab341 WebContent: Implement ConsoleGlobalObject which proxies to WindowObject
ConsoleGlobalObject is used as the global object when running javascript
from the Browser console. This lets us implement console-only functions
and variables (like `$0`) without exposing them to webpage content. It
passes other calls over to the usual WindowObject so any code that would
have worked in the webpage will still work in the console. :^)
2021-09-06 18:20:26 +02:00
Sam Atkins
e2c32a6c65 Everywhere: Use my shiny new serenityos.org email :^) 2021-09-03 12:22:36 +02:00
Sam Atkins
1ccf10789e LibWeb+WebContent: Add query for hovered DOM node to OOPWV
This is needed for the "Inspect Element" context menu action.
2021-09-02 22:16:41 +02:00
Sam Atkins
3b07f49d48 LibWeb+WebContent: Implement asynchronous DOM Node properties call
This lets us "push" a new style-properties list to the DOM Inspector,
for example when JS changes the style of the inspected node.
2021-09-02 22:16:41 +02:00
Sam Atkins
f381f8d63e LibWeb+WebContent: Add inspect_dom_node() IPC call
This is the IPC version of `Document::set_inspected_node()`, using a
node ID.

We return the inspected node's style properties as JSON, so that the DOM
Inspector can immediately display them.
2021-09-02 22:16:41 +02:00
Andreas Kling
fd922cf92f LibWeb+WebContent: Add a simple API for running arbitrary JavaScript
This patch adds OutOfProcessWebView::run_javascript(StringView).
This can be used by the OOPWV embedder to execute arbitrary JavaScript
in the top-level browsing context on the WebContent process side.
2021-08-24 16:56:42 +02:00
Brian Gianforcaro
808aa31353 Services: Remove unused header includes 2021-08-01 08:10:16 +02:00
Timothy Flynn
ae910e4370 LibWeb: Add OOPWV IPC for selecting all text 2021-07-14 17:16:39 +02:00
Timothy Flynn
2fda6ce159 LibWeb: Add OOPWV IPC for retrieving selected text 2021-07-14 17:16:39 +02:00
Timothy
944e5cfb35 Everywhere: Use IPC include syntax
Remove superfluous includes from IPCCompiler's generated output and
add include directives in IPC definitions where appropriate.
2021-07-03 12:16:00 +02:00
Adam Hodgen
cd6b9613c5 LibWeb+WebContent: Add IPC flow for Inspect DOM Tree
Add `inspect_dom_tree` to WebContentServer and 'did_get_dom_tree' to
WebContentClient.

These two async methods form a request & response for requesting a JSON
representation of the Content's DOM tree.
2021-06-29 23:06:48 +02:00
Tom
4392da970a WindowServer: Add initial support for rendering on multiple screens
This allows WindowServer to use multiple framebuffer devices and
compose the desktop with any arbitrary layout. Currently, it is assumed
that it is configured contiguous and non-overlapping, but this should
eventually be enforced.

To make rendering efficient, each window now also tracks on which
screens it needs to be rendered. This way we don't have to iterate all
the windows for each screen but instead use the same rendering loop and
then only render to the screen (or screens) that the window actually
uses.
2021-06-20 14:57:26 +02:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Andreas Kling
4190fd2199 LibWeb: Rename Web::Frame to Web::BrowsingContext
Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
2021-05-30 12:39:53 +02:00
Andreas Kling
67b47d62f3 WebContent: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
bb23e61fbf LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase
(where it's all hardcoded), they now get it from WindowServer.

These are then plumbed into the usual Gfx::FontDatabase places so that
the old default_font() and default_fixed_width_font() APIs keep working.
2021-05-21 20:15:51 +02:00
Gunnar Beutner
9e22e9ce88 Userland: Use snake case names in .ipc files
This updates all .ipc files to have snake case names for IPC methods.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
eb21aa65d1 Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's
return value directly - instead of the response struct - for IPC
methods which only have a single return value.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
5bb79ea0a7 Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
78803ce384 Userland: Split IPC endpoints into proxies and stubs
This enables support for automatically generating client methods.
With this added the user gets code completion support for all
IPC methods which are available on a connection object.
2021-05-03 21:14:06 +02:00
Gunnar Beutner
065040872f Userland: Change IPC funcs to use plain arguments instead of a struct
Instead of having a single overloaded handle method each method gets
its own unique method name now.
2021-05-03 21:14:06 +02:00
Gunnar Beutner
889359b6f9 Userland: Make IPC handlers return void if they don't have any outputs 2021-05-02 08:11:38 +02:00
Gunnar Beutner
7cf2839a26 Userland: Get rid of the OwnPtr<...> boilerplate code for IPC handlers 2021-05-02 08:11:38 +02:00
DexesTTP
71d27abb97 Services: Rename ProtocolServer to RequestServer
The current ProtocolServer was really only used for requests, and with
the recent introduction of the WebSocket service, long-lasting
connections with another server are not part of it. To better reflect
this, this commit renames it to RequestServer.

This commit also changes the existing 'protocol' portal to 'request',
the existing 'protocol' user and group to 'request', and most mentions
of the 'download' aspect of the request to 'request' when relevant, to
make everything consistent across the system.

Note that LibProtocol still exists as-is, but the more generic Client
class and the more specific Download class have both been renamed to a
more accurate RequestClient and Request to match the new names.

This commit only change names, not behaviors.
2021-04-25 19:04:34 +02:00
DexesTTP
22413ef729 LibWeb: Add WebSocket bindings
The WebSocket bindings match the original specification from the
WHATWG living standard, but do not match the later update of the
standard that involves FETCH. The FETCH update will be handled later
since the changes would also affect XMLHttpRequest.
2021-04-25 19:04:34 +02:00
sin-ack
62af6cd4f9 IPCCompiler: Remove hardcoded endpoint magic, attempt deux
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)

Additionally, endpoint magic is now treated as a u32, because endpoint
numbers were never negative anyway.

For cases where the endpoint number does have to be hardcoded (a current
case is LookupServer because the endpoint number must be known in LibC),
the syntax has been made more explicit to avoid confusing those
unfamiliar.  To hardcode the endpoint magic, the following syntax is now
used:

endpoint EndpointName [magic=1234]
2021-04-25 14:06:56 +02:00
Andreas Kling
418bc484e4 Revert "IPCCompiler: Use string hashes for IPC endpoint magic"
This reverts commit 59218007a3.
2021-04-25 11:24:12 +02:00
sin-ack
59218007a3 IPCCompiler: Use string hashes for IPC endpoint magic
This patch removes the IPC endpoint numbers that needed to be specified
in the IPC files.  Since the string hash is a (hopefully) collision free
number that depends on the name of the endpoint, we now use that
instead. :^)
2021-04-25 09:29:49 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Linus Groh
8d490aba76 LibJS: Implement console.assert() 2021-04-18 18:28:17 +02:00
Linus Groh
e37421bddc Browser+WebContent: Fix HTML injection in console functions output 2021-04-18 18:28:17 +02:00
Timothy Flynn
2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00