Subversion Repositories Kolibri OS

Rev

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

Rev 8500 Rev 9103
Line 48... Line 48...
48
	if (tag.is("iframe"))     { tag_iframe();         return; }
48
	if (tag.is("iframe"))     { tag_iframe();         return; }
49
	if (tag.is("caption"))    { tag_h1234_caption();  return; }
49
	if (tag.is("caption"))    { tag_h1234_caption();  return; }
50
	if (tag.is("title"))      { tag_title();          return; }
50
	if (tag.is("title"))      { tag_title();          return; }
51
	if (tag.is("body"))       { tag_body();           return; }
51
	if (tag.is("body"))       { tag_body();           return; }
52
	if (tag.is("html"))       { t_html = tag.opened;  return; }
52
	if (tag.is("html"))       { t_html = tag.opened;  return; }
53
 
-
 
54
	if (tag.is("table"))      { tag_table();          return; }
53
	tag_table();
55
	if (tag.is("tr"))         { if (tag.opened) NewLine();    return; } //temp
-
 
56
	//if (tag.is("tr"))         { tag_tr();             return; }
-
 
57
	//if (tag.is("td"))         { tag_td();             return; }
-
 
58
}
54
}
Line 59... Line 55...
59
 
55
 
60
void TWebBrowser::tag_p()
56
void TWebBrowser::tag_p()
61
{
57
{
Line 196... Line 192...
196
	}
192
	}
197
}
193
}
Line 198... Line 194...
198
 
194
 
