macOS find: page matches drawn with the CSS Custom Highlight API (window.find showed nothing while the page was not the key view); --diag logs exit requests, window close/destroy and each native pane placement on macOS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-01 14:13:53 +07:00
parent 82382293a2
commit a7988f70f8
4 changed files with 113 additions and 36 deletions

View file

@ -166,7 +166,7 @@ pub fn forget_tab_zoom<R: Runtime>(app: &AppHandle<R>, id: &str) {
/// `tab_find`: searches tab `id`'s page ([`crate::find`]). The engine's own find where this build
/// can drive it (WebView2's `ICoreWebView2Find`, which reports counts through `tab-find` events);
/// otherwise the evaluated `window.find` fallback. The query is kept nowhere.
/// otherwise the evaluated Custom Highlight fallback ([`crate::find::fallback_script`]). The query is kept nowhere.
pub fn tab_find<R: Runtime>(app: &AppHandle<R>, id: &str, action: &str, query: Option<&str>) -> Result<(), String> {
if !policy::valid_tab_id(id) {
return Err("VALIDATION: invalid tab id".into());
@ -451,10 +451,20 @@ pub fn place_child<R: Runtime>(webview: &Webview<R>, x: f64, y: f64, width: f64,
// One native move+resize: separate set_position/set_size calls were two WebView2 `SetBounds`
// (the page re-laid out at the old size, then at the new one) and two main-thread messages.
#[cfg(not(target_os = "linux"))]
let _ = webview.set_bounds(tauri::Rect {
position: tauri::LogicalPosition::new(x, y).into(),
size: tauri::LogicalSize::new(width, height).into(),
});
{
let _ = webview.set_bounds(tauri::Rect {
position: tauri::LogicalPosition::new(x, y).into(),
size: tauri::LogicalSize::new(width, height).into(),
});
#[cfg(target_os = "macos")]
if crate::diag::active() {
let actual = webview.bounds().map(|b| {
let (p, s) = (b.position.to_logical::<f64>(1.0), b.size.to_logical::<f64>(1.0));
format!("{},{} {}x{}", p.x, p.y, s.width, s.height)
});
crate::diag::log("host", &format!("place {} asked {x},{y} {width}x{height} now {actual:?}", webview.label()));
}
}
}
/// Linux: the shell webview becomes the base layer of a GtkOverlay filling the window, which