nx_paint_box_borders.nx
buildroot/runtime/nx_paint_box_borders.nx
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
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
| 51 | struct BorderPropTable |
consts
| 71 | const NX_BORDER_PROP_TABLE_BYTES: i64 = 136 |
functions
| 75 | func _border_put_byte(buf: *u8, i: i64, v: i64) -> i64 called by 1: nx_border_prop_table_init |
| 83 | func nx_border_prop_table_init(t: *BorderPropTable, buf: *u8) -> i64 |
| 202 | func _border_bytes_equal(a_src: *u8, a_off: i64, a_len: i64, called by 1: _border_lookup |
| 217 | func _border_lookup(computed: *CssComputedDecl, n_computed: i64, |
| 237 | func _border_width(computed: *CssComputedDecl, n_computed: i64, |
| 254 | func _border_color(computed: *CssComputedDecl, n_computed: i64, |
| 273 | func nx_paint_box_borders(fb: *Framebuffer, |