code wiki / _hdl_build / nx_browser_render.nx

nx_browser_render.nx

buildroot/runtime/_hdl_build/nx_browser_render.nx

81039 B1482 linesdepth 8pulls 28 transitivereach 33 importersview sourcekind librarytopic browser
docsdependenciesstructsconstsfunctions

about

nx_browser_render.nx -- REUSABLE sovereign CSS render core. Holds nx_browser's OS-AGNOSTIC pipeline: br_layout (HTML body -> CSS cascade -> box/flex/float layout -> LayoutTree + computed styles) and br_draw_fb / br_shot_png (paint the laid-out page into an RGBA framebuffer / PNG). NO X11, NO network -- pure compute over sys_mmap, so it compiles into the native-Windows GUI PE exactly as into the WSL/X11 browser. The window/blit/input + fetch live in the consumers. CSS-on-native-Windows arc R2. NOTE (R3 dedup pending): these fns are still ALSO defined in runtime/_hdl_build/nx_browser.nx; once this organ is proven, nx_browser.nx imports this and drops its copies. license_tier: ORIGINAL

dependencies 16 imports · 33 importers

nx_syscalls.nx nx_font8x8.nx nx_html_tokenizer.nx nx_dom_query.nx nx_html_entities.nx nx_render_html.nx nx_css_color_decode.nx nx_layout_box.nx nx_layout_default_display.nx nx_layout_from_dom.nx nx_browser_render.nx nishi_gui.nx nx_aw_browser_gate.nx nx_blitproof.nx nx_browser_bg_cascade_gate.nx nx_browser_bg_gate.nx nx_browser_darkmode_gate.nx nx_browser_find_gate.nx nx_browser_render_pe.nx nx_browser_render_shot.nx nx_browser_user_sim.nx

diagram shows first 10 each side; +6 more imports, +23 more importers in the complete lists below.

imports: nx_syscalls.nxnx_font8x8.nxnx_html_tokenizer.nxnx_dom_query.nxnx_html_entities.nxnx_render_html.nxnx_css_color_decode.nxnx_layout_box.nxnx_layout_default_display.nxnx_layout_from_dom.nxnx_layout_block.nxnx_paint_solid_rect.nxnx_paint_text.nxnx_png_write.nxnx_font.nxnx_aa_raster.nx

imported by: nishi_gui.nxnx_aw_browser_gate.nxnx_blitproof.nxnx_browser_bg_cascade_gate.nxnx_browser_bg_gate.nxnx_browser_darkmode_gate.nxnx_browser_find_gate.nxnx_browser_render_pe.nxnx_browser_render_shot.nxnx_browser_user_sim.nxnx_browser_xp.nxnx_cidx_equiv_gate.nxnx_css_boxmodel_gate.nxnx_css_fontsize_frac_gate.nxnx_drawfb_probe.nxnx_gx1b_page3d_gate.nxnx_gx1c_canvas_gate.nxnx_gx4_walk_gate.nxnx_gx7_game_gate.nxnx_imgpage.nxnx_imgsrc_probe.nxnx_inline_vec_measure_gate.nxnx_layout_probe.nxnx_lineheight_gate.nxnx_nishios_browser.nxnx_nishios_browser_input.nxnx_nishios_browser_x86.nxnx_nishios_docview.nxnx_nishios_net.nxnx_nishios_net_wire.nxnx_ocr_bench_render.nxnx_rawtext_layout_gate.nxnx_vecpaint_test.nx

structs

25struct Page

consts

51const NX_PAGE_BYTES: i64 = 160
52const NX_CHROME_H: i64 = 44 // browser chrome (toolbar + address bar) height; page viewport is below it
1022const BR_LO: i64 = 40
1023const BR_HI: i64 = 165

functions

