/* browser_html: see browser_html.h. A deliberately tolerant parser: bad * nesting is repaired, unknown tags are transparent, and the CSS engine only * implements the properties in the browser's documented subset. */ #include "browser_html.h" #include #include static int is_space(char c); static int is_ident(char c); /* ---- storage (one document per process) ---- * * The node/text/attribute arenas are allocated from the ring-3 heap, not * static BSS: a large article needs several MB and the process image lives * in the 4 MB user window. heap_reset() on navigation releases them with * the rest of the page heap. */ static struct br_rule rule_fallback[BR_RULE_FALLBACK]; static char css_store[BR_CSS_SIZE]; static int root_font_px = 16; /* Distinct background-image URLs per page (app stores give every card an * icon through an inline style). */ #define BR_BG_URLS 512 static char bg_urls[BR_BG_URLS][192]; static unsigned int bg_url_count; /* @font-face definitions, one document at a time. The URL is resolved by * the browser against `base` (the sheet URL, or the page URL for