cdp_driver/protocol/input.rs
1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! The `Input` domain.
5//!
6//! Types, command parameters and event payloads for the `Input`
7//! domain. The method-name constants for the same domain are in
8//! [`crate::methods`].
9
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
13pub struct TouchPoint {
14 /// X coordinate of the event relative to the main frame's viewport in CSS
15 /// pixels.
16 pub x: f64,
17 /// Y coordinate of the event relative to the main frame's viewport in CSS
18 /// pixels. 0 refers to the top of the viewport and Y increases as it proceeds
19 /// towards the bottom of the viewport.
20 pub y: f64,
21 /// X radius of the touch area (default: 1.0).
22 #[serde(rename = "radiusX", default, skip_serializing_if = "Option::is_none")]
23 pub radius_x: Option<f64>,
24 /// Y radius of the touch area (default: 1.0).
25 #[serde(rename = "radiusY", default, skip_serializing_if = "Option::is_none")]
26 pub radius_y: Option<f64>,
27 /// Rotation angle (default: 0.0).
28 #[serde(
29 rename = "rotationAngle",
30 default,
31 skip_serializing_if = "Option::is_none"
32 )]
33 pub rotation_angle: Option<f64>,
34 /// Force (default: 1.0).
35 #[serde(default, skip_serializing_if = "Option::is_none")]
36 pub force: Option<f64>,
37 /// The normalized tangential pressure, which has a range of \[-1,1\]
38 /// (default: 0).
39 ///
40 /// Experimental: may change without notice.
41 #[serde(
42 rename = "tangentialPressure",
43 default,
44 skip_serializing_if = "Option::is_none"
45 )]
46 pub tangential_pressure: Option<f64>,
47 /// The plane angle between the Y-Z plane and the plane containing both the
48 /// stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive
49 /// tiltX is to the right (default: 0)
50 #[serde(rename = "tiltX", default, skip_serializing_if = "Option::is_none")]
51 pub tilt_x: Option<f64>,
52 /// The plane angle between the X-Z plane and the plane containing both the
53 /// stylus axis and the X axis, in degrees of the range \[-90,90\], a positive
54 /// tiltY is towards the user (default: 0).
55 #[serde(rename = "tiltY", default, skip_serializing_if = "Option::is_none")]
56 pub tilt_y: Option<f64>,
57 /// The clockwise rotation of a pen stylus around its own major axis, in
58 /// degrees in the range \[0,359\] (default: 0).
59 ///
60 /// Experimental: may change without notice.
61 #[serde(default, skip_serializing_if = "Option::is_none")]
62 pub twist: Option<i64>,
63 /// Identifier used to track touch sources between events, must be unique
64 /// within an event.
65 #[serde(default, skip_serializing_if = "Option::is_none")]
66 pub id: Option<f64>,
67}
68
69/// Experimental: may change without notice.
70#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
71pub enum GestureSourceType {
72 /// `default`
73 #[serde(rename = "default")]
74 Default,
75 /// `touch`
76 #[serde(rename = "touch")]
77 Touch,
78 /// `mouse`
79 #[serde(rename = "mouse")]
80 Mouse,
81 /// A value this vendored schema does not list. Chrome adds values ahead of
82 /// the published protocol, so an unrecognised one is kept as it arrived
83 /// rather than failing the payload it came in.
84 #[serde(untagged)]
85 Unrecognized(String),
86}
87
88#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
89pub enum MouseButton {
90 /// `none`
91 #[serde(rename = "none")]
92 None,
93 /// `left`
94 #[serde(rename = "left")]
95 Left,
96 /// `middle`
97 #[serde(rename = "middle")]
98 Middle,
99 /// `right`
100 #[serde(rename = "right")]
101 Right,
102 /// `back`
103 #[serde(rename = "back")]
104 Back,
105 /// `forward`
106 #[serde(rename = "forward")]
107 Forward,
108 /// A value this vendored schema does not list. Chrome adds values ahead of
109 /// the published protocol, so an unrecognised one is kept as it arrived
110 /// rather than failing the payload it came in.
111 #[serde(untagged)]
112 Unrecognized(String),
113}
114
115/// UTC time in seconds, counted from January 1, 1970.
116pub type TimeSinceEpoch = f64;
117
118/// Experimental: may change without notice.
119#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
120pub struct DragDataItem {
121 /// Mime type of the dragged data.
122 #[serde(rename = "mimeType")]
123 pub mime_type: String,
124 /// Depending of the value of `mimeType`, it contains the dragged link, text,
125 /// HTML markup or any other data.
126 pub data: String,
127 /// Title associated with a link. Only valid when `mimeType` ==
128 /// "text/uri-list".
129 #[serde(default, skip_serializing_if = "Option::is_none")]
130 pub title: Option<String>,
131 /// Stores the base URL for the contained markup. Only valid when `mimeType`
132 /// == "text/html".
133 #[serde(rename = "baseURL", default, skip_serializing_if = "Option::is_none")]
134 pub base_url: Option<String>,
135}
136
137/// Experimental: may change without notice.
138#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
139pub struct DragData {
140 pub items: Vec<DragDataItem>,
141 /// List of filenames that should be included when dropping
142 #[serde(default, skip_serializing_if = "Option::is_none")]
143 pub files: Option<Vec<String>>,
144 /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move =
145 /// 16
146 #[serde(rename = "dragOperationsMask")]
147 pub drag_operations_mask: i64,
148}
149
150/// Dispatches a drag event into the page.
151///
152/// Experimental: may change without notice.
153///
154/// Parameters of `Input.dispatchDragEvent`.
155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
156pub struct DispatchDragEventParams {
157 /// Type of the drag event.
158 pub r#type: DispatchDragEventType,
159 /// X coordinate of the event relative to the main frame's viewport in CSS
160 /// pixels.
161 pub x: f64,
162 /// Y coordinate of the event relative to the main frame's viewport in CSS
163 /// pixels. 0 refers to the top of the viewport and Y increases as it proceeds
164 /// towards the bottom of the viewport.
165 pub y: f64,
166 pub data: DragData,
167 /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
168 /// Meta/Command=4, Shift=8 (default: 0).
169 #[serde(default, skip_serializing_if = "Option::is_none")]
170 pub modifiers: Option<i64>,
171}
172
173/// The values `type` accepts on `dispatchDragEvent`.
174#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
175pub enum DispatchDragEventType {
176 /// `dragEnter`
177 #[serde(rename = "dragEnter")]
178 DragEnter,
179 /// `dragOver`
180 #[serde(rename = "dragOver")]
181 DragOver,
182 /// `drop`
183 #[serde(rename = "drop")]
184 Drop,
185 /// `dragCancel`
186 #[serde(rename = "dragCancel")]
187 DragCancel,
188 /// A value this vendored schema does not list. Chrome adds values ahead of
189 /// the published protocol, so an unrecognised one is kept as it arrived
190 /// rather than failing the payload it came in.
191 #[serde(untagged)]
192 Unrecognized(String),
193}
194
195impl crate::typed::Command for DispatchDragEventParams {
196 const METHOD: &'static str = "Input.dispatchDragEvent";
197 type Returns = crate::typed::NoReturns;
198}
199
200/// Dispatches a key event to the page.
201///
202/// Parameters of `Input.dispatchKeyEvent`.
203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
204pub struct DispatchKeyEventParams {
205 /// Type of the key event.
206 pub r#type: DispatchKeyEventType,
207 /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
208 /// Meta/Command=4, Shift=8 (default: 0).
209 #[serde(default, skip_serializing_if = "Option::is_none")]
210 pub modifiers: Option<i64>,
211 /// Time at which the event occurred.
212 #[serde(default, skip_serializing_if = "Option::is_none")]
213 pub timestamp: Option<TimeSinceEpoch>,
214 /// Text as generated by processing a virtual key code with a keyboard layout.
215 /// Not needed for for `keyUp` and `rawKeyDown` events (default: "")
216 #[serde(default, skip_serializing_if = "Option::is_none")]
217 pub text: Option<String>,
218 /// Text that would have been generated by the keyboard if no modifiers were
219 /// pressed (except for shift). Useful for shortcut (accelerator) key handling
220 /// (default: "").
221 #[serde(
222 rename = "unmodifiedText",
223 default,
224 skip_serializing_if = "Option::is_none"
225 )]
226 pub unmodified_text: Option<String>,
227 /// Unique key identifier (e.g., 'U+0041') (default: "").
228 #[serde(
229 rename = "keyIdentifier",
230 default,
231 skip_serializing_if = "Option::is_none"
232 )]
233 pub key_identifier: Option<String>,
234 /// Unique DOM defined string value for each physical key (e.g., 'KeyA')
235 /// (default: "").
236 #[serde(default, skip_serializing_if = "Option::is_none")]
237 pub code: Option<String>,
238 /// Unique DOM defined string value describing the meaning of the key in the
239 /// context of active modifiers, keyboard layout, etc (e.g., 'AltGr')
240 /// (default: "").
241 #[serde(default, skip_serializing_if = "Option::is_none")]
242 pub key: Option<String>,
243 /// Windows virtual key code (default: 0).
244 #[serde(
245 rename = "windowsVirtualKeyCode",
246 default,
247 skip_serializing_if = "Option::is_none"
248 )]
249 pub windows_virtual_key_code: Option<i64>,
250 /// Native virtual key code (default: 0).
251 #[serde(
252 rename = "nativeVirtualKeyCode",
253 default,
254 skip_serializing_if = "Option::is_none"
255 )]
256 pub native_virtual_key_code: Option<i64>,
257 /// Whether the event was generated from auto repeat (default: false).
258 #[serde(
259 rename = "autoRepeat",
260 default,
261 skip_serializing_if = "Option::is_none"
262 )]
263 pub auto_repeat: Option<bool>,
264 /// Whether the event was generated from the keypad (default: false).
265 #[serde(rename = "isKeypad", default, skip_serializing_if = "Option::is_none")]
266 pub is_keypad: Option<bool>,
267 /// Whether the event was a system key event (default: false).
268 #[serde(
269 rename = "isSystemKey",
270 default,
271 skip_serializing_if = "Option::is_none"
272 )]
273 pub is_system_key: Option<bool>,
274 /// Whether the event was from the left or right side of the keyboard. 1=Left,
275 /// 2=Right (default: 0).
276 #[serde(default, skip_serializing_if = "Option::is_none")]
277 pub location: Option<i64>,
278 /// Editing commands to send with the key event (e.g., 'selectAll') (default:
279 /// \[\]). These are related to but not equal the command names used in
280 /// `document.execCommand` and NSStandardKeyBindingResponding. See
281 /// <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h>
282 /// for valid command names.
283 ///
284 /// Experimental: may change without notice.
285 #[serde(default, skip_serializing_if = "Option::is_none")]
286 pub commands: Option<Vec<String>>,
287}
288
289/// The values `type` accepts on `dispatchKeyEvent`.
290#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
291pub enum DispatchKeyEventType {
292 /// `keyDown`
293 #[serde(rename = "keyDown")]
294 KeyDown,
295 /// `keyUp`
296 #[serde(rename = "keyUp")]
297 KeyUp,
298 /// `rawKeyDown`
299 #[serde(rename = "rawKeyDown")]
300 RawKeyDown,
301 /// `char`
302 #[serde(rename = "char")]
303 Char,
304 /// A value this vendored schema does not list. Chrome adds values ahead of
305 /// the published protocol, so an unrecognised one is kept as it arrived
306 /// rather than failing the payload it came in.
307 #[serde(untagged)]
308 Unrecognized(String),
309}
310
311impl crate::typed::Command for DispatchKeyEventParams {
312 const METHOD: &'static str = "Input.dispatchKeyEvent";
313 type Returns = crate::typed::NoReturns;
314}
315
316/// This method emulates inserting text that doesn't come from a key press,
317/// for example an emoji keyboard or an IME.
318///
319/// Experimental: may change without notice.
320///
321/// Parameters of `Input.insertText`.
322#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
323pub struct InsertTextParams {
324 /// The text to insert.
325 pub text: String,
326}
327
328impl crate::typed::Command for InsertTextParams {
329 const METHOD: &'static str = "Input.insertText";
330 type Returns = crate::typed::NoReturns;
331}
332
333/// This method sets the current candidate text for IME. Use
334/// imeCommitComposition to commit the final text. Use imeSetComposition with
335/// empty string as text to cancel composition.
336///
337/// Experimental: may change without notice.
338///
339/// Parameters of `Input.imeSetComposition`.
340#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
341pub struct ImeSetCompositionParams {
342 /// The text to insert
343 pub text: String,
344 /// selection start
345 #[serde(rename = "selectionStart")]
346 pub selection_start: i64,
347 /// selection end
348 #[serde(rename = "selectionEnd")]
349 pub selection_end: i64,
350 /// replacement start
351 #[serde(
352 rename = "replacementStart",
353 default,
354 skip_serializing_if = "Option::is_none"
355 )]
356 pub replacement_start: Option<i64>,
357 /// replacement end
358 #[serde(
359 rename = "replacementEnd",
360 default,
361 skip_serializing_if = "Option::is_none"
362 )]
363 pub replacement_end: Option<i64>,
364}
365
366impl crate::typed::Command for ImeSetCompositionParams {
367 const METHOD: &'static str = "Input.imeSetComposition";
368 type Returns = crate::typed::NoReturns;
369}
370
371/// Dispatches a mouse event to the page.
372///
373/// Parameters of `Input.dispatchMouseEvent`.
374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
375pub struct DispatchMouseEventParams {
376 /// Type of the mouse event.
377 pub r#type: DispatchMouseEventType,
378 /// X coordinate of the event relative to the main frame's viewport in CSS
379 /// pixels.
380 pub x: f64,
381 /// Y coordinate of the event relative to the main frame's viewport in CSS
382 /// pixels. 0 refers to the top of the viewport and Y increases as it proceeds
383 /// towards the bottom of the viewport.
384 pub y: f64,
385 /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
386 /// Meta/Command=4, Shift=8 (default: 0).
387 #[serde(default, skip_serializing_if = "Option::is_none")]
388 pub modifiers: Option<i64>,
389 /// Time at which the event occurred.
390 #[serde(default, skip_serializing_if = "Option::is_none")]
391 pub timestamp: Option<TimeSinceEpoch>,
392 /// Mouse button (default: "none").
393 #[serde(default, skip_serializing_if = "Option::is_none")]
394 pub button: Option<MouseButton>,
395 /// A number indicating which buttons are pressed on the mouse when a mouse
396 /// event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
397 #[serde(default, skip_serializing_if = "Option::is_none")]
398 pub buttons: Option<i64>,
399 /// Number of times the mouse button was clicked (default: 0).
400 #[serde(
401 rename = "clickCount",
402 default,
403 skip_serializing_if = "Option::is_none"
404 )]
405 pub click_count: Option<i64>,
406 /// The normalized pressure, which has a range of \[0,1\] (default: 0).
407 ///
408 /// Experimental: may change without notice.
409 #[serde(default, skip_serializing_if = "Option::is_none")]
410 pub force: Option<f64>,
411 /// The normalized tangential pressure, which has a range of \[-1,1\]
412 /// (default: 0).
413 ///
414 /// Experimental: may change without notice.
415 #[serde(
416 rename = "tangentialPressure",
417 default,
418 skip_serializing_if = "Option::is_none"
419 )]
420 pub tangential_pressure: Option<f64>,
421 /// The plane angle between the Y-Z plane and the plane containing both the
422 /// stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive
423 /// tiltX is to the right (default: 0).
424 #[serde(rename = "tiltX", default, skip_serializing_if = "Option::is_none")]
425 pub tilt_x: Option<f64>,
426 /// The plane angle between the X-Z plane and the plane containing both the
427 /// stylus axis and the X axis, in degrees of the range \[-90,90\], a positive
428 /// tiltY is towards the user (default: 0).
429 #[serde(rename = "tiltY", default, skip_serializing_if = "Option::is_none")]
430 pub tilt_y: Option<f64>,
431 /// The clockwise rotation of a pen stylus around its own major axis, in
432 /// degrees in the range \[0,359\] (default: 0).
433 ///
434 /// Experimental: may change without notice.
435 #[serde(default, skip_serializing_if = "Option::is_none")]
436 pub twist: Option<i64>,
437 /// X delta in CSS pixels for mouse wheel event (default: 0).
438 #[serde(rename = "deltaX", default, skip_serializing_if = "Option::is_none")]
439 pub delta_x: Option<f64>,
440 /// Y delta in CSS pixels for mouse wheel event (default: 0).
441 #[serde(rename = "deltaY", default, skip_serializing_if = "Option::is_none")]
442 pub delta_y: Option<f64>,
443 /// Pointer type (default: "mouse").
444 #[serde(
445 rename = "pointerType",
446 default,
447 skip_serializing_if = "Option::is_none"
448 )]
449 pub pointer_type: Option<DispatchMouseEventPointerType>,
450}
451
452/// The values `type` accepts on `dispatchMouseEvent`.
453#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
454pub enum DispatchMouseEventType {
455 /// `mousePressed`
456 #[serde(rename = "mousePressed")]
457 MousePressed,
458 /// `mouseReleased`
459 #[serde(rename = "mouseReleased")]
460 MouseReleased,
461 /// `mouseMoved`
462 #[serde(rename = "mouseMoved")]
463 MouseMoved,
464 /// `mouseWheel`
465 #[serde(rename = "mouseWheel")]
466 MouseWheel,
467 /// A value this vendored schema does not list. Chrome adds values ahead of
468 /// the published protocol, so an unrecognised one is kept as it arrived
469 /// rather than failing the payload it came in.
470 #[serde(untagged)]
471 Unrecognized(String),
472}
473
474/// The values `pointerType` accepts on `dispatchMouseEvent`.
475#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
476pub enum DispatchMouseEventPointerType {
477 /// `mouse`
478 #[serde(rename = "mouse")]
479 Mouse,
480 /// `pen`
481 #[serde(rename = "pen")]
482 Pen,
483 /// A value this vendored schema does not list. Chrome adds values ahead of
484 /// the published protocol, so an unrecognised one is kept as it arrived
485 /// rather than failing the payload it came in.
486 #[serde(untagged)]
487 Unrecognized(String),
488}
489
490impl crate::typed::Command for DispatchMouseEventParams {
491 const METHOD: &'static str = "Input.dispatchMouseEvent";
492 type Returns = crate::typed::NoReturns;
493}
494
495/// Dispatches a touch event to the page.
496///
497/// Parameters of `Input.dispatchTouchEvent`.
498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
499pub struct DispatchTouchEventParams {
500 /// Type of the touch event. TouchEnd and TouchCancel must not contain any
501 /// touch points, while TouchStart and TouchMove must contains at least one.
502 pub r#type: DispatchTouchEventType,
503 /// Active touch points on the touch device. One event per any changed point
504 /// (compared to previous touch event in a sequence) is generated, emulating
505 /// pressing/moving/releasing points one by one.
506 #[serde(rename = "touchPoints")]
507 pub touch_points: Vec<TouchPoint>,
508 /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
509 /// Meta/Command=4, Shift=8 (default: 0).
510 #[serde(default, skip_serializing_if = "Option::is_none")]
511 pub modifiers: Option<i64>,
512 /// Time at which the event occurred.
513 #[serde(default, skip_serializing_if = "Option::is_none")]
514 pub timestamp: Option<TimeSinceEpoch>,
515}
516
517/// The values `type` accepts on `dispatchTouchEvent`.
518#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
519pub enum DispatchTouchEventType {
520 /// `touchStart`
521 #[serde(rename = "touchStart")]
522 TouchStart,
523 /// `touchEnd`
524 #[serde(rename = "touchEnd")]
525 TouchEnd,
526 /// `touchMove`
527 #[serde(rename = "touchMove")]
528 TouchMove,
529 /// `touchCancel`
530 #[serde(rename = "touchCancel")]
531 TouchCancel,
532 /// A value this vendored schema does not list. Chrome adds values ahead of
533 /// the published protocol, so an unrecognised one is kept as it arrived
534 /// rather than failing the payload it came in.
535 #[serde(untagged)]
536 Unrecognized(String),
537}
538
539impl crate::typed::Command for DispatchTouchEventParams {
540 const METHOD: &'static str = "Input.dispatchTouchEvent";
541 type Returns = crate::typed::NoReturns;
542}
543
544/// Cancels any active dragging in the page.
545///
546/// Parameters of `Input.cancelDragging`.
547#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
548pub struct CancelDraggingParams {}
549
550impl crate::typed::Command for CancelDraggingParams {
551 const METHOD: &'static str = "Input.cancelDragging";
552 type Returns = crate::typed::NoReturns;
553}
554
555/// Emulates touch event from the mouse event parameters.
556///
557/// Experimental: may change without notice.
558///
559/// Parameters of `Input.emulateTouchFromMouseEvent`.
560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
561pub struct EmulateTouchFromMouseEventParams {
562 /// Type of the mouse event.
563 pub r#type: EmulateTouchFromMouseEventType,
564 /// X coordinate of the mouse pointer in DIP.
565 pub x: i64,
566 /// Y coordinate of the mouse pointer in DIP.
567 pub y: i64,
568 /// Mouse button. Only "none", "left", "right" are supported.
569 pub button: MouseButton,
570 /// Time at which the event occurred (default: current time).
571 #[serde(default, skip_serializing_if = "Option::is_none")]
572 pub timestamp: Option<TimeSinceEpoch>,
573 /// X delta in DIP for mouse wheel event (default: 0).
574 #[serde(rename = "deltaX", default, skip_serializing_if = "Option::is_none")]
575 pub delta_x: Option<f64>,
576 /// Y delta in DIP for mouse wheel event (default: 0).
577 #[serde(rename = "deltaY", default, skip_serializing_if = "Option::is_none")]
578 pub delta_y: Option<f64>,
579 /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
580 /// Meta/Command=4, Shift=8 (default: 0).
581 #[serde(default, skip_serializing_if = "Option::is_none")]
582 pub modifiers: Option<i64>,
583 /// Number of times the mouse button was clicked (default: 0).
584 #[serde(
585 rename = "clickCount",
586 default,
587 skip_serializing_if = "Option::is_none"
588 )]
589 pub click_count: Option<i64>,
590}
591
592/// The values `type` accepts on `emulateTouchFromMouseEvent`.
593#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
594pub enum EmulateTouchFromMouseEventType {
595 /// `mousePressed`
596 #[serde(rename = "mousePressed")]
597 MousePressed,
598 /// `mouseReleased`
599 #[serde(rename = "mouseReleased")]
600 MouseReleased,
601 /// `mouseMoved`
602 #[serde(rename = "mouseMoved")]
603 MouseMoved,
604 /// `mouseWheel`
605 #[serde(rename = "mouseWheel")]
606 MouseWheel,
607 /// A value this vendored schema does not list. Chrome adds values ahead of
608 /// the published protocol, so an unrecognised one is kept as it arrived
609 /// rather than failing the payload it came in.
610 #[serde(untagged)]
611 Unrecognized(String),
612}
613
614impl crate::typed::Command for EmulateTouchFromMouseEventParams {
615 const METHOD: &'static str = "Input.emulateTouchFromMouseEvent";
616 type Returns = crate::typed::NoReturns;
617}
618
619/// Ignores input events (useful while auditing page).
620///
621/// Parameters of `Input.setIgnoreInputEvents`.
622#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
623pub struct SetIgnoreInputEventsParams {
624 /// Ignores input events processing when set to true.
625 pub ignore: bool,
626}
627
628impl crate::typed::Command for SetIgnoreInputEventsParams {
629 const METHOD: &'static str = "Input.setIgnoreInputEvents";
630 type Returns = crate::typed::NoReturns;
631}
632
633/// Prevents default drag and drop behavior and instead emits
634/// `Input.dragIntercepted` events. Drag and drop behavior can be directly
635/// controlled via `Input.dispatchDragEvent`.
636///
637/// Experimental: may change without notice.
638///
639/// Parameters of `Input.setInterceptDrags`.
640#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
641pub struct SetInterceptDragsParams {
642 pub enabled: bool,
643}
644
645impl crate::typed::Command for SetInterceptDragsParams {
646 const METHOD: &'static str = "Input.setInterceptDrags";
647 type Returns = crate::typed::NoReturns;
648}
649
650/// Synthesizes a pinch gesture over a time period by issuing appropriate
651/// touch events.
652///
653/// Experimental: may change without notice.
654///
655/// Parameters of `Input.synthesizePinchGesture`.
656#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
657pub struct SynthesizePinchGestureParams {
658 /// X coordinate of the start of the gesture in CSS pixels.
659 pub x: f64,
660 /// Y coordinate of the start of the gesture in CSS pixels.
661 pub y: f64,
662 /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
663 #[serde(rename = "scaleFactor")]
664 pub scale_factor: f64,
665 /// Relative pointer speed in pixels per second (default: 800).
666 #[serde(
667 rename = "relativeSpeed",
668 default,
669 skip_serializing_if = "Option::is_none"
670 )]
671 pub relative_speed: Option<i64>,
672 /// Which type of input events to be generated (default: 'default', which
673 /// queries the platform for the preferred input type).
674 #[serde(
675 rename = "gestureSourceType",
676 default,
677 skip_serializing_if = "Option::is_none"
678 )]
679 pub gesture_source_type: Option<GestureSourceType>,
680}
681
682impl crate::typed::Command for SynthesizePinchGestureParams {
683 const METHOD: &'static str = "Input.synthesizePinchGesture";
684 type Returns = crate::typed::NoReturns;
685}
686
687/// Synthesizes a scroll gesture over a time period by issuing appropriate
688/// touch events.
689///
690/// Experimental: may change without notice.
691///
692/// Parameters of `Input.synthesizeScrollGesture`.
693#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
694pub struct SynthesizeScrollGestureParams {
695 /// X coordinate of the start of the gesture in CSS pixels.
696 pub x: f64,
697 /// Y coordinate of the start of the gesture in CSS pixels.
698 pub y: f64,
699 /// The distance to scroll along the X axis (positive to scroll left).
700 #[serde(rename = "xDistance", default, skip_serializing_if = "Option::is_none")]
701 pub x_distance: Option<f64>,
702 /// The distance to scroll along the Y axis (positive to scroll up).
703 #[serde(rename = "yDistance", default, skip_serializing_if = "Option::is_none")]
704 pub y_distance: Option<f64>,
705 /// The number of additional pixels to scroll back along the X axis, in
706 /// addition to the given distance.
707 #[serde(
708 rename = "xOverscroll",
709 default,
710 skip_serializing_if = "Option::is_none"
711 )]
712 pub x_overscroll: Option<f64>,
713 /// The number of additional pixels to scroll back along the Y axis, in
714 /// addition to the given distance.
715 #[serde(
716 rename = "yOverscroll",
717 default,
718 skip_serializing_if = "Option::is_none"
719 )]
720 pub y_overscroll: Option<f64>,
721 /// Prevent fling (default: true).
722 #[serde(
723 rename = "preventFling",
724 default,
725 skip_serializing_if = "Option::is_none"
726 )]
727 pub prevent_fling: Option<bool>,
728 /// Swipe speed in pixels per second (default: 800).
729 #[serde(default, skip_serializing_if = "Option::is_none")]
730 pub speed: Option<i64>,
731 /// Which type of input events to be generated (default: 'default', which
732 /// queries the platform for the preferred input type).
733 #[serde(
734 rename = "gestureSourceType",
735 default,
736 skip_serializing_if = "Option::is_none"
737 )]
738 pub gesture_source_type: Option<GestureSourceType>,
739 /// The number of times to repeat the gesture (default: 0).
740 #[serde(
741 rename = "repeatCount",
742 default,
743 skip_serializing_if = "Option::is_none"
744 )]
745 pub repeat_count: Option<i64>,
746 /// The number of milliseconds delay between each repeat. (default: 250).
747 #[serde(
748 rename = "repeatDelayMs",
749 default,
750 skip_serializing_if = "Option::is_none"
751 )]
752 pub repeat_delay_ms: Option<i64>,
753 /// The name of the interaction markers to generate, if not empty (default:
754 /// "").
755 #[serde(
756 rename = "interactionMarkerName",
757 default,
758 skip_serializing_if = "Option::is_none"
759 )]
760 pub interaction_marker_name: Option<String>,
761}
762
763impl crate::typed::Command for SynthesizeScrollGestureParams {
764 const METHOD: &'static str = "Input.synthesizeScrollGesture";
765 type Returns = crate::typed::NoReturns;
766}
767
768/// Synthesizes a tap gesture over a time period by issuing appropriate touch
769/// events.
770///
771/// Experimental: may change without notice.
772///
773/// Parameters of `Input.synthesizeTapGesture`.
774#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
775pub struct SynthesizeTapGestureParams {
776 /// X coordinate of the start of the gesture in CSS pixels.
777 pub x: f64,
778 /// Y coordinate of the start of the gesture in CSS pixels.
779 pub y: f64,
780 /// Duration between touchdown and touchup events in ms (default: 50).
781 #[serde(default, skip_serializing_if = "Option::is_none")]
782 pub duration: Option<i64>,
783 /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
784 #[serde(rename = "tapCount", default, skip_serializing_if = "Option::is_none")]
785 pub tap_count: Option<i64>,
786 /// Which type of input events to be generated (default: 'default', which
787 /// queries the platform for the preferred input type).
788 #[serde(
789 rename = "gestureSourceType",
790 default,
791 skip_serializing_if = "Option::is_none"
792 )]
793 pub gesture_source_type: Option<GestureSourceType>,
794}
795
796impl crate::typed::Command for SynthesizeTapGestureParams {
797 const METHOD: &'static str = "Input.synthesizeTapGesture";
798 type Returns = crate::typed::NoReturns;
799}
800
801/// Emitted only when `Input.setInterceptDrags` is enabled. Use this data with
802/// `Input.dispatchDragEvent` to restore normal drag and drop behavior.
803///
804/// Experimental: may change without notice.
805///
806/// Payload of the `Input.dragIntercepted` event.
807#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
808pub struct DragInterceptedEvent {
809 pub data: DragData,
810}
811
812impl crate::typed::Event for DragInterceptedEvent {
813 const METHOD: &'static str = "Input.dragIntercepted";
814}