aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/activation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/activation.rs')
-rw-r--r--components/script/dom/activation.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/components/script/dom/activation.rs b/components/script/dom/activation.rs
index ff8d59aac96..5c59393f766 100644
--- a/components/script/dom/activation.rs
+++ b/components/script/dom/activation.rs
@@ -10,6 +10,9 @@ use dom::event::{Event, EventBubbles, EventCancelable};
use dom::eventtarget::EventTarget;
use dom::mouseevent::MouseEvent;
use dom::node::window_from_node;
+use dom::window::ReflowReason;
+use script_layout_interface::message::ReflowQueryType;
+use style::context::ReflowGoal;
/// Trait for elements with defined activation behavior
pub trait Activatable {
@@ -29,6 +32,25 @@ pub trait Activatable {
// https://html.spec.whatwg.org/multipage/#implicit-submission
fn implicit_submission(&self, ctrlKey: bool, shiftKey: bool, altKey: bool, metaKey: bool);
+
+ // https://html.spec.whatwg.org/multipage/#concept-selector-active
+ fn enter_formal_activation_state(&self) {
+ self.as_element().set_active_state(true);
+
+ let win = window_from_node(self.as_element());
+ win.reflow(ReflowGoal::ForDisplay,
+ ReflowQueryType::NoQuery,
+ 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::ForDisplay,
+ ReflowQueryType::NoQuery,
+ ReflowReason::ElementStateChanged);
+ }
}
/// Whether an activation was initiated via the click() method