Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
cssparser.cc File Reference
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "msg.h"
#include "colors.h"
#include "html_common.hh"
#include "css.hh"
#include "cssparser.hh"
Include dependency graph for cssparser.cc:

Go to the source code of this file.

Macros

#define MSG_CSS(A, ...)   do {} while(0)
 
#define DEBUG_TOKEN_LEVEL   0
 
#define DEBUG_PARSE_LEVEL   0
 
#define DEBUG_CREATE_LEVEL   0
 
#define DEBUG_LEVEL   10
 
#define CSS_NUM_INTERNAL_PROPERTIES   3
 
#define CSS_NUM_PARSED_PROPERTIES    (CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES)
 
#define CSS_SHORTHAND_NUM    (sizeof(Css_shorthand_info) / sizeof(Css_shorthand_info[0]))
 

Functions

static int Css_property_info_cmp (const void *a, const void *b)
 bsearch(3) compare function for searching properties
 
static int Css_shorthand_info_cmp (const void *a, const void *b)
 bsearch(3) compare function for searching shorthands
 

Variables

static const char *const Css_background_attachment_enum_vals []
 
static const char *const Css_background_repeat_enum_vals []
 
static const char *const Css_border_collapse_enum_vals []
 
static const char *const Css_border_color_enum_vals []
 
static const char *const Css_border_style_enum_vals []
 
static const char *const Css_border_width_enum_vals []
 
static const char *const Css_clear_enum_vals []
 
static const char *const Css_cursor_enum_vals []
 
static const char *const Css_display_enum_vals []
 
static const char *const Css_float_enum_vals []
 
static const char *const Css_font_size_enum_vals []
 
static const char *const Css_font_style_enum_vals []
 
static const char *const Css_font_variant_enum_vals []
 
static const char *const Css_font_weight_enum_vals []
 
static const char *const Css_letter_spacing_enum_vals []
 
static const char *const Css_list_style_position_enum_vals []
 
static const char *const Css_line_height_enum_vals []
 
static const char *const Css_list_style_type_enum_vals []
 
static const char *const Css_overflow_enum_vals []
 
static const char *const Css_position_enum_vals []
 
static const char *const Css_text_align_enum_vals []
 
static const char *const Css_text_decoration_enum_vals []
 
static const char *const Css_text_transform_enum_vals []
 
static const char *const Css_vertical_align_vals []
 
static const char *const Css_white_space_vals []
 
static const char *const Css_word_spacing_enum_vals []
 
const CssPropertyInfo Css_property_info [CSS_PROPERTY_LAST]
 
const CssPropertyName Css_background_properties []
 
const CssPropertyName Css_border_bottom_properties []
 
const CssPropertyName Css_border_color_properties [4]
 
const CssPropertyName Css_border_left_properties []
 
const CssPropertyName Css_border_right_properties []
 
const CssPropertyName Css_border_style_properties []
 
const CssPropertyName Css_border_top_properties []
 
const CssPropertyName Css_border_width_properties []
 
const CssPropertyName Css_list_style_properties []
 
const CssPropertyName Css_margin_properties []
 
const CssPropertyName Css_outline_properties []
 
const CssPropertyName Css_padding_properties []
 
const CssPropertyName Css_border_properties []
 
const CssPropertyName Css_font_properties []
 
static const CssShorthandInfo Css_shorthand_info []
 

Macro Definition Documentation

◆ CSS_NUM_INTERNAL_PROPERTIES

#define CSS_NUM_INTERNAL_PROPERTIES   3

Definition at line 40 of file cssparser.cc.

◆ CSS_NUM_PARSED_PROPERTIES

#define CSS_NUM_PARSED_PROPERTIES    (CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES)

Definition at line 41 of file cssparser.cc.

◆ CSS_SHORTHAND_NUM

#define CSS_SHORTHAND_NUM    (sizeof(Css_shorthand_info) / sizeof(Css_shorthand_info[0]))

Definition at line 451 of file cssparser.cc.

◆ DEBUG_CREATE_LEVEL

#define DEBUG_CREATE_LEVEL   0

Definition at line 35 of file cssparser.cc.

◆ DEBUG_LEVEL

#define DEBUG_LEVEL   10

Definition at line 37 of file cssparser.cc.

◆ DEBUG_PARSE_LEVEL

