Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
html_common.hh File Reference
#include "url.h"
#include "bw.h"
#include "lout/misc.hh"
#include "dw/core.hh"
#include "dw/image.hh"
#include "dw/style.hh"
#include "image.hh"
#include "form.hh"
#include "styleengine.hh"
Include dependency graph for html_common.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DilloHtmlImage
 
struct  DilloHtmlState
 
class  DilloHtml
 
class  DilloHtml::HtmlLinkReceiver
 

Macros

#define HT2TB(html)   ((Textblock*)(html->dw))
 "html struct" to Textblock
 
#define HT2LT(html)   ((Layout*)html->bw->render_layout)
 "html struct" to "Layout"
 
#define IM2DW(Image)   ((Widget*)Image->dw)
 "Image" to "Dw Widget"
 
#define S_TOP(html)   (html->stack->getRef(html->stack->size()-1))
 Top of the parsing stack.
 
#define BUG_MSG(...)
 Add a bug-meter message.
 

Enumerations

enum  DilloHtmlDocumentType { DT_NONE , DT_UNRECOGNIZED , DT_HTML , DT_XHTML }
 
enum  DilloHtmlParseMode {
  DILLO_HTML_PARSE_MODE_INIT = 0 , DILLO_HTML_PARSE_MODE_STASH , DILLO_HTML_PARSE_MODE_STASH_AND_BODY , DILLO_HTML_PARSE_MODE_VERBATIM ,
  DILLO_HTML_PARSE_MODE_BODY , DILLO_HTML_PARSE_MODE_PRE
}
 
enum  DilloHtmlTableMode { DILLO_HTML_TABLE_MODE_NONE , DILLO_HTML_TABLE_MODE_TOP , DILLO_HTML_TABLE_MODE_TR , DILLO_HTML_TABLE_MODE_TD }
 
enum  DilloHtmlTableBorderMode { DILLO_HTML_TABLE_BORDER_SEPARATE , DILLO_HTML_TABLE_BORDER_COLLAPSE }
 
enum  DilloHtmlListMode { HTML_LIST_NONE , HTML_LIST_UNORDERED , HTML_LIST_ORDERED }
 
enum  DilloHtmlProcessingState {
  IN_NONE = 0 , IN_HTML = 1 << 0 , IN_HEAD = 1 << 1 , IN_BODY = 1 << 2 ,
  IN_FORM = 1 << 3 , IN_SELECT = 1 << 4 , IN_OPTION = 1 << 5 , IN_OPTGROUP = 1 << 6 ,
  IN_TEXTAREA = 1 << 7 , IN_BUTTON = 1 << 8 , IN_MAP = 1 << 9 , IN_PRE = 1 << 10 ,
  IN_LI = 1 << 11 , IN_MEDIA = 1 << 12 , IN_META_HACK = 1 << 13 , IN_A = 1 << 14 ,
  IN_EOF = 1 << 15
}
 

Functions

int a_Html_tag_index (const char *tag)
 Get 'tag' index.
 
const char * a_Html_get_attr (DilloHtml *html, const char *tag, int tagsize, const char *attrname)
 Call Html_get_attr2 telling it to parse entities and strip the result.
 
char * a_Html_get_attr_wdef (DilloHtml *html, const char *tag, int tagsize, const char *attrname, const char *def)
 "a_Html_get_attr with default" Call a_Html_get_attr() and dStrdup() the returned string.
 
DilloUrla_Html_url_new (DilloHtml *html, const char *url_str, const char *base_url, int use_base_url)
 Wrapper for a_Url_new that adds an error detection message.
 
void a_Html_common_image_attrs (DilloHtml *html, const char *tag, int tagsize)
 Read image-associated tag attributes and create new image.
 
DilloImagea_Html_image_new (DilloHtml *html, const char *tag, int tagsize)
 
char * a_Html_parse_entities (DilloHtml *html, const char *token, int toksize)
 Parse all the entities in a token.
 
void a_Html_pop_tag (DilloHtml *html, int TagIdx)
 
void a_Html_stash_init (DilloHtml *html)
 Initialize the stash buffer.
 
int32_t a_Html_color_parse (DilloHtml *html, const char *str, int32_t default_color)
 Parse a color attribute.
 
CssLength a_Html_parse_length (DilloHtml *html, const char *attr)
 Returns a length or a percentage, or UNDEF_LENGTH in case of an error, or if attr is NULL.
 
void a_Html_tag_set_align_attr (DilloHtml *html, const char *tag, int tagsize)
 Evaluates the ALIGN attribute (left|center|right|justify) and sets the style at the top of the stack.
 
bool a_Html_tag_set_valign_attr (DilloHtml *html, const char *tag, int tagsize)
 Evaluates the VALIGN attribute (top|bottom|middle|baseline) and sets the style in style_attrs.
 
void a_Html_load_stylesheet (DilloHtml *html, DilloUrl *url)
 Tell cache to retrieve a stylesheet.
 

Macro Definition Documentation

◆ BUG_MSG

#define BUG_MSG (   ...)
Value:
html->bugMessage(__VA_ARGS__); \
#define D_STMT_START
Definition dlib.h:62
#define D_STMT_END
Definition dlib.h:63

Add a bug-meter message.

Definition at line 45 of file html_common.hh.

◆ HT2LT

#define HT2LT (   html)    ((Layout*)html->bw->render_layout)

"html struct" to "Layout"

Definition at line 38 of file html_common.hh.

◆ HT2TB

#define HT2TB (   html)    ((Textblock*)(html->dw))

"html struct" to Textblock

