Dillo v3.1.1-119-g140d9ebd
|
#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"
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. | |
DilloUrl * | a_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. | |
DilloImage * | a_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. | |
#define BUG_MSG | ( | ... | ) |
Add a bug-meter message.
Definition at line 45 of file html_common.hh.
#define HT2LT | ( | html | ) | ((Layout*)html->bw->render_layout) |
"html struct" to "Layout"
Definition at line 38 of file html_common.hh.
#define HT2TB | ( | html | ) | ((Textblock*)(html->dw)) |
"html struct" to Textblock
Definition at line 36 of file html_common.hh.
#define IM2DW | ( | Image | ) | ((Widget*)Image->dw) |
"Image" to "Dw Widget"
Definition at line 40 of file html_common.hh.
#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.
Enumerator | |
---|---|
DT_NONE | |
DT_UNRECOGNIZED | |
DT_HTML | |
DT_XHTML |
Definition at line 55 of file html_common.hh.
enum DilloHtmlListMode |
Enumerator | |
---|---|
HTML_LIST_NONE | |
HTML_LIST_UNORDERED | |
HTML_LIST_ORDERED |
Definition at line 83 of file html_common.hh.
enum 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.
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.
Enumerator | |
---|---|
DILLO_HTML_TABLE_BORDER_SEPARATE | |
DILLO_HTML_TABLE_BORDER_COLLAPSE |
Definition at line 78 of file html_common.hh.
enum 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.
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().
void a_Html_common_image_attrs | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Read image-associated tag attributes and create new image.
Definition at line 2063 of file html.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), a_Html_parse_length(), CSS_CREATE_LENGTH(), CSS_LENGTH_TYPE(), CSS_LENGTH_TYPE_AUTO, CSS_LENGTH_TYPE_PX, CSS_LENGTH_VALUE(), CSS_PROPERTY_HEIGHT, CSS_PROPERTY_WIDTH, CSS_TYPE_INTEGER, CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_STRING, dFree(), IMAGE_MAX_AREA, DilloHtml::images, MSG, prefs, PROPERTY_X_IMG, PROPERTY_X_TOOLTIP, StyleEngine::setNonCssHint(), DilloPrefs::show_tooltip, lout::misc::SimpleVector< T >::size(), and DilloHtml::styleEngine.
Referenced by Html_input_image(), and Html_tag_open_img().
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.
Definition at line 4267 of file html.cc.
References Html_get_attr2(), HTML_LeftTrim, HTML_ParseEntities, and HTML_RightTrim.
Referenced by a_Html_common_image_attrs(), a_Html_get_attr_wdef(), a_Html_image_new(), a_Html_tag_set_align_attr(), a_Html_tag_set_valign_attr(), Html_parse_common_attrs(), Html_tag_content_area(), Html_tag_content_embed(), Html_tag_content_frame(), Html_tag_content_img(), Html_tag_content_map(), Html_tag_content_object(), Html_tag_content_source(), Html_tag_content_table_cell(), Html_tag_content_textarea(), Html_tag_open_a(), Html_tag_open_abbr(), Html_tag_open_audio(), Html_tag_open_base(), Html_tag_open_body(), Html_tag_open_button(), Html_tag_open_embed(), Html_tag_open_font(), Html_tag_open_form(), Html_tag_open_frame(), Html_tag_open_hr(), Html_tag_open_img(), Html_tag_open_input(), Html_tag_open_isindex(), Html_tag_open_li(), Html_tag_open_link(), Html_tag_open_meta(), Html_tag_open_object(), Html_tag_open_ol(), Html_tag_open_optgroup(), Html_tag_open_option(), Html_tag_open_sectioning(), Html_tag_open_select(), Html_tag_open_source(), Html_tag_open_span(), Html_tag_open_style(), Html_tag_open_table(), Html_tag_open_table_cell(), Html_tag_open_tr(), Html_tag_open_ul(), and Html_tag_open_video().
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().
DilloImage * a_Html_image_new | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 2133 of file html.cc.
References a_Capi_get_flags_with_redirection(), a_Html_get_attr(), a_Html_get_attr_wdef(), a_Html_url_new(), a_Image_new(), a_Image_ref(), a_Image_unref(), DilloHtml::bw, CAPI_IsCached, dFree(), dNew, dStrAsciiCasecmp(), dStrdup(), DilloHtml::dw, dw::core::Widget::getBgColor(), dw::core::style::ColorAttrs::getColor(), dw::core::Widget::getFgColor(), dw::core::Widget::getLayout(), HT2TB, Html_load_image(), DilloHtmlImage::image, image, DilloHtml::images, lout::misc::SimpleVector< T >::increase(), DilloPrefs::load_images, DilloHtml::page_url, prefs, lout::misc::SimpleVector< T >::set(), lout::misc::SimpleVector< T >::size(), DilloHtmlImage::url, and URL_SCHEME.
Referenced by Html_input_image(), and Html_tag_content_img().
Tell cache to retrieve a stylesheet.
Definition at line 3247 of file html.cc.
References _MSG, a_Bw_add_client(), a_Bw_add_url(), a_Capi_get_buf(), a_Capi_get_flags_with_redirection(), a_Capi_open_url(), a_Capi_set_content_type(), a_Capi_unref_buf(), a_Web_new(), DilloHtml::bw, CAPI_Completed, DilloHtml::content_type, CSS_ORIGIN_AUTHOR, dFree(), dReturn_if, dStrconcat(), _DilloWeb::flags, Html_css_load_callback(), DilloPrefs::load_stylesheets, MSG, BrowserWindow::NumPendingStyleSheets, DilloHtml::page_url, StyleEngine::parse(), prefs, DilloHtml::styleEngine, URL_STR, and WEB_Stylesheet.
Referenced by Html_tag_close_head(), and CssParser::parseImport().
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().
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().
void a_Html_pop_tag | ( | DilloHtml * | html, |
int | TagIdx | ||
) |
void a_Html_stash_init | ( | DilloHtml * | html | ) |
Initialize the stash buffer.
Definition at line 843 of file html.cc.
References DILLO_HTML_PARSE_MODE_STASH, dStr_truncate(), S_TOP, DilloHtml::Stash, and DilloHtml::StashSpace.
Referenced by Html_tag_content_textarea(), Html_tag_open_h(), Html_tag_open_option(), Html_tag_open_script(), Html_tag_open_select(), Html_tag_open_style(), and Html_tag_open_title().
int a_Html_tag_index | ( | const char * | tag | ) |
Get 'tag' index.
return -1 if tag is not handled yet
Definition at line 3610 of file html.cc.
References Html_tag_compare(), NTAGS, and Tags.
Referenced by Html_check_html5_obsolete(), Html_process_tag(), Html_table_get_border_model(), Html_table_set_border_model(), Html_tag_pre_excludes(), Html_test_section(), CssParser::parseSimpleSelector(), and StyleEngine::startElement().
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.
Definition at line 318 of file html.cc.
References a_Html_get_attr(), BUG_MSG, CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, DilloHtml::DocType, DilloHtml::DocTypeVersion, dStrAsciiCasecmp(), DT_HTML, StyleEngine::setNonCssHint(), DilloHtml::styleEngine, dw::core::style::TEXT_ALIGN_CENTER, dw::core::style::TEXT_ALIGN_JUSTIFY, dw::core::style::TEXT_ALIGN_LEFT, dw::core::style::TEXT_ALIGN_RIGHT, and dw::core::style::TEXT_ALIGN_STRING.
Referenced by Html_tag_open_div(), Html_tag_open_h(), Html_tag_open_hr(), Html_tag_open_p(), Html_tag_open_table_cell(), and Html_tag_open_tr().
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.
Returns true when set.
Definition at line 363 of file html.cc.
References a_Html_get_attr(), BUG_MSG, CSS_PROPERTY_VERTICAL_ALIGN, CSS_TYPE_ENUM, DilloHtml::DocType, DilloHtml::DocTypeVersion, dStrAsciiCasecmp(), DT_HTML, StyleEngine::setNonCssHint(), DilloHtml::styleEngine, dw::core::style::VALIGN_BASELINE, dw::core::style::VALIGN_BOTTOM, dw::core::style::VALIGN_MIDDLE, and dw::core::style::VALIGN_TOP.
Referenced by Html_tag_open_table_cell(), and Html_tag_open_tr().
DilloUrl * a_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.
If use_base_url is TRUE, it uses base_url. Otherwise it uses html->base_url.
Definition at line 172 of file html.cc.
References a_Url_new(), DilloHtml::base_url, BUG_MSG, MSG, URL_ILLEGAL_CHARS, URL_ILLEGAL_CHARS_SPC, and URL_STR_.
Referenced by a_Html_image_new(), Html_tag_content_area(), Html_tag_content_img(), Html_tag_content_map(), Html_tag_open_a(), Html_tag_open_audio(), Html_tag_open_base(), Html_tag_open_embed(), Html_tag_open_form(), Html_tag_open_frame(), Html_tag_open_isindex(), Html_tag_open_link(), Html_tag_open_meta(), Html_tag_open_object(), Html_tag_open_source(), Html_tag_open_video(), and CssParser::parseImport().