WebView 3.65: table width support

git-svn-id: svn://kolibrios.org@9309 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-11-25 01:11:11 +00:00
parent ebd134809c
commit a0253bc1a6
4 changed files with 25 additions and 8 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.62c";
char version[]="WebView 3.65";

View File

@ -1,5 +1,6 @@
<html>
<title>TEST</title>
<style>a {display:block;font-size:130%;margin:5px 40px 5px 0;}</style>
<body>
<pre>
<a href=//kolibrios.org>KolibriOS</a>