#define DEBUG_PARSE_LEVEL   0

Definition at line 34 of file cssparser.cc.

◆ DEBUG_TOKEN_LEVEL

#define DEBUG_TOKEN_LEVEL   0

Definition at line 33 of file cssparser.cc.

◆ MSG_CSS

#define MSG_CSS (   A,
  ... 
)    do {} while(0)

Definition at line 32 of file cssparser.cc.

Function Documentation

◆ Css_property_info_cmp()

static int Css_property_info_cmp ( const void *  a,
const void *  b 
)
static

bsearch(3) compare function for searching properties

Definition at line 1235 of file cssparser.cc.

References dStrAsciiCasecmp().

Referenced by CssParser::parseDeclaration().

◆ Css_shorthand_info_cmp()

static int Css_shorthand_info_cmp ( const void *  a,
const void *  b 
)
static

bsearch(3) compare function for searching shorthands

Definition at line 1245 of file cssparser.cc.

References dStrAsciiCasecmp().

Referenced by CssParser::parseDeclaration().

Variable Documentation

◆ Css_background_attachment_enum_vals

const char* const Css_background_attachment_enum_vals[]
static
Initial value:
= {
"scroll", "fixed", NULL
}

Definition at line 51 of file cssparser.cc.

◆ Css_background_properties

const CssPropertyName Css_background_properties[]
Initial value:
= {
}
@ CSS_PROPERTY_END
Definition css.hh:164
@ CSS_PROPERTY_BACKGROUND_REPEAT
Definition css.hh:169
@ CSS_PROPERTY_BACKGROUND_ATTACHMENT
Definition css.hh:165
@ CSS_PROPERTY_BACKGROUND_IMAGE
Definition css.hh:167
@ CSS_PROPERTY_BACKGROUND_COLOR
Definition css.hh:166
@ CSS_PROPERTY_BACKGROUND_POSITION
Definition css.hh:168

Definition at line 310 of file cssparser.cc.

◆ Css_background_repeat_enum_vals

const char* const Css_background_repeat_enum_vals[]
static
Initial value:
= {
"repeat", "repeat-x", "repeat-y", "no-repeat", NULL
}

Definition at line 55 of file cssparser.cc.

◆ Css_border_bottom_properties

const CssPropertyName Css_border_bottom_properties[]
Initial value:

Definition at line 319 of file cssparser.cc.

◆ Css_border_collapse_enum_vals

const char* const Css_border_collapse_enum_vals[]
static
Initial value:
= {
"separate", "collapse", NULL
}

Definition at line 59 of file cssparser.cc.

◆ Css_border_color_enum_vals

const char* const Css_border_color_enum_vals[]
static
Initial value:
= {
"transparent", NULL
}

Definition at line 63 of file cssparser.cc.

◆ Css_border_color_properties

const CssPropertyName Css_border_color_properties[4]
Initial value:

Definition at line 326 of file cssparser.cc.

◆ Css_border_left_properties

const CssPropertyName Css_border_left_properties[]
Initial value:

Definition at line 333 of file cssparser.cc.

◆ Css_border_properties

◆ Css_border_right_properties

const CssPropertyName Css_border_right_properties[]

◆ Css_border_style_enum_vals

const char* const Css_border_style_enum_vals[]
static
Initial value:
= {
"none", "hidden", "dotted", "dashed", "solid", "double", "groove",
"ridge", "inset", "outset", NULL
}

Definition at line 67 of file cssparser.cc.

◆ Css_border_style_properties

◆ Css_border_top_properties

const CssPropertyName Css_border_top_properties[]

◆ Css_border_width_enum_vals

const char* const Css_border_width_enum_vals[]
static
Initial value:
= {
"thin", "medium", "thick", NULL
}

Definition at line 72 of file cssparser.cc.

◆ Css_border_width_properties

◆ Css_clear_enum_vals

const char* const Css_clear_enum_vals[]
static
Initial value:
= {
"left", "right", "both", "none", NULL
}

Definition at line 76 of file cssparser.cc.

◆ Css_cursor_enum_vals

const char* const Css_cursor_enum_vals[]
static
Initial value:
= {
"crosshair", "default", "pointer", "move", "e-resize", "ne-resize",
"nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize",
"w-resize", "text", "wait", "help", NULL
}

