Gitweb links:

...log 
http://git.netsurf-browser.org/libcss.git/shortlog/ecf42afc3329b03ee642ede84f9ba224d2aff1e1
...commit 
http://git.netsurf-browser.org/libcss.git/commit/ecf42afc3329b03ee642ede84f9ba224d2aff1e1
...tree 
http://git.netsurf-browser.org/libcss.git/tree/ecf42afc3329b03ee642ede84f9ba224d2aff1e1

The branch, master has been updated
       via  ecf42afc3329b03ee642ede84f9ba224d2aff1e1 (commit)
       via  65d4fd6e83d421e7fa7a8c7df44d01797e3c69ae (commit)
       via  6cd205329373efe5a1629518c2875724cc79dce3 (commit)
       via  0cf10a040aea028c7dc81cf353da7a7af5331076 (commit)
      from  57fa3608e13accc24a45e5d7801a381212c2ff22 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 Makefile                     |    1 +
 docs/Bytecode                |   23 +-
 examples/example1.c          |   79 ++-----
 include/libcss/computed.h    |    6 +-
 include/libcss/select.h      |    9 +-
 include/libcss/types.h       |   29 +--
 include/libcss/unit.h        |  156 +++++++++++++
 src/bytecode/bytecode.h      |   23 +-
 src/parse/properties/font.c  |    3 -
 src/parse/properties/utils.c |    6 -
 src/select/Makefile          |    2 +-
 src/select/computed.c        |   34 +--
 src/select/computed.h        |    6 +-
 src/select/hash.c            |   14 +-
 src/select/hash.h            |    2 +
 src/select/helpers.h         |    3 -
 src/select/mq.h              |  165 ++++----------
 src/select/select.c          |   39 +++-
 src/select/select.h          |    1 +
 src/select/unit.c            |  511 ++++++++++++++++++++++++++++++++++++++++++
 src/select/unit.h            |   42 ++++
 test/data/parse2/units.dat   |   24 --
 test/data/select/tests1.dat  |  258 ++++++++++-----------
 test/dump.h                  |    9 -
 test/dump_computed.h         |    9 -
 test/select.c                |   85 ++-----
 26 files changed, 1011 insertions(+), 528 deletions(-)
 create mode 100644 include/libcss/unit.h
 create mode 100644 src/select/unit.c
 create mode 100644 src/select/unit.h

diff --git a/Makefile b/Makefile
index 0835c8f..86d6641 100644
--- a/Makefile
+++ b/Makefile
@@ -65,5 +65,6 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) 
$(I):include/libcss/properties.h
 INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/select.h
 INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/stylesheet.h
 INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/types.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/unit.h
 INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in
 INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT)
diff --git a/docs/Bytecode b/docs/Bytecode
index d691923..4914e65 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -44,19 +44,16 @@ Length is a 32bit numeric value (as described above) and 
unit is as follows:
                        00000101 => mm
                        00000110 => pt
                        00000111 => pc
-                       00001000 => cap
-                       00001001 => ch
-                       00001010 => ic
-                       00001011 => rem
-                       00001100 => lh
-                       00001101 => rlh
-                       00001110 => vh
-                       00001111 => vw
-                       00010000 => vi
-                       00010001 => vb
-                       00010010 => vmin
-                       00010011 => vmax
-                       00010100 => q
+                       00001000 => ch
+                       00001001 => rem
+                       00001010 => lh
+                       00001011 => vh
+                       00001100 => vw
+                       00001101 => vi
+                       00001110 => vb
+                       00001111 => vmin
+                       00010000 => vmax
+                       00010001 => q
 
        bit 9 set => percentage unit
                bits 9-31: MBZ
diff --git a/examples/example1.c b/examples/example1.c
index c36a94d..1d2462c 100644
--- a/examples/example1.c
+++ b/examples/example1.c
@@ -98,13 +98,22 @@ static css_error node_presentational_hint(void *pw, void 
*node,
                uint32_t *nhints, css_hint **hints);
 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);
 static css_error set_libcss_node_data(void *pw, void *n,
                void *libcss_node_data);
 static css_error get_libcss_node_data(void *pw, void *n,
                void **libcss_node_data);
 
+static css_unit_ctx uint_len_ctx = {
+       .viewport_width    = 800 * (1 << CSS_RADIX_POINT),
+       .viewport_height   = 600 * (1 << CSS_RADIX_POINT),
+       .font_size_default =  16 * (1 << CSS_RADIX_POINT),
+       .font_size_minimum =   6 * (1 << CSS_RADIX_POINT),
+       .device_dpi        =  96 * (1 << CSS_RADIX_POINT),
+       .root_style        = NULL, /* We don't have a root node yet. */
+       .pw                = NULL, /* We're not implementing measure callback */
+       .measure           = NULL, /* We're not implementing measure callback */
+};
+
 /* Table of function pointers for the LibCSS Select API. */
 static css_select_handler select_handler = {
        CSS_SELECT_HANDLER_VERSION_1,
@@ -143,9 +152,8 @@ static css_select_handler select_handler = {
        node_is_lang,
        node_presentational_hint,
        ua_default_for_property,
-       compute_font_size,
        set_libcss_node_data,
-       get_libcss_node_data
+       get_libcss_node_data,
 };
 
 
@@ -237,6 +245,7 @@ int main(int argc, char **argv)
                lwc_intern_string(element, strlen(element), &element_name);
 
                code = css_select_style(select_ctx, element_name,
+                               &uint_len_ctx,
                                &media, NULL,
                                &select_handler, 0,
                                &style);
@@ -662,68 +671,6 @@ 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)
-{
-       static css_hint_length sizes[] = {
-               { FLTTOFIX(6.75), CSS_UNIT_PT },
-               { FLTTOFIX(7.50), CSS_UNIT_PT },
-               { FLTTOFIX(9.75), CSS_UNIT_PT },
-               { FLTTOFIX(12.0), CSS_UNIT_PT },
-               { FLTTOFIX(13.5), CSS_UNIT_PT },
-               { FLTTOFIX(18.0), CSS_UNIT_PT },
-               { FLTTOFIX(24.0), CSS_UNIT_PT }
-       };
-       const css_hint_length *parent_size;
-
-       UNUSED(pw);
-
-       /* Grab parent size, defaulting to medium if none */
-       if (parent == NULL) {
-               parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1];
-       } else {
-               assert(parent->status == CSS_FONT_SIZE_DIMENSION);
-               assert(parent->data.length.unit != CSS_UNIT_EM);
-               assert(parent->data.length.unit != CSS_UNIT_EX);
-               parent_size = &parent->data.length;
-       }
-
-       assert(size->status != CSS_FONT_SIZE_INHERIT);
-
-       if (size->status < CSS_FONT_SIZE_LARGER) {
-               /* Keyword -- simple */
-               size->data.length = sizes[size->status - 1];
-       } else if (size->status == CSS_FONT_SIZE_LARGER) {
-               /** \todo Step within table, if appropriate */
-               size->data.length.value =
-                               FMUL(parent_size->value, FLTTOFIX(1.2));
-               size->data.length.unit = parent_size->unit;
-       } else if (size->status == CSS_FONT_SIZE_SMALLER) {
-               /** \todo Step within table, if appropriate */
-               size->data.length.value =
-                               FMUL(parent_size->value, FLTTOFIX(1.2));
-               size->data.length.unit = parent_size->unit;
-       } else if (size->data.length.unit == CSS_UNIT_EM ||
-                       size->data.length.unit == CSS_UNIT_EX) {
-               size->data.length.value =
-                       FMUL(size->data.length.value, parent_size->value);
-
-               if (size->data.length.unit == CSS_UNIT_EX) {
-                       size->data.length.value = FMUL(size->data.length.value,
-                                       FLTTOFIX(0.6));
-               }
-
-               size->data.length.unit = parent_size->unit;
-       } else if (size->data.length.unit == CSS_UNIT_PCT) {
-               size->data.length.value = FDIV(FMUL(size->data.length.value,
-                               parent_size->value), FLTTOFIX(100));
-               size->data.length.unit = parent_size->unit;
-       }
-
-       size->status = CSS_FONT_SIZE_DIMENSION;
-
-       return CSS_OK;
-}
-
 static css_error set_libcss_node_data(void *pw, void *n,
                void *libcss_node_data)
 {
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index f4b3e21..30e369b 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -19,6 +19,7 @@ extern "C"
 #include <libcss/functypes.h>
 #include <libcss/properties.h>
 #include <libcss/types.h>
+#include <libcss/unit.h>
 
 struct css_hint;
 struct css_select_handler;
@@ -81,10 +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,
-               css_error (*compute_font_size)(void *pw,
-                               const struct css_hint *parent,
-                               struct css_hint *size),
-               void *pw,
+               const css_unit_ctx *unit_ctx,
                css_computed_style **restrict result);
 
 /******************************************************************************
diff --git a/include/libcss/select.h b/include/libcss/select.h
index ca57456..25317e5 100644
--- a/include/libcss/select.h
+++ b/include/libcss/select.h
@@ -18,6 +18,7 @@ extern "C"
 #include <libcss/hint.h>
 #include <libcss/types.h>
 #include <libcss/computed.h>
+#include <libcss/unit.h>
 
 typedef enum css_pseudo_element {
        CSS_PSEUDO_ELEMENT_NONE         = 0,
@@ -123,9 +124,6 @@ typedef struct css_select_handler {
        css_error (*ua_default_for_property)(void *pw, uint32_t property,
                        css_hint *hint);
 
-       css_error (*compute_font_size)(void *pw, const css_hint *parent,
-                       css_hint *size);
-
        /**
         * Set libcss_node_data on a DOM node.
         *
@@ -221,13 +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_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 d8ac494..2b0dfb7 100644
--- a/include/libcss/types.h
+++ b/include/libcss/types.h
@@ -88,19 +88,16 @@ typedef enum css_unit {
        CSS_UNIT_MM                 = 0x05,
        CSS_UNIT_PT                 = 0x06,
        CSS_UNIT_PC                 = 0x07,
-       CSS_UNIT_CAP                = 0x08,
-       CSS_UNIT_CH                 = 0x09,
-       CSS_UNIT_IC                 = 0x0a,
-       CSS_UNIT_REM                = 0x0b,
-       CSS_UNIT_LH                 = 0x0c,
-       CSS_UNIT_RLH                = 0x0d,
-       CSS_UNIT_VH                 = 0x0e,
-       CSS_UNIT_VW                 = 0x0f,
-       CSS_UNIT_VI                 = 0x10,
-       CSS_UNIT_VB                 = 0x11,
-       CSS_UNIT_VMIN               = 0x12,
-       CSS_UNIT_VMAX               = 0x13,
-       CSS_UNIT_Q                  = 0x14,
+       CSS_UNIT_CH                 = 0x08,
+       CSS_UNIT_REM                = 0x09,
+       CSS_UNIT_LH                 = 0x0a,
+       CSS_UNIT_VH                 = 0x0b,
+       CSS_UNIT_VW                 = 0x0c,
+       CSS_UNIT_VI                 = 0x0d,
+       CSS_UNIT_VB                 = 0x0e,
+       CSS_UNIT_VMIN               = 0x0f,
+       CSS_UNIT_VMAX               = 0x10,
+       CSS_UNIT_Q                  = 0x11,
 
        CSS_UNIT_PCT                = 0x15,     /* Percentage */
 
