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
use script_layout_interface::message::ReflowGoal;
use crate::dom::element::Element;
use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlinputelement::InputActivationState;
use crate::dom::node::window_from_node;
use crate::dom::window::ReflowReason;
pub trait Activatable {
fn as_element(&self) -> ∈
fn is_instance_activatable(&self) -> bool;
fn legacy_pre_activation_behavior(&self) -> Option<InputActivationState> {
None
}
fn legacy_canceled_activation_behavior(&self, _state_before: Option<InputActivationState>) {}
fn activation_behavior(&self, event: &Event, target: &EventTarget);
fn enter_formal_activation_state(&self) {
self.as_element().set_active_state(true);
let win = window_from_node(self.as_element());
win.reflow(ReflowGoal::Full, ReflowReason::ElementStateChanged);
}
fn exit_formal_activation_state(&self) {
self.as_element().set_active_state(false);
let win = window_from_node(self.as_element());
win.reflow(ReflowGoal::Full, ReflowReason::ElementStateChanged);
}
}