Sign in

    mizchi/crater-renderer/renderer does not have a README file

    ImageIntrinsicSizeProvider

    pub struct ImageIntrinsicSizeProvider {
    func : (String) -> (Double, Double)?
    }

    Image intrinsic-size provider hook for integrating external image metadata resolvers.

    ImageIntrinsicSizeProvider::new

    fn ImageIntrinsicSizeProvider::new(func : (String) -> (Double, Double)?) -> ImageIntrinsicSizeProvider

    PreparedExternalCss

    pub struct PreparedExternalCss {
    stylesheets : Array[
    Stylesheet
    ]
    indexed_stylesheets : Array[
    IndexedStylesheet
    ]
    before_rules : Array[PseudoRule]
    after_rules : Array[PseudoRule]
    before_index : PseudoRuleIndex
    after_index : PseudoRuleIndex
    total_rules : Int
    }

    PreparedRenderDocument

    pub struct PreparedRenderDocument {
    stylesheets : Array[
    Stylesheet
    ]
    indexed_stylesheets : Array[
    IndexedStylesheet
    ]
    css_vars : Map[String, String]
    doc_root_selector :
    Element

    doc_root_style :
    Style

    render_root :
    Element

    render_root_tag : String
    body_uses_document_root_style : Bool
    suppress_quirks_body_ua_top_margin : Bool
    before_index : PseudoRuleIndex
    after_index : PseudoRuleIndex
    }

    PseudoRule

    pub struct PseudoRule {
    base_selector :
    ComplexSelector
    ?
    base_selector_text : String
    declarations : Array[
    Declaration
    ]
    media_query :
    MediaQueryList
    ?
    }

    PseudoRuleIndex

    pub struct PseudoRuleIndex {
    rules : Array[PseudoRule]
    by_id : Map[String, Array[Int]]
    by_class : Map[String, Array[Int]]
    by_tag : Map[String, Array[Int]]
    universal : Array[Int]
    }

    Indexed pseudo rules for fast lookup (same strategy as SelectorIndex)

    RenderContext

    pub(all) struct RenderContext {
    viewport_width : Double
    viewport_height : Double
    root_font_size : Double
    color_scheme :
    ColorScheme

    }

    Render context with viewport dimensions

    RenderContext::default

    fn RenderContext::default() -> RenderContext

    TextMetricsProvider

    pub struct TextMetricsProvider {
    func : (String, Double, Double,
    WhiteSpace
    ,
    WritingMode
    , Double, String) ->
    MeasureFunc

    }

    Text metrics provider hook for integrating external font engines.

    apply_css_property_debug

    fn apply_css_property_debug(style :
    Style
    , property : String, value : String) ->
    Style

    Apply a CSS property value to a style (public for testing)

    build_render_root_node

    clear_builtin_text_advance_ratio_override_for_test

    fn clear_builtin_text_advance_ratio_override_for_test() -> Unit

    Clear the deterministic built-in text measurement hook on JS.

    clear_image_intrinsic_size_provider

    fn clear_image_intrinsic_size_provider() -> Unit

    clear_text_metrics_provider

    fn clear_text_metrics_provider() -> Unit

    compute_layout_from_render_root

    fn compute_layout_from_render_root(root :
    Node
    , prepared : PreparedRenderDocument, ctx : RenderContext) ->
    Layout

    element_to_node

    Convert HTML Element to Node tree for layout computation

    get_content_height

    fn get_content_height(html : String, width : Int, height : Int) -> Int

    Get content height from HTML

    get_content_height_with_css

    fn get_content_height_with_css(html : String, width : Int, height : Int, external_css : Array[String]) -> Int

    Get content height with external CSS

    get_content_height_with_document

    fn get_content_height_with_document(doc :
    Document
    , width : Int, height : Int, external_css : Array[String]) -> Int

    Get content height from a parsed Document with external CSS

    get_force_monospace_metrics

    fn get_force_monospace_metrics() -> Bool

    layout_to_json

    fn layout_to_json(layout :
    Layout
    ) -> String

    Convert layout to JSON string (with Box Model)

    perf_child_loop_us

    let perf_child_loop_us :
    Ref
    [Int64]

    perf_clock_us

    fn perf_clock_us() -> Int64

    perf_node_build_us

    let perf_node_build_us :
    Ref
    [Int64]

    perf_pre_checks_us

    let perf_pre_checks_us :
    Ref
    [Int64]

    perf_pseudo_us

    let perf_pseudo_us :
    Ref
    [Int64]

    perf_selector_build_us

    let perf_selector_build_us :
    Ref
    [Int64]

    prepare_external_css

    fn prepare_external_css(external_css : Array[String]) -> PreparedExternalCss

    prepare_render_document

    fn prepare_render_document(doc :
    Document
    , ctx : RenderContext, external_css : Array[String]) -> PreparedRenderDocument

    prepare_render_document_with_prepared_external_css

    fn prepare_render_document_with_prepared_external_css(doc :
    Document
    , ctx : RenderContext, external_css : PreparedExternalCss) -> PreparedRenderDocument

    fn print_layout_tree(layout :
    Layout
    , indent : Int) -> Unit

    Print layout tree for debugging
    fn print_layout_tree_with_options(layout :
    Layout
    , indent : Int, show_box_model : Bool) -> Unit

    Print layout tree with optional detailed box model info

    render

    fn render(html : String, ctx : RenderContext) ->
    Layout

    Render HTML string to Layout

    render_document_with_external_css

    fn render_document_with_external_css(doc :
    Document
    , ctx : RenderContext, external_css : Array[String]) ->
    Layout

    Render a parsed HTML Document to Layout with external CSS This is useful when you need to pre-process the document (e.g., add synthetic IDs)

    render_document_with_prepared_external_css

    fn render_document_with_prepared_external_css(doc :
    Document
    , ctx : RenderContext, external_css : PreparedExternalCss) ->
    Layout

    Render a parsed HTML Document to Layout with a prepared external CSS handle.

    render_to_node

    fn render_to_node(html : String, ctx : RenderContext) ->
    Node

    Render HTML to Node tree (for testing/debugging)

    render_to_node_and_layout

    fn render_to_node_and_layout(html : String, ctx : RenderContext) -> (
    Node
    ,
    Layout
    )

    Render HTML to Node tree and Layout in a shared pass.

    render_to_node_and_layout_full_document

    fn render_to_node_and_layout_full_document(html : String, ctx : RenderContext) -> (
    Node
    ,
    Layout
    )

    Render the whole document without viewport skeleton culling.

    render_to_node_and_layout_with_document

    fn render_to_node_and_layout_with_document(doc :
    Document
    , ctx : RenderContext, external_css : Array[String]) -> (
    Node
    ,
    Layout
    )

    Render a parsed HTML Document to Node tree and Layout with external CSS while sharing HTML/CSS preparation and node construction.

    render_to_node_and_layout_with_external_css

    fn render_to_node_and_layout_with_external_css(html : String, ctx : RenderContext, external_css : Array[String]) -> (
    Node
    ,
    Layout
    )

    Render HTML to Node tree and Layout with external CSS in a shared pass.

    render_to_node_and_layout_with_prepared_external_css

    fn render_to_node_and_layout_with_prepared_external_css(doc :
    Document
    , ctx : RenderContext, external_css : PreparedExternalCss) -> (
    Node
    ,
    Layout
    )

    Render a parsed HTML Document to Node tree and Layout with a prepared external CSS handle.

    render_to_node_with_document

    fn render_to_node_with_document(doc :
    Document
    , ctx : RenderContext, external_css : Array[String]) ->
    Node

    Render a parsed HTML Document to Node tree with external CSS This is useful when you need to use a pre-parsed document (e.g., from streaming parser)

    render_to_node_with_external_css

    fn render_to_node_with_external_css(html : String, ctx : RenderContext, external_css : Array[String]) ->
    Node

    Render HTML to Node tree with external CSS

    render_to_node_with_prepared_external_css

    fn render_to_node_with_prepared_external_css(doc :
    Document
    , ctx : RenderContext, external_css : PreparedExternalCss) ->
    Node

    Render a parsed HTML Document to Node tree with a prepared external CSS handle.

    render_with_external_css

    fn render_with_external_css(html : String, ctx : RenderContext, external_css : Array[String]) ->
    Layout

    Render HTML string to Layout with external CSS

    set_builtin_text_advance_ratio_override_for_test

    fn set_builtin_text_advance_ratio_override_for_test(ratio : Double) -> Unit

    Test-only hook for deterministic built-in text measurement on JS.

    set_force_monospace_metrics

    fn set_force_monospace_metrics(enabled : Bool) -> Unit

    set_image_intrinsic_size_provider

    fn set_image_intrinsic_size_provider(provider : ImageIntrinsicSizeProvider) -> Unit

    set_text_metrics_provider

    fn set_text_metrics_provider(provider : TextMetricsProvider) -> Unit

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io