From a0253bc1a6cb0fd9234519032dcfaf549f4996ae Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 25 Nov 2021 01:11:11 +0000 Subject: [PATCH] WebView 3.65: table width support git-svn-id: svn://kolibrios.org@9309 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/TWB/set_style.h | 24 +++++++++++++++++------- programs/cmm/browser/WebView.c | 6 ++++++ programs/cmm/browser/const.h | 2 +- programs/cmm/browser/res/test.htm | 1 + 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/programs/cmm/browser/TWB/set_style.h b/programs/cmm/browser/TWB/set_style.h index a5faa60273..536789ddf8 100644 --- a/programs/cmm/browser/TWB/set_style.h +++ b/programs/cmm/browser/TWB/set_style.h @@ -329,7 +329,9 @@ NOIMG: struct TABLE { int count; int depth; + int margin; collection_int cols; + collection_int width; } table; @@ -360,6 +362,12 @@ void TWebBrowser::tag_table() if (table.depth==1) { table.count++; colcount = 0; + if (tag.get_number_of("width")) { + if (strchr(tag.value, '%')) tag.number = list.w * tag.number / 100; + table.width.set(table.count, math.min(tag.number,list.w)); + } else { + table.width.set(table.count, list.w); + } } } else { if (table.depth>0) { @@ -428,19 +436,21 @@ void TWebBrowser::tag_table() if (tag.opened) { if (!td_pos) { - draw_x = left_gap = BODY_MARGIN; + table.margin = list.w - table.width.get(table.count) / 2 + BODY_MARGIN; + draw_x = left_gap = table.margin; + draw_w = table.width.get(table.count) - BODY_MARGIN; } else { draw_x = left_gap = left_gap + draw_w; + draw_w = table.width.get(table.count) - left_gap; } - 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; + draw_x = left_gap = table.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; + tag.number = table.width.get(table.count) - table.margin - 23 - left_gap * tag.number / 100; } if (tag.number < draw_w) draw_w = tag.number; } @@ -450,9 +460,9 @@ void TWebBrowser::tag_table() } } } - if (draw_x > list.w) { - draw_x = left_gap = BODY_MARGIN; - draw_w = list.w - BODY_MARGIN - 23 - left_gap; + if (draw_x > table.width.get(table.count)) { + draw_x = left_gap = table.margin; + draw_w = table.width.get(table.count) - table.margin - 23 - left_gap; table.depth = 0; NewLine(); if (debug_mode) { diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 056d0433a2..0fbd6e30dc 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -343,6 +343,12 @@ void ProcessKeyEvent() void SetElementSizes() { omnibox_edit.width = Form.cwidth - omnibox_edit.left - 52 - 16; + if (Form.cwidth - scroll_wv.size_x != WB1.list.w) { + //temporary fix for crash + //related to 'cur_img_url' var read + //http://board.kolibrios.org/viewtopic.php?f=1&t=1712&start=60#p77523 + StopLoading(); + } WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.cwidth - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); WB1.list.wheel_size = 7 * BASIC_LINE_H; diff --git a/programs/cmm/browser/const.h b/programs/cmm/browser/const.h index c4aaac4086..57b649534b 100644 --- a/programs/cmm/browser/const.h +++ b/programs/cmm/browser/const.h @@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw"; #define DEFAULT_URL URL_SERVICE_HOMEPAGE -char version[]="WebView 3.62c"; \ No newline at end of file +char version[]="WebView 3.65"; \ No newline at end of file diff --git a/programs/cmm/browser/res/test.htm b/programs/cmm/browser/res/test.htm index 6e70a3d81c..a35bd1aec5 100644 --- a/programs/cmm/browser/res/test.htm +++ b/programs/cmm/browser/res/test.htm @@ -1,5 +1,6 @@ TEST +
 KolibriOS