Apps/webview: Version 3.82. Fixed text rendering, speedup (#130)
Co-authored-by: leency <lipatov.kiril@gmail.com> Co-committed-by: leency <lipatov.kiril@gmail.com>
This commit is contained in:
@@ -101,16 +101,16 @@ void TWebBrowser::SetPageDefaults()
|
||||
img_url.drop();
|
||||
text_colors.drop();
|
||||
text_colors.add(0);
|
||||
if (!secondrun) {
|
||||
bg_colors.drop();
|
||||
bg_colors.add(DEFAULT_BG_COL);
|
||||
} else {
|
||||
if (secondrun) {
|
||||
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count));
|
||||
canvas.Fill(0, bg_colors.get(0));
|
||||
}
|
||||
bg_colors.drop();
|
||||
bg_colors.add(DEFAULT_BG_COL);
|
||||
header = NULL;
|
||||
draw_y = BODY_MARGIN;
|
||||
draw_x = left_gap = BODY_MARGIN;
|
||||
draw_w = list.w - BODY_MARGIN;
|
||||
draw_w = list.w - BODY_MARGIN - BODY_MARGIN;
|
||||
linebuf = 0;
|
||||
redirect = '\0';
|
||||
list.SetFont(8, 14, 10011000b);
|
||||
@@ -136,8 +136,6 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
dword bufpos;
|
||||
bufsize = _bufsize;
|
||||
|
||||
if (list.w!=canvas.bufw) canvas.Init(list.x, list.y, list.w, 400*20);
|
||||
|
||||
if (bufpointer == _bufpointer) {
|
||||
custom_encoding = cur_encoding;
|
||||
} else {
|
||||
@@ -156,7 +154,6 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
table.cols.drop();
|
||||
secondrun = false;
|
||||
|
||||
@@ -219,19 +216,15 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
AddCharToTheLine(ESBYTE[bufpos]);
|
||||
}
|
||||
|
||||
RenderTextbuf();
|
||||
list.count = draw_y + style.cur_line_h;
|
||||
list.CheckDoesValuesOkey();
|
||||
anchors.current = NULL;
|
||||
|
||||
if (!secondrun) {
|
||||
secondrun = true;
|
||||
goto _PARSE_START_;
|
||||
}
|
||||
|
||||
RenderTextbuf();
|
||||
list.count = draw_y + style.cur_line_h;
|
||||
|
||||
canvas.bufh = math.max(list.visible, list.count);
|
||||
buf_data = realloc(buf_data, canvas.bufh * canvas.bufw * 4 + 8);
|
||||
|
||||
list.CheckDoesValuesOkey();
|
||||
anchors.current = NULL;
|
||||
if (!header) {
|
||||
strncpy(#header, #version, sizeof(TWebBrowser.header)-1);
|
||||
DrawTitle(#header);
|
||||
|
@@ -22,9 +22,8 @@ void TWebBrowser::RenderLine(dword _line)
|
||||
zoom = list.font_w / BASIC_CHAR_W;
|
||||
|
||||
//there is some shit happens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
if (pw > draw_w) {
|
||||
//draw_w = pw;
|
||||
NewLine();
|
||||
if (pw > draw_w + BODY_MARGIN) {
|
||||
//debugln("shit");
|
||||
}
|
||||
|
||||
if (debug_mode) {
|
||||
@@ -83,12 +82,13 @@ void TWebBrowser::RenderTextbuf()
|
||||
|
||||
//debugln(" \\n");
|
||||
|
||||
//Is a new line fits in the current line?
|
||||
//Is a new line fits in the maximum line width?
|
||||
if (br * list.font_w + draw_x - left_gap >= draw_w) {
|
||||
br = draw_w - draw_x + left_gap /list.font_w;
|
||||
if (br < 0) br = 0;
|
||||
while(br) {
|
||||
if (ESBYTE[lbp + br]==' ') {
|
||||
br++;
|
||||
if (br < len) br++;
|
||||
break;
|
||||
}
|
||||
br--;
|
||||
@@ -96,7 +96,16 @@ void TWebBrowser::RenderTextbuf()
|
||||
}
|
||||
//Maybe a new line is too big for the whole new line? Then we have to split it
|
||||
if (!br) && (len * list.font_w >= draw_w) {
|
||||
//debugln("bigbr");
|
||||
//debugval("draw_x", draw_x);
|
||||
//debugval("draw_w", draw_w);
|
||||
br = draw_w - draw_x / list.font_w;
|
||||
//debugval("cut into 1", br * list.font_w);
|
||||
if (br < 0) {
|
||||
NewLine();
|
||||
br = draw_w - draw_x / list.font_w;
|
||||
//debugval("cut into 2", br * list.font_w);
|
||||
}
|
||||
}
|
||||
|
||||
if (br) {
|
||||
@@ -122,7 +131,11 @@ void TWebBrowser::NewLine()
|
||||
if (t_html) && (!t_body) return;
|
||||
|
||||
if (draw_x == style.tag_list.level * 5 * list.font_w + left_gap) {
|
||||
if (!empty_line) empty_line=true; else return;
|
||||
if (!empty_line) {
|
||||
empty_line=true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
empty_line = false;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ void TWebBrowser::SetStyle()
|
||||
void TWebBrowser::tag_p()
|
||||
{
|
||||
IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) return;
|
||||
if (!tag.opened) && (streq(#tag.prior,"p")) return;
|
||||
IF (!tag.opened) && (streq(#tag.prior,"p")) return;
|
||||
NewLine();
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ void TWebBrowser::tag_iframe()
|
||||
|
||||
void TWebBrowser::tag_a()
|
||||
{
|
||||
if (!secondrun) return;
|
||||
if (tag.opened)
|
||||
{
|
||||
if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:"))
|
||||
@@ -133,6 +134,7 @@ void TWebBrowser::tag_a()
|
||||
|
||||
void TWebBrowser::tag_meta_xml()
|
||||
{
|
||||
if (secondrun) return;
|
||||
if (custom_encoding == -1) if (tag.get_value_of("charset"))
|
||||
|| (tag.get_value_of("content")) || (tag.get_value_of("encoding"))
|
||||
{
|
||||
@@ -187,7 +189,7 @@ void TWebBrowser::tag_ol_ul_dt()
|
||||
|
||||
void TWebBrowser::tag_li()
|
||||
{
|
||||
if (style.nav) return;
|
||||
//if (style.nav) return;
|
||||
if (tag.opened) {
|
||||
if (!style.tag_list.level) style.tag_list.upd_level(1, 'u');
|
||||
if (!style.pre) NewLine();
|
||||
@@ -219,10 +221,7 @@ void TWebBrowser::tag_body()
|
||||
if (tag.get_value_of("link")) link_color_default = GetColor(tag.value);
|
||||
if (tag.get_value_of("alink")) link_color_active = GetColor(tag.value);
|
||||
if (tag.get_value_of("text")) text_colors.set(0, GetColor(tag.value));
|
||||
if (tag.get_value_of("bgcolor")) {
|
||||
bg_colors.set(0, GetColor(tag.value));
|
||||
canvas.Fill(0, bg_colors.get(0));
|
||||
}
|
||||
if (tag.get_value_of("bgcolor")) bg_colors.set(0, GetColor(tag.value));
|
||||
// Autodetecting encoding if no encoding was set
|
||||
if (tag.opened) && (custom_encoding==-1) && (cur_encoding == CH_CP866) {
|
||||
if (strstr(bufpointer, "\208\190")) ChangeEncoding(CH_UTF8);
|
||||
@@ -250,10 +249,10 @@ void TWebBrowser::tag_h1234_caption()
|
||||
NewLine();
|
||||
}
|
||||
if (tag.is("h1")) {
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+12, 10011001b);
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
|
||||
style.b = true;
|
||||
} else if (tag.is("h2")) {
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+12, 10011001b);
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
|
||||
} else {
|
||||
list.SetFont(6*2, 9+7, 10001001b);
|
||||
}
|
||||
@@ -294,7 +293,7 @@ void TWebBrowser::tag_img()
|
||||
if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
|
||||
|
||||
strlcpy(#img_path, tag.value, sizeof(img_path)-1);
|
||||
replace_char(#img_path, ' ', '\0', sizeof(img_path));
|
||||
replace_char(#img_path, ' ', '\0', sizeof(img_path)-1);
|
||||
get_absolute_url(#img_path, history.current());
|
||||
|
||||
if (check_is_the_adress_local(#img_path)) {
|
||||
@@ -331,31 +330,28 @@ NOIMG:
|
||||
text_colors.pop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct TABLE {
|
||||
int count;
|
||||
int depth;
|
||||
int margin;
|
||||
collection_int cols;
|
||||
collection_int width;
|
||||
} table;
|
||||
|
||||
|
||||
int tr_pos, td_pos;
|
||||
int row_start_y;
|
||||
int colcount;
|
||||
dword tallest_cell_in_row;
|
||||
unsigned table_id;
|
||||
unsigned colcount;
|
||||
unsigned tr_pos;
|
||||
unsigned td_pos;
|
||||
unsigned row_start_y;
|
||||
unsigned tallest_cell_in_row;
|
||||
unsigned cur_cell_w;
|
||||
|
||||
void TWebBrowser::tag_table_reset()
|
||||
{
|
||||
table.depth = 0;
|
||||
table.count = 0;
|
||||
table_id = 0;
|
||||
colcount = 0;
|
||||
tr_pos = 0;
|
||||
td_pos = 0;
|
||||
table.depth = 0;
|
||||
cur_cell_w = 0;
|
||||
}
|
||||
|
||||
void TWebBrowser::tag_table()
|
||||
@@ -369,15 +365,15 @@ void TWebBrowser::tag_table()
|
||||
if(tag.opened) {
|
||||
table.depth++;
|
||||
if (table.depth==1) {
|
||||
table.count++;
|
||||
table_id++;
|
||||
colcount = 0;
|
||||
td_pos = 0;
|
||||
row_start_y = draw_y;
|
||||
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));
|
||||
cur_cell_w = math.min(tag.number,list.w);
|
||||
} else {
|
||||
table.width.set(table.count, list.w);
|
||||
cur_cell_w = list.w;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -436,26 +432,17 @@ void TWebBrowser::tag_table()
|
||||
|
||||
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+1, tallest_cell_in_row);
|
||||
style.cur_line_h = list.item_h;
|
||||
if (tag.opened) {
|
||||
|
||||
if (tag.opened)
|
||||
{
|
||||
if (!td_pos) {
|
||||
table.margin = list.w - table.width.get(table.count) / 2 + BODY_MARGIN;
|
||||
table.margin = list.w - cur_cell_w / 2 + BODY_MARGIN;
|
||||
draw_x = left_gap = table.margin;
|
||||
draw_w = table.width.get(table.count) - BODY_MARGIN;
|
||||
draw_w = cur_cell_w - BODY_MARGIN;
|
||||
} else {
|
||||
draw_x = left_gap = left_gap + draw_w;
|
||||
draw_w = table.width.get(table.count) - left_gap + table.margin - BODY_MARGIN;
|
||||
draw_w = cur_cell_w - left_gap + table.margin - BODY_MARGIN;
|
||||
}
|
||||
|
||||
if (EAX = table.cols.get(tr_pos-1)-td_pos) {
|
||||
@@ -466,20 +453,18 @@ void TWebBrowser::tag_table()
|
||||
}
|
||||
if (table.cols.get(tr_pos-1)-td_pos>1) && (tag.get_number_of("width")) {
|
||||
if (strchr(tag.value, '%')) {
|
||||
tag.number = table.width.get(table.count) - table.margin - 23 - left_gap * tag.number / 100;
|
||||
tag.number = cur_cell_w - table.margin - 23 - left_gap * tag.number / 100;
|
||||
}
|
||||
if (tag.number < draw_w) draw_w = tag.number;
|
||||
}
|
||||
draw_y = row_start_y;
|
||||
//canvas.WriteText(draw_x, draw_y, 10001001b, 0x0000FE, itoa(draw_x), NULL);
|
||||
//canvas.WriteText(draw_x, draw_y+20, 10001001b, 0xFF0000, itoa(draw_w), NULL);
|
||||
td_pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (draw_x > table.width.get(table.count)) {
|
||||
if (draw_x > cur_cell_w) {
|
||||
draw_x = left_gap = table.margin;
|
||||
draw_w = table.width.get(table.count) - table.margin - 23 - left_gap;
|
||||
draw_w = cur_cell_w - table.margin - 23 - left_gap;
|
||||
table.depth = 0;
|
||||
NewLine();
|
||||
if (debug_mode) {
|
||||
@@ -487,11 +472,8 @@ void TWebBrowser::tag_table()
|
||||
canvas.DrawBar(0, draw_y, 20, 20, 0xFF0000);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (left_gap + draw_w > list.w) {
|
||||
draw_w = list.w - left_gap;
|
||||
if (debug_mode) debugln("anomaly draw_W");
|
||||
}
|
||||
*/
|
||||
//if (left_gap + draw_w > list.w) {
|
||||
// draw_w = list.w - left_gap;
|
||||
// if (debug_mode) debugln("anomaly draw_W");
|
||||
//}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
//Copyright 2007-2021 by Veliant & Leency
|
||||
//Copyright 2007-2025 by Veliant & Leency
|
||||
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
|
||||
|
||||
//BUGS
|
||||
|
@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
|
||||
|
||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||
|
||||
char version[]="WebView 3.8";
|
||||
char version[]="WebView 3.82";
|
@@ -4,10 +4,10 @@
|
||||
</head>
|
||||
<body><pre>Welcome to WebView a Text-Based Browser.
|
||||
|
||||
Bookmarks:
|
||||
1. <a href=//kolibrios.org>KolibriOS homepage</a>
|
||||
KolibriOS Bookmarks:
|
||||
1. <a href=//kolibrios.org>Homepage</a>
|
||||
2. <a href="//builds.kolibrios.org">Night-builds</a>
|
||||
3. <a href="//ftp.kolibrios.org">KolibriOS FTP</a>
|
||||
3. <a href="//ftp.kolibrios.org">FTP Server</a>
|
||||
|
||||
<font bg=#F8F15B>By the way,</font>
|
||||
<font color="#555555">• You can check for browser updates from the main menu.
|
||||
|
@@ -1,16 +1,15 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="cp-866">
|
||||
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>࠭<EFBFBD><E0A0AD><EFBFBD></title>
|
||||
</head>
|
||||
<body><pre><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
1. <a href=//kolibrios.org><EFBFBD><EFBFBD><EFBFBD>樠<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᠩ<> KolibriOS</a>
|
||||
2. <a href="//builds.kolibrios.org"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᡮન</a>
|
||||
3. <a href="//ftp.kolibrios.org">KolibriOS FTP</a>
|
||||
<html><head><meta charset="cp-866">
|
||||
<title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>࠭<EFBFBD><E0A0AD><EFBFBD></title></head>
|
||||
<body><pre><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥪<>⮢<EFBFBD><E2AEA2> <20><><EFBFBD>㧥<EFBFBD> WebView!
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> KolibriOS:<ol>
|
||||
<li><a href=//kolibrios.org><EFBFBD><EFBFBD><EFBFBD>樠<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᠩ<></a>
|
||||
<li><a href="//builds.kolibrios.org"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᡮન</a>
|
||||
<li><a href="//ftp.kolibrios.org">FTP <20><>ࢥ<EFBFBD></a></ol>
|
||||
|
||||
<font bg=#F8F15B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,</font>
|
||||
<font color="#555555">• <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>稥 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
• <20><><EFBFBD> <20><><EFBFBD>᪠ <20> Google <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>᭮<EFBFBD> <20><>ப<EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+Enter
|
||||
• <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> F6 <20><>६<EFBFBD>頥<EFBFBD> ⥪<>⮢<EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
• <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2> <20><>࠭<EFBFBD><E0A0AD><EFBFBD>, <20><><EFBFBD> <20>⮣<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>ࠢ<EFBFBD><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㣫<> <20><><EFBFBD><EFBFBD>.
|
||||
</font>
|
||||
|
||||
|
Reference in New Issue
Block a user