forked from KolibriOS/kolibrios
WebView 3.6: better table support, bugfixes
git-svn-id: svn://kolibrios.org@9294 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
40ec5cc46e
commit
53fd96fe51
@ -198,6 +198,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
|||||||
//*/
|
//*/
|
||||||
|
|
||||||
RenderTextbuf();
|
RenderTextbuf();
|
||||||
|
if (debug_mode) { debugch('<'); if(!tag.opened)debugch('/'); debug(#tag.name); debugln(">"); }
|
||||||
$push cur_encoding
|
$push cur_encoding
|
||||||
SetStyle();
|
SetStyle();
|
||||||
$pop eax
|
$pop eax
|
||||||
|
@ -71,10 +71,12 @@ void TWebBrowser::RenderTextbuf()
|
|||||||
dword lbp = #linebuf;
|
dword lbp = #linebuf;
|
||||||
int br; //break position
|
int br; //break position
|
||||||
char nul = '\0';
|
char nul = '\0';
|
||||||
int len;
|
unsigned int len;
|
||||||
|
|
||||||
//Do we need a line break?
|
//Do we need a line break?
|
||||||
|
|
||||||
|
if (!linebuf[0]) return;
|
||||||
|
|
||||||
while (len = strlen(lbp)) && (len * list.font_w + draw_x - left_gap >= draw_w) {
|
while (len = strlen(lbp)) && (len * list.font_w + draw_x - left_gap >= draw_w) {
|
||||||
//Yes, we do. Lets calculate where...
|
//Yes, we do. Lets calculate where...
|
||||||
br = len;
|
br = len;
|
||||||
@ -109,7 +111,9 @@ void TWebBrowser::RenderTextbuf()
|
|||||||
RenderLine(lbp);
|
RenderLine(lbp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
debugln("rnd_");
|
||||||
RenderLine(lbp);
|
RenderLine(lbp);
|
||||||
|
debugln("_rnd");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWebBrowser::NewLine()
|
void TWebBrowser::NewLine()
|
||||||
|
@ -51,7 +51,10 @@ void TWebBrowser::SetStyle()
|
|||||||
if (tag.is("title")) { tag_title(); return; }
|
if (tag.is("title")) { tag_title(); return; }
|
||||||
if (tag.is("body")) { tag_body(); return; }
|
if (tag.is("body")) { tag_body(); return; }
|
||||||
if (tag.is("html")) { t_html = tag.opened; return; }
|
if (tag.is("html")) { t_html = tag.opened; return; }
|
||||||
tag_table();
|
if (tag.is("table")) { tag_table(); return; }
|
||||||
|
if (tag.is("tr")) { tag_table(); return; }
|
||||||
|
if (tag.is("th")) { tag_table(); return; }
|
||||||
|
if (tag.is("td")) { tag_table(); return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWebBrowser::tag_p()
|
void TWebBrowser::tag_p()
|
||||||
@ -320,8 +323,8 @@ NOIMG:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct TABLE {
|
struct TABLE {
|
||||||
|
int count;
|
||||||
int depth;
|
int depth;
|
||||||
collection_int cols;
|
collection_int cols;
|
||||||
} table;
|
} table;
|
||||||
@ -335,6 +338,7 @@ dword tallest_cell_in_row;
|
|||||||
void TWebBrowser::tag_table_reset()
|
void TWebBrowser::tag_table_reset()
|
||||||
{
|
{
|
||||||
table.depth = 0;
|
table.depth = 0;
|
||||||
|
table.count = 0;
|
||||||
colcount = 0;
|
colcount = 0;
|
||||||
tr_pos = 0;
|
tr_pos = 0;
|
||||||
td_pos = 0;
|
td_pos = 0;
|
||||||
@ -347,11 +351,11 @@ void TWebBrowser::tag_table()
|
|||||||
if (link) tag_a();
|
if (link) tag_a();
|
||||||
style.b = false;
|
style.b = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.is("table")) {
|
if (tag.is("table")) {
|
||||||
if(tag.opened) {
|
if(tag.opened) {
|
||||||
table.depth++;
|
table.depth++;
|
||||||
if (table.depth==1) {
|
if (table.depth==1) {
|
||||||
|
table.count++;
|
||||||
colcount = 0;
|
colcount = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -379,7 +383,8 @@ void TWebBrowser::tag_table()
|
|||||||
}
|
}
|
||||||
colcount = 0;
|
colcount = 0;
|
||||||
}
|
}
|
||||||
if (tag.opened) && (tag.is("td")) || (tag.is("th")) {
|
if (tag.opened) if (tag.is("td")) || (tag.is("th")) {
|
||||||
|
if (!table.cols.count) { table.cols.add(1); colcount = 0;}
|
||||||
colcount++;
|
colcount++;
|
||||||
if (colcount) table.cols.set(table.cols.count-1, colcount);
|
if (colcount) table.cols.set(table.cols.count-1, colcount);
|
||||||
//if (tag.get_number_of("colspan")) colcount += tag.number-1;
|
//if (tag.get_number_of("colspan")) colcount += tag.number-1;
|
||||||
@ -387,6 +392,7 @@ void TWebBrowser::tag_table()
|
|||||||
} else {
|
} else {
|
||||||
if (tag.is("tr")) {
|
if (tag.is("tr")) {
|
||||||
if (tag.opened) {
|
if (tag.opened) {
|
||||||
|
_TR_FIX:
|
||||||
if (draw_x==left_gap) && (draw_y==BODY_MARGIN) {
|
if (draw_x==left_gap) && (draw_y==BODY_MARGIN) {
|
||||||
row_start_y = tallest_cell_in_row = draw_y;
|
row_start_y = tallest_cell_in_row = draw_y;
|
||||||
} else {
|
} else {
|
||||||
@ -401,18 +407,55 @@ void TWebBrowser::tag_table()
|
|||||||
draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
|
draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
|
||||||
draw_w = list.w;
|
draw_w = list.w;
|
||||||
}
|
}
|
||||||
if (tr_pos) && (tag.is("td")) || (tag.is("th")) {
|
if (tag.is("td")) || (tag.is("th")) {
|
||||||
|
|
||||||
|
if (!tr_pos) goto _TR_FIX;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (tag.opened) {
|
||||||
|
if (tag.get_value_of("bgcolor")) {
|
||||||
|
bg_colors.add(GetColor(tag.value));
|
||||||
|
} else {
|
||||||
|
bg_colors.add(bg_colors.get(0));
|
||||||
|
}
|
||||||
|
} */
|
||||||
|
|
||||||
tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h, tallest_cell_in_row);
|
tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h, tallest_cell_in_row);
|
||||||
style.cur_line_h = list.item_h;
|
style.cur_line_h = list.item_h;
|
||||||
if (tag.opened) {
|
if (tag.opened) {
|
||||||
draw_w = list.w - BODY_MARGIN - BODY_MARGIN - 23 / table.cols.get(tr_pos-1);
|
|
||||||
draw_x = left_gap = draw_w * td_pos + BODY_MARGIN;
|
if (!td_pos) {
|
||||||
//debugval(itoa(draw_x), list.w);
|
draw_x = left_gap = BODY_MARGIN;
|
||||||
|
} else {
|
||||||
|
draw_x = left_gap = left_gap + draw_w;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_w = list.w - BODY_MARGIN - 23 - left_gap;
|
||||||
|
if (EAX = table.cols.get(tr_pos-1)-td_pos) draw_w /= EAX; else {
|
||||||
|
draw_y = row_start_y;
|
||||||
|
draw_x = left_gap = BODY_MARGIN;
|
||||||
|
}
|
||||||
|
if (table.cols.get(tr_pos-1)-td_pos>1) && (tag.get_number_of("width")) {
|
||||||
|
if (strchr(tag.value, '%')) {
|
||||||
|
tag.number = list.w - BODY_MARGIN - 23 - left_gap * tag.number / 100;
|
||||||
|
}
|
||||||
|
if (tag.number < draw_w) draw_w = tag.number;
|
||||||
|
}
|
||||||
draw_y = row_start_y;
|
draw_y = row_start_y;
|
||||||
//canvas.WriteText(draw_x, draw_y, 10001001b, 0x0000FE, itoa(draw_x), NULL);
|
//canvas.WriteText(draw_x, draw_y, 10001001b, 0x0000FE, itoa(draw_x), NULL);
|
||||||
td_pos++;
|
td_pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (draw_x > list.w) {
|
||||||
|
draw_x = left_gap = BODY_MARGIN;
|
||||||
|
draw_w = list.w - BODY_MARGIN - 23 - left_gap;
|
||||||
|
table.depth = 0;
|
||||||
|
NewLine();
|
||||||
|
if (debug_mode) {
|
||||||
|
debugln("anomaly draw_x");
|
||||||
|
canvas.DrawBar(0, draw_y, 20, 20, 0xFF0000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
|
|||||||
|
|
||||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||||
|
|
||||||
char version[]="WebView 3.52c";
|
char version[]="WebView 3.6";
|
Loading…
Reference in New Issue
Block a user