diff --git a/desktop/textarea.c b/desktop/textarea.c index 4832e29cf..1b48d9d55 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1415,3 +1415,18 @@ void textarea_normalise_text(struct text_area *ta, } } + + +/** + * Gets the dimensions of a textarea + * + * \param width if not NULL, gets updated to the width of the textarea + * \param height if not NULL, gets updated to the height of the textarea + */ +void textarea_get_dimensions(struct text_area *ta, int *width, int *height) +{ + if (width != NULL) + *width = ta->vis_width; + if (height != NULL) + *height = ta->vis_height; +} diff --git a/desktop/textarea.h b/desktop/textarea.h index 06cd2b8ee..14e93f5e8 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -54,6 +54,7 @@ bool textarea_mouse_action(struct text_area *ta, browser_mouse_state mouse, int x, int y); bool textarea_drag_end(struct text_area *ta, browser_mouse_state mouse, int x, int y); +void textarea_get_dimensions(struct text_area *ta, int *width, int *height); #endif