14#ifndef __HTML_COMMON_HH__
15#define __HTML_COMMON_HH__
36#define HT2TB(html) ((Textblock*)(html->dw))
38#define HT2LT(html) ((Layout*)html->bw->render_layout)
40#define IM2DW(Image) ((Widget*)Image->dw)
42#define S_TOP(html) (html->stack->getRef(html->stack->size()-1))
47 html->bugMessage(__VA_ARGS__); \
228 void write(
char *Buf,
int BufSize,
int Eof);
264 const char *attrname);
269 const char *attrname,
273 const char *url_str,
const char *base_url,
283 int32_t default_color);
288 const char *tag,
int tagsize);
bool enter(dw::core::Widget *widget, int link, int img, int x, int y)
Called, when a link is entered, left, or the position has changed.
bool press(dw::core::Widget *widget, int link, int img, int x, int y, dw::core::EventButton *event)
Handle the "press" signal.
bool click(dw::core::Widget *widget, int link, int img, int x, int y, dw::core::EventButton *event)
Handle the "click" signal.
bool ReqTagClose
Flag to close the stack's top tag.
void freeParseData()
Free parsing data.
int InFlags
tracks which elements we are in
DilloHtmlDocumentType DocType
int getCurrLineNumber()
Return the line number of the tag/word being processed by the parser.
void connectSignals(dw::core::Widget *dw)
void bugMessage(const char *format,...)
Collect HTML error strings.
lout::misc::SimpleVector< DilloHtmlState > * stack
void write(char *Buf, int BufSize, int Eof)
Process the newly arrived html and put it into the page structure.
dw::core::style::Style * backgroundStyle()
int formNew(DilloHtmlMethod method, const DilloUrl *action, DilloHtmlEnc enc, const char *charset)
Allocate and insert form information.
void finishParsing(int ClientKey)
Finish parsing a HTML page.
bool PreFirstChar
used to skip the first CR or CRLF in PRE tags
void startElement(int tag)
void addCssUrl(const DilloUrl *url)
Save URL in a vector (may be loaded later).
bool PrevWasOpenTag
Flag to help deferred parsing of white space.
void initDw()
Miscellaneous initializations for Dw.
bool PrevWasCR
Flag to help parsing of "\r\n" in PRE tags.
bool TagSoup
Flag to enable the parser's cleanup functions.
int pre_column
current column, used in PRE tags with tabs
lout::misc::SimpleVector< DilloHtmlInput * > * inputs_outside_form
bool PrevWasHtmlClose
set when </html> is found
dw::core::style::Style * wordStyle()
int32_t non_css_visited_color
as provided by vlink attribute in BODY
bool loadCssFromStash
current stash content should be loaded as CSS
lout::misc::SimpleVector< DilloHtmlForm * > * forms
~DilloHtml()
Free memory used by the DilloHtml class.
dw::core::style::Style * style()
uchar_t Num_HTML
element counters: used for validation purposes.
lout::misc::SimpleVector< DilloUrl * > * links
int32_t non_css_link_color
as provided by link attribute in BODY
Dstr * attr_data
Buffer for attribute value.
bool PrevWasBodyClose
set when </body> is found
void startElement(const char *tagname)
lout::misc::SimpleVector< DilloUrl * > * cssUrls
int32_t visited_color
as computed according to CSS
bool InVisitedLink
used to 'contrast_visited_colors'
StyleEngine * styleEngine
lout::misc::SimpleVector< DilloHtmlImage * > * images
HtmlLinkReceiver linkReceiver
DilloHtmlForm * getCurrentForm()
Get the current form.
void loadImages(const DilloUrl *pattern)
Load images if they were disabled.
This class provides the glue between HTML parser and CSS subsystem.
void restyle(BrowserWindow *bw)
Recompute all style information from scratch This is used to take into account CSS styles for the HTM...
void startElement(int tag, BrowserWindow *bw)
tell the styleEngine that a new html element has started.
dw::core::style::Style * style(BrowserWindow *bw)
dw::core::style::Style * wordStyle(BrowserWindow *bw)
dw::core::style::Style * backgroundStyle(BrowserWindow *bw)
Similar to StyleEngine::style(), but with backgroundColor set.
Represents a list of client-side image maps.
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector.
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.
void a_Html_pop_tag(DilloHtml *html, int TagIdx)
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_stash_init(DilloHtml *html)
Initialize the stash buffer.
@ DILLO_HTML_TABLE_MODE_TD
inside of
@ DILLO_HTML_TABLE_MODE_NONE
no table at all
@ DILLO_HTML_TABLE_MODE_TR
inside of , outside of
@ DILLO_HTML_TABLE_MODE_TOP
outside of
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.
DilloImage * a_Html_image_new(DilloHtml *html, const char *tag, int tagsize)
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.
int32_t a_Html_color_parse(DilloHtml *html, const char *str, int32_t default_color)
Parse a color attribute.
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.
@ DILLO_HTML_PARSE_MODE_PRE
@ DILLO_HTML_PARSE_MODE_VERBATIM
@ DILLO_HTML_PARSE_MODE_BODY
@ DILLO_HTML_PARSE_MODE_INIT
@ DILLO_HTML_PARSE_MODE_STASH_AND_BODY
@ DILLO_HTML_PARSE_MODE_STASH
void a_Html_common_image_attrs(DilloHtml *html, const char *tag, int tagsize)
Read image-associated tag attributes and create new image.
@ DILLO_HTML_TABLE_BORDER_COLLAPSE
@ DILLO_HTML_TABLE_BORDER_SEPARATE
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.
int a_Html_tag_index(const char *tag)
Get 'tag' index.
char * a_Html_parse_entities(DilloHtml *html, const char *token, int toksize)
Parse all the entities in a token.
void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url)
Tell cache to retrieve a stylesheet.
Dw is in this namespace, or sub namespaces of this one.
The DilloImage data-structure and methods.
Contains the specific data for a single window.
DilloHtmlTableMode table_mode
bool hand_over_break
This is used for list items etc.
DilloHtmlTableBorderMode table_border_mode
DilloHtmlListMode list_type
dw::core::Widget * ref_list_item
This is used to align list items (especially in enumerated lists)
DilloHtmlParseMode parse_mode
int tag_idx
TagInfo index for the tag that's being processed.
Parse and normalize all URL's inside Dillo.