S056 (WIP): real PiP (video only, floating, own app id), Material PiP controls, side buttons, middle/Ctrl-click links in a new tab, spell underline position

Resume: freeze not reproduced yet (hidden + visible); context menu works on a test page,
YouTube case waits for the orchestrator's answer; bindings audit list, final smokes, PROGRESS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-13 20:41:39 -06:00
commit 0478385bcb
2 changed files with 308 additions and 67 deletions

View file

@ -611,9 +611,22 @@ impl Engine {
let filters = self.filters.clone();
let images = self.images_filter.clone();
web.connect_decide_policy(move |web, decision, kind| match kind {
webkit::PolicyDecisionType::NavigationAction => {
webkit::PolicyDecisionType::NavigationAction | webkit::PolicyDecisionType::NewWindowAction => {
let Some(nav) = decision.downcast_ref::<webkit::NavigationPolicyDecision>() else { return false };
let Some(mut action) = nav.navigation_action() else { return false };
// A link clicked with the middle button or Ctrl opens in a new tab (Ctrl+Shift: in front), as in
// other browsers; WebKit would load it here.
let mods = gtk::gdk::ModifierType::from_bits_truncate(action.modifiers());
if action.navigation_type() == webkit::NavigationType::LinkClicked && (action.mouse_button() == 2 || mods.contains(gtk::gdk::ModifierType::CONTROL_MASK))
&& let Some(url) = action.request().and_then(|r| r.uri()).and_then(|u| Url::parse(&u).ok())
{
decision.ignore();
hub.push(Event::OpenLink(id, url, mods.contains(gtk::gdk::ModifierType::SHIFT_MASK)));
return true;
}
if kind == webkit::PolicyDecisionType::NewWindowAction {
return false;
}
// Only the top frame: frames load as the page asks.
if action.frame_name().is_some() {
return false;

View file

@ -78,6 +78,8 @@ pub enum Event {
/// A pop-up (`window.open`, target=_blank): its view, already made as a related view of the opener, and the
/// address it will load (none for `about:blank`-style opens).
CreateNew(ViewId, View, Option<Url>),
/// A link clicked with the middle button or Ctrl: open it in a new tab (true: in front).
OpenLink(ViewId, Url, bool),
Permission(ViewId, crate::store::permissions::Kind, PermissionAsk),
Auth(ViewId, AuthRequest),
Control(ViewId, Control),