Commit Graph

9 Commits

Author SHA1 Message Date
Martin Robinson
1e4feeaa0d script: Add context-based context menu options (#40501)
Add context menu options for images, links, and editable text areas. In
addition add the ability to show menu options that are disabled. This
also improves the visual style of the context menu in egui as part of
supporting disabled options.

Testing: This has been manually tested, but we could we should be able
to
easily add unit tests when enriching the API with information about the
active element under context menus.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2025-11-11 11:03:41 +00:00
atbrakhi
ad8c81d634 servoshell: Implement context menu in servoshell (#40434)
This PR adds context menu support with clickable menu items in the
Minibrowser. The menu appears on right click and supports basic
navigation actions (Back, Forward, Reload).


Testing: We already have tests for ContextMenu in WebView API test.

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-11-08 11:11:09 +00:00
atbrakhi
67d15c706f libservo: Fix panic in Reload of ContextMenuAction (#40430)
Right now when the Reload action is selected from a right-click context
menu, Servo would panic. Context menu's Reload action was calling
`Location.Reload()`, which caused the panic. As per [HTML
spec](https://html.spec.whatwg.org/multipage/#dom-location-reload) it
looks like, to perform a user-requested reload we should be using
`reload_without_origin_check()` instead.

Testing: Added a test for `ContextMenuAction::Relaod` action.

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-11-06 12:34:03 +00:00
Martin Robinson
2c77d9d8a1 libservo: Integrate context menu into the show_embedder_control API (#40402)
This PR integrates showing context menus into the
`WebViewDelegate::show_embedder_control` API. In addition,
`ContextMenuItem` and `ContextMenuAction` data types are exposed which
abstract away the different components of the context menu. Later
changes will implement this API for servoshell as well as add
element-specific actions such as "Select All" and "Copy Image URL".

Testing: This change adds a WebView API test.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-11-04 21:08:04 +00:00
Martin Robinson
868793e175 libservo: Merge input method activation into the EmbedderControl API (#40014)
Input methods are very similar to other kinds of embedder controls such
as file selection boxes, so merge them into the same libservo API. This
simplfiies the API surface a bit.

Testing: This change comes with a new unit test.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-10-24 12:09:31 +00:00
shuppy
3fd9ebb849 script: Make file picker selection flow asynchronous (#39893)
Previously the `<input type=file>` would wait synchronously for file
selection
results from the embedder. This change moves that synchronous wait to
the
`FileManager` worker thread. The main benefit is that script is not
blocked waiting
for the embedder. The synchronous wait on the worker thread is not a
large issue
because it is run from a thread pool, though a later change could also
remove
that synchronous wait.

In addition, the API surface for file selection changes a bit as there
is now a `dismiss`
method which differentiates between selecting no file and not making a
choice at
all.

Testing: Covered by exiting WPT, WebDriver conformance, and unit tests.

---------

Signed-off-by: delan azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-20 07:33:11 +00:00
shuppy
0d57fcb3e6 libservo: Merge file selection dialog into EmbedderControls (#39859)
in #39709, we introduced a single “form control” or “embedder control”
delegate that requests the embedder’s input for &lt;select> and
&lt;input type="color"> elements.

this patch partially merges &lt;input type="file"> elements into that
new system, and renames “form controls” to “embedder controls” for
consistency.

internally we continue to use a separate code path where the embedder
directly communicates with the file manager thread. subsequent work will
make the messages asynchronous via the constellation and script thread,
like other embedder controls.

Testing: this is currently tricky to write an automated test for; we
expect to write a WebDriver test for this once we make the communication
asynchronous

---------

Signed-off-by: delan azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-15 06:12:19 +00:00
shuppy
b88007c14b libservo: Allow Servo to hide embedder controls (#39763)
In some situations, web content may need to hide embedder controls. For
example, when focus shifts when a `<select>` box is open or when the
element showing the control is removed from the DOM. This change adds a
new API to hide embedder controls when that happens.

Testing: This change adds a new API test.

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-10-14 07:56:33 +00:00
Martin Robinson
89dfb3ee49 libservo: Make FormControl responses completely asynchronous (#39709)
Before responses to `FormControl` requests were handled synchronous in
script (ie they would block the page). This change makes it so that they
are handled asynchronously, with their responses filtering back through
the Constellation. This should fix many WPT tests when run with
WebDriver.

Testing: There are some WebDriver-based test for this, but they do
not quite pass yet. More investigation is required, but this is
necessary to get them to pass.
Fixes: #39652
Fixes: #37013

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-10-08 09:06:17 +00:00