@@ -116,7 +113,7 @@ typedef enum css_unit {
 } css_unit;
 
 /**
- * Media orienations
+ * Media orientations
  */
 typedef enum css_media_orientation {
        CSS_MEDIA_ORIENTATION_PORTRAIT  = 0,
@@ -237,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
new file mode 100644
index 0000000..67194c1
--- /dev/null
+++ b/include/libcss/unit.h
@@ -0,0 +1,156 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ *                http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <j...@netsurf-browser.org>
+ */
+
+#ifndef libcss_unit_h_
+#define libcss_unit_h_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libcss/types.h>
+
+/**
+ * Client callback for font measuring.
+ *
+ * \param[in]  pw     Client data.
+ * \param[in]  style  Style to measure font for, or NULL.
+ * \param[in]  unit   Either CSS_UNIT_EX, or CSS_UNIT_CH.
+ * \return length in CSS pixels.
+ */
+typedef css_fixed (*css_unit_len_measure)(
+               void *pw,
+               const css_computed_style *style,
+               const css_unit unit);
+
+/**
+ * LibCSS unit conversion context.
+ *
+ * The client callback is optional.  It is used for measuring "ch"
+ * (glyph '0' advance) and "ex" (height of the letter 'x') units.
+ * If a NULL pointer is given, LibCSS will use a fixed scaling of
+ * the "em" unit.
+ */
+typedef struct css_unit_ctx {
+       /**
+        * Viewport width in CSS pixels.
+        * Used if unit is vh, vw, vi, vb, vmin, or vmax.
+        */
+       css_fixed viewport_width;
+       /**
+        * Viewport height in CSS pixels.
+        * Used if unit is vh, vw, vi, vb, vmin, or vmax.
+        */
+       css_fixed viewport_height;
+       /**
+        * Client default font size in CSS pixels.
+        */
+       css_fixed font_size_default;
+       /**
+        * Client minimum font size in CSS pixels.  May be zero.
+        */
+       css_fixed font_size_minimum;
+       /**
+        * DPI of the device the style is selected for.
+        */
+       css_fixed device_dpi;
+       /**
+        * Computed style for the document root element, needed for rem units.
+        * May be NULL, in which case font_size_default is used instead, as
+        * would be the case if rem unit is used on the root element.
+        */
+       const css_computed_style *root_style;
+       /**
+        * Optional client private word for measure callback.
+        */
+       void *pw;
+       /**
+        * Optional client callback for font measuring.
+        */
+       const css_unit_len_measure measure;
+} css_unit_ctx;
+
+/**
+ * Convert css pixels to physical pixels.
+ *
+ * \param[in] css_pixels  Length in css pixels.
+ * \param[in] device_dpi  Device dots per inch.
+ * \return Length in device pixels.
+ */
+static inline css_fixed css_unit_css2device_px(
+               const css_fixed css_pixels,
+               const css_fixed device_dpi)
+{
+       return FDIV(FMUL(css_pixels, device_dpi), F_96);
+}
+
+/**
+ * Convert device pixels to css pixels.
+ *
+ * \param[in] device_pixels  Length in physical pixels.
+ * \param[in] device_dpi     Device dots per inch.
+ * \return Length in css pixels.
+ */
+static inline css_fixed css_unit_device2css_px(
+               const css_fixed device_pixels,
+               const css_fixed device_dpi)
+{
+       return FDIV(FMUL(device_pixels, F_96), device_dpi);
+}
+
+/**
+ * Convert a length to points (pt).
+ *
+ * \param[in]  style   Style to perform conversion for or NULL.
+ * \param[in]  ctx     Length unit conversion context.
+ * \param[in]  length  Length to convert.
+ * \param[in]  unit    Current unit of length.
+ * \return A length in points.
+ */
+css_fixed css_unit_font_size_len2pt(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit);
+
+/**
+ * Convert a length to CSS pixels.
+ *
+ * \param[in]  style   Style to perform conversion for or NULL.
+ * \param[in]  ctx     Length unit conversion context.
+ * \param[in]  length  Length to convert.
+ * \param[in]  unit    Current unit of length.
+ * \return A length in CSS pixels.
+ */
+css_fixed css_unit_len2css_px(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit);
+
+/**
+ * Convert a length to device pixels.
+ *
+ * \param[in]  style   Style to perform conversion for or NULL.
+ * \param[in]  ctx     Length unit conversion context.
+ * \param[in]  length  Length to convert.
+ * \param[in]  unit    Current unit of length.
+ * \return A length in device pixels.
+ */
+css_fixed css_unit_len2device_px(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7518281..7f5ea9d 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -34,19 +34,16 @@ typedef enum unit {
        UNIT_MM   = (1u << 8) + 5,
        UNIT_PT   = (1u << 8) + 6,
        UNIT_PC   = (1u << 8) + 7,
-       UNIT_CAP  = (1u << 8) + 8,
-       UNIT_CH   = (1u << 8) + 9,
-       UNIT_IC   = (1u << 8) + 10,
-       UNIT_REM  = (1u << 8) + 11,
-       UNIT_LH   = (1u << 8) + 12,
-       UNIT_RLH  = (1u << 8) + 13,
-       UNIT_VH   = (1u << 8) + 14,
-       UNIT_VW   = (1u << 8) + 15,
-       UNIT_VI   = (1u << 8) + 16,
-       UNIT_VB   = (1u << 8) + 17,
-       UNIT_VMIN = (1u << 8) + 18,
-       UNIT_VMAX = (1u << 8) + 19,
-       UNIT_Q    = (1u << 8) + 20,
+       UNIT_CH   = (1u << 8) + 8,
+       UNIT_REM  = (1u << 8) + 9,
+       UNIT_LH   = (1u << 8) + 10,
+       UNIT_VH   = (1u << 8) + 11,
+       UNIT_VW   = (1u << 8) + 12,
+       UNIT_VI   = (1u << 8) + 13,
+       UNIT_VB   = (1u << 8) + 14,
+       UNIT_VMIN = (1u << 8) + 15,
+       UNIT_VMAX = (1u << 8) + 16,
+       UNIT_Q    = (1u << 8) + 17,
 
        UNIT_PCT = (1 << 9),
 
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 681c613..5010242 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -27,12 +27,9 @@ static inline uint32_t css__to_parse_unit(css_unit u)
        case CSS_UNIT_MM:   return UNIT_MM;
        case CSS_UNIT_PT:   return UNIT_PT;
        case CSS_UNIT_PC:   return UNIT_PC;
-       case CSS_UNIT_CAP:  return UNIT_CAP;
        case CSS_UNIT_CH:   return UNIT_CH;
-       case CSS_UNIT_IC:   return UNIT_IC;
        case CSS_UNIT_REM:  return UNIT_REM;
        case CSS_UNIT_LH:   return UNIT_LH;
-       case CSS_UNIT_RLH:  return UNIT_RLH;
        case CSS_UNIT_VH:   return UNIT_VH;
        case CSS_UNIT_VW:   return UNIT_VW;
        case CSS_UNIT_VI:   return UNIT_VI;
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 707a22b..1e184f8 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1032,12 +1032,8 @@ css_error css__parse_unit_keyword(const char *ptr, 
size_t len, uint32_t *unit)
                        *unit = UNIT_DEG;
                else if (strncasecmp(ptr, "rad", 3) == 0)
                        *unit = UNIT_RAD;
-               else if (strncasecmp(ptr, "cap", 3) == 0)
-                       *unit = UNIT_CAP;
                else if (strncasecmp(ptr, "rem", 3) == 0)
                        *unit = UNIT_REM;
-               else if (strncasecmp(ptr, "rlh", 3) == 0)
-                       *unit = UNIT_RLH;
                else if (strncasecmp(ptr, "dpi", 3) == 0)
                        *unit = UNIT_DPI;
                else
@@ -1065,8 +1061,6 @@ css_error css__parse_unit_keyword(const char *ptr, size_t 
len, uint32_t *unit)
                        *unit = UNIT_PC;
                else if (strncasecmp(ptr, "ch", 2) == 0)
                        *unit = UNIT_CH;
-               else if (strncasecmp(ptr, "ic", 2) == 0)
-                       *unit = UNIT_IC;
                else if (strncasecmp(ptr, "lh", 2) == 0)
                        *unit = UNIT_LH;
                else if (strncasecmp(ptr, "vh", 2) == 0)
diff --git a/src/select/Makefile b/src/select/Makefile
index 8b47673..f5ddb18 100644
--- a/src/select/Makefile
+++ b/src/select/Makefile
@@ -2,6 +2,6 @@
 select_generator:
        python3 src/select/select_generator.py
 
-DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c font_face.c 
format_list_style.c
+DIR_SOURCES := arena.c computed.c dispatch.c hash.c select.c font_face.c 
format_list_style.c unit.c
 
 include $(NSBUILD)/Makefile.subdir
diff --git a/src/select/computed.c b/src/select/computed.c
index a1b345b..c019590 100644
--- a/src/select/computed.c
+++ b/src/select/computed.c
@@ -12,6 +12,7 @@
 #include "select/dispatch.h"
 #include "select/propget.h"
 #include "select/propset.h"
+#include "select/unit.h"
 #include "utils/utils.h"
 
 static css_error compute_absolute_color(css_computed_style *style,
@@ -247,9 +248,7 @@ css_error css__computed_style_initialise(css_computed_style 
*style,
 css_error css_computed_style_compose(
                const css_computed_style *restrict parent,
                const css_computed_style *restrict child,
-               css_error (*compute_font_size)(void *pw,
-                       const css_hint *parent, css_hint *size),
-               void *pw,
+               const css_unit_ctx *unit_ctx,
                css_computed_style **restrict result)
 {
        css_computed_style *composed;
@@ -275,8 +274,7 @@ css_error css_computed_style_compose(
        }
 
        /* Finally, compute absolute values for everything */
-       error = css__compute_absolute_values(parent, composed,
-                       compute_font_size, pw);
+       error = css__compute_absolute_values(parent, composed, unit_ctx);
        if (error != CSS_OK) {
                return error;
        }
@@ -1087,31 +1085,36 @@ uint8_t css_computed_order(const css_computed_style 
*style,
  *
  * \param parent             Parent style, or NULL for tree root
  * \param style              Computed style to process
- * \param compute_font_size  Callback to calculate an absolute font-size
- * \param pw                 Private word for callback
+ * \param unit_ctx       Client length conversion context.
  * \return CSS_OK on success.
  */
 css_error css__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),
-               void *pw)
+               const css_unit_ctx *unit_ctx)
 {
+       css_hint_length *ref_length = NULL;
        css_hint psize, size, ex_size;
        css_error error;
 
-       /* Ensure font-size is absolute */
+       /* Get reference font-size for relative sizes. */
        if (parent != NULL) {
                psize.status = get_font_size(parent,
                                &psize.data.length.value,
                                &psize.data.length.unit);
+               if (psize.status != CSS_FONT_SIZE_DIMENSION) {
+                       return CSS_BADPARM;
+               }
+               ref_length = &psize.data.length;
        }
 
        size.status = get_font_size(style,
                        &size.data.length.value,
                        &size.data.length.unit);
 
-       error = compute_font_size(pw, parent != NULL ? &psize : NULL, &size);
+       error = css_unit_compute_absolute_font_size(ref_length,
+                       unit_ctx->root_style,
+                       unit_ctx->font_size_default,
+                       &size);
        if (error != CSS_OK)
                return error;
 
@@ -1125,7 +1128,12 @@ css_error css__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 = css_unit_compute_absolute_font_size(
+                       &size.data.length,
+                       unit_ctx->root_style,
+                       unit_ctx->font_size_default,
+                       &ex_size);
        if (error != CSS_OK)
                return error;
 
diff --git a/src/select/computed.h b/src/select/computed.h
index c926cec..a4bd23d 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -10,6 +10,8 @@
 
 #include <libcss/computed.h>
 #include <libcss/hint.h>
+#include <libcss/unit.h>
+
 #include "autogenerated_computed.h"
 
 /**
@@ -35,8 +37,6 @@ css_error css__computed_style_initialise(css_computed_style 
*style,
 
 css_error css__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),
-               void *pw);
+               const css_unit_ctx *unit_ctx);
 
 #endif
diff --git a/src/select/hash.c b/src/select/hash.c
index 4b11702..16aebf7 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -8,6 +8,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <libcss/hint.h>
+
 #include "stylesheet.h"
 #include "select/hash.h"
 #include "select/mq.h"
@@ -368,7 +370,7 @@ css_error css__selector_hash_find(css_selector_hash *hash,
                                                head->sel_chain_bloom,
                                                req->node_bloom) &&
                                    mq_rule_good_for_media(head->sel->rule,
-                                               req->media)) {
+                                               req->unit_ctx, req->media)) {
                                        /* Found a match */
                                        break;
                                }
@@ -447,6 +449,7 @@ css_error 
css__selector_hash_find_by_class(css_selector_hash *hash,
                                                        req->uni) &&
                                            mq_rule_good_for_media(
                                                        head->sel->rule,
+                                                       req->unit_ctx,
                                                        req->media)) {
                                                /* Found a match */
                                                break;
@@ -527,6 +530,7 @@ css_error css__selector_hash_find_by_id(css_selector_hash 
*hash,
                                                        req->uni) &&
                                            mq_rule_good_for_media(
                                                        head->sel->rule,
+                                                       req->unit_ctx,
                                                        req->media)) {
                                                /* Found a match */
                                                break;
@@ -577,7 +581,7 @@ css_error 
css__selector_hash_find_universal(css_selector_hash *hash,
                                        head->sel_chain_bloom,
                                        req->node_bloom) &&
                            mq_rule_good_for_media(head->sel->rule,
-                                       req->media)) {
+                                       req->unit_ctx, req->media)) {
                                /* Found a match */
                                break;
                        }
@@ -920,7 +924,7 @@ css_error _iterate_elements(
                                                head->sel_chain_bloom,
                                                req->node_bloom) &&
                                    mq_rule_good_for_media(head->sel->rule,
-                                               req->media)) {
+                                               req->unit_ctx, req->media)) {
                                        /* Found a match */
                                        break;
                                }
