/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::cell::{Cell, Ref}; use bitflags::bitflags; use embedder_traits::FocusSequenceNumber; use script_bindings::codegen::GenericBindings::ShadowRootBinding::ShadowRootMethods; use script_bindings::inheritance::Castable; use script_bindings::root::{Dom, DomRoot}; use script_bindings::script_runtime::CanGc; use servo_constellation_traits::ScriptToConstellationMessage; use crate::dom::bindings::cell::DomRefCell; use crate::dom::focusevent::FocusEventType; use crate::dom::types::{Element, EventTarget, FocusEvent, HTMLElement, HTMLIFrameElement, Window}; use crate::dom::{Document, Event, EventBubbles, EventCancelable, Node, NodeTraits}; /// The kind of focusable area a [`FocusableArea`] is. A [`FocusableArea`] may be click focusable, /// sequentially focusable, or both. #[derive(Clone, Copy, Debug, Default, JSTraceable, MallocSizeOf, PartialEq)] pub(crate) struct FocusableAreaKind(u8); bitflags! { impl FocusableAreaKind: u8 { /// /// /// > A focusable area is said to be click focusable if the user agent determines that it is /// > click focusable. User agents should consider focusable areas with non-null tabindex values /// > to be click focusable. const Click = 1 << 0; /// . /// /// > A focusable area is said to be sequentially focusable if it is included in its /// > Document's sequential focus navigation order and the user agent determines that it is /// > sequentially focusable. const Sequential = 1 << 1; } } /// #[derive(Clone, Default, JSTraceable, MallocSizeOf, PartialEq)] pub(crate) enum FocusableArea { Node { node: DomRoot, kind: FocusableAreaKind, }, /// The viewport of an `