Subversion Repositories Kolibri OS

Rev

Rev 8439 | Rev 8451 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8439 Rev 8444
Line 1... Line 1...
1
void TWebBrowser::SetStyle() 
1
void TWebBrowser::SetStyle() 
2
{
2
{
3
	if (tag.get_value_of("name=")) || (tag.get_value_of("id=")) {
3
	if (tag.get_value_of("name")) || (tag.get_value_of("id")) {
4
		anchors.add(tag.value, draw_y);
4
		anchors.add(tag.value, draw_y);
5
		if (anchors.current) && (streq(tag.value, #anchors.current+1)) {
5
		if (anchors.current) && (streq(tag.value, #anchors.current+1)) {
6
			list.first = draw_y;
6
			list.first = draw_y;
7
			anchors.current = NULL;
7
			anchors.current = NULL;
8
		}
8
		}
Line 75... Line 75...
75
{
75
{
76
	style.font = tag.opened;
76
	style.font = tag.opened;
77
	style.bg_color = page_bg;
77
	style.bg_color = page_bg;
78
	if (tag.opened)
78
	if (tag.opened)
79
	{
79
	{
80
		if (tag.get_value_of("bg=")) style.bg_color = GetColor(tag.value);
80
		if (tag.get_value_of("bg")) style.bg_color = GetColor(tag.value);
81
		if (tag.get_value_of("color=")) {
81
		if (tag.get_value_of("color")) {
82
			text_colors.add(GetColor(tag.value));
82
			text_colors.add(GetColor(tag.value));
83
		} else {
83
		} else {
84
			text_colors.add(text_colors.get_last());
84
			text_colors.add(text_colors.get_last());
85
		}
85
		}
86
	}
86
	}
Line 94... Line 94...
94
	NewLine();
94
	NewLine();
95
}
95
}
Line 96... Line 96...
96
 
96
 
97
void TWebBrowser::tag_iframe()
97
void TWebBrowser::tag_iframe()
98
{
98
{
99
	if (tag.get_value_of("src=")) {
99
	if (tag.get_value_of("src")) {
100
		NewLine();
100
		NewLine();
101
		strcpy(#line, "IFRAME: ");
101
		strcpy(#line, "IFRAME: ");
102
		Paint();
102
		Paint();
103
		link=true;
103
		link=true;
Line 112... Line 112...
112
 
112
 
113
void TWebBrowser::tag_a()
113
void TWebBrowser::tag_a()
114
{
114
{
115
	if (tag.opened)
115
	if (tag.opened)
116
	{
116
	{
117
		if (tag.get_value_of("href=")) && (!strstr(tag.value,"javascript:"))
117
		if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:"))
118
		{
118
		{
119
			link = true;
119
			link = true;
120
			links.add_link(tag.value);
120
			links.add_link(tag.value);
121
		}
121
		}
Line 125... Line 125...
125
	}
125
	}
126
}
126
}
Line 127... Line 127...
127
 
127
 
128
void TWebBrowser::tag_meta_xml()
128
void TWebBrowser::tag_meta_xml()
129
{
129
{
130
	if (custom_encoding == -1) if (tag.get_value_of("charset=")) 
130
	if (custom_encoding == -1) if (tag.get_value_of("charset")) 
131
	|| (tag.get_value_of("content=")) || (tag.get_value_of("encoding="))
131
	|| (tag.get_value_of("content")) || (tag.get_value_of("encoding"))
132
	{
132
	{
133
		EDX = strrchr(tag.value, '=') + tag.value; //search in content=
133
		EDX = strrchr(tag.value, '=') + tag.value; //search in content=
134
		if (ESBYTE[EDX] == '"') EDX++;
134
		if (ESBYTE[EDX] == '"') EDX++;
135
		strlwr(EDX);
135
		strlwr(EDX);
136
		if      (streqrp(EDX,"utf-8"))        || (streqrp(EDX,"utf8"))        ChangeEncoding(CH_UTF8);
136
		if      (streqrp(EDX,"utf-8"))        || (streqrp(EDX,"utf8"))        ChangeEncoding(CH_UTF8);
137
		else if (streqrp(EDX,"windows-1251")) || (streqrp(EDX,"windows1251")) ChangeEncoding(CH_CP1251);
137
		else if (streqrp(EDX,"windows-1251")) || (streqrp(EDX,"windows1251")) ChangeEncoding(CH_CP1251);
138
		else if (streqrp(EDX,"dos"))          || (streqrp(EDX,"cp-866"))      ChangeEncoding(CH_CP866);
138
		else if (streqrp(EDX,"dos"))          || (streqrp(EDX,"cp-866"))      ChangeEncoding(CH_CP866);
139
		else if (streqrp(EDX,"iso-8859-5"))   || (streqrp(EDX,"iso8859-5"))   ChangeEncoding(CH_ISO8859_5);
139
		else if (streqrp(EDX,"iso-8859-5"))   || (streqrp(EDX,"iso8859-5"))   ChangeEncoding(CH_ISO8859_5);
140
		else if (streqrp(EDX,"koi8-r"))       || (streqrp(EDX,"koi8-u"))      ChangeEncoding(CH_KOI8);
140
		else if (streqrp(EDX,"koi8-r"))       || (streqrp(EDX,"koi8-u"))      ChangeEncoding(CH_KOI8);
141
	}
141
	}
142
	if (streq(tag.get_value_of("http-equiv="), "refresh")) && (tag.get_value_of("content=")) {
142
	if (streq(tag.get_value_of("http-equiv"), "refresh")) && (tag.get_value_of("content")) {
143
		if (tag.value = strstri(tag.value, "url=")) strcpy(#redirect, tag.value);
143
		if (tag.value = strstri(tag.value, "url")) strcpy(#redirect, tag.value);
144
	}
144
	}
Line 145... Line 145...
145
}
145
}
146
 
146
 
Line 185... Line 185...
185
}
185
}
Line 186... Line 186...
186
 
186
 
187
void TWebBrowser::tag_hr()
187
void TWebBrowser::tag_hr()
188
{
188
{
189
	EAX = 0x999999;
189
	EAX = 0x999999;
190
	if (tag.get_value_of("color=")) GetColor(tag.value);
190
	if (tag.get_value_of("color")) GetColor(tag.value);
191
	$push eax;
191
	$push eax;
192
	NewLine();
192
	NewLine();
193
	$pop edi;
193
	$pop edi;
194
	draw_y += 10;
194
	draw_y += 10;
Line 199... Line 199...
199
}
199
}
Line 200... Line 200...
200
 
200
 
201
void TWebBrowser::tag_body()
201
void TWebBrowser::tag_body()
202
{
202
{
203
	t_body = tag.opened;
203
	t_body = tag.opened;
204
	if (tag.get_value_of("link="))   link_color_default = GetColor(tag.value);
204
	if (tag.get_value_of("link"))   link_color_default = GetColor(tag.value);
205
	if (tag.get_value_of("alink="))  link_color_active = GetColor(tag.value);
205
	if (tag.get_value_of("alink"))  link_color_active = GetColor(tag.value);
206
	if (tag.get_value_of("text="))   text_colors.set(0, GetColor(tag.value));
206
	if (tag.get_value_of("text"))   text_colors.set(0, GetColor(tag.value));
207
	if (tag.get_value_of("bgcolor=")) {
207
	if (tag.get_value_of("bgcolor")) {
208
		style.bg_color = page_bg = GetColor(tag.value);
208
		style.bg_color = page_bg = GetColor(tag.value);
209
		canvas.Fill(0, page_bg);
209
		canvas.Fill(0, page_bg);
210
	}
210
	}
211
	// Autodetecting encoding if no encoding was set
211
	// Autodetecting encoding if no encoding was set
Line 258... Line 258...
258
	char img_path[4096]=0;
258
	char img_path[4096]=0;
259
	dword imgbuf[44];
259
	dword imgbuf[44];
260
	dword cur_img;
260
	dword cur_img;
261
	int img_x, img_y, img_w, img_h;
261
	int img_x, img_y, img_w, img_h;
Line 262... Line 262...
262
 
262
 
Line 263... Line 263...
263
	if (!tag.get_value_of("src=")) goto NOIMG;
263
	if (!tag.get_value_of("src")) goto NOIMG;
264
 
264
 
265
	if (streqrp(tag.value, "data:")) {
265
	if (streqrp(tag.value, "data:")) {
266
		if (!strstr(tag.value, "base64,")) goto NOIMG;
266
		if (!strstr(tag.value, "base64,")) goto NOIMG;
Line 332... Line 332...
332
	img_blend stdcall(#imgbuf, cur_img, img_x, img_y, 0, 0, img_w, img_h);
332
	img_blend stdcall(#imgbuf, cur_img, img_x, img_y, 0, 0, img_w, img_h);
333
	img_destroy stdcall(cur_img);
333
	img_destroy stdcall(cur_img);
334
	return;
334
	return;
Line 335... Line 335...
335
 
335
 
336
NOIMG:
336
NOIMG:
337
	if (tag.get_value_of("title=")) || (tag.get_value_of("alt=")) {
337
	if (tag.get_value_of("title")) || (tag.get_value_of("alt")) {
338
		strncpy(#img_path, tag.value, sizeof(line)-3);
338
		strncpy(#img_path, tag.value, sizeof(line)-3);
339
		sprintf(#line, "[%s]", #img_path);
339
		sprintf(#line, "[%s]", #img_path);
340
	} else {
340
	} else {
341
		if (streqrp(#img_path, "data:")) img_path=0;
341
		if (streqrp(#img_path, "data:")) img_path=0;