Definition at line 80 of file cssparser.cc.

◆ Css_display_enum_vals

const char* const Css_display_enum_vals[]
static
Initial value:
= {
"block", "inline", "inline-block", "list-item", "none", "table",
"table-row-group", "table-header-group", "table-footer-group", "table-row",
"table-cell", NULL
}

Definition at line 86 of file cssparser.cc.

◆ Css_float_enum_vals

const char* const Css_float_enum_vals[]
static
Initial value:
= {
"none", "left", "right", NULL
}

Definition at line 92 of file cssparser.cc.

◆ Css_font_properties

const CssPropertyName Css_font_properties[]
Initial value:
= {
}
@ CSS_PROPERTY_FONT_VARIANT
Definition css.hh:202
@ CSS_PROPERTY_FONT_STYLE
Definition css.hh:201
@ CSS_PROPERTY_FONT_SIZE
Definition css.hh:198
@ CSS_PROPERTY_FONT_FAMILY
Definition css.hh:197
@ CSS_PROPERTY_FONT_WEIGHT
Definition css.hh:203

Definition at line 411 of file cssparser.cc.

◆ Css_font_size_enum_vals

const char* const Css_font_size_enum_vals[]
static
Initial value:
= {
"large", "larger", "medium", "small", "smaller", "xx-large", "xx-small",
"x-large", "x-small", NULL
}

Definition at line 96 of file cssparser.cc.

◆ Css_font_style_enum_vals

const char* const Css_font_style_enum_vals[]
static
Initial value:
= {
"normal", "italic", "oblique", NULL
}

Definition at line 101 of file cssparser.cc.

◆ Css_font_variant_enum_vals

const char* const Css_font_variant_enum_vals[]
static
Initial value:
= {
"normal", "small-caps", NULL
}

Definition at line 105 of file cssparser.cc.

◆ Css_font_weight_enum_vals

const char* const Css_font_weight_enum_vals[]
static
Initial value:
= {
"bold", "bolder", "light", "lighter", "normal", NULL
}

Definition at line 109 of file cssparser.cc.

◆ Css_letter_spacing_enum_vals

const char* const Css_letter_spacing_enum_vals[]
static
Initial value:
= {
"normal", NULL
}

Definition at line 113 of file cssparser.cc.

◆ Css_line_height_enum_vals

const char* const Css_line_height_enum_vals[]
static
Initial value:
= {
"normal", NULL
}

Definition at line 121 of file cssparser.cc.

◆ Css_list_style_position_enum_vals

const char* const Css_list_style_position_enum_vals[]
static
Initial value:
= {
"inside", "outside", NULL
}

Definition at line 117 of file cssparser.cc.

◆ Css_list_style_properties

const CssPropertyName Css_list_style_properties[]
Initial value:

Definition at line 368 of file cssparser.cc.

◆ Css_list_style_type_enum_vals

const char* const Css_list_style_type_enum_vals[]
static
Initial value:
= {
"disc", "circle", "square", "decimal", "decimal-leading-zero",
"lower-roman", "upper-roman", "lower-greek", "lower-alpha",
"lower-latin", "upper-alpha", "upper-latin", "hebrew", "armenian",
"georgian", "cjk-ideographic", "hiragana", "katakana", "hiragana-iroha",
"katakana-iroha", "none", NULL
}

Definition at line 125 of file cssparser.cc.

◆ Css_margin_properties

const CssPropertyName Css_margin_properties[]
Initial value:
= {
}
@ CSS_PROPERTY_MARGIN_BOTTOM
Definition css.hh:211
@ CSS_PROPERTY_MARGIN_RIGHT
Definition css.hh:213
@ CSS_PROPERTY_MARGIN_LEFT
Definition css.hh:212
@ CSS_PROPERTY_MARGIN_TOP
Definition css.hh:214

Definition at line 375 of file cssparser.cc.

◆ Css_outline_properties

const CssPropertyName Css_outline_properties[]
Initial value:

Definition at line 382 of file cssparser.cc.

◆ Css_overflow_enum_vals

const char* const Css_overflow_enum_vals[]
static
Initial value:
= {
"visible", "hidden", "scroll", "auto", NULL
}

Definition at line 133 of file cssparser.cc.

◆ Css_padding_properties

