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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
//! The core DOM abstraction in Bliss
//!
//! This crate implements a flexible headless DOM ([`BaseDocument`]), designed to be embedded in and driven by external code.
//! Most users will want to use a wrapper:
//!
//! - [`HtmlDocument`](https://docs.rs/bliss-html/latest/bliss_html/struct.HtmlDocument.html) from [bliss-html](https://docs.rs/bliss-html) — parse HTML into a `BaseDocument`
//! - [`DioxusDocument`](https://docs.rs/dioxus-native/latest/dioxus_native/struct.DioxusDocument.html) from [dioxus-native](https://docs.rs/dioxus-native) — dynamic rendering with Dioxus
//!
//! This crate provides: DOM tree construction and mutation, CSS parsing and style resolution,
//! layout computation (via taffy), text layout (via parley), event handling, form submission,
//! script execution, text selection, and URL resolution.
//!
//! Companion crates: [bliss-html](https://docs.rs/bliss-html) (parsing), [bliss-net](https://docs.rs/bliss-net) (networking),
//! [bliss-paint](https://docs.rs/bliss-paint) (rendering), [bliss-shell](https://docs.rs/bliss-shell) (windowing).
//!
//! ## Feature Flags
//!
//! - `tracing`: Enable `tracing` spans for performance instrumentation
//! - `incremental`: Enable incremental layout with damage propagation (default: full relayout)
//! - `parallel-construct`: Parallelize inline layout construction with rayon
//! - `accessibility`: Enable accessibility tree support
//! - `file_input`: Enable file upload form controls
//! - `serde`: Enable serialization support
pub const DEFAULT_CSS: &str = include_str!;
pub const BULLET_FONT: & = include_bytes!;
const INCREMENTAL: bool = cfg!;
const NON_INCREMENTAL: bool = !INCREMENTAL;
/// The core DOM implementation: [`BaseDocument`], [`DocGuard`], [`DocGuardMut`], [`Document`], [`PlainDocument`].
///
/// `BaseDocument` manages the node tree, style system, layout state, event handlers,
/// and all cross-cutting concerns. Most of the high-level APIs live as methods on this struct.
/// DOM node types: [`Node`], [`NodeData`], [`ElementData`], [`Attribute`], [`TextNodeData`].
///
/// Nodes are stored in [`BaseDocument`]'s arena and referenced by `usize` IDs.
/// `ElementData` holds tag names, attributes, computed styles, layout state, and inline text data.
/// Document construction options: [`DocumentConfig`].
///
/// Controls viewport, base URL, user-agent stylesheets, font context, and provider
/// implementations for networking, navigation, shell, and HTML parsing.
/// Debug and inspection utilities: `print_taffy_tree`, `debug_log_node`.
///
/// Methods on [`BaseDocument`] for dumping layout trees, inline content,
/// and node metadata to stdout for debugging purposes.
/// Policy-based DOM controller: [`PolicyDomController`].
///
/// Provides sandboxing and security restrictions on DOM mutations.
/// Used to enforce content-security policies and prevent unauthorized
/// script-driven modifications.
/// DOM event system: [`EventDriver`], [`EventHandler`], [`NoopEventHandler`].
///
/// Sub-modules:
/// - `driver`: Event dispatch and lifecycle
/// - `focus`: Focus management (tab navigation, focusin/focusout)
/// - `keyboard`: Keyboard event handling
/// - `pointer`: Pointer/mouse/touch event handling
/// - `ime`: Input method editor composition events
/// Font metrics resolution for text measurement.
///
/// Caches parley `FontMetrics` per font family and style, used during
/// inline layout construction to size text runs accurately.
/// HTML form submission: form data construction, encoding, and navigation.
///
/// Implements the [form submission algorithm](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm)
/// including form data set construction, URL-encoded and multipart encoding,
/// and navigation to the action URL.
/// HTML parsing trait: [`HtmlParserProvider`], [`DummyHtmlParserProvider`].
///
/// Allows pluggable parsing of `innerHTML` into the DOM tree.
/// The `DummyHtmlParserProvider` is a no-op placeholder; real parsing
/// comes from [bliss-html](https://docs.rs/bliss-html).
/// Layout tree construction, computation, and damage tracking.
///
/// Sub-modules:
/// - `construct`: Builds the layout tree (inline layout, anonymous blocks, layout children)
/// - `damage`: Damage flags for incremental layout
/// - `inline`: Inline/block layout via parley
/// - `list`: List-item marker generation
/// - `replaced`: Replaced element sizing (images, canvas)
/// - `table`: Table layout integration
///
/// Uses [taffy](https://docs.rs/taffy) as the block/flex/grid layout engine.
/// High-level DOM mutation API: [`DocumentMutator`].
///
/// Provides safe, ergonomic methods for creating, inserting, moving, and removing nodes,
/// setting attributes, managing inline styles, and handling form control state.
/// Acquired via [`BaseDocument::mutate()`].
/// CSS selector matching: `querySelector` / `querySelectorAll`.
///
/// Finds elements in the DOM tree matching a CSS selector string,
/// using Servo's `selectors` crate for parsing and matching.
/// Style resolution and layout computation pipeline.
///
/// Orchestrates: message processing → scroll animation → style resolution →
/// damage propagation → layout children construction → deferred tasks →
/// style-to-taffy flush → layout computation → damage clearing.
///
/// Entry point: [`BaseDocument::resolve()`].
/// Script engine abstraction: [`ScriptEngine`], [`NoopScriptEngine`], [`BoxedScriptEngine`].
///
/// Provides a pluggable interface for running JavaScript or other scripting languages
/// in a sandboxed execution context. The `NoopScriptEngine` is the default placeholder.
/// Text selection state for non-input elements.
///
/// Tracks anchor/focus endpoints across inline roots, including anonymous blocks
/// whose IDs may change across layout reconstructions. Used by event handling
/// to implement click-to-select and drag-to-extend.
/// Integration with Servo's style engine (stylo).
///
/// Bridges Servo's CSS selector matching, property declaration resolution,
/// and cascade logic into bliss-dom's node system. Provides the computed
/// style data used by layout.
/// Conversion from Servo's `cursor` CSS property values to system cursor icons.
///
/// Maps CSS cursor keywords (pointer, text, grab, etc.) to
/// platform-specific cursor representations for [`bliss-shell`].
/// Conversion from Servo's computed styles to parley's text layout styles.
///
/// Translates CSS font properties (font-family, size, weight, style, letter-spacing,
/// line-height, text-decoration, etc.) into parley's `Style` and `StyleProperty` types
/// for text layout and shaping.
/// DOM tree traversal utilities: [`TreeTraverser`], [`AncestorTraverser`].
///
/// Provides iterators for pre-order DOM traversal, ancestor chain walking,
/// document-order comparison, inline-root collection across anonymous blocks,
/// and subtree mutation iteration.
/// Engine tests
/// Document URL resolution and Servo `UrlExtraData` integration.
///
/// Wraps `url::Url` in a thread-safe `ServoArc` for use by Servo's style system.
/// Provides relative URL resolution for `<a href>`, `<img src>`, `@import`, etc.
/// Networking and resource loading.
///
/// Types for HTTP requests, resource handling (CSS, images, fonts),
/// and the [`StylesheetHandler`] that loads external stylesheets.
/// Requires the `net` provider configured in [`DocumentConfig`].
/// Shared utility types.
///
/// Exports [`Point`] and other geometry primitives used across the bliss crate family.
pub use DocumentConfig;
pub use ;
pub use PolicyDomController;
pub use ;
pub use DocumentMutator;
pub use ;
pub use FontContext;
pub use ;
pub use Atom;
pub use RestyleHint;
pub type SelectorList = SelectorList;
pub use ;
pub use ;
pub use Point;