#![expect(unsafe_code)]
#![deny(missing_docs)]
use std::fmt::Debug;
use html5ever::{LocalName, Namespace};
use servo_arc::Arc;
use style::attr::AttrValue;
use style::context::SharedStyleContext;
use style::data::{ElementDataMut, ElementDataRef};
use style::dom::TElement;
use style::properties::ComputedValues;
use style::selector_parser::{PseudoElement, SelectorImpl};
use crate::layout_dom::{DangerousStyleElementOf, LayoutElementOf, LayoutNodeOf};
use crate::{LayoutDataTrait, LayoutDomTypeBundle, LayoutNodeType, PseudoElementChain, StyleData};
pub trait LayoutElement<'dom>: Copy + Debug + Send + Sync {
type ConcreteTypeBundle: LayoutDomTypeBundle<'dom>;
fn with_pseudo(&self, pseudo: PseudoElement) -> Option<Self>;
fn pseudo_element_chain(&self) -> PseudoElementChain;
fn as_node(&self) -> LayoutNodeOf<'dom, Self::ConcreteTypeBundle>;
unsafe fn dangerous_style_element(
self,
) -> DangerousStyleElementOf<'dom, Self::ConcreteTypeBundle>;
fn initialize_style_and_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self);
fn unset_snapshot_flags(&self);
fn set_has_snapshot(&self);
fn style_data(self) -> Option<&'dom StyleData>;
fn type_id(&self) -> Option<LayoutNodeType>;
fn local_name(&self) -> &LocalName;
fn attribute(&self, namespace: &Namespace, name: &LocalName) -> Option<&AttrValue>;
fn attribute_as_str<'a>(&'a self, namespace: &Namespace, name: &LocalName) -> Option<&'a str>;
fn element_data(&self) -> ElementDataRef<'dom>;
fn element_data_mut(&self) -> ElementDataMut<'dom>;
fn style(&self, context: &SharedStyleContext) -> Arc<ComputedValues>;
fn is_shadow_host(&self) -> bool;
fn is_body_element_of_html_element_root(&self) -> bool;
fn is_html_element_in_html_document(&self) -> bool;
fn is_root(&self) -> bool;
}
pub trait DangerousStyleElement<'dom>:
TElement + ::selectors::Element<Impl = SelectorImpl> + Send + Sync
{
type ConcreteTypeBundle: LayoutDomTypeBundle<'dom>;
fn layout_element(&self) -> LayoutElementOf<'dom, Self::ConcreteTypeBundle>;
}