Commit Graph

97 Commits

Author SHA1 Message Date
Karol Baraniecki
506c26acce LibGUI+Userland: Switch order of parameters for InputBox::show
Because usage of the input_type parameter is now higher than of the
placeholder parameter, this makes for a cleaner API.
2023-02-04 18:46:39 -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
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
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
Sam Atkins
3cc376d1a2 LibWebView: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-26 09:57:14 -05: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
Linus Groh
36866730ce Browser: Implement zoom :^)
Largely based on the Ladybird implementation in 0cc151b.
2023-01-12 18:52:32 +00:00
Karol Kosek
ab57fde8ec LibWebView: Port to Core::Stream 2023-01-09 22:50:53 +00:00
Andreas Kling
ed3c2cbdf6 LibWebView: Add OOPWV "content scales to viewport" hint
By setting this hint, you indicate to OOPWV that the content inside will
scale itself to the viewport size. In such situations, it's fine for
OOPWV to reuse a scaled version of an outdated backing store while the
view is being resized.
2023-01-09 22:34:57 +00:00
Karol Kosek
247db3fdd0 LibFileSystemAccessClient: Rename try_* functions to try_*_deprecated
These functions return the deprecated `Core::File` class, so let's mark
it as such to avoid possible confusion between future non try_*
functions which will use Core::Stream family classes and to possibly
grab someone's attention. :^)
2023-01-07 10:53:43 +00:00
Jonah
e361025cfb Browser: Add Accessibility Tab to Inspector Widget
This tab allows you to view the accessibility tree like you do
the DOM tree. The implementation limited to the role currently,
once we add the name and description calculation algorithm, those
will be displayed here as well. Selections are also not currently
supported.
2023-01-07 10:51:53 +00: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
Sam Atkins
0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
MacDue
3de5dcf383 Browser+WebContent: Fixup some DOM inspector weirdness
This fixes a few things I noticed whilst working on the inspector
for Ladybird.

1.
The computed and resolved values were being passed swapped around
from the inspect_dom_node() IPC call. I.e. computed values were
passed as resolved values and vice versa. This was then fixed by
swapping them again in the InspectorWidget (two errors canceled out).

2.
Resolved values were called "specified values" seemingly only in the
inspect_dom_node() IPC calls. This was a little confusing so I've
renamed them to back to "resolved values" for consistency.

3.
The inspector took and stored the DOM JSON strings unnecessarily,
all the models immediately parse the JSON and don't need the strings
to hang around.
2022-12-19 11:37:56 -05:00
Baitinq
af1c26f05b Browser: Go back/forward when pressing back/forward mouse buttons
This currently doesn't work when running Serenity through QEMU, as it
doesn't pass the side button events over to Serenity due to some bug or
missing feature.
2022-12-12 15:00:08 +00:00
Timothy Flynn
bf060adcf9 Browser+LibWebView+WebContent: Do not domain match on cookie updates
Updating cookies through these hooks happens in one of two manners:
1. Through the Browser's storage inspector.
2. Through WebDriver's delete-cookies operation.

In (1), we should not restrict ourselves to being able to delete cookies
for the current page. For example, it's handy to open the inspector from
the welcome page and be able to delete cookies for any domain.

In (2), we already are only interacting with cookies that have been
matched against the document URL.
2022-12-08 17:14:48 +01:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Baitinq
f1205b608f Browser: 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.
2022-11-26 11:03:24 +01:00
Baitinq
45214fdb1a LibWeb+WebContent: Label redirects with new FrameLoader::Type::Redirect
Previously we labeled redirects as normal FrameLoader::Type::Navigation,
now we introduce a new FrameLoader::Type::Redirect and label redirects
with it. This will allow us to handle redirects in the browser
differently (such as for overwritting the latest history entry when a
redirect happens) :^)
2022-11-26 11:03:24 +01:00
Sam Atkins
d94d60219c LibWebView+WebContent: Propagate unconsumed input events out of OOPWV
Since 9e2bd9d261a8c0c1b5eeafde95ca310efc667204, the OOPWV has been
consuming all mouse and keyboard events, preventing action shortcuts
from working. So let's fix that. :^)

