Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of LibCSS.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef libcss_types_h_
  9. #define libcss_types_h_
  10.  
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15.  
  16. #include <stdbool.h>
  17. #include <stdint.h>
  18. #include <stdlib.h>
  19.  
  20. #include <libwapcaplet/libwapcaplet.h>
  21.  
  22. #include <libcss/fpmath.h>
  23.  
  24. /**
  25.  * Source of charset information, in order of importance.
  26.  * A client-dictated charset will override all others.
  27.  * A document-specified charset will override autodetection or the default.
  28.  */
  29. typedef enum css_charset_source {
  30.         CSS_CHARSET_DEFAULT          = 0,       /**< Default setting */
  31.         CSS_CHARSET_REFERRED         = 1,       /**< From referring document */
  32.         CSS_CHARSET_METADATA         = 2,       /**< From linking metadata */
  33.         CSS_CHARSET_DOCUMENT         = 3,       /**< Defined in document */
  34.         CSS_CHARSET_DICTATED         = 4        /**< Dictated by client */
  35. } css_charset_source;
  36.  
  37. /**
  38.  * Stylesheet language level -- defines parsing rules and supported properties
  39.  */
  40. typedef enum css_language_level {
  41.         CSS_LEVEL_1                 = 0,        /**< CSS 1 */
  42.         CSS_LEVEL_2                 = 1,        /**< CSS 2 */
  43.         CSS_LEVEL_21                = 2,        /**< CSS 2.1 */
  44.         CSS_LEVEL_3                 = 3,        /**< CSS 3 */
  45.         CSS_LEVEL_DEFAULT           = CSS_LEVEL_21      /**< Default level */
  46. } css_language_level;
  47.  
  48. /**
  49.  * Stylesheet media types
  50.  */
  51. typedef enum css_media_type {
  52.         CSS_MEDIA_AURAL             = (1 << 0),
  53.         CSS_MEDIA_BRAILLE           = (1 << 1),
  54.         CSS_MEDIA_EMBOSSED          = (1 << 2),
  55.         CSS_MEDIA_HANDHELD          = (1 << 3),
  56.         CSS_MEDIA_PRINT             = (1 << 4),
  57.         CSS_MEDIA_PROJECTION        = (1 << 5),
  58.         CSS_MEDIA_SCREEN            = (1 << 6),
  59.         CSS_MEDIA_SPEECH            = (1 << 7),
  60.         CSS_MEDIA_TTY               = (1 << 8),
  61.         CSS_MEDIA_TV                = (1 << 9),
  62.         CSS_MEDIA_ALL               = CSS_MEDIA_AURAL | CSS_MEDIA_BRAILLE |
  63.                                       CSS_MEDIA_EMBOSSED | CSS_MEDIA_HANDHELD |
  64.                                       CSS_MEDIA_PRINT | CSS_MEDIA_PROJECTION |
  65.                                       CSS_MEDIA_SCREEN | CSS_MEDIA_SPEECH |
  66.                                       CSS_MEDIA_TTY | CSS_MEDIA_TV
  67. } css_media_type;
  68.  
  69. /**
  70.  * Stylesheet origin
  71.  */
  72. typedef enum css_origin {
  73.         CSS_ORIGIN_UA               = 0,        /**< User agent stylesheet */
  74.         CSS_ORIGIN_USER             = 1,        /**< User stylesheet */
  75.         CSS_ORIGIN_AUTHOR           = 2         /**< Author stylesheet */
  76. } css_origin;
  77.  
  78. /** CSS colour -- AARRGGBB */
  79. typedef uint32_t css_color;
  80.  
  81. /* CSS unit */
  82. typedef enum css_unit {
  83.         CSS_UNIT_PX                 = 0x0,
  84.         CSS_UNIT_EX                 = 0x1,
  85.         CSS_UNIT_EM                 = 0x2,
  86.         CSS_UNIT_IN                 = 0x3,
  87.         CSS_UNIT_CM                 = 0x4,
  88.         CSS_UNIT_MM                 = 0x5,
  89.         CSS_UNIT_PT                 = 0x6,
  90.         CSS_UNIT_PC                 = 0x7,
  91.  
  92.         CSS_UNIT_PCT                = 0x8,      /* Percentage */
  93.  
  94.         CSS_UNIT_DEG                = 0x9,
  95.         CSS_UNIT_GRAD               = 0xa,
  96.         CSS_UNIT_RAD                = 0xb,
  97.  
  98.         CSS_UNIT_MS                 = 0xc,
  99.         CSS_UNIT_S                  = 0xd,
  100.  
  101.         CSS_UNIT_HZ                 = 0xe,
  102.         CSS_UNIT_KHZ                = 0xf
  103. } css_unit;
  104.  
  105. /**
  106.  * Type of a qualified name
  107.  */
  108. typedef struct css_qname {
  109.         /**
  110.          * Namespace URI:
  111.          *
  112.          * NULL for no namespace
  113.          * '*' for any namespace (including none)
  114.          * URI for a specific namespace
  115.          */
  116.         lwc_string *ns;
  117.  
  118.         /**
  119.          * Local part of qualified name
  120.          */
  121.         lwc_string *name;
  122. } css_qname;
  123.  
  124. typedef struct css_stylesheet css_stylesheet;
  125.  
  126. typedef struct css_select_ctx css_select_ctx;
  127.  
  128. typedef struct css_computed_style css_computed_style;
  129.  
  130. typedef struct css_font_face css_font_face;
  131.  
  132. typedef struct css_font_face_src css_font_face_src;
  133.  
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137.  
  138. #endif
  139.