40 uint32_t* out_href_off,
41 uint32_t* out_href_len)
52 if ((x >= rect->
x) && (x < (rect->
x + rect->
w)) && (y >= rect->
y) &&
53 (y < (rect->
y + rect->
h))) {
79 if ((x >= box->
x) && (x < (box->
x + box->
w)) && (y >= box->
y) && (y < (box->
y + box->
h))) {
99 bool equal = anchor->
id_len == id_len;
100 for (uint32_t j = 0U; equal && (j < id_len); ++j) {
142 for (uint32_t i = 0U; i < end; ++i) {
143 if (href[i] ==
'/') {
146 if (href[i] ==
':') {
189 uint32_t* out_path_len,
190 uint32_t* out_frag_off,
191 uint32_t* out_frag_len)
194 for (uint32_t i = 0U; i < len; ++i) {
195 if (href[i] ==
'#') {
205 const bool has_frag = (hash < len);
206 *out_path_len = hash;
208 *out_frag_off = hash + 1U;
209 *out_frag_len = len - hash - 1U;
221 uint32_t* out_path_len,
222 uint32_t* out_frag_off,
223 uint32_t* out_frag_len)
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
HTML / CSS reflow + paginate engine for the ra8d2 ereader.
ra8_err_t reflow_hit_test_link(const reflow_t *engine, uint32_t page_idx, int32_t x, int32_t y, uint32_t *out_href_off, uint32_t *out_href_len)
Hit-test a point on a page against the laid-out <a> link rectangles.
static bool internal_has_scheme(const char *href, uint32_t end)
True iff href has a URI scheme (a ':' before any '/' in [0,end)).
static const char *const s_tag_link
Log tag for the link/anchor query module.
ra8_err_t reflow_find_anchor(const reflow_t *engine, const char *id, uint32_t id_len, uint32_t *out_page)
Find the page of a same-chapter id anchor (for #fragment jumps).
ra8_err_t reflow_href_split(const char *href, uint32_t len, reflow_href_kind_t *out_kind, uint32_t *out_path_len, uint32_t *out_frag_off, uint32_t *out_frag_len)
Split + classify an <a href> into a path part and a #fragment.
ra8_err_t reflow_hit_test_image(const reflow_t *engine, uint32_t page_idx, int32_t x, int32_t y, uint32_t *out_index)
Hit-test a point on a page against the laid-out <img> boxes (#478).
static void internal_href_classify(const char *href, uint32_t len, reflow_href_kind_t *out_kind, uint32_t *out_path_len, uint32_t *out_frag_off, uint32_t *out_frag_len)
Core href split + classify (no validation; pure on the inputs).
reflow_href_kind_t
Classification of an in-content <a href> target.
@ k_reflow_href_fragment
"#id" – same-chapter anchor.
@ k_reflow_href_chapter_fragment
"path#id" – chapter + anchor.
@ k_reflow_href_empty
Empty / whitespace-only href.
@ k_reflow_href_chapter
"path" – another chapter, no frag.
@ k_reflow_href_external
Has a URI scheme (http:, mailto:).
A laid-out element id, for same-chapter #fragment jumps.
uint32_t page_index
Page the id landed on.
uint32_t id_len
Id slice length, bytes.
uint32_t id_off
Id slice offset into the text pool.
One laid-out <img> rectangle (decoded + blitted at render time).
int32_t y
Page-local top edge, pixels.
int32_t x
Page-local left edge, pixels.
uint32_t page_index
Page this image belongs to.
int32_t w
Scaled box width, pixels.
int32_t h
Scaled box height, pixels.
One tappable rectangle covering a run of <a> glyphs on a page.
int32_t w
Rect width, pixels.
uint32_t target
Index into engine->link_targets[].
uint32_t page_index
Page this rect belongs to.
int32_t x
Page-local left edge, pixels.
int32_t h
Rect height, pixels.
int32_t y
Page-local top edge, pixels.
One distinct <a href> destination interned during a parse.
uint32_t href_len
Href slice length, bytes.
uint32_t href_off
Href slice offset into the text pool.
Reflow / pagination engine state.
reflow_link_rect_t link_rects[k_reflow_max_link_rects]
Tappable rects.
uint8_t text_pool[k_reflow_text_pool_bytes]
Text bytes.
reflow_anchor_t anchors[k_reflow_max_anchors]
id= anchor positions.
uint32_t anchor_count
Anchor positions used.
reflow_link_target_t link_targets[k_reflow_max_links]
Distinct hrefs.
reflow_image_box_t image_boxes[k_reflow_max_images]
Laid-out images.
uint32_t image_box_count
Image boxes used.
uint32_t link_rect_count
Link rects used.