code wiki / (root) / nx_paint_box_borders.nx

nx_paint_box_borders.nx

buildroot/runtime/nx_paint_box_borders.nx

15595 B338 linesdepth 6pulls 11 transitivereach 1 importersview sourcekind librarytopic paint
docsdependenciesstructsconstsfunctions

about

nx_paint_box_borders.nx -- paint a box's 4 borders (top / right / bottom / left) into a Framebuffer. Phase 4 third primitive of NISHI_BROWSER_ROADMAP. Composes nx_css_apply (cascade) + nx_css_dimension_to_px (border-width) + nx_css_color_decode (border-color) + nx_paint_solid_rect (actual pixel fill). Per W3C CSS Backgrounds and Borders Module Level 3, each border has independent width + color + style. This primitive supports solid borders only (style: solid). Other border-styles (dashed, dotted, double) are Phase 4b queued. Geometry: borders are painted OUTSIDE the box's content/padding rect in the CSS box model, but since nx_layout_block currently uses content-box width (b.w = content_w) and mixed-axis height (b.h = padding_top + content_h + padding_bottom), border placement here treats b as the BORDER box (top edge at b.y - border_top_w, etc.). Until nx_layout_block grows border-box semantics in Phase 3b, the simpler convention is borders drawn INSIDE b's rectangle along each edge. What it does NOT handle yet (Phase 4b queued, explicit in header): - border-style values other than solid (dashed, dotted, double, groove, ridge, inset, outset) - border-radius (rounded corners) - border-image - corner blending where two adjacent borders meet (currently the right/bottom borders paint OVER the top/left at corners -- last-wins, source-order; W3C spec wants mitred joins) - independent border-width directional shorthand parsing (border-width: 2px 1px 3px 1px) -- only longhands today Per cardinal feedback-honest-perf-verdict-no-aspirational-claims: gap list is EXACT. genealogy_id: w3c_css_backgrounds_borders_module_level_3 + substrate_browser_phase_4_box_borders lineage_id: nishi_browser_paint_box_borders_v1

dependencies 8 imports · 1 importers

nx_syscalls.nx nx_css_tokenize.nx nx_css_apply.nx nx_css_color_decode.nx nx_css_number_parse.nx nx_css_dimension_to_px.nx nx_layout_box.nx nx_paint_solid_rect.nx nx_paint_box_borders.nx nx_paint_box_borders_test.nx

imports: nx_syscalls.nxnx_css_tokenize.nxnx_css_apply.nxnx_css_color_decode.nxnx_css_number_parse.nxnx_css_dimension_to_px.nxnx_layout_box.nxnx_paint_solid_rect.nx

imported by: nx_paint_box_borders_test.nx

structs

51struct BorderPropTable

consts

71const NX_BORDER_PROP_TABLE_BYTES: i64 = 136

functions

75func _border_put_byte(buf: *u8, i: i64, v: i64) -> i64
83func nx_border_prop_table_init(t: *BorderPropTable, buf: *u8) -> i64
called by 1: main calls 1: _border_put_byte
202func _border_bytes_equal(a_src: *u8, a_off: i64, a_len: i64,
called by 1: _border_lookup
217func _border_lookup(computed: *CssComputedDecl, n_computed: i64,
237func _border_width(computed: *CssComputedDecl, n_computed: i64,
254func _border_color(computed: *CssComputedDecl, n_computed: i64,
273func nx_paint_box_borders(fb: *Framebuffer,