Definition at line 36 of file html_common.hh.

◆ IM2DW

#define IM2DW (   Image)    ((Widget*)Image->dw)

"Image" to "Dw Widget"

Definition at line 40 of file html_common.hh.

◆ S_TOP

#define S_TOP (   html)    (html->stack->getRef(html->stack->size()-1))

Top of the parsing stack.

Definition at line 42 of file html_common.hh.

Enumeration Type Documentation

◆ DilloHtmlDocumentType

Enumerator
DT_NONE 
DT_UNRECOGNIZED 
DT_HTML 
DT_XHTML 

Definition at line 55 of file html_common.hh.

◆ DilloHtmlListMode

Enumerator
HTML_LIST_NONE 
HTML_LIST_UNORDERED 
HTML_LIST_ORDERED 

Definition at line 83 of file html_common.hh.

◆ DilloHtmlParseMode

Enumerator
DILLO_HTML_PARSE_MODE_INIT 
DILLO_HTML_PARSE_MODE_STASH 
DILLO_HTML_PARSE_MODE_STASH_AND_BODY 
DILLO_HTML_PARSE_MODE_VERBATIM 
DILLO_HTML_PARSE_MODE_BODY 
DILLO_HTML_PARSE_MODE_PRE 

Definition at line 62 of file html_common.hh.

◆ DilloHtmlProcessingState

Enumerator
IN_NONE 
IN_HTML 
IN_HEAD 
IN_BODY 
IN_FORM 
IN_SELECT 
IN_OPTION 
IN_OPTGROUP 
IN_TEXTAREA 
IN_BUTTON 
IN_MAP 
IN_PRE 
IN_LI 
IN_MEDIA 
IN_META_HACK 
IN_A 
IN_EOF 

Definition at line 89 of file html_common.hh.

◆ DilloHtmlTableBorderMode

Enumerator
DILLO_HTML_TABLE_BORDER_SEPARATE 
DILLO_HTML_TABLE_BORDER_COLLAPSE 

Definition at line 78 of file html_common.hh.

◆ DilloHtmlTableMode

Enumerator
DILLO_HTML_TABLE_MODE_NONE 

no table at all

DILLO_HTML_TABLE_MODE_TOP 

outside of

DILLO_HTML_TABLE_MODE_TR 

inside of

, outside of

DILLO_HTML_TABLE_MODE_TD 

inside of

Definition at line 71 of file html_common.hh.

Function Documentation

◆ a_Html_color_parse()

int32_t a_Html_color_parse ( DilloHtml html,
const char *  str,
int32_t  default_color 
)

Parse a color attribute.

Return value: parsed color, or default_color (+ error msg) on error.

Definition at line 1458 of file html.cc.

References a_Color_parse(), and BUG_MSG.

Referenced by Html_tag_open_body(), Html_tag_open_font(), Html_tag_open_table(), Html_tag_open_table_cell(), and Html_tag_open_tr().

◆ a_Html_common_image_attrs()

◆ a_Html_get_attr()

◆ a_Html_get_attr_wdef()

char * a_Html_get_attr_wdef ( DilloHtml html,
const char *  tag,
int  tagsize,
const char *  attrname,
const char *  def 
)

"a_Html_get_attr with default" Call a_Html_get_attr() and dStrdup() the returned string.

If the attribute isn't found a copy of 'def' is returned.

Definition at line 4281 of file html.cc.

References a_Html_get_attr(), and dStrdup().

Referenced by a_Html_common_image_attrs(), a_Html_image_new(), Html_tag_open_button(), Html_tag_open_hr(), Html_tag_open_input(), Html_tag_open_optgroup(), Html_tag_open_option(), and Html_tag_open_select().

◆ a_Html_image_new()

◆ a_Html_load_stylesheet()

◆ a_Html_parse_entities()

char * a_Html_parse_entities ( DilloHtml html,
const char *  token,
int  toksize 
)

Parse all the entities in a token.

Takes the token and its length, and returns a newly allocated string.

Definition at line 1070 of file html.cc.

References dStr_append(), dStr_append_c(), dStr_append_l(), dStr_free(), dStr_sized_new(), dStrndup(), FALSE, Html_parse_entity(), and Dstr::str.

Referenced by Html_process_word(), and Html_tag_close_textarea().

◆ a_Html_parse_length()

CssLength a_Html_parse_length ( DilloHtml html,
const char *  attr 
)

Returns a length or a percentage, or UNDEF_LENGTH in case of an error, or if attr is NULL.

Definition at line 1433 of file html.cc.

References _MSG, BUG_MSG, CSS_CREATE_LENGTH(), CSS_LENGTH_TYPE(), CSS_LENGTH_TYPE_AUTO, CSS_LENGTH_TYPE_RELATIVE, CSS_LENGTH_VALUE(), and Html_parse_length_or_multi_length().

Referenced by a_Html_common_image_attrs(), Html_tag_open_hr(), Html_tag_open_table(), and Html_tag_open_table_cell().

◆ a_Html_pop_tag()

void a_Html_pop_tag ( DilloHtml html,
int  TagIdx 
)

◆ a_Html_stash_init()

◆ a_Html_tag_index()

int a_Html_tag_index ( const char *  tag)

◆ a_Html_tag_set_align_attr()

◆ a_Html_tag_set_valign_attr()

bool a_Html_tag_set_valign_attr ( DilloHtml html,
const char *  tag,
int  tagsize 
)

◆ a_Html_url_new()

DilloUrl * a_Html_url_new ( DilloHtml html,
const char *  url_str,
const char *  base_url,
int  use_base_url 
)