ltk_webkit/types/
page.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

/// What a secondary press landed on; the position is in the host's coordinates.
#[ derive( Clone, Debug, Default, PartialEq ) ]
pub struct PageTarget
{
	pub x:          f32,
	pub y:          f32,
	pub link_uri:   Option<String>,
	pub link_label: Option<String>,
	pub image_uri:  Option<String>,
	pub editable:   bool,
	pub selection:  bool,
}

impl PageTarget
{
	pub fn is_empty( &self ) -> bool
	{
		self.link_uri.is_none() && self.image_uri.is_none() && !self.editable && !self.selection
	}
}

/// Why a page's web process went away. The view survives it and can load again.
#[ derive( Clone, Copy, Debug, PartialEq, Eq ) ]
pub enum Termination
{
	/// Also what a process killed by the kernel looks like.
	Crashed,
	ExceededMemoryLimit,
	/// [`crate::WebView::terminate_web_process`].
	Requested,
}

/// Premultiplied RGBA, `width * 4` bytes a row.
pub struct Snapshot
{
	pub rgba:   Vec<u8>,
	pub width:  u32,
	pub height: u32,
}