const CssPropertyName Css_padding_properties[]
Initial value:
= {
}
@ CSS_PROPERTY_PADDING_TOP
Definition css.hh:228
@ CSS_PROPERTY_PADDING_BOTTOM
Definition css.hh:225
@ CSS_PROPERTY_PADDING_RIGHT
Definition css.hh:227
@ CSS_PROPERTY_PADDING_LEFT
Definition css.hh:226

Definition at line 389 of file cssparser.cc.

◆ Css_position_enum_vals

const char* const Css_position_enum_vals[]
static
Initial value:
= {
"static", "relative", "absolute", "fixed", NULL
}

Definition at line 137 of file cssparser.cc.

◆ Css_property_info

const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST]

◆ Css_shorthand_info

const CssShorthandInfo Css_shorthand_info[]
static
Initial value:
= {
{"background", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"border", CssShorthandInfo::CSS_SHORTHAND_BORDER,
{"border-bottom", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"border-color", CssShorthandInfo::CSS_SHORTHAND_DIRECTIONS,
{"border-left", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"border-right", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"border-style", CssShorthandInfo::CSS_SHORTHAND_DIRECTIONS,
{"border-top", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"border-width", CssShorthandInfo::CSS_SHORTHAND_DIRECTIONS,
{"font", CssShorthandInfo::CSS_SHORTHAND_FONT,
{"list-style", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"margin", CssShorthandInfo::CSS_SHORTHAND_DIRECTIONS,
{"outline", CssShorthandInfo::CSS_SHORTHAND_MULTIPLE,
{"padding", CssShorthandInfo::CSS_SHORTHAND_DIRECTIONS,
}
const CssPropertyName Css_font_properties[]
Definition cssparser.cc:411
const CssPropertyName Css_border_top_properties[]
Definition cssparser.cc:354
const CssPropertyName Css_background_properties[]
Definition cssparser.cc:310
const CssPropertyName Css_padding_properties[]
Definition cssparser.cc:389
const CssPropertyName Css_outline_properties[]
Definition cssparser.cc:382
const CssPropertyName Css_border_properties[]
Definition cssparser.cc:396
const CssPropertyName Css_border_right_properties[]
Definition cssparser.cc:340
const CssPropertyName Css_border_bottom_properties[]
Definition cssparser.cc:319
const CssPropertyName Css_border_color_properties[4]
Definition cssparser.cc:326
const CssPropertyName Css_border_style_properties[]
Definition cssparser.cc:347
const CssPropertyName Css_border_left_properties[]
Definition cssparser.cc:333
const CssPropertyName Css_margin_properties[]
Definition cssparser.cc:375
const CssPropertyName Css_border_width_properties[]
Definition cssparser.cc:361
const CssPropertyName Css_list_style_properties[]
Definition cssparser.cc:368

Definition at line 420 of file cssparser.cc.

Referenced by CssParser::parseDeclaration().

◆ Css_text_align_enum_vals

const char* const Css_text_align_enum_vals[]
static
Initial value:
= {
"left", "right", "center", "justify", "string", NULL
}

Definition at line 141 of file cssparser.cc.

◆ Css_text_decoration_enum_vals

const char* const Css_text_decoration_enum_vals[]
static
Initial value:
= {
"underline", "overline", "line-through", "blink", NULL
}

Definition at line 145 of file cssparser.cc.

◆ Css_text_transform_enum_vals

const char* const Css_text_transform_enum_vals[]
static
Initial value:
= {
"none", "capitalize", "uppercase", "lowercase", NULL
}

Definition at line 149 of file cssparser.cc.

◆ Css_vertical_align_vals

const char* const Css_vertical_align_vals[]
static
Initial value:
= {
"top", "bottom", "middle", "baseline", "sub", "super", "text-top",
"text-bottom", NULL
}

Definition at line 153 of file cssparser.cc.

◆ Css_white_space_vals

const char* const Css_white_space_vals[]
static
Initial value:
= {
"normal", "pre", "nowrap", "pre-wrap", "pre-line", NULL
}

Definition at line 158 of file cssparser.cc.

◆ Css_word_spacing_enum_vals

const char* const Css_word_spacing_enum_vals[]
static
Initial value:
= {
"normal", NULL
}

Definition at line 162 of file cssparser.cc.