From da7915e3931a0b43d75d2a1e041f339f356e1d4b Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 16 Jul 2009 14:37:55 +0000 Subject: Add a flag to the font size computation callback to indicate that the resultant absolute font size should not be clamped to a fixed minimum (e.g. if the client has a minimum permissible font size) svn path=/trunk/libcss/; revision=8586 --- include/libcss/computed.h | 1 + include/libcss/select.h | 2 +- src/select/computed.c | 9 +++++---- src/select/computed.h | 2 +- test/select-auto.c | 6 ++++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/libcss/computed.h b/include/libcss/computed.h index a55cc4b..df2f5cf 100644 --- a/include/libcss/computed.h +++ b/include/libcss/computed.h @@ -341,6 +341,7 @@ css_error css_computed_style_compose(const css_computed_style *parent, const css_computed_style *child, css_error (*compute_font_size)(void *pw, const struct css_hint *parent, + bool may_clamp, struct css_hint *size), void *pw, css_computed_style *result); diff --git a/include/libcss/select.h b/include/libcss/select.h index e961275..5eaf120 100644 --- a/include/libcss/select.h +++ b/include/libcss/select.h @@ -69,7 +69,7 @@ typedef struct css_select_handler { css_hint *hint); css_error (*compute_font_size)(void *pw, const css_hint *parent, - css_hint *size); + bool may_clamp, css_hint *size); } css_select_handler; css_error css_select_ctx_create(css_allocator_fn alloc, void *pw, diff --git a/src/select/computed.c b/src/select/computed.c index 9bbaa52..4e3d219 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -216,7 +216,7 @@ css_error css_computed_style_initialise(css_computed_style *style, css_error css_computed_style_compose(const css_computed_style *parent, const css_computed_style *child, css_error (*compute_font_size)(void *pw, - const css_hint *parent, css_hint *size), + const css_hint *parent, bool may_clamp, css_hint *size), void *pw, css_computed_style *result) { @@ -265,7 +265,7 @@ css_error css_computed_style_compose(const css_computed_style *parent, css_error compute_absolute_values(const css_computed_style *parent, css_computed_style *style, css_error (*compute_font_size)(void *pw, - const css_hint *parent, css_hint *size), + const css_hint *parent, bool may_clamp, css_hint *size), void *pw) { css_hint psize, size, ex_size; @@ -282,7 +282,8 @@ css_error compute_absolute_values(const css_computed_style *parent, &size.data.length.value, &size.data.length.unit); - error = compute_font_size(pw, parent != NULL ? &psize : NULL, &size); + error = compute_font_size(pw, parent != NULL ? &psize : NULL, + true, &size); if (error != CSS_OK) return error; @@ -295,7 +296,7 @@ css_error compute_absolute_values(const css_computed_style *parent, ex_size.status = CSS_FONT_SIZE_DIMENSION; ex_size.data.length.value = INTTOFIX(1); ex_size.data.length.unit = CSS_UNIT_EX; - error = compute_font_size(pw, &size, &ex_size); + error = compute_font_size(pw, &size, false, &ex_size); if (error != CSS_OK) return error; diff --git a/src/select/computed.h b/src/select/computed.h index 5527742..4b0e1aa 100644 --- a/src/select/computed.h +++ b/src/select/computed.h @@ -14,7 +14,7 @@ css_error compute_absolute_values(const css_computed_style *parent, css_computed_style *style, css_error (*compute_font_size)(void *pw, - const css_hint *parent, css_hint *size), + const css_hint *parent, bool may_clamp, css_hint *size), void *pw); #endif diff --git a/test/select-auto.c b/test/select-auto.c index c52cb0a..f0c4fef 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -117,7 +117,7 @@ static css_error node_presentational_hint(void *pw, void *node, static css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint); static css_error compute_font_size(void *pw, const css_hint *parent, - css_hint *size); + bool may_clamp, css_hint *size); static css_select_handler select_handler = { node_name, @@ -1113,7 +1113,8 @@ css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint) return CSS_OK; } -css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size) +css_error compute_font_size(void *pw, const css_hint *parent, + bool may_clamp, css_hint *size) { static css_hint_length sizes[] = { { FLTTOFIX(6.75), CSS_UNIT_PT }, @@ -1127,6 +1128,7 @@ css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size) const css_hint_length *parent_size; UNUSED(pw); + UNUSED(may_clamp); /* Grab parent size, defaulting to medium if none */ if (parent == NULL) { -- cgit v1.2.3