From ecf42afc3329b03ee642ede84f9ba224d2aff1e1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 22 Mar 2021 17:47:11 +0000 Subject: Selection: Don't duplicate unit conversion members in media descriptor. --- include/libcss/computed.h | 2 +- include/libcss/select.h | 6 ++++-- include/libcss/types.h | 4 ---- include/libcss/unit.h | 10 +++++----- 4 files changed, 10 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/libcss/computed.h b/include/libcss/computed.h index 1587d78..30e369b 100644 --- a/include/libcss/computed.h +++ b/include/libcss/computed.h @@ -82,7 +82,7 @@ css_error css_computed_style_destroy(css_computed_style *style); css_error css_computed_style_compose( const css_computed_style *restrict parent, const css_computed_style *restrict child, - const css_unit_len_ctx *unit_len_ctx, + const css_unit_ctx *unit_ctx, css_computed_style **restrict result); /****************************************************************************** diff --git a/include/libcss/select.h b/include/libcss/select.h index bfaf531..25317e5 100644 --- a/include/libcss/select.h +++ b/include/libcss/select.h @@ -219,14 +219,16 @@ css_error css_select_default_style(css_select_ctx *ctx, css_select_handler *handler, void *pw, css_computed_style **style); css_error css_select_style(css_select_ctx *ctx, void *node, - const css_unit_len_ctx *unit_len_ctx, + const css_unit_ctx *unit_ctx, const css_media *media, const css_stylesheet *inline_style, css_select_handler *handler, void *pw, css_select_results **result); css_error css_select_results_destroy(css_select_results *results); css_error css_select_font_faces(css_select_ctx *ctx, - const css_media *media, lwc_string *font_family, + const css_media *media, + const css_unit_ctx *unit_ctx, + lwc_string *font_family, css_select_font_faces_results **result); css_error css_select_font_faces_results_destroy( css_select_font_faces_results *results); diff --git a/include/libcss/types.h b/include/libcss/types.h index 1186c6f..2b0dfb7 100644 --- a/include/libcss/types.h +++ b/include/libcss/types.h @@ -234,10 +234,6 @@ typedef struct css_media { /* Scripting media features */ css_media_scripting scripting; - - /* Client details for length conversion */ - css_fixed client_font_size; /* In pt */ - css_fixed client_line_height; /* In css pixels */ } css_media; /** diff --git a/include/libcss/unit.h b/include/libcss/unit.h index a847077..67194c1 100644 --- a/include/libcss/unit.h +++ b/include/libcss/unit.h @@ -36,7 +36,7 @@ typedef css_fixed (*css_unit_len_measure)( * If a NULL pointer is given, LibCSS will use a fixed scaling of * the "em" unit. */ -typedef struct css_unit_len_ctx { +typedef struct css_unit_ctx { /** * Viewport width in CSS pixels. * Used if unit is vh, vw, vi, vb, vmin, or vmax. @@ -73,7 +73,7 @@ typedef struct css_unit_len_ctx { * Optional client callback for font measuring. */ const css_unit_len_measure measure; -} css_unit_len_ctx; +} css_unit_ctx; /** * Convert css pixels to physical pixels. @@ -114,7 +114,7 @@ static inline css_fixed css_unit_device2css_px( */ css_fixed css_unit_font_size_len2pt( const css_computed_style *style, - const css_unit_len_ctx *ctx, + const css_unit_ctx *ctx, const css_fixed length, const css_unit unit); @@ -129,7 +129,7 @@ css_fixed css_unit_font_size_len2pt( */ css_fixed css_unit_len2css_px( const css_computed_style *style, - const css_unit_len_ctx *ctx, + const css_unit_ctx *ctx, const css_fixed length, const css_unit unit); @@ -144,7 +144,7 @@ css_fixed css_unit_len2css_px( */ css_fixed css_unit_len2device_px( const css_computed_style *style, - const css_unit_len_ctx *ctx, + const css_unit_ctx *ctx, const css_fixed length, const css_unit unit); -- cgit v1.2.1