199
void TWebBrowser::tag_hr()
195
void TWebBrowser::tag_hr()
200
{
196
{
201
	dword hrcol = 0x777777;
197
	dword hrcol = 0x00777777;
202
	if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
198
	if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
203
	if (draw_x != left_gap) NewLine();
199
	if (draw_x != left_gap) NewLine();
204
	canvas.DrawBar(5, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
200
	if (secondrun) canvas.DrawBar(5, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
205
	draw_x++;
201
	draw_x++;
206
	NewLine();
202
	NewLine();
207
	return;
203
	return;
Line 318... Line 314...
318
}
314
}
Line 319... Line -...
319
 
-
 
320
 
-
 
Line -... Line 315...
-
 
315
 
-
 
316
 
-
 
317
 
-
 
318
 
321
 
319
 
322
 
-
 
323
int tdepth;
320
 
324
int col_n;
321
 
325
 
322
 
326
struct TABLE {
323
 
327
	collection_int col_w;
324
int tdepth;
Line 328... Line 325...
328
	collection_int col_span;
325
collection_int tr_col_count; //drop on once!
329
	collection_int row_h;
326
int tr_pos, td_pos;
330
	int row_y, next_row_y;
-
 
331
	int colcount;
327
int row_start_y;
332
} t[5];
-
 
333
 
328
int colcount;
334
void TWebBrowser::tag_table_reset()
-
 
335
{
-
 
336
	int i;
329
dword tallest_cell_in_row;
337
	tdepth = 0;
330
 
338
	for (i=0; i<5; i++) {
-
 
339
		t[i].col_w.drop();
331
void TWebBrowser::tag_table_reset()
Line 340... Line 332...
340
		t[i].row_h.drop();
332
{
341
		t[i].col_span.drop();
333
	tdepth = 0;
-
 
334
	colcount = 0;
342
		t[i].row_y = 0;
335
	tr_pos = 0;
343
		t[i].next_row_y = 0;
-
 
344
	}
-
 
345
}
-
 
346
 
336
	td_pos = 0;
347
void TWebBrowser::tag_table()
337
}
348
{
338
 
349
	if (tag.opened) {
339
void TWebBrowser::tag_table()
-
 
340
{
-
 
341
	if (tag.is("table")) {
-
 
342
		if(tag.opened) {
350
		if (tdepth==0) {
343
			tdepth++; 
351
			t[0].next_row_y = t[0].row_y = draw_y;
344
		} else {
352
		}
345
			if (tdepth>0) tdepth--;
-
 
346
			if (tdepth==0) {
353
		tdepth++;
347
				draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
354
	} else {
348
				draw_w = list.w;
-
 
349
				
-
 
350
				draw_y = math.max(draw_y+style.cur_line_h, tallest_cell_in_row);
-
 
351
				row_start_y = draw_y = tallest_cell_in_row = draw_y;
355
		tdepth--;
352
				style.cur_line_h = list.item_h;
Line -... Line 353...
-
 
353
			}
356
		if (tdepth==0) {
354
		}
-
 
355
	}
357
			draw_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
356
	if (tdepth>1) {
358
			left_gap = BODY_MARGIN;
357
		if (tag.is("tr")) && (tag.opened) NewLine();
359
			draw_w = list.w - BODY_MARGIN;
-
 
360
		}
-
 
361
	} 
-
 
362
}
-
 
363
 
358
		return;
364
:void TWebBrowser::tag_tr()
-
 
365
{
-
 
366
	if (tag.opened) {
-
 
367
		if (tdepth>1) {
359
	}
368
			NewLine();
360
 
-
 
361
	if (!secondrun) {
-
 
362
		if (tag.is("tr")) {
-
 
363
			if (colcount) tr_col_count.set(tr_col_count.count-1, colcount);
369
		} else {
364
			colcount = 0;
370
			t[0].colcount = math.max(t[0].colcount, col_n);
-
 
371
			col_n = 0;
-
 
372
			t[0].row_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
365
			if (tag.opened) {
373
			left_gap = BODY_MARGIN;
366
				tr_col_count.add(1);
374
			NewLine();	
367
			}
-
 
368
		}
-
 
369
		if (tag.opened) && (tag.is("td")) || (tag.is("th")) {
375
		}		
370
			colcount++;
376
	}
371
			//if (tag.get_number_of("colspan")) colcount += tag.number-1;
-
 
372
		}		
377
}
373
	} else {
378
 
-
 
379
:void TWebBrowser::tag_td()
-
 
380
{
-
 
381
	if (tdepth>1) return;
374
		if (tag.is("tr")) {
382
	if (tag.opened) {
-
 
383
 
-
 
384
		t[0].next_row_y = math.max(draw_y + style.cur_line_h, t[0].next_row_y);
375
			if (tag.opened) {
385
		style.cur_line_h = list.item_h;
376
				if (draw_x==left_gap) && (draw_y==BODY_MARGIN) {
386
		t[0].col_w.set(col_n, math.max(draw_x,t[0].col_w.get(col_n)) );
377
					row_start_y = tallest_cell_in_row = draw_y;
387
		draw_x = left_gap = t[0].col_w.get(col_n);
378
				} else {
388
		draw_w = list.w - left_gap;
379
					row_start_y = tallest_cell_in_row = draw_y = draw_y + style.cur_line_h;
389
		draw_y = t[0].row_y;
380
				}
390
		if (tag.get_number_of("width")) {
381
				style.cur_line_h = list.item_h;
-
 
382
				tr_pos++;
-
 
383
				td_pos = 0;
-
 
384
			} else {
-
 
385
				draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
-
 
386
				draw_w = list.w;
-
 
387
				draw_y = tallest_cell_in_row;
-
 
388
			}
-
 
389
		}
-
 
390
		if (tr_pos) && (tag.is("td")) || (tag.is("th"))  {
-
 
391
			tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h, tallest_cell_in_row);
391
			if (!strchr(tag.value, '%')) {
392
			style.cur_line_h = list.item_h;
392
				draw_w = tag.number;
-
 
393
			} else {
-
 
394
				if (tag.number < 100) {
-
 
395
					draw_w = draw_w - left_gap * tag.number / 100;
-
 
396
					if (draw_w > list.w - left_gap) draw_w = list.w - left_gap;
-
 
397
				}
-
 
398
			}
-
 
399
		}
-
 
400
		col_n++;
-
 
401
		t[0].col_w.set(col_n, draw_x + draw_w);
393
			if (tag.opened) {
402
 
-
 
403
		if (left_gap >= list.w - list.font_w - 10) {
-
 
404
			debugln("left_gap overflow");
-
 
405
			draw_x = left_gap = BODY_MARGIN;
-
 
406
			t[0].col_w.drop();
-
 
407
			NewLine();
-
 
408
			canvas.WriteText(draw_x, draw_y, 10011001b, 0xFE0000, "lgo", NULL);
-
 
409
		}
394
				draw_w = list.w - BODY_MARGIN - BODY_MARGIN - 23 / tr_col_count.get(tr_pos-1);
410
 
395
				draw_x = left_gap = draw_w * td_pos + BODY_MARGIN;
Line 411... Line -...
411
		if (draw_w < 0) || (draw_w >= list.w) {
-