@@ -980,6 +984,7 @@ css_error _iterate_classes(
                                                        req->uni) &&
                                            mq_rule_good_for_media(
                                                        head->sel->rule,
+                                                       req->unit_ctx,
                                                        req->media)) {
                                                /* Found a match */
                                                break;
@@ -1041,6 +1046,7 @@ css_error _iterate_ids(
                                                        req->uni) &&
                                            mq_rule_good_for_media(
                                                        head->sel->rule,
+                                                       req->unit_ctx,
                                                        req->media)) {
                                                /* Found a match */
                                                break;
@@ -1084,7 +1090,7 @@ css_error _iterate_universal(
                                        head->sel_chain_bloom,
                                        req->node_bloom) &&
                            mq_rule_good_for_media(head->sel->rule,
-                                       req->media)) {
+                                       req->unit_ctx, req->media)) {
                                /* Found a match */
                                break;
                        }
diff --git a/src/select/hash.h b/src/select/hash.h
index aecf15a..df4102f 100644
--- a/src/select/hash.h
+++ b/src/select/hash.h
@@ -10,6 +10,7 @@
 
 #include <libwapcaplet/libwapcaplet.h>
 
+#include <libcss/unit.h>
 #include <libcss/errors.h>
 #include <libcss/functypes.h>
 
@@ -26,6 +27,7 @@ struct css_hash_selection_requirments {
        lwc_string *id;                 /* Name of id, or NULL */
        lwc_string *uni;                /* Universal element string "*" */
        const css_media *media;         /* Media spec we're selecting for */
+       const css_unit_ctx *unit_ctx;   /* Document unit conversion context. */
        const css_bloom *node_bloom;    /* Node's bloom filter */
 };
 
diff --git a/src/select/helpers.h b/src/select/helpers.h
index ba2e3be..19ff7de 100644
--- a/src/select/helpers.h
+++ b/src/select/helpers.h
@@ -22,12 +22,9 @@ static inline css_unit css__to_css_unit(uint32_t u)
        case UNIT_MM:   return CSS_UNIT_MM;
        case UNIT_PT:   return CSS_UNIT_PT;
        case UNIT_PC:   return CSS_UNIT_PC;
-       case UNIT_CAP:  return CSS_UNIT_CAP;
        case UNIT_CH:   return CSS_UNIT_CH;
-       case UNIT_IC:   return CSS_UNIT_IC;
        case UNIT_REM:  return CSS_UNIT_REM;
        case UNIT_LH:   return CSS_UNIT_LH;
-       case UNIT_RLH:  return CSS_UNIT_RLH;
        case UNIT_VH:   return CSS_UNIT_VH;
        case UNIT_VW:   return CSS_UNIT_VW;
        case UNIT_VI:   return CSS_UNIT_VI;
diff --git a/src/select/mq.h b/src/select/mq.h
index 79303e9..a012a7b 100644
--- a/src/select/mq.h
+++ b/src/select/mq.h
@@ -10,113 +10,13 @@
 #define css_select_mq_h_
 
 #include "select/helpers.h"