54func br_slen(s: *u8) -> i64 { var k: i64=0; while s[k]!=(0 as u8){k=k+1} return k }
72func br_cidx_build(tree: *LayoutTree, computed: *CssComputedDecl, ncomp: i64) -> i64
called by 1: br_layout calls 1: sys_mmap
122func br_comp_int(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64, prop: *u8, plen: i64, dflt: i64) -> i64
called by 1: main
156func br_comp_color(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64, prop: *u8, plen: i64) -> i64
197func br_comp_fontsize_own(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64, pct_out: *i64) -> i64
243func br_comp_lineheight_own(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64, fs: i64) -> i64
338func br_comp_lineheight_px(src: *u8, computed: *CssComputedDecl, ncomp: i64, tree: *LayoutTree, box_idx: i64, fs: i64) -> i64
352func br_comp_fontsize_inh(src: *u8, computed: *CssComputedDecl, ncomp: i64, tree: *LayoutTree, box_idx: i64, dflt: i64) -> i64
374func br_comp_color_inh(src: *u8, computed: *CssComputedDecl, ncomp: i64, tree: *LayoutTree, box_idx: i64) -> i64
called by 2: br_draw_fb_atmain calls 1: br_comp_color
391func br_prop_eq(src: *u8, off: i64, lit: *u8, len: i64) -> i64
400func br_comp_bg(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64) -> i64
435func br_comp_border(src: *u8, computed: *CssComputedDecl, ncomp: i64, box_idx: i64, wout: *i64) -> i64
481func br_extract(html: *u8, hlen: i64, elements: *CssElement, ehref_off: *i64, ehref_len: *i64, esrc_off: *i64, esrc_len: *i64, maxn: i64) -> i64
541func br_layout(page: *Page, vw: i64) -> i64
680func br_find_canvas(page: *Page, from: i64) -> i64
called by 3: mainmainmain
719func br_set_fast_vec(v: i64) -> i64 { bpv_fast_on = v; return 0 }
called by 2: paint_cssmain
720func bpv_atlas_init() -> i64
called by 1: br_paint_vec_atlas calls 1: sys_mmap
738func bpv_cell(ch: i64, empx: i64, cs: *i64, sn: *i64, out: *i64) -> i64
774func bpv_blit_rgba(fb: *Framebuffer, ox: i64, oy: i64, cov: *u8, gw: i64, gh: i64, cr: i64, cg: i64, cb: i64) -> i64
called by 1: br_paint_vec_atlas
801func br_paint_vec_atlas(fb: *Framebuffer, x0: i64, y0: i64, text: *u8, text_len: i64, empx: i64, color: *CssColor, avail_w: i64) -> i64
839func br_paint_vec(fb: *Framebuffer, x0: i64, y0: i64, text: *u8, text_len: i64, empx: i64, color: *CssColor, avail_w: i64) -> i64
923func font_vec_adv_px2(ch: i64, empx: i64) -> i64 { return (font_adv_em(ch) * empx) / 1000 }
924func font_vec_text_w_px(text: *u8, start: i64, end: i64, empx: i64) -> i64
called by 1: br_paint_vec calls 1: font_vec_adv_px2
930func font_vec_next_break_px(text: *u8, len: i64, avail_px: i64, start: i64, empx: i64) -> i64
953func br_ci(a: i64) -> i64 { if a >= 65 { if a <= 90 { return a + 32 } } return a }
called by 1: br_box_has_term
954func br_box_has_term(buf: *u8, off: i64, len: i64, term: *u8, tlen: i64) -> i64
called by 2: br_findbr_draw_fb_at calls 1: br_ci
966func br_find(page: *Page, term: *u8, tlen: i64, yb: *i64) -> i64
calls 1: br_box_has_term
988func br_color_from_int(c: i64) -> *CssColor
997func br_bit(ft8: *u8, go: i64, col: i64, row: i64) -> i64
1006func br_glyph_cov(ft8: *u8, go: i64, fx256: i64, fy256: i64) -> i64
called by 1: br_cov_hybrid calls 1: br_bit
1024func br_sharpen(c: i64) -> i64
called by 1: br_cov_hybrid
1032func br_cov_hybrid(ft8: *u8, go: i64, fx256: i64, fy256: i64) -> i64
1048func br_paint_text2x(fb: *Framebuffer, x: i64, y: i64, text: *u8, text_len: i64, color: *CssColor, scale: i64) -> i64
1104func br_blit_rgb(fb: *Framebuffer, dx: i64, dy: i64, boxW: i64, boxH: i64, src: *u8, sw: i64, sh: i64) -> i64
called by 2: mainbr_draw_fb_at
1141func br_draw_fb_at(fb: *Framebuffer, page: *Page, win_w: i64, cur_url: *u8, ulen: i64, scale: i64, scroll_y: i64) -> i64
1381func br_draw_fb(fb: *Framebuffer, page: *Page, win_w: i64, cur_url: *u8, ulen: i64, scale: i64) -> i64
1392func br_shot_png(page: *Page, cur_url: *u8, ulen: i64, path: *u8) -> i64