summaryrefslogtreecommitdiff
path: root/src/select/unit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/select/unit.h')
-rw-r--r--src/select/unit.h42
1 files changed, 42 insertions, 0 deletions
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 <tlsa@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