annotate src/html_common.hh @ 2048:5060d415a85a

clickable menu items (even those introducing submenus) MUST have callbacks I clicked on the "Panel size" item itself instead of any of the options in its submenu, and: Segfault!
author corvid <corvid@lavabit.com>
date Thu, 26 May 2011 02:51:18 +0000
parents f5b91fafcbd4
children
rev   line source
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
1 #ifndef __HTML_COMMON_HH__
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
2 #define __HTML_COMMON_HH__
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
3
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
4 #include "url.h"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
5 #include "bw.h"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
6
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
7 #include "lout/misc.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
8 #include "dw/core.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
9 #include "dw/image.hh"
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
10 #include "dw/style.hh"
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
11
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
12 #include "image.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
13
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
14 #include "form.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
15
497
96713a0f5d8b css.[ch][ch] -> styleengine.[ch][ch]
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 495
diff changeset
16 #include "styleengine.hh"
495
7224de9c34b7 add StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 494
diff changeset
17
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
18 /*
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
19 * Macros
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
20 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
21
1087
1f3e4f17a41a [mq]: replace-DW2TB-with-HT2TB
Jeremy Henty <onepoint@starurchin.org>
parents: 1037
diff changeset
22 // "html struct" to Textblock
1f3e4f17a41a [mq]: replace-DW2TB-with-HT2TB
Jeremy Henty <onepoint@starurchin.org>
parents: 1037
diff changeset
23 #define HT2TB(html) ((Textblock*)(html->dw))
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
24 // "html struct" to "Layout"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
25 #define HT2LT(html) ((Layout*)html->bw->render_layout)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
26 // "Image" to "Dw Widget"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
27 #define IM2DW(Image) ((Widget*)Image->dw)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
28 // Top of the parsing stack
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
29 #define S_TOP(html) (html->stack->getRef(html->stack->size()-1))
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
30
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
31 // Add a bug-meter message.
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
32 #define BUG_MSG(...) \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
33 D_STMT_START { \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
34 html->bugMessage(__VA_ARGS__); \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
35 } D_STMT_END
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
36
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
37 /*
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
38 * Typedefs
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
39 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
40
1435
c3c2a22e7e4e DilloLinkImage -> DilloHtmlImage
corvid <corvid@lavabit.com>
parents: 1373
diff changeset
41 typedef struct _DilloHtmlImage DilloHtmlImage;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
42 typedef struct _DilloHtmlState DilloHtmlState;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
43
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
44 typedef enum {
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
45 DT_NONE,
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
46 DT_HTML,
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
47 DT_XHTML
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
48 } DilloHtmlDocumentType;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
49
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
50 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
51 DILLO_HTML_PARSE_MODE_INIT = 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
52 DILLO_HTML_PARSE_MODE_STASH,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
53 DILLO_HTML_PARSE_MODE_STASH_AND_BODY,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
54 DILLO_HTML_PARSE_MODE_VERBATIM,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
55 DILLO_HTML_PARSE_MODE_BODY,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
56 DILLO_HTML_PARSE_MODE_PRE
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
57 } DilloHtmlParseMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
58
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
59 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
60 DILLO_HTML_TABLE_MODE_NONE, /* no table at all */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
61 DILLO_HTML_TABLE_MODE_TOP, /* outside of <tr> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
62 DILLO_HTML_TABLE_MODE_TR, /* inside of <tr>, outside of <td> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
63 DILLO_HTML_TABLE_MODE_TD /* inside of <td> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
64 } DilloHtmlTableMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
65
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
66 typedef enum {
1761
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
67 DILLO_HTML_TABLE_BORDER_SEPARATE,
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
68 DILLO_HTML_TABLE_BORDER_COLLAPSE
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
69 } DilloHtmlTableBorderMode;
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
70
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
71 typedef enum {
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
72 HTML_LIST_NONE,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
73 HTML_LIST_UNORDERED,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
74 HTML_LIST_ORDERED
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
75 } DilloHtmlListMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
76
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
77 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
78 IN_NONE = 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
79 IN_HTML = 1 << 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
80 IN_HEAD = 1 << 1,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
81 IN_BODY = 1 << 2,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
82 IN_FORM = 1 << 3,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
83 IN_SELECT = 1 << 4,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
84 IN_OPTION = 1 << 5,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
85 IN_TEXTAREA = 1 << 6,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
86 IN_MAP = 1 << 7,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
87 IN_PRE = 1 << 8,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
88 IN_BUTTON = 1 << 9,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
89 IN_LI = 1 << 10,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
90 } DilloHtmlProcessingState;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
91
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
92 /*
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
93 * Data Structures
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
94 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
95
1435
c3c2a22e7e4e DilloLinkImage -> DilloHtmlImage
corvid <corvid@lavabit.com>
parents: 1373
diff changeset
96 struct _DilloHtmlImage {
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
97 DilloUrl *url;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
98 DilloImage *image;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
99 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
100
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
101 struct _DilloHtmlState {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
102 DilloHtmlParseMode parse_mode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
103 DilloHtmlTableMode table_mode;
1761
f5b91fafcbd4 Moved the table border model flag from style to DilloHtmlState (i.e. stack)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1757
diff changeset
104 DilloHtmlTableBorderMode table_border_mode;
284
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
105 bool cell_text_align_set;
1757
c75d0b8f71fc imported patch border-collapse
Jorge Arellano Cid <jcid@dillo.org>
parents: 1733
diff changeset
106
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
107 DilloHtmlListMode list_type;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
108 int list_number;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
109
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
110 /* TagInfo index for the tag that's being processed */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
111 int tag_idx;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
112
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
113 dw::core::Widget *textblock, *table;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
114
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
115 /* This is used to align list items (especially in enumerated lists) */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
116 dw::core::Widget *ref_list_item;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
117
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
118 /* This is used for list items etc; if it is set to TRUE, breaks
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
119 have to be "handed over" (see Html_add_indented and
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
120 Html_eventually_pop_dw). */
283
f97319b762d2 - minor cleanup.
jcid
parents: 263
diff changeset
121 bool hand_over_break;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
122 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
123
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
124 /*
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
125 * Classes
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
126 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
127
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
128 class DilloHtml {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
129 private:
1373
e3683ea10681 move link signal emitter/receiver from Widget to Layout
corvid <corvid@lavabit.com>
parents: 1370
diff changeset
130 class HtmlLinkReceiver: public dw::core::Layout::LinkReceiver {
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
131 public:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
132 DilloHtml *html;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
133
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
134 bool enter (dw::core::Widget *widget, int link, int img, int x, int y);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
135 bool press (dw::core::Widget *widget, int link, int img, int x, int y,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
136 dw::core::EventButton *event);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
137 bool click (dw::core::Widget *widget, int link, int img, int x, int y,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
138 dw::core::EventButton *event);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
139 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
140 HtmlLinkReceiver linkReceiver;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
141
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
142 public: //BUG: for now everything is public
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
143
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
144 BrowserWindow *bw;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
145 DilloUrl *page_url, *base_url;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
146 dw::core::Widget *dw; /* this is duplicated in the stack */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
147
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
148 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
149 /* Variables required at parsing time */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
150 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
151 char *Start_Buf;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
152 int Start_Ofs;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
153 char *content_type, *charset;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
154 bool stop_parser;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
155
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
156 size_t CurrTagOfs;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
157 size_t OldTagOfs, OldTagLine;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
158
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
159 DilloHtmlDocumentType DocType; /* as given by DOCTYPE tag */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
160 float DocTypeVersion; /* HTML or XHTML version number */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
161
897
cdb32eeb8322 Fix a race condition with charset, and the case of charset after CSS in HEAD
Jorge Arellano Cid <jcid@dillo.org>
parents: 896
diff changeset
162 /* vector of remote CSS resources, as given by the LINK element */
cdb32eeb8322 Fix a race condition with charset, and the case of charset after CSS in HEAD
Jorge Arellano Cid <jcid@dillo.org>
parents: 896
diff changeset
163 lout::misc::SimpleVector<DilloUrl*> *cssUrls;
cdb32eeb8322 Fix a race condition with charset, and the case of charset after CSS in HEAD
Jorge Arellano Cid <jcid@dillo.org>
parents: 896
diff changeset
164
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
165 lout::misc::SimpleVector<DilloHtmlState> *stack;
495
7224de9c34b7 add StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 494
diff changeset
166 StyleEngine *styleEngine;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
167
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
168 int InFlags; /* tracks which elements we are in */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
169
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
170 Dstr *Stash;
284
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
171 bool StashSpace;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
172
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
173 int pre_column; /* current column, used in PRE tags with tabs */
284
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
174 bool PreFirstChar; /* used to skip the first CR or CRLF in PRE tags */
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
175 bool PrevWasCR; /* Flag to help parsing of "\r\n" in PRE tags */
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
176 bool PrevWasOpenTag; /* Flag to help deferred parsing of white space */
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
177 bool InVisitedLink; /* used to 'contrast_visited_colors' */
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
178 bool ReqTagClose; /* Flag to help handling bad-formed HTML */
23b5586b9869 - cleanup: switched bool_t to bool in html.cc
jcid
parents: 283
diff changeset
179 bool TagSoup; /* Flag to enable the parser's cleanup functions */
1013
f4d5923de127 load <style></style> content only if applicable
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 999
diff changeset
180 bool loadCssFromStash; /* current stash content should be loaded as CSS */
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
181
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
182 /* element counters: used for validation purposes */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
183 uchar_t Num_HTML, Num_HEAD, Num_BODY, Num_TITLE;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
184
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
185 Dstr *attr_data; /* Buffer for attribute value */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
186
1037
a72e5506e280 Implemented Instant client-side redirects (META refresh with delay=0)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1035
diff changeset
187 int32_t non_css_link_color; /* as provided by link attribute in BODY */
a72e5506e280 Implemented Instant client-side redirects (META refresh with delay=0)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1035
diff changeset
188 int32_t non_css_visited_color; /* as provided by vlink attribute in BODY */
992
5e2c7a06f7ab replace visited_color dillorc option
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 930
diff changeset
189 int32_t visited_color; /* as computed according to CSS */
896
28c48c67ff1d Minor cleanups
Jorge Arellano Cid <jcid@dillo.org>
parents: 806
diff changeset
190
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
191 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
192 /* Variables required after parsing (for page functionality) */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
193 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
194 lout::misc::SimpleVector<DilloHtmlForm*> *forms;
305
43ba970f42cf - Allowed form inputs outside FORM (it's in the standard).
jcid
parents: 288
diff changeset
195 lout::misc::SimpleVector<DilloHtmlInput*> *inputs_outside_form;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
196 lout::misc::SimpleVector<DilloUrl*> *links;
1435
c3c2a22e7e4e DilloLinkImage -> DilloHtmlImage
corvid <corvid@lavabit.com>
parents: 1373
diff changeset
197 lout::misc::SimpleVector<DilloHtmlImage*> *images;
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
198 dw::ImageMapsList maps;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
199
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
200 private:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
201 void freeParseData();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
202 void initDw(); /* Used by the constructor */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
203
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
204 public:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
205 DilloHtml(BrowserWindow *bw, const DilloUrl *url, const char *content_type);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
206 ~DilloHtml();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
207 void bugMessage(const char *format, ... );
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
208 void connectSignals(dw::core::Widget *dw);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
209 void write(char *Buf, int BufSize, int Eof);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
210 int getCurTagLineNumber();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
211 void finishParsing(int ClientKey);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
212 int formNew(DilloHtmlMethod method, const DilloUrl *action,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
213 DilloHtmlEnc enc, const char *charset);
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
214 DilloHtmlForm *getCurrentForm ();
328
6a5b6bbf9836 - Fixed the "Load Images" menu item in the page popup.
jcid
parents: 305
diff changeset
215 bool_t unloadedImages();
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
216 void loadImages (const DilloUrl *pattern);
897
cdb32eeb8322 Fix a race condition with charset, and the case of charset after CSS in HEAD
Jorge Arellano Cid <jcid@dillo.org>
parents: 896
diff changeset
217 void addCssUrl(const DilloUrl *url);
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
218 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
219
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
220 /*
930
b277eed3119c whitespace cleanup: 's/ +$//g'
Jorge Arellano Cid <jcid@dillo.org>
parents: 925
diff changeset
221 * Parser functions
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
222 */
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
223
494
db216e0183a1 make a_Html_tag_index accessible outside of html.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 351
diff changeset
224 int a_Html_tag_index(const char *tag);
db216e0183a1 make a_Html_tag_index accessible outside of html.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 351
diff changeset
225
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
226 const char *a_Html_get_attr(DilloHtml *html,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
227 const char *tag,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
228 int tagsize,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
229 const char *attrname);
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
230
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
231 char *a_Html_get_attr_wdef(DilloHtml *html,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
232 const char *tag,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
233 int tagsize,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
234 const char *attrname,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
235 const char *def);
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
236
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
237 DilloUrl *a_Html_url_new(DilloHtml *html,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
238 const char *url_str, const char *base_url,
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
239 int use_base_url);
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
240
925
f3a156cbce61 API cleanup: a_Html_add_new_image() loses the boolean parameter.
Jeremy Henty <onepoint@starurchin.org>
parents: 901
diff changeset
241 DilloImage *a_Html_image_new(DilloHtml *html, const char *tag,
f3a156cbce61 API cleanup: a_Html_add_new_image() loses the boolean parameter.
Jeremy Henty <onepoint@starurchin.org>
parents: 901
diff changeset
242 int tagsize, DilloUrl *url);
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
243
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
244 char *a_Html_parse_entities(DilloHtml *html, const char *token, int toksize);
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
245 void a_Html_pop_tag(DilloHtml *html, int TagIdx);
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
246 void a_Html_stash_init(DilloHtml *html);
288
d1769acf3830 - split table code from html.cc
jcid
parents: 284
diff changeset
247 int32_t a_Html_color_parse(DilloHtml *html,
d1769acf3830 - split table code from html.cc
jcid
parents: 284
diff changeset
248 const char *subtag, int32_t default_color);
d1769acf3830 - split table code from html.cc
jcid
parents: 284
diff changeset
249 dw::core::style::Length a_Html_parse_length (DilloHtml *html,
d1769acf3830 - split table code from html.cc
jcid
parents: 284
diff changeset
250 const char *attr);
1733
f39cfc38ea10 rework nonCssHints API of StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1435
diff changeset
251 void a_Html_tag_set_align_attr(DilloHtml *html, const char *tag, int tagsize);
288
d1769acf3830 - split table code from html.cc
jcid
parents: 284
diff changeset
252 bool a_Html_tag_set_valign_attr(DilloHtml *html,
1733
f39cfc38ea10 rework nonCssHints API of StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1435
diff changeset
253 const char *tag, int tagsize);
263
af0161ff58ec - html.cc cleanup (in progress): source split.
jcid
parents: 262
diff changeset
254
1035
474b9814a8fa support CSS @import directive
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1013
diff changeset
255 void a_Html_load_stylesheet(DilloHtml *html, DilloUrl *url);
474b9814a8fa support CSS @import directive
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1013
diff changeset
256
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
257 #endif /* __HTML_COMMON_HH__ */