-
-static inline css_fixed css_len2px(
-               css_fixed length,
-               css_unit unit,
-               const css_media *media)
-{
-       css_fixed px_per_unit;
-
-       switch (unit) {
-       case CSS_UNIT_VI:
-               /* TODO: Assumes writing mode. */
-               unit = CSS_UNIT_VW;
-               break;
-       case CSS_UNIT_VB:
-               /* TODO: Assumes writing mode. */
-               unit = CSS_UNIT_VH;
-               break;
-       case CSS_UNIT_VMIN:
-               unit = (media->height < media->width) ?
-                               CSS_UNIT_VH : CSS_UNIT_VW;
-               break;
-       case CSS_UNIT_VMAX:
-               unit = (media->width > media->height) ?
-                               CSS_UNIT_VH : CSS_UNIT_VW;
-               break;
-       default:
-               break;
-       }
-
-       switch (unit) {
-       case CSS_UNIT_EM:
-       case CSS_UNIT_EX:
-       case CSS_UNIT_CAP:
-       case CSS_UNIT_CH:
-       case CSS_UNIT_IC:
-       {
-               px_per_unit = FDIV(FMUL(media->client_font_size, F_96), F_72);
-
-               /* TODO: Handling these as fixed ratios of CSS_UNIT_EM. */
-               switch (unit) {
-               case CSS_UNIT_EX:
-                       px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.6));
-                       break;
-               case CSS_UNIT_CAP:
-                       px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.9));
-                       break;
-               case CSS_UNIT_CH:
-                       px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.4));
-                       break;
-               case CSS_UNIT_IC:
-                       px_per_unit = FMUL(px_per_unit, FLTTOFIX(1.1));
-                       break;
-               default:
-                       break;
-               }
-       }
-               break;
-       case CSS_UNIT_PX:
-               return length;
-       case CSS_UNIT_IN:
-               px_per_unit = F_96;
-               break;
-       case CSS_UNIT_CM:
-               px_per_unit = FDIV(F_96, FLTTOFIX(2.54));
-               break;
-       case CSS_UNIT_MM:
-               px_per_unit = FDIV(F_96, FLTTOFIX(25.4));
-               break;
-       case CSS_UNIT_Q:
-               px_per_unit = FDIV(F_96, FLTTOFIX(101.6));
-               break;
-       case CSS_UNIT_PT:
-               px_per_unit = FDIV(F_96, F_72);
-               break;
-       case CSS_UNIT_PC:
-               px_per_unit = FDIV(F_96, INTTOFIX(6));
-               break;
-       case CSS_UNIT_REM:
-               px_per_unit = FDIV(FMUL(media->client_font_size, F_96), F_72);
-               break;
-       case CSS_UNIT_RLH:
-               px_per_unit = media->client_line_height;
-               break;
-       case CSS_UNIT_VH:
-               px_per_unit = FDIV(media->height, F_100);
-               break;
-       case CSS_UNIT_VW:
-               px_per_unit = FDIV(media->width, F_100);
-               break;
-       default:
-               px_per_unit = 0;
-               break;
-       }
-
-       /* Ensure we round px_per_unit to the nearest whole number of pixels:
-        * the use of FIXTOINT() below will truncate. */
-       px_per_unit += F_0_5;
-
-       /* Calculate total number of pixels */
-       return FMUL(length, TRUNCATEFIX(px_per_unit));
-}
+#include "select/unit.h"
 
 static inline bool mq_match_feature_range_length_op1(
                css_mq_feature_op op,
                const css_mq_value *value,
                const css_fixed client_len,
-               const css_media *media)
+               const css_unit_ctx *unit_ctx)
 {
        css_fixed v;
 
@@ -125,9 +25,9 @@ static inline bool mq_match_feature_range_length_op1(
        }
 
        if (value->data.dim.unit != UNIT_PX) {
-               v = css_len2px(value->data.dim.len,
-                               css__to_css_unit(value->data.dim.unit),
-                               media);
+               v = css_unit_len2px_mq(unit_ctx,
+                               value->data.dim.len,
+                               css__to_css_unit(value->data.dim.unit));
        } else {
                v = value->data.dim.len;
        }
@@ -148,7 +48,7 @@ static inline bool mq_match_feature_range_length_op2(
                css_mq_feature_op op,
                const css_mq_value *value,
                const css_fixed client_len,
-               const css_media *media)
+               const css_unit_ctx *unit_ctx)
 {
        css_fixed v;
 
@@ -160,9 +60,9 @@ static inline bool mq_match_feature_range_length_op2(
        }
 
        if (value->data.dim.unit != UNIT_PX) {
-               v = css_len2px(value->data.dim.len,
-                               css__to_css_unit(value->data.dim.unit),
-                               media);
+               v = css_unit_len2px_mq(unit_ctx,
+                               value->data.dim.len,
+                               css__to_css_unit(value->data.dim.unit));
        } else {
                v = value->data.dim.len;
        }
@@ -181,31 +81,33 @@ static inline bool mq_match_feature_range_length_op2(
 /**
  * Match media query features.
  *
- * \param[in] feat   Condition to match.
- * \param[in] media  Current media spec, to check against feat.
+ * \param[in] feat      Condition to match.
+ * \param[in] unit_ctx  Current unit conversion context.
+ * \param[in] media     Current media spec, to check against feat.
  * \return true if condition matches, otherwise false.
  */
 static inline bool mq_match_feature(
                const css_mq_feature *feat,
+               const css_unit_ctx *unit_ctx,
                const css_media *media)
 {
        /* TODO: Use interned string for comparison. */
        if (strcmp(lwc_string_data(feat->name), "width") == 0) {
                if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
-                                       media->width, media)) {
+                                       media->width, unit_ctx)) {
                        return false;
                }
                return mq_match_feature_range_length_op2(feat->op2,
-                                       &feat->value2, media->width, media);
+                               &feat->value2, media->width, unit_ctx);
 
        } else if (strcmp(lwc_string_data(feat->name), "height") == 0) {
                if (!mq_match_feature_range_length_op1(feat->op, &feat->value,
-                               media->height, media)) {
+                               media->height, unit_ctx)) {
                        return false;
                }
 
                return mq_match_feature_range_length_op2(feat->op2,
-                               &feat->value2, media->height, media);
+                               &feat->value2, media->height, unit_ctx);
        }
 
        /* TODO: Look at other feature names. */
