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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.
//! Reporting of performance timeline events, as specified in
//! <https://w3c.github.io/performance-timeline/#dom-performanceobserver>.
//!
//! Types, command parameters and event payloads for the `PerformanceTimeline`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
//!
//! This domain is experimental and may change without notice.
use serde::{Deserialize, Serialize};
/// See <https://github.com/WICG/LargestContentfulPaint> and
/// largest_contentful_paint.idl
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LargestContentfulPaint {
#[serde(rename = "renderTime")]
pub render_time: crate::protocol::network::TimeSinceEpoch,
#[serde(rename = "loadTime")]
pub load_time: crate::protocol::network::TimeSinceEpoch,
/// The number of pixels being painted.
pub size: f64,
/// The id attribute of the element, if available.
#[serde(rename = "elementId", default, skip_serializing_if = "Option::is_none")]
pub element_id: Option<String>,
/// The URL of the image (may be trimmed).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
pub node_id: Option<crate::protocol::dom::BackendNodeId>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LayoutShiftAttribution {
#[serde(rename = "previousRect")]
pub previous_rect: crate::protocol::dom::Rect,
#[serde(rename = "currentRect")]
pub current_rect: crate::protocol::dom::Rect,
#[serde(rename = "nodeId", default, skip_serializing_if = "Option::is_none")]
pub node_id: Option<crate::protocol::dom::BackendNodeId>,
}
/// See <https://wicg.github.io/layout-instability/#sec-layout-shift> and
/// layout_shift.idl
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LayoutShift {
/// Score increment produced by this event.
pub value: f64,
#[serde(rename = "hadRecentInput")]
pub had_recent_input: bool,
#[serde(rename = "lastInputTime")]
pub last_input_time: crate::protocol::network::TimeSinceEpoch,
pub sources: Vec<LayoutShiftAttribution>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TimelineEvent {
/// Identifies the frame that this event is related to. Empty for non-frame
/// targets.
#[serde(rename = "frameId")]
pub frame_id: crate::protocol::page::FrameId,
/// The event type, as specified in
/// <https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype>
/// This determines which of the optional "details" fields is present.
pub r#type: String,
/// Name may be empty depending on the type.
pub name: String,
/// Time in seconds since Epoch, monotonically increasing within document
/// lifetime.
pub time: crate::protocol::network::TimeSinceEpoch,
/// Event duration, if applicable.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<f64>,
#[serde(
rename = "lcpDetails",
default,
skip_serializing_if = "Option::is_none"
)]
pub lcp_details: Option<LargestContentfulPaint>,
#[serde(
rename = "layoutShiftDetails",
default,
skip_serializing_if = "Option::is_none"
)]
pub layout_shift_details: Option<LayoutShift>,
}
/// Previously buffered events would be reported before method returns. See
/// also: timelineEventAdded
///
/// Parameters of `PerformanceTimeline.enable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
/// The types of event to report, as specified in
/// <https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype>
/// The specified filter overrides any previous filters, passing empty filter
/// disables recording. Note that not all types exposed to the web platform
/// are currently supported.
#[serde(rename = "eventTypes")]
pub event_types: Vec<String>,
}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "PerformanceTimeline.enable";
type Returns = crate::typed::NoReturns;
}
/// Sent when a performance timeline event is added. See
/// reportPerformanceTimeline method.
///
/// Payload of the `PerformanceTimeline.timelineEventAdded` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TimelineEventAddedEvent {
pub event: TimelineEvent,
}
impl crate::typed::Event for TimelineEventAddedEvent {
const METHOD: &'static str = "PerformanceTimeline.timelineEventAdded";
}