OOPWV now queues up input events, sending them one at a time to the
WebContent process and waiting for the new
`did_finish_handling_input_event(bool event_was_accepted) =|` IPC call
before sending the next one. If the event was not accepted, OOPWV
imitates the usual event bubbling: first passing the event to its
superclass, then to its parent widget, and finally propagating to any
Action shortcuts.

With this, shortcuts like Ctrl+I to open Browser's JS console work
again, except when a contenteditable field is selected. That's a
whole separate stack of yaks.

Co-authored-by: Zaggy1024 <zaggy1024@gmail.com>
2022-11-26 00:44:49 +01:00
Sam Atkins
2654bfead4 LibWebView: Define the OOPWV's superclass in one place
This lets us change it later without having to remember to update a
bunch of uses. (More are coming in the next commit.)
2022-11-26 00:44:49 +01:00
Timothy Flynn
9782660cb6 LibWebView: Update OOPWV's URL when a page starts/finishes loading
If the page's URL is changed from within the WebContent process (e.g.
window.location.href is set from JavaScript, or a navigation is started
from WebDriver), we would not store the URL at all within OOPWV. This
prevented actions like reloading from working properly, as the browser
would reload whatever URL was previously entered in the URL box.
2022-11-19 16:56:02 +00:00
Timothy Flynn
f7bb835d09 LibWeb+LibWebView+WebContent+WebDriver: Implement Send Alert Text 2022-11-16 17:23:56 +00:00
Timothy Flynn
0e94904034 LibWebView+WebContent: Begin handling open user dialogs for WebDriver
The way in which dialogs should be handled is configurable by the driver
capabilities object, which we don't support yet. So this implements just
the default mode to dismiss the dialog and return an error if there is
one open.

In the OOPWV, this means we need to refer to the dialog after it has
been open, so we now hold a pointer to whatever dialog is open.
2022-11-16 17:23:56 +00:00
Timothy Flynn
364f44d7d8 LibWebView+WebContent: Wait for dialog responses without blocking IPC
Currently, the WebContent process is completely blocked while waiting
for a response to a dialog request. This patch allows the IPC event loop
to continue executing while only blocking the HTML event loop.

This will allow other processes like WebDriver to continue to operate on
the WebContent process while a dialog is open.
2022-11-16 17:23:56 +00:00
Timothy Flynn
4fd9e3ab08 Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
Tobias Christiansen
1aa16b4dd4 WebDriver: Implement POST /session/{id}/window/fullscreen endpoint 2022-11-12 12:12:05 +00:00
Timothy Flynn
24fb7cd0ad LibWebView+WebContent: Add IPCs to navigate the browser's history 2022-11-11 22:03:23 +00:00
Timothy Flynn
d202999853 LibWebView+WebContent: Add IPC to update a document's cookie 2022-11-11 18:02:04 +00:00
Timothy Flynn
c6a0888088 LibWebView+WebContent: Add IPC to get a document's named cookie 2022-11-11 18:02:04 +00:00
Timothy Flynn
d2c1957d8f LibWebView+WebContent: Add IPC to get all cookies for a document's URL 2022-11-11 18:02:04 +00:00
Timothy Flynn
31469ee45a Browser+WebContent+WebDriver: Move Execute Async Script to WebContent
With this, WebDriverEndpoints is unused and removed :^)
2022-11-11 11:36:07 +00:00
Timothy Flynn
88dcdf681f Browser+WebContent+WebDriver: Move Get Page Source to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
ea0561a0b3 Browser+WebContent+WebDriver: Move Take Element Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
93e14799c5 Browser+WebContent+WebDriver: Move Is Element Enabled to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
30d6a73d0e Browser+WebContent+WebDriver: Move Get Element Rect to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
9dd62228c8 Browser+WebContent+WebDriver: Move Get Element Tag Name to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
5d32fd7026 Browser+WebContent+WebDriver: Move Get Element Text to WebContent 2022-11-10 17:02:11 +00:00