@@ -216,12 +118,14 @@ static inline bool mq_match_feature(
 /**
  * Match media query conditions.
  *
- * \param[in] cond   Condition to match.
- * \param[in] media  Current media spec, to check against cond.
+ * \param[in] cond      Condition to match.
+ * \param[in] unit_ctx  Current unit conversion context.
+ * \param[in] media     Current media spec, to check against cond.
  * \return true if condition matches, otherwise false.
  */
 static inline bool mq_match_condition(
                const css_mq_cond *cond,
+               const css_unit_ctx *unit_ctx,
                const css_media *media)
 {
        bool matched = !cond->op;
@@ -230,11 +134,13 @@ static inline bool mq_match_condition(
                bool part_matched;
                if (cond->parts[i]->type == CSS_MQ_FEATURE) {
                        part_matched = mq_match_feature(
-                                       cond->parts[i]->data.feat, media);
+                                       cond->parts[i]->data.feat,
+                                       unit_ctx, media);
                } else {
                        assert(cond->parts[i]->type == CSS_MQ_COND);
                        part_matched = mq_match_condition(
-                                       cond->parts[i]->data.cond, media);
+                                       cond->parts[i]->data.cond,
+                                       unit_ctx, media);
                }
 
                if (cond->op) {
@@ -261,19 +167,22 @@ static inline bool mq_match_condition(
  * If anything in the list matches, the list matches.  If none match
  * it doesn't match.
  *
- * \param[in] m      Media query list.
- * \param[in] media  Current media spec, to check against m.
+ * \param[in] m         Media query list.
+ * \param[in] unit_ctx  Current unit conversion context.
+ * \param[in] media     Current media spec, to check against m.
  * \return true if media query list matches media
  */
 static inline bool mq__list_match(
                const css_mq_query *m,
+               const css_unit_ctx *unit_ctx,
                const css_media *media)
 {
        for (; m != NULL; m = m->next) {
                /* Check type */
                if (!!(m->type & media->type) != m->negate_type) {
                        if (m->cond == NULL ||
-                                       mq_match_condition(m->cond, media)) {
+                                       mq_match_condition(m->cond,
+                                                       unit_ctx, media)) {
                                /* We have a match, no need to look further. */
                                return true;
                        }
@@ -286,11 +195,15 @@ static inline bool mq__list_match(
 /**
  * Test whether the rule applies for current media.
  *
- * \param rule   Rule to test
- * \param media  Current media spec
+ * \param rule      Rule to test
+ * \param unit_ctx  Current unit conversion context.
+ * \param media     Current media spec
  * \return true iff chain's rule applies for media
  */
-static inline bool mq_rule_good_for_media(const css_rule *rule, const 
css_media *media)
+static inline bool mq_rule_good_for_media(
+               const css_rule *rule,
+               const css_unit_ctx *unit_ctx,
+               const css_media *media)
 {
        bool applies = true;
        const css_rule *ancestor = rule;
@@ -299,7 +212,7 @@ static inline bool mq_rule_good_for_media(const css_rule 
*rule, const css_media
                const css_rule_media *m = (const css_rule_media *) ancestor;
 
                if (ancestor->type == CSS_RULE_MEDIA) {
-                       applies = mq__list_match(m->media, media);
+                       applies = mq__list_match(m->media, unit_ctx, media);
                        if (applies == false) {
                                break;
                        }
diff --git a/src/select/select.c b/src/select/select.c
index f6efbfe..b050c0c 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -23,6 +23,7 @@
 #include "select/propset.h"
 #include "select/font_face.h"
 #include "select/select.h"
+#include "select/unit.h"
 #include "utils/parserutilserror.h"
 #include "utils/utils.h"
 
@@ -98,6 +99,7 @@ typedef struct css_select_font_faces_list {
 typedef struct css_select_font_faces_state {
        lwc_string *font_family;
        const css_media *media;
+       const css_unit_ctx *unit_ctx;
 
        css_select_font_faces_list ua_font_faces;
        css_select_font_faces_list user_font_faces;
@@ -1051,12 +1053,13 @@ static void css_select__finalise_selection_state(
 /**
  * Initialise a selection state.
  *
- * \param[in]  state    The selection state to initialise
- * \param[in]  node     The node we are selecting for.
- * \param[in]  parent   The node's parent node, or NULL.
- * \param[in]  media    The media specification we're selecting for.
- * \param[in]  handler  The client selection callback table.
- * \param[in]  pw       The client private data, passsed out to callbacks.
+ * \param[in]  state         The selection state to initialise
+ * \param[in]  node          The node we are selecting for.
+ * \param[in]  parent        The node's parent node, or NULL.
+ * \param[in]  media         The media specification we're selecting for.
+ * \param[in]  unit_ctx  Unit conversion context.
+ * \param[in]  handler       The client selection callback table.
+ * \param[in]  pw            The client private data, passsed out to callbacks.
  * \return CSS_OK or appropriate error otherwise.
  */
 static css_error css_select__initialise_selection_state(
@@ -1064,6 +1067,7 @@ static css_error css_select__initialise_selection_state(
                void *node,
                void *parent,
                const css_media *media,
+               const css_unit_ctx *unit_ctx,
                css_select_handler *handler,
                void *pw)
 {
@@ -1074,6 +1078,7 @@ static css_error css_select__initialise_selection_state(
        memset(state, 0, sizeof(*state));
        state->node = node;
        state->media = media;
+       state->unit_ctx = unit_ctx;
        state->handler = handler;
        state->pw = pw;
        state->next_reject = state->reject_cache +
@@ -1164,6 +1169,7 @@ failed:
  *
  * \param ctx             Selection context to use
  * \param node            Node to select style for
+ * \param unit_ctx        Context for length unit conversions.
  * \param media           Currently active media specification
  * \param inline_style    Corresponding inline style for node, or NULL
  * \param handler         Dispatch table of handler functions
@@ -1181,6 +1187,7 @@ failed:
  * update the fully computed style for a node when layout changes.
  */
 css_error css_select_style(css_select_ctx *ctx, void *node,
+               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)
@@ -1201,7 +1208,7 @@ css_error css_select_style(css_select_ctx *ctx, void 
*node,
                return error;
 
        error = css_select__initialise_selection_state(
-                       &state, node, parent, media, handler, pw);
+                       &state, node, parent, media, unit_ctx, handler, pw);
        if (error != CSS_OK)
                return error;
 
@@ -1266,7 +1273,7 @@ css_error css_select_style(css_select_ctx *ctx, void 
*node,
        for (i = 0; i < ctx->n_sheets; i++) {
                const css_select_sheet s = ctx->sheets[i];
 
-               if (mq__list_match(s.media, media) &&
+               if (mq__list_match(s.media, unit_ctx, media) &&
                                s.sheet->disabled == false) {
                        error = select_from_sheet(ctx, s.sheet,
                                        s.origin, &state);
@@ -1353,7 +1360,7 @@ css_error css_select_style(css_select_ctx *ctx, void 
*node,
                /* Only compute absolute values for the base element */
                error = css__compute_absolute_values(NULL,
                                state.results->styles[CSS_PSEUDO_ELEMENT_NONE],
-                               handler->compute_font_size, pw);
+                               unit_ctx);
                if (error != CSS_OK)
                        goto cleanup;
        }
@@ -1417,12 +1424,15 @@ css_error css_select_results_destroy(css_select_results 
*results)
  *
  * \param ctx          Selection context
  * \param media        Currently active media spec
+ * \param unit_ctx     Current unit conversion context.
  * \param font_family  Font family to search for
  * \param result       Pointer to location to receive result
  * \return CSS_OK on success, appropriate error otherwise.
  */
 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)
 {
        uint32_t i;
@@ -1436,6 +1446,7 @@ css_error css_select_font_faces(css_select_ctx *ctx,
        memset(&state, 0, sizeof(css_select_font_faces_state));
        state.font_family = font_family;
        state.media = media;
+       state.unit_ctx = unit_ctx;
 
        /* Iterate through the top-level stylesheets, selecting font-faces
         * from those which apply to our current media requirements and
@@ -1443,7 +1454,7 @@ css_error css_select_font_faces(css_select_ctx *ctx,
        for (i = 0; i < ctx->n_sheets; i++) {
                const css_select_sheet s = ctx->sheets[i];
 
-               if (mq__list_match(s.media, media) &&
+               if (mq__list_match(s.media, unit_ctx, media) &&
                                s.sheet->disabled == false) {
                        error = select_font_faces_from_sheet(s.sheet,
                                        s.origin, &state);
@@ -1843,6 +1854,7 @@ css_error select_from_sheet(css_select_ctx *ctx, const 
css_stylesheet *sheet,
 
                        if (import->sheet != NULL &&
                                        mq__list_match(import->media,
+                                                       state->unit_ctx,
                                                        state->media)) {
                                /* It's applicable, so process it */
                                if (sp >= IMPORT_STACK_SIZE)
@@ -1886,7 +1898,8 @@ static css_error _select_font_face_from_rule(
                const css_rule_font_face *rule, css_origin origin,
                css_select_font_faces_state *state)
 {
-       if (mq_rule_good_for_media((const css_rule *) rule, state->media)) {
+       if (mq_rule_good_for_media((const css_rule *) rule,
+                       state->unit_ctx, state->media)) {
                bool correct_family = false;
 
                if (lwc_string_isequal(
@@ -1951,6 +1964,7 @@ static css_error select_font_faces_from_sheet(
 
                        if (import->sheet != NULL &&
                                        mq__list_match(import->media,
+                                                       state->unit_ctx,
                                                        state->media)) {
                                /* It's applicable, so process it */
                                if (sp >= IMPORT_STACK_SIZE)
@@ -2098,6 +2112,7 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx,
 
        /* Set up general selector chain requirments */
        req.media = state->media;
+       req.unit_ctx = state->unit_ctx;
        req.node_bloom = state->node_data->bloom;
        req.uni = ctx->universal;
 
diff --git a/src/select/select.h b/src/select/select.h
index dc9aa4a..0a16b12 100644
--- a/src/select/select.h
+++ b/src/select/select.h
@@ -64,6 +64,7 @@ struct css_node_data {
 typedef struct css_select_state {
        void *node;                     /* Node we're selecting for */
        const css_media *media;         /* Currently active media spec */
+       const css_unit_ctx *unit_ctx;   /* Unit conversion context. */
        css_select_results *results;    /* Result set to populate */
 
        css_pseudo_element current_pseudo;      /* Current pseudo element */
diff --git a/src/select/unit.c b/src/select/unit.c
new file mode 100644
index 0000000..9129d72
--- /dev/null
+++ b/src/select/unit.c
@@ -0,0 +1,511 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ *                http://www.opensource.org/licenses/mit-license.php
+ *
+ * Copyright 2021 Michael Drake <t...@netsurf-browser.org>
+ */
+
+#include <libcss/stylesheet.h>
+
+#include "utils/utils.h"
+
+#include "propget.h"
+#include "unit.h"
+
+/**
+ * Map viewport-relative length units to either vh or vw.
+ *
+ * Non-viewport-relative units are unchanged.
+ *
+ * \param[in] style            Reference style.
+ * \param[in] viewport_height  Viewport height in px.
+ * \param[in] viewport_width   Viewport width in px.
+ * \param[in] unit             Unit to map.
+ * \return the mapped unit.
+ */
+static inline css_unit css_unit__map_viewport_units(
+               const css_computed_style *style,
+               const css_fixed viewport_height,
+               const css_fixed viewport_width,
+               const css_unit unit)
+{
+       switch (unit) {
+       case CSS_UNIT_VI:
+               return (style != NULL && get_writing_mode(style) !=
+                               CSS_WRITING_MODE_HORIZONTAL_TB) ?
+                               CSS_UNIT_VH : CSS_UNIT_VW;
+
+       case CSS_UNIT_VB:
+               return (style != NULL && get_writing_mode(style) !=
+                               CSS_WRITING_MODE_HORIZONTAL_TB) ?
+                               CSS_UNIT_VW : CSS_UNIT_VH;
+
+       case CSS_UNIT_VMIN:
+               return (viewport_height < viewport_width) ?
+                               CSS_UNIT_VH : CSS_UNIT_VW;
+
+       case CSS_UNIT_VMAX:
+               return (viewport_height > viewport_width) ?
+                               CSS_UNIT_VH : CSS_UNIT_VW;
+
+       default:
+               return unit;
+       }
+}
+
+/**
+ * Convert an absolute length to points (pt).
+ *
+ * \param[in] style            Style to get font-size from, or NULL.
+ * \param[in] viewport_height  Client viewport height.
+ * \param[in] viewport_width   Client viewport width.
+ * \param[in] length           Length to convert.
+ * \param[in] unit             Current unit of length.
+ * \return length in points (pt).
+ */
+static inline css_fixed css_unit__absolute_len2pt(
+               const css_computed_style *style,
+               const css_fixed viewport_height,
+               const css_fixed viewport_width,
+               const css_fixed length,
+               const css_unit unit)
+{
+       /* Length must not be relative */
+       assert(unit != CSS_UNIT_EM &&
+              unit != CSS_UNIT_EX &&
+              unit != CSS_UNIT_CH &&
+              unit != CSS_UNIT_REM);
+
+       switch (css_unit__map_viewport_units(style,
+                       viewport_height,
+                       viewport_width,
+                       unit)) {
+       case CSS_UNIT_PX:
+               return FDIV(FMUL(length, F_72), F_96);
+
+       case CSS_UNIT_IN:
+               return FMUL(length, F_72);
+
+       case CSS_UNIT_CM:
+               return FMUL(length, FDIV(F_72, FLTTOFIX(2.54)));
+
+       case CSS_UNIT_MM:
+               return FMUL(length, FDIV(F_72, FLTTOFIX(25.4)));
+
+       case CSS_UNIT_Q:
+               return FMUL(length, FDIV(F_72, FLTTOFIX(101.6)));
+
+       case CSS_UNIT_PT:
+               return length;
+
+       case CSS_UNIT_PC:
+               return FMUL(length, INTTOFIX(12));
+
+       case CSS_UNIT_VH:
+               return FDIV(FMUL(FDIV(FMUL(length, viewport_height), F_100),
+                               F_72), F_96);
+
+       case CSS_UNIT_VW:
+               return FDIV(FMUL(FDIV(FMUL(length, viewport_width), F_100),
+                               F_72), F_96);
+
+       default:
+               return 0;
+       }
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_font_size_len2pt(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit)
+{
+       return css_unit__absolute_len2pt(
+                       style,
+                       ctx->viewport_height,
+                       ctx->viewport_width,
+                       length,
+                       unit);
+}
+
+/**
+ * Get font size from a style in CSS pixels.
+ *
+ * The style should have font size in absolute units.
+ *
+ * \param[in] style              Style to get font-size from, or NULL.
+ * \param[in] font_size_default  Client font size for NULL style.
+ * \param[in] font_size_minimum  Client minimum font size clamp.
+ * \param[in] viewport_height    Client viewport height.
+ * \param[in] viewport_width     Client viewport width.
+ * \return font-size in CSS pixels.
+ */
+static inline css_fixed css_unit__font_size_px(
+               const css_computed_style *style,
+               const css_fixed font_size_default,
+               const css_fixed font_size_minimum,
+               const css_fixed viewport_height,
+               const css_fixed viewport_width)
+{
+       css_fixed font_length = 0;
+       css_unit font_unit = CSS_UNIT_PT;
+
+       if (style == NULL) {
+               return font_size_default;
+       }
+
+       get_font_size(style, &font_length, &font_unit);
+
+       if (font_unit != CSS_UNIT_PX) {
+               font_length = css_unit__absolute_len2pt(style,
+                               viewport_height,
+                               viewport_width,
+                               font_length,
+                               font_unit);
+
+               /* Convert from pt to CSS pixels.*/
+               font_length = FDIV(FMUL(font_length, F_96), F_72);
+       }
+
+       /* Clamp to configured minimum */
+       if (font_length < font_size_minimum) {
+               font_length = font_size_minimum;
+       }
+
+       return font_length;
+}
+
+/**
+ * Get the number of CSS pixels for a given unit.
+ *
+ * \param[in] measure            Client callback for font measuring.
+ * \param[in] ref_style          Reference style.  (Element or parent, or 
NULL).
+ * \param[in] root_style         Root element style or NULL.
+ * \param[in] font_size_default  Client default font size in CSS pixels.
+ * \param[in] font_size_minimum  Client minimum font size in CSS pixels.
+ * \param[in] viewport_height    Viewport height in CSS pixels.
+ * \param[in] viewport_width     Viewport width in CSS pixels.
+ * \param[in] unit               The unit to convert from.
+ * \param[in] pw                 Client private word for measure callback.
+ * \return Number of CSS pixels equivalent to the given unit.
+ */
+static inline css_fixed css_unit__px_per_unit(
+               const css_unit_len_measure measure,
+               const css_computed_style *ref_style,
+               const css_computed_style *root_style,
+               const css_fixed font_size_default,
+               const css_fixed font_size_minimum,
+               const css_fixed viewport_height,
+               const css_fixed viewport_width,
+               const css_unit unit,
+               void *pw)
+{
+       switch (css_unit__map_viewport_units(
+                       ref_style,
+                       viewport_height,
+                       viewport_width,
+                       unit)) {
+       case CSS_UNIT_EM:
+               return css_unit__font_size_px(
+                               ref_style,
+                               font_size_default,
+                               font_size_minimum,
+                               viewport_height,
+                               viewport_width);
+
+       case CSS_UNIT_EX:
+               if (measure != NULL) {
+                       return measure(pw, ref_style, CSS_UNIT_EX);
+               }
+               return FMUL(css_unit__font_size_px(
+                               ref_style,
+                               font_size_default,
+                               font_size_minimum,
+                               viewport_height,
+                               viewport_width), FLTTOFIX(0.6));
+
+       case CSS_UNIT_CH:
+               if (measure != NULL) {
+                       return measure(pw, ref_style, CSS_UNIT_CH);
+               }
+               return FMUL(css_unit__font_size_px(
+                               ref_style,
+                               font_size_default,
+                               font_size_minimum,
+                               viewport_height,
+                               viewport_width), FLTTOFIX(0.4));
+
+       case CSS_UNIT_PX:
+               return F_1;
+
+       case CSS_UNIT_IN:
+               return F_96;
+
+       case CSS_UNIT_CM:
+               return FDIV(F_96, FLTTOFIX(2.54));
+
+       case CSS_UNIT_MM:
+               return FDIV(F_96, FLTTOFIX(25.4));
+
+       case CSS_UNIT_Q:
+               return FDIV(F_96, FLTTOFIX(101.6));
+
+       case CSS_UNIT_PT:
+               return FDIV(F_96, F_72);
+
+       case CSS_UNIT_PC:
+               return FDIV(F_96, INTTOFIX(6));
+
+       case CSS_UNIT_REM:
+               return css_unit__font_size_px(
+                               root_style,
+                               font_size_default,
+                               font_size_minimum,
+                               viewport_height,
+                               viewport_width);
+
+       case CSS_UNIT_VH:
+               return FDIV(viewport_width, F_100);
+
+       case CSS_UNIT_VW:
+               return FDIV(viewport_height, F_100);
+
+       default:
+               return 0;
+       }
+}
+
+/* Exported function, documented in unit.h. */
+css_fixed css_unit_len2px_mq(
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit)
+{
+       /* In the media query context there is no reference or root element
+        * style, so these are hard-coded to NULL. */
+       css_fixed px_per_unit = css_unit__px_per_unit(
+                       ctx->measure,
+                       NULL,
+                       NULL,
+                       ctx->font_size_default,
+                       ctx->font_size_minimum,
+                       ctx->viewport_height,
+                       ctx->viewport_width,
+                       unit,
+                       ctx->pw);
+
+       /* Ensure we round px_per_unit to the nearest whole number of pixels:
+        * the use of FIXTOINT() below will truncate. */
+       px_per_unit += F_0_5;
+
+       /* Calculate total number of pixels */
+       return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_len2css_px(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit)
+{
+       css_fixed px_per_unit = css_unit__px_per_unit(
+                       ctx->measure,
+                       style,
+                       ctx->root_style,
+                       ctx->font_size_default,
+                       ctx->font_size_minimum,
+                       ctx->viewport_height,
+                       ctx->viewport_width,
+                       unit,
+                       ctx->pw);
+
+       /* Ensure we round px_per_unit to the nearest whole number of pixels:
+        * the use of FIXTOINT() below will truncate. */
+       px_per_unit += F_0_5;
+
+       /* Calculate total number of pixels */
+       return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/* Exported function, documented in libcss/unit.h. */
+css_fixed css_unit_len2device_px(
+               const css_computed_style *style,
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit)
+{
+       css_fixed px_per_unit = css_unit__px_per_unit(
+                       ctx->measure,
+                       style,
+                       ctx->root_style,
+                       ctx->font_size_default,
+                       ctx->font_size_minimum,
+                       ctx->viewport_height,
+                       ctx->viewport_width,
+                       unit,
+                       ctx->pw);
+
+       px_per_unit = css_unit_css2device_px(px_per_unit, ctx->device_dpi);
+
+       /* Ensure we round px_per_unit to the nearest whole number of pixels:
+        * the use of FIXTOINT() below will truncate. */
+       px_per_unit += F_0_5;
+
+       /* Calculate total number of pixels */
+       return FMUL(length, TRUNCATEFIX(px_per_unit));
+}
+
+/**
+ * Get font size from a computed style.
+ *
+ * The computed style will have font-size with an absolute unit.
+ * If no computed style is given, the client default font-size will be 
returned.
+ *
+ * \param[in] style              Reference style.  (Element or parent, or 
NULL).
+ * \param[in] font_size_default  Client default font size in CSS pixels.
+ * \return The font size in absolute units.
+ */
+static inline css_hint_length css_unit__get_font_size(
+               const css_computed_style *style,
+               css_fixed font_size_default)
+{
+       css_hint_length size;
+
+       if (style == NULL) {
+               size.value = font_size_default;
+               size.unit = CSS_UNIT_PX;
+       } else {
+               enum css_font_size_e status = get_font_size(
+                               style, &size.value, &size.unit);
+
+               UNUSED(status);
+
+               assert(status == CSS_FONT_SIZE_DIMENSION);
+               assert(size.unit != CSS_UNIT_EM);
+               assert(size.unit != CSS_UNIT_EX);
+               assert(size.unit != CSS_UNIT_PCT);
+       }
+
+       return size;
+}
+
+/* Exported function, documented in unit.h. */
+css_error css_unit_compute_absolute_font_size(
+               const css_hint_length *ref_length,
+               const css_computed_style *root_style,
+               css_fixed font_size_default,
+               css_hint *size)
+{
+       css_hint_length ref_len = {
+               .value = font_size_default,
+               .unit = CSS_UNIT_PX,
+       };
+
+       if (ref_length != NULL) {
+               /* Must be absolute. */
+               assert(ref_length->unit != CSS_UNIT_EM);
+               assert(ref_length->unit != CSS_UNIT_EX);
+               assert(ref_length->unit != CSS_UNIT_PCT);
+
+               ref_len = *ref_length;
+       }
+
+       assert(size->status != CSS_FONT_SIZE_INHERIT);
+
+       switch (size->status) {
+       case CSS_FONT_SIZE_XX_SMALL: /* Fall-through. */
+       case CSS_FONT_SIZE_X_SMALL:  /* Fall-through. */
+       case CSS_FONT_SIZE_SMALL:    /* Fall-through. */
+       case CSS_FONT_SIZE_MEDIUM:   /* Fall-through. */
+       case CSS_FONT_SIZE_LARGE:    /* Fall-through. */
+       case CSS_FONT_SIZE_X_LARGE:  /* Fall-through. */
+       case CSS_FONT_SIZE_XX_LARGE:
+       {
+               static const css_fixed factors[CSS_FONT_SIZE_XX_LARGE] = {
+                       [CSS_FONT_SIZE_XX_SMALL - 1] = FLTTOFIX(0.5625),
+                       [CSS_FONT_SIZE_X_SMALL  - 1] = FLTTOFIX(0.6250),
+                       [CSS_FONT_SIZE_SMALL    - 1] = FLTTOFIX(0.8125),
+                       [CSS_FONT_SIZE_MEDIUM   - 1] = FLTTOFIX(1.0000),
+                       [CSS_FONT_SIZE_LARGE    - 1] = FLTTOFIX(1.1250),
+                       [CSS_FONT_SIZE_X_LARGE  - 1] = FLTTOFIX(1.5000),
+                       [CSS_FONT_SIZE_XX_LARGE - 1] = FLTTOFIX(2.0000),
+               };
+               assert(CSS_FONT_SIZE_INHERIT  == 0);
+               assert(CSS_FONT_SIZE_XX_SMALL == 1);
+
+               size->data.length.value = FMUL(factors[size->status - 1],
+                               font_size_default);
+               size->data.length.unit = CSS_UNIT_PX;
+               size->status = CSS_FONT_SIZE_DIMENSION;
+               break;
+       }
+       case CSS_FONT_SIZE_LARGER:
+               size->data.length.value = FMUL(ref_len.value, FLTTOFIX(1.2));
+               size->data.length.unit = ref_len.unit;
+               size->status = CSS_FONT_SIZE_DIMENSION;
+               break;
+
+       case CSS_FONT_SIZE_SMALLER:
+               size->data.length.value = FDIV(ref_len.value, FLTTOFIX(1.2));
+               size->data.length.unit = ref_len.unit;
+               size->status = CSS_FONT_SIZE_DIMENSION;
+               break;
+
+       case CSS_FONT_SIZE_DIMENSION:
+               /* Convert any relative units to absolute. */
+               switch (size->data.length.unit) {
+               case CSS_UNIT_PCT:
+                       size->data.length.value = FDIV(FMUL(
+                                       size->data.length.value,
+                                       ref_len.value), INTTOFIX(100));
+                       size->data.length.unit = ref_len.unit;
+                       break;
+
+               case CSS_UNIT_EM: /* Fall-through */
+               case CSS_UNIT_EX: /* Fall-through */
+               case CSS_UNIT_CH:
+                       /* Parent relative units. */
+                       size->data.length.value = FMUL(
+                                       size->data.length.value, ref_len.value);
+
+                       switch (size->data.length.unit) {
+                       case CSS_UNIT_EX:
+                               size->data.length.value = FMUL(
+                                               size->data.length.value,
+                                               FLTTOFIX(0.6));
+                               break;
+
+                       case CSS_UNIT_CH:
+                               size->data.length.value = FMUL(
+                                               size->data.length.value,
+                                               FLTTOFIX(0.4));
+                               break;
+
+                       default:
+                               break;
+                       }
+                       size->data.length.unit = ref_len.unit;
+                       break;
+
+               case CSS_UNIT_REM:
+                       /* Root element relative units. */
+                       ref_len = css_unit__get_font_size(root_style,
+                                       font_size_default);
+
+                       size->data.length.unit = ref_len.unit;
+                       size->data.length.value = FMUL(
+                                       size->data.length.value, ref_len.value);
+                       break;
+
+               default:
+                       break;
+               }
+       default:
+               break;
+       }
+
+       return CSS_OK;
+}
diff --git a/src/select/unit.h b/src/select/unit.h
new file mode 100644
index 0000000..6a677b6
--- /dev/null
+++ b/src/select/unit.h
@@ -0,0 +1,42 @@
+/*
+ * This file is part of LibCSS
+ * Licensed under the MIT License,
+ *                http://www.opensource.org/licenses/mit-license.php
+ *
+ * Copyright 2021 Michael Drake <t...@netsurf-browser.org>
+ */
+
+#ifndef css_select_unit_h_
+#define css_select_unit_h_
+
+#include <libcss/unit.h>
+
+/**
+ * Convert a length to CSS pixels for a media query context.
+ *
+ * \param[in]  ctx     Document unit conversion context.
+ * \param[in]  length  Length to convert.
+ * \param[in]  unit    Current unit of length.
+ * \return A length in CSS pixels.
+ */
+css_fixed css_unit_len2px_mq(
+               const css_unit_ctx *ctx,
+               const css_fixed length,
+               const css_unit unit);
+
+/**
+ * Convert relative font size units to absolute units.
+ *
+ * \param[in] ref_length         Reference font-size length or NULL.
+ * \param[in] root_style         Root element style or NULL.
+ * \param[in] font_size_default  Client default font size in CSS pixels.
+ * \param[in,out] size           The length to convert.
+ * \return CSS_OK on success, or appropriate error otherwise.
+ */
+css_error css_unit_compute_absolute_font_size(
+               const css_hint_length *ref_length,
+               const css_computed_style *root_style,
+               css_fixed font_size_default,
+               css_hint *size);
+
+#endif
diff --git a/test/data/parse2/units.dat b/test/data/parse2/units.dat
index 1052dc5..800df75 100644
--- a/test/data/parse2/units.dat
+++ b/test/data/parse2/units.dat
@@ -70,14 +70,6 @@
 #reset
 
 #data
-* { width: 10cap; }
-#errors
-#expected
-| *
-|  width: 10cap
-#reset
-
-#data
 * { width: 10ch; }
 #errors
 #expected
@@ -86,14 +78,6 @@
 #reset
 
 #data
-* { width: 10ic; }
-#errors
-#expected
-| *
-|  width: 10ic
-#reset
-
-#data
 * { width: 10rem; }
 #errors
 #expected
@@ -110,14 +94,6 @@
 #reset
 
 #data
-* { width: 10rlh; }
-#errors
-#expected
-| *
-|  width: 10rlh
-#reset
-
-#data
 * { width: 10vh; }
 #errors
 #expected
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 1a91e82..295ab2e 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -59,7 +59,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -173,7 +173,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -291,7 +291,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -410,7 +410,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -529,7 +529,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -648,7 +648,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -757,7 +757,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -867,7 +867,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -977,7 +977,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1086,7 +1086,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1200,7 +1200,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1314,7 +1314,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1429,7 +1429,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1547,7 +1547,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1664,7 +1664,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1787,7 +1787,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -1910,7 +1910,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2033,7 +2033,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2160,7 +2160,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2286,7 +2286,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2410,7 +2410,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2533,7 +2533,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2656,7 +2656,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2779,7 +2779,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -2902,7 +2902,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3025,7 +3025,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3148,7 +3148,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3271,7 +3271,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3394,7 +3394,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3517,7 +3517,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3640,7 +3640,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 10.600pt
+font-size: 13.342px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3763,7 +3763,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 14.391pt
+font-size: 19.187px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -3886,7 +3886,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 24pt
+font-size: 32px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4009,7 +4009,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 18pt
+font-size: 24px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4132,7 +4132,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 13.500pt
+font-size: 18px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4255,7 +4255,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4378,7 +4378,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 9.750pt
+font-size: 13px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4501,7 +4501,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 7.500pt
+font-size: 10px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4624,7 +4624,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 6.750pt
+font-size: 9px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4870,7 +4870,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -4986,7 +4986,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5102,7 +5102,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5218,7 +5218,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5331,7 +5331,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5445,7 +5445,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5559,7 +5559,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5673,7 +5673,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5783,7 +5783,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -5894,7 +5894,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6004,7 +6004,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6114,7 +6114,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6224,7 +6224,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6334,7 +6334,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6444,7 +6444,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6556,7 +6556,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6666,7 +6666,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6776,7 +6776,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6887,7 +6887,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -6997,7 +6997,7 @@ flex-shrink: 3.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7107,7 +7107,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7217,7 +7217,7 @@ flex-shrink: 0.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7327,7 +7327,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7437,7 +7437,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7547,7 +7547,7 @@ flex-shrink: 0.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7657,7 +7657,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7766,7 +7766,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7875,7 +7875,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -7984,7 +7984,7 @@ flex-shrink: 30.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8095,7 +8095,7 @@ flex-shrink: 3.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8206,7 +8206,7 @@ flex-shrink: 3.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8315,7 +8315,7 @@ flex-shrink: 0.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8426,7 +8426,7 @@ flex-shrink: 0.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8537,7 +8537,7 @@ flex-shrink: 3.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8648,7 +8648,7 @@ flex-shrink: 3.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8757,7 +8757,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8866,7 +8866,7 @@ flex-shrink: 1.000
 flex-wrap: wrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -8975,7 +8975,7 @@ flex-shrink: 1.000
 flex-wrap: wrap-reverse
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9084,7 +9084,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9193,7 +9193,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9302,7 +9302,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9411,7 +9411,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9520,7 +9520,7 @@ flex-shrink: 1.000
 flex-wrap: wrap-reverse
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9631,7 +9631,7 @@ flex-shrink: 1.000
 flex-wrap: wrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9742,7 +9742,7 @@ flex-shrink: 1.000
 flex-wrap: wrap-reverse
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9851,7 +9851,7 @@ flex-shrink: 0.899
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -9960,7 +9960,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10069,7 +10069,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10178,7 +10178,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10287,7 +10287,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10396,7 +10396,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10505,7 +10505,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10616,7 +10616,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10727,7 +10727,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10836,7 +10836,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -10945,7 +10945,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11054,7 +11054,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11165,7 +11165,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11274,7 +11274,7 @@ flex-shrink: 3.780
 flex-wrap: wrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11385,7 +11385,7 @@ flex-shrink: 3.780
 flex-wrap: wrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11494,7 +11494,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11603,7 +11603,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11712,7 +11712,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11821,7 +11821,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -11930,7 +11930,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12039,7 +12039,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12148,7 +12148,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12257,7 +12257,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12366,7 +12366,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12419,7 +12419,7 @@ z-index: auto
 #tree
 | div*
 #ua
-div { width: 10cap; }
+div { width: 10em; }
 #errors
 #expected
 align-content: stretch
@@ -12475,7 +12475,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12519,7 +12519,7 @@ unicode-bidi: normal
 vertical-align: baseline
 visibility: visible
 white-space: normal
-width: 10cap
+width: 10em
 word-spacing: normal
 writing-mode: horizontal-tb
 z-index: auto
@@ -12584,7 +12584,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12637,7 +12637,7 @@ z-index: auto
 #tree
 | div*
 #ua
-div { width: 10ic; }
+div { width: 10ch; }
 #errors
 #expected
 align-content: stretch
@@ -12693,7 +12693,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12737,7 +12737,7 @@ unicode-bidi: normal
 vertical-align: baseline
 visibility: visible
 white-space: normal
-width: 10ic
+width: 10ch
 word-spacing: normal
 writing-mode: horizontal-tb
 z-index: auto
@@ -12802,7 +12802,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12911,7 +12911,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -12964,7 +12964,7 @@ z-index: auto
 #tree
 | div*
 #ua
-div { width: 10rlh; }
+div { width: 10rem; }
 #errors
 #expected
 align-content: stretch
@@ -13020,7 +13020,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13064,7 +13064,7 @@ unicode-bidi: normal
 vertical-align: baseline
 visibility: visible
 white-space: normal
-width: 10rlh
+width: 10rem
 word-spacing: normal
 writing-mode: horizontal-tb
 z-index: auto
@@ -13129,7 +13129,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13238,7 +13238,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13347,7 +13347,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13456,7 +13456,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13565,7 +13565,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13674,7 +13674,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13783,7 +13783,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -13892,7 +13892,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
@@ -14020,7 +14020,7 @@ flex-shrink: 1.000
 flex-wrap: nowrap
 float: none
 font-family: sans-serif
-font-size: 12pt
+font-size: 16px
 font-style: normal
 font-variant: normal
 font-weight: normal
diff --git a/test/dump.h b/test/dump.h
index d67bb2a..79819e0 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -584,24 +584,15 @@ static void dump_unit(css_fixed val, uint32_t unit, char 
**ptr)
        case UNIT_PC:
                *ptr += sprintf(*ptr, "pc");
                break;
-       case UNIT_CAP:
-               *ptr += sprintf(*ptr, "cap");
-               break;
        case UNIT_CH:
                *ptr += sprintf(*ptr, "ch");
                break;
-       case UNIT_IC:
-               *ptr += sprintf(*ptr, "ic");
-               break;
        case UNIT_REM:
                *ptr += sprintf(*ptr, "rem");
                break;
        case UNIT_LH:
                *ptr += sprintf(*ptr, "lh");
                break;
-       case UNIT_RLH:
-               *ptr += sprintf(*ptr, "rlh");
-               break;
        case UNIT_VH:
                *ptr += sprintf(*ptr, "vh");
                break;
diff --git a/test/dump_computed.h b/test/dump_computed.h
index b0c8bda..8ac6424 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -105,24 +105,15 @@ static size_t dump_css_unit(css_fixed val, css_unit unit, 
char *ptr, size_t len)
        case CSS_UNIT_PC:
                ret += snprintf(ptr + ret, len - ret, "pc");
                break;
-       case CSS_UNIT_CAP:
-               ret += snprintf(ptr + ret, len - ret, "cap");
-               break;
        case CSS_UNIT_CH:
                ret += snprintf(ptr + ret, len - ret, "ch");
                break;
-       case CSS_UNIT_IC:
-               ret += snprintf(ptr + ret, len - ret, "ic");
-               break;
        case CSS_UNIT_REM:
                ret += snprintf(ptr + ret, len - ret, "rem");
                break;
        case CSS_UNIT_LH:
                ret += snprintf(ptr + ret, len - ret, "lh");
                break;
-       case CSS_UNIT_RLH:
-               ret += snprintf(ptr + ret, len - ret, "rlh");
-               break;
        case CSS_UNIT_VH:
                ret += snprintf(ptr + ret, len - ret, "vh");
                break;
diff --git a/test/select.c b/test/select.c
index 33f31dd..c104b38 100644
--- a/test/select.c
+++ b/test/select.c
@@ -159,13 +159,15 @@ static css_error node_presentational_hint(void *pw, void 
*node,
                uint32_t *nhints, css_hint **hints);
 static css_error ua_default_for_property(void *pw, uint32_t property,
                css_hint *hints);
-static css_error compute_font_size(void *pw, const css_hint *parent,
-               css_hint *size);
 static css_error set_libcss_node_data(void *pw, void *n,
                void *libcss_node_data);
 static css_error get_libcss_node_data(void *pw, void *n,
                void **libcss_node_data);
 
+static css_unit_ctx unit_ctx = {
+       .font_size_default = 16 * (1 << CSS_RADIX_POINT),
+};
+
 static css_select_handler select_handler = {
        CSS_SELECT_HANDLER_VERSION_1,
 
@@ -203,9 +205,9 @@ static css_select_handler select_handler = {
        node_is_lang,
        node_presentational_hint,
        ua_default_for_property,
-       compute_font_size,
+
        set_libcss_node_data,
-       get_libcss_node_data
+       get_libcss_node_data,
 };
 
 static css_error resolve_url(void *pw,
@@ -798,7 +800,12 @@ static void run_test_select_tree(css_select_ctx *select,
        css_select_results *sr;
        struct node *n = NULL;
 
-       assert(css_select_style(select, node, &ctx->media, NULL,
+       if (node->parent == NULL) {
+               unit_ctx.root_style = NULL;
+       }
+
+
+       assert(css_select_style(select, node, &unit_ctx, &ctx->media, NULL,
                        &select_handler, ctx, &sr) == CSS_OK);
 
        if (node->parent != NULL) {
@@ -806,7 +813,7 @@ static void run_test_select_tree(css_select_ctx *select,
                assert(css_computed_style_compose(
                                node->parent->sr->styles[ctx->pseudo_element],
                                sr->styles[ctx->pseudo_element],
-                               compute_font_size, NULL,
+                               &unit_ctx,
                                &composed) == CSS_OK);
                css_computed_style_destroy(sr->styles[ctx->pseudo_element]);
                sr->styles[ctx->pseudo_element] = composed;
@@ -819,6 +826,10 @@ static void run_test_select_tree(css_select_ctx *select,
                                buf, buflen);
        }
 
+       if (node->parent == NULL) {
+               unit_ctx.root_style = node->sr->styles[ctx->pseudo_element];
+       }
+
        for (n = node->children; n != NULL; n = n->next) {
                run_test_select_tree(select, n, ctx, buf, buflen);
        }
@@ -1639,68 +1650,6 @@ 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)
-{
-       static css_hint_length sizes[] = {
-               { FLTTOFIX(6.75), CSS_UNIT_PT },
-               { FLTTOFIX(7.50), CSS_UNIT_PT },
-               { FLTTOFIX(9.75), CSS_UNIT_PT },
-               { FLTTOFIX(12.0), CSS_UNIT_PT },
-               { FLTTOFIX(13.5), CSS_UNIT_PT },
-               { FLTTOFIX(18.0), CSS_UNIT_PT },
-               { FLTTOFIX(24.0), CSS_UNIT_PT }
-       };
-       const css_hint_length *parent_size;
-
-       UNUSED(pw);
-
-       /* Grab parent size, defaulting to medium if none */
-       if (parent == NULL) {
-               parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1];
-       } else {
-               assert(parent->status == CSS_FONT_SIZE_DIMENSION);
-               assert(parent->data.length.unit != CSS_UNIT_EM);
-               assert(parent->data.length.unit != CSS_UNIT_EX);
-               parent_size = &parent->data.length;
-       }
-
-       assert(size->status != CSS_FONT_SIZE_INHERIT);
-
-       if (size->status < CSS_FONT_SIZE_LARGER) {
-               /* Keyword -- simple */
-               size->data.length = sizes[size->status - 1];
-       } else if (size->status == CSS_FONT_SIZE_LARGER) {
-               /** \todo Step within table, if appropriate */
-               size->data.length.value =
-                               FMUL(parent_size->value, FLTTOFIX(1.2));
-               size->data.length.unit = parent_size->unit;
-       } else if (size->status == CSS_FONT_SIZE_SMALLER) {
-               /** \todo Step within table, if appropriate */
-               size->data.length.value =
-                               FDIV(parent_size->value, FLTTOFIX(1.2));
-               size->data.length.unit = parent_size->unit;
-       } else if (size->data.length.unit == CSS_UNIT_EM ||
-                       size->data.length.unit == CSS_UNIT_EX) {
-               size->data.length.value =
-                       FMUL(size->data.length.value, parent_size->value);
-
-               if (size->data.length.unit == CSS_UNIT_EX) {
-                       size->data.length.value = FMUL(size->data.length.value,
-                                       FLTTOFIX(0.6));
-               }
-
-               size->data.length.unit = parent_size->unit;
-       } else if (size->data.length.unit == CSS_UNIT_PCT) {
-               size->data.length.value = FDIV(FMUL(size->data.length.value,
-                               parent_size->value), FLTTOFIX(100));
-               size->data.length.unit = parent_size->unit;
-       }
-
-       size->status = CSS_FONT_SIZE_DIMENSION;
-
-       return CSS_OK;
-}
-
 static css_error set_libcss_node_data(void *pw, void *n,
                void *libcss_node_data)
 {


-- 
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to