Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
//! One-shot CSS box construction, numeric layout, and owned paint projection.
//!
//! The crate knows Stylo and Taffy but never knows Moli's live DOM or V8
//! runtime. Renderer-owned adapters lend a canonical source view and resolve
//! styles; all source/style borrows and per-pass caches are gone before the
//! returned [`FrozenLayoutTree`] or [`PaintSnapshot`] crosses into a consumer.
/// Number of fixed layout subpixels in one CSS pixel, matching Blink's
/// `LayoutUnit` precision.
pub(crate) const LAYOUT_SUBPIXELS_PER_CSS_PIXEL: f32 = 64.0;
mod anonymous_style;
mod builder;
mod capture;
mod containment;
mod environment;
mod error;
mod form;
mod gradient;
mod grid;
mod inline;
mod intrinsic;
mod layout_tree;
mod list;
mod normalize;
mod normalize_source;
mod overflow;
mod paint;
mod pass;
mod positioned;
mod projection;
mod replaced;
mod scrollbar;
mod snapshot;
mod source;
mod stacking;
mod style;
mod stylo_to_parley;
mod table;
mod taffy_tree;
mod text;
mod world;
pub use anonymous_style::LayoutAnonymousStyleContext;
pub use builder::build_layout_world;
pub use capture::{
FULL_DOCUMENT_CAPTURE_CSS_DIMENSION_LIMIT, PaintCaptureRegion, PaintCaptureRequest,
PaintCaptureSurface,
};
pub use environment::LayoutEnvironment;
pub use error::LayoutError;
pub use layout_tree::{
FrozenCoordinateSpace, FrozenEmbeddedFrame, FrozenLayoutBox, FrozenLayoutTree,
GeometryProvider, LayoutAnswers, LayoutBoxGeometry, LayoutBoxModel, LayoutCaretPosition,
LayoutClipChainId, LayoutClipNode, LayoutCoordinateSpaceId, LayoutCssImageReference,
LayoutDocumentMetrics, LayoutElementMetrics, LayoutFlushReason, LayoutFragment,
LayoutFragmentBoxModel, LayoutFragmentId, LayoutFragmentKind, LayoutHit,
LayoutIntersectionGeometry, LayoutNodeOutput, LayoutOutputBoxId, LayoutPaintedSurfaceHit,
LayoutPassMetrics, LayoutPassResult, LayoutPoint, LayoutQuad, LayoutQuery, LayoutQueryAnswer,
LayoutQueryBatch, LayoutRect, LayoutResizeObserverMetrics, LayoutResizeObserverSize,
LayoutResolvedGridTrackList, LayoutResolvedGridTracks, LayoutScrollContainerMetrics,
LayoutScrollExtent, LayoutScrollIntoViewGeometry, LayoutSize, LayoutTransform2D,
LayoutTreeRetentionMetrics, LayoutUsedSize, LayoutViewport, MAX_RETAINED_LAYOUT_BOXES,
MAX_RETAINED_LAYOUT_FRAGMENTS, MAX_RETAINED_LAYOUT_TREE_BYTES,
};
pub use normalize::{NormalizedBoxNode, NormalizedBoxTree, NormalizedFormattingContext};
pub use normalize_source::{
NormalizedLayoutSourceNode, NormalizedLayoutSourceTree, normalize_layout_source,
};
pub use pass::{
EmbeddedFrameRenderer, EmbeddedFrameSnapshot, LayoutPassRequest, ScreenshotLayoutRequest,
build_layout_pass, build_layout_pass_with_embedded_frames, build_screenshot_snapshot,
};
pub use scrollbar::{
LayoutControlSurfaceHit, LayoutScrollbarAxis, LayoutScrollbarColors, LayoutScrollbarCornerHit,
LayoutScrollbarGeometry, LayoutScrollbarGutter, LayoutScrollbarHit, LayoutScrollbarPart,
LayoutScrollbarWidth,
};
pub use snapshot::{
PaintBlendMode, PaintBorderColors, PaintBorderStyle, PaintBorderStyles, PaintBoxShadow,
PaintBrush, PaintColor, PaintCompositeMode, PaintConicGradient, PaintCornerRadii,
PaintCornerRadius, PaintDiagnostic, PaintDiagnosticSeverity, PaintEdgeSizes, PaintFillRule,
PaintFilter, PaintFontId, PaintFontResource, PaintFragment, PaintGlyph, PaintGlyphRun,
PaintGradientColorSpace, PaintGradientExtend, PaintGradientHueDirection,
PaintGradientInterpolation, PaintGradientStop, PaintImage, PaintImageId, PaintImageResource,
PaintImageSampling, PaintLineCap, PaintLineJoin, PaintLinearGradient, PaintLink,
PaintLinkTarget, PaintPath, PaintPathElement, PaintPoint, PaintRadialGradient, PaintRect,
PaintShape, PaintSize, PaintSnapshot, PaintStroke, PaintSvgImage, PaintSvgImageId,
PaintSvgImageResource, PaintTextDecoration, PaintTextDecorationStyle, PaintTextSemantics,
PaintTextShadow, PaintTransform2D, PaintViewport, pixel_snap_paint_axis,
pixel_snap_paint_axis_allowing_zero, pixel_snap_paint_rect,
};
pub use source::{
LayoutElementCategory, LayoutElementMetadata, LayoutElementSemantics, LayoutFormControlData,
LayoutFormControlKind, LayoutHyperlink, LayoutImageResource, LayoutInputControlKind,
LayoutListData, LayoutListRole, LayoutNamespace, LayoutPseudo, LayoutReplacedKind,
LayoutSource, LayoutSourceKind, LayoutStyleResolver, LayoutTableData, LayoutTableRole,
LayoutTextSelection, ReplacedMetrics, ResolvedLayoutElementStyles, ResolvedLayoutPseudoStyle,
};
pub use style::{
LayoutDisplay, LayoutInlineAlignment, LayoutListMarkerPosition, LayoutListMarkerType,
LayoutPosition, ResolvedLayoutStyle,
};
pub use text::{
DocumentLayoutServices, FontFaceData, SystemFontPolicy, WebFontDeclaration, WebFontFace,
WebFontRegistration, WebFontRegistrationError, WebFontRegistrationOutcome,
WebFontRegistrationScope, WebFontStyle, WebFontUnicodeRange, validate_web_font_bytes,
};
pub use world::{
LayoutAnonymousReason, LayoutBox, LayoutBoxId, LayoutBoxKind, LayoutCapabilityDiagnostic,
LayoutWorld,
};