#![expect(unsafe_code)]
#![deny(missing_docs)]
use std::borrow::Cow;
use std::fmt::Debug;
use net_traits::image_cache::Image;
use pixels::ImageMetadata;
use servo_arc::Arc;
use servo_base::id::{BrowsingContextId, PipelineId};
use servo_url::ServoUrl;
use style::context::SharedStyleContext;
use style::dom::{NodeInfo, OpaqueNode, TNode};
use style::properties::ComputedValues;
use style::selector_parser::PseudoElement;
use crate::layout_dom::{DangerousStyleNodeOf, LayoutElementOf, LayoutNodeOf};
use crate::pseudo_element_chain::PseudoElementChain;
use crate::{
GenericLayoutData, HTMLCanvasData, HTMLMediaData, LayoutDataTrait, LayoutDomTypeBundle,
LayoutNodeType, SVGElementData, SharedSelection,
};
pub trait LayoutNode<'dom>: Copy + Debug + NodeInfo + Send + Sync {
type ConcreteTypeBundle: LayoutDomTypeBundle<'dom>;
fn with_pseudo(&self, pseudo_element_type: PseudoElement) -> Option<Self>;
fn pseudo_element_chain(&self) -> PseudoElementChain;
unsafe fn dangerous_style_node(self) -> DangerousStyleNodeOf<'dom, Self::ConcreteTypeBundle>;
unsafe fn dangerous_dom_parent(self) -> Option<Self>;
unsafe fn dangerous_flat_tree_parent(self) -> Option<Self>;
fn layout_data(&self) -> Option<&'dom GenericLayoutData>;
fn is_connected(&self) -> bool;
fn opaque(&self) -> OpaqueNode;
fn type_id(&self) -> Option<LayoutNodeType>;
fn initialize_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self);
fn flat_tree_children(&self) -> impl Iterator<Item = Self> + Sized;
fn dom_children(&self) -> impl Iterator<Item = Self> + Sized;
fn as_html_element(&self) -> Option<LayoutElementOf<'dom, Self::ConcreteTypeBundle>>;
fn as_element(&self) -> Option<LayoutElementOf<'dom, Self::ConcreteTypeBundle>>;
fn style(&self, context: &SharedStyleContext) -> Arc<ComputedValues>;
fn parent_style(&self, context: &SharedStyleContext) -> Arc<ComputedValues>;
fn selected_style(&self, context: &SharedStyleContext) -> Arc<ComputedValues>;
fn text_content(self) -> Cow<'dom, str>;
fn selection(&self) -> Option<SharedSelection>;
fn image_url(&self) -> Option<ServoUrl>;
fn image_density(&self) -> Option<f64>;
fn image_data(&self) -> Option<(Option<Image>, Option<ImageMetadata>)>;
fn showing_broken_image_icon(&self) -> bool;
fn canvas_data(&self) -> Option<HTMLCanvasData>;
fn svg_data(&self) -> Option<SVGElementData<'dom>>;
fn media_data(&self) -> Option<HTMLMediaData>;
fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>;
fn iframe_pipeline_id(&self) -> Option<PipelineId>;
fn table_span(&self) -> Option<u32>;
fn table_colspan(&self) -> Option<u32>;
fn table_rowspan(&self) -> Option<u32>;
fn is_single_line_text_input(&self) -> bool;
fn is_root_of_user_agent_widget(&self) -> bool;
fn set_uses_content_attribute_with_attr(&self, _uses_content_attribute_with_attr: bool);
}
pub trait DangerousStyleNode<'dom>: TNode + Sized + NodeInfo + Send + Sync {
type ConcreteTypeBundle: LayoutDomTypeBundle<'dom>;
fn layout_node(&self) -> LayoutNodeOf<'dom, Self::ConcreteTypeBundle>;
}