mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2025-08-03 11:46:34 -04:00
webview-3.91
- fix crash on menuetos.net - improve position of the line under text (and related code) for a various font sizes - handle params width= and size= of <hr> - update acid_0.1.htm page
This commit is contained in:
parent
51b150c9aa
commit
54a8e96984
@ -85,6 +85,7 @@ struct TWebBrowser {
|
||||
void tag_table();
|
||||
void tag_td();
|
||||
void tag_tr();
|
||||
void reset_font_style();
|
||||
};
|
||||
|
||||
#include "TWB\render.h"
|
||||
@ -94,16 +95,16 @@ void TWebBrowser::SetPageDefaults()
|
||||
{
|
||||
t_html = t_body = link = false;
|
||||
style.reset();
|
||||
reset_font_style();
|
||||
link_color_default = 0x0000FF;
|
||||
link_color_active = 0xFF0000;
|
||||
style.cur_line_h = list.item_h;
|
||||
links.clear();
|
||||
anchors.clear();
|
||||
img_url.drop();
|
||||
text_colors.drop();
|
||||
text_colors.add(0);
|
||||
if (secondrun) {
|
||||
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count));
|
||||
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count)+200);
|
||||
canvas.Fill(0, bg_colors.get(0));
|
||||
}
|
||||
bg_colors.drop();
|
||||
@ -114,7 +115,6 @@ void TWebBrowser::SetPageDefaults()
|
||||
draw_w = list.w - BODY_MARGIN - BODY_MARGIN;
|
||||
linebuf = 0;
|
||||
redirect = '\0';
|
||||
list.SetFont(8, 14, 10011000b);
|
||||
tag_table_reset();
|
||||
is_html = true;
|
||||
if (!strstri(bufpointer, "<body")) {
|
||||
|
@ -49,14 +49,14 @@ void TWebBrowser::RenderLine(dword _line)
|
||||
pc = text_colors.get_last();
|
||||
if (link) && (pc == text_colors.get(0)) pc = link_color_default;
|
||||
|
||||
canvas.WriteText(draw_x, draw_y, list.font_type, pc, _line, NULL);
|
||||
if (style.b) canvas.WriteText(draw_x+1, draw_y, list.font_type, pc, _line, NULL);
|
||||
canvas.WriteText(draw_x, draw_y+1, list.font_type, pc, _line, NULL);
|
||||
if (style.b) canvas.WriteText(draw_x+1, draw_y+1, list.font_type, pc, _line, NULL);
|
||||
if (style.s) canvas.DrawBar(draw_x, list.item_h / 2 - zoom + draw_y, pw, zoom, pc);
|
||||
if (style.u) canvas.DrawBar(draw_x, list.item_h - zoom - zoom + draw_y, pw, zoom, pc);
|
||||
if (style.u) canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, pc);
|
||||
if (link) {
|
||||
if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else {
|
||||
canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default);
|
||||
links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom);
|
||||
canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, link_color_default);
|
||||
links.add_text(draw_x, draw_y + list.y, pw, list.font_h, zoom);
|
||||
}
|
||||
}
|
||||
_SKIP_DRAW:
|
||||
|
@ -208,9 +208,20 @@ void TWebBrowser::tag_li()
|
||||
void TWebBrowser::tag_hr()
|
||||
{
|
||||
dword hrcol = 0x00777777;
|
||||
if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
|
||||
dword hr_width = draw_w-BODY_MARGIN-BODY_MARGIN;
|
||||
dword hr_size = 1;
|
||||
if (tag.get_value_of("color")) {
|
||||
hrcol = GetColor(tag.value);
|
||||
}
|
||||
if (tag.get_value_of("width")) && (!strchr(tag.value, '%')) {
|
||||
hr_width = math.min(hr_width, tag.get_number_of("width"));
|
||||
}
|
||||
if (tag.get_number_of("size")) {
|
||||
hr_size = math.min(500, tag.number);
|
||||
}
|
||||
if (draw_x != left_gap) NewLine();
|
||||
if (secondrun) canvas.DrawBar(5+left_gap, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
|
||||
if (secondrun) canvas.DrawBar(left_gap, style.cur_line_h / 2 + draw_y - 1, hr_width, hr_size, hrcol);
|
||||
draw_y += hr_size - 3;
|
||||
draw_x++;
|
||||
NewLine();
|
||||
return;
|
||||
@ -235,6 +246,12 @@ void TWebBrowser::tag_q()
|
||||
chrncat(#linebuf, '\"', sizeof(TWebBrowser.linebuf));
|
||||
}
|
||||
|
||||
void TWebBrowser::reset_font_style()
|
||||
{
|
||||
list.SetFont(BASIC_CHAR_W, 14, 10011000b);
|
||||
style.cur_line_h = list.item_h = list.font_h + 5;
|
||||
}
|
||||
|
||||
void TWebBrowser::tag_h1234_caption()
|
||||
{
|
||||
if (ESBYTE[#tag.name+1]=='4') {
|
||||
@ -250,19 +267,18 @@ void TWebBrowser::tag_h1234_caption()
|
||||
NewLine();
|
||||
}
|
||||
if (tag.is("h1")) {
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
|
||||
style.b = true;
|
||||
} else if (tag.is("h2")) {
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
|
||||
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
|
||||
} else {
|
||||
list.SetFont(6*2, 9+7, 10001001b);
|
||||
list.SetFont(6*2, 9+8, 10001001b);
|
||||
}
|
||||
style.cur_line_h = list.item_h = list.font_h + 2;
|
||||
style.cur_line_h = list.item_h = list.font_h + 3;
|
||||
} else {
|
||||
if (tag.is("h1")) style.b = false;
|
||||
NewLine();
|
||||
list.SetFont(BASIC_CHAR_W, 14, 10011000b);
|
||||
style.cur_line_h = list.item_h = BASIC_LINE_H;
|
||||
reset_font_style();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -276,7 +292,7 @@ void TWebBrowser::tag_kosicon()
|
||||
if (shared_i18) && (tag.get_number_of("n")) {
|
||||
if (tag.number < maxicon) {
|
||||
if (draw_x + 18 > canvas.bufw) NewLine();
|
||||
canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18);
|
||||
canvas.DrawImage(draw_x, draw_y-1, 18, 18, 18*18*4*tag.number+shared_i18);
|
||||
draw_x += 22;
|
||||
}
|
||||
}
|
||||
|
@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
|
||||
|
||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||
|
||||
char version[]="WebView 3.9";
|
||||
char version[]="WebView 3.91";
|
@ -1,7 +1,7 @@
|
||||
#ifdef LANG_RUS
|
||||
#define HISTORY_HEADER "<html><title>ˆáâ®à¨ï</title><body><b><3E>®á¥é¥ë¥ áâà ¨æë</b><br>"
|
||||
#define HISTORY_HEADER "<html><title>ˆáâ®à¨ï</title><body bgcolor=#fff><h3><3E>®á¥é¥ë¥ áâà ¨æë</h3><br>"
|
||||
#else
|
||||
#define HISTORY_HEADER "<html><title>History</title><body><b>Visited pages</b><br>"
|
||||
#define HISTORY_HEADER "<html><title>History</title><body bgcolor=#fff><h3>Visited pages</h3><br>"
|
||||
#endif
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ ShowHistory()
|
||||
|
||||
for (i=0; i<history.items.count-1; i++) //if (cache.type.get(i) == PAGE)
|
||||
{
|
||||
strcat(history_pointer, "<a href='");
|
||||
strcat(history_pointer, "<kosicon n=3><a href='");
|
||||
strcat(history_pointer, history.items.get(i));
|
||||
strcat(history_pointer, "'>");
|
||||
strcat(history_pointer, history.items.get(i));
|
||||
|
@ -1,18 +1,18 @@
|
||||
<html><head><title>New tab</title></head>
|
||||
<body bgcolor=#fff>
|
||||
|
||||
<table><tr><td width=20><td width=210><pre>
|
||||
___________________
|
||||
|# : : #|
|
||||
| : WebView : |
|
||||
| : TextBased : |
|
||||
| : Browser : |
|
||||
| : : |
|
||||
| :_____________: |
|
||||
| ___________ |
|
||||
| | __ | |
|
||||
| || | | |
|
||||
\____||__|_______|__|<font color=#DDD>lc</font>
|
||||
<table><tr><td width=20><td width=220><pre>
|
||||
_____________________
|
||||
|# : : #|
|
||||
| : WebView : |
|
||||
| : for : |
|
||||
| : KolibriOS : |
|
||||
| : : |
|
||||
| :_______________: |
|
||||
| ____________ |
|
||||
| | __ | |
|
||||
| || | | |
|
||||
\_____||__|________|__|<font color=#DDD>lc</font>
|
||||
|
||||
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
|
||||
<font bg=#3CE7FF> </font></font></font></font>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<html><head><title><EFBFBD>®¢ ï ¢ª« ¤ª </title></head>
|
||||
<body bgcolor=#fff>
|
||||
|
||||
<table><tr><td width=20><td width=210><pre>
|
||||
___________________
|
||||
|# : : #|
|
||||
| : WebView : |
|
||||
| : ’¥ªáâ®¢ë© : |
|
||||
| : <EFBFBD>à ã§¥à : |
|
||||
| : : |
|
||||
| :_____________: |
|
||||
| ___________ |
|
||||
| | __ | |
|
||||
| || | | |
|
||||
\____||__|_______|__|<font color=#DDD>lc</font>
|
||||
<table><tr><td width=20><td width=220><pre>
|
||||
_____________________
|
||||
|# : : #|
|
||||
| : WebView : |
|
||||
| : for : |
|
||||
| : KolibriOS : |
|
||||
| : : |
|
||||
| :_______________: |
|
||||
| ____________ |
|
||||
| | __ | |
|
||||
| || | | |
|
||||
\_____||__|________|__|<font color=#DDD>lc</font>
|
||||
|
||||
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
|
||||
<font bg=#3CE7FF> </font></font></font></font>
|
||||
|
@ -5,12 +5,19 @@
|
||||
<title>Тест Acid 0.1</title>
|
||||
</head>
|
||||
<body bgcolor="#000000" link="#0066FF" text="#FFFFFF">
|
||||
<h1 align=center>Это тестовая страница для проверки WebViewer</h1>
|
||||
<br />
|
||||
<p>WebViewer является текстовым браузером и поддерживает все популярные кодировки (cp1251, koi-8, cp866, unicode)
|
||||
и некоторые теги. Поддержка таблииц (<table>), CSS, Javascript'a и Контактика пока не реализована :)
|
||||
<h1 align=center>Тест Acid 0.1</h1>
|
||||
<br>
|
||||
<b>Это тестовая страница для проверки текстового браузера <s>HTML Viewer</s> WebView</b>
|
||||
|
||||
<p>Из кодировок поддерживаются: CP866(DOS), CP1251(Windows), CP1252(Latin legacy), KOI8, и конечно UTF8. CSS и Javascript пока не реализованы (ахахаха). Поддержка тега <table> крайне базовая, поддержки вложенных таблиц нет.
|
||||
</p>
|
||||
<br />
|
||||
|
||||
<h3>История</h3>
|
||||
|
||||
Ранее программа называлась <b >HTMLv (HTML Viewer)</b> и изначально задумывалась как <q>Центр справки и поддержки</q>. Чтобы не изобретать велосипед и одновременно исполнить мечту многих, форматом просматриваемых страниц был выбран html.
|
||||
Первоначальный автор Veliant, затем разработка была подхвачена дизайнером Leency. Это была моя вторая программа после файлового менеджера Eolite.<br>
|
||||
|
||||
<span> <br />
|
||||
|
||||
<b>
|
||||
<font color="#FF0000">K</font>
|
||||
@ -33,7 +40,8 @@
|
||||
</b>
|
||||
<br>
|
||||
|
||||
<p>
|
||||
<table>
|
||||
<td>
|
||||
<bg bgcolor=#333>
|
||||
Небольшой список:<ol>
|
||||
<li><q>Этот текст в кавычках</q></li>
|
||||
@ -46,17 +54,14 @@
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<pre>
|
||||
"Осень уже пришла!"-
|
||||
Шепнул мне на ухо ветер,
|
||||
Подкравшись к подушке моей.
|
||||
|
||||
Басе
|
||||
</pre>
|
||||
<!-- комментарий: этого текста здесь <нет> -->
|
||||
|
||||
<br>
|
||||
|
||||
<img alt="нет картинки, просто alt">
|
||||
|
||||
<img src = http://wiby.org/about/wibyplex.gif>
|
||||
|
||||
<a href="http://kolibrios.org/i/logo.png"><img id="2.1.4" src="http://kolibrios.org/i/logo.png" alt="logo"><br>Открыть</a><br>
|
||||
|
||||
<br>
|
||||
@ -65,10 +70,25 @@
|
||||
<a href='/sys/index.htm'>Незакрытый тег а - index.htm<br>
|
||||
<a href="/sys/calc">/sys/calc</a><br>
|
||||
<a href="#2.1.4">#2.1.4</a><br>
|
||||
<a href="http://bash.im">http://bash.im</a><br>
|
||||
<a href="http://kolibrios.org">http://kolibrios.org</a><br>
|
||||
<a href="mailto:leency@mail.ru">Mail to Leency</a><br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<h1><a href=#>Link H1</a> <u>Underline H1</u></h1>
|
||||
<h2><a href=#>Link H2</a> <u>Underline H2</u></h2>
|
||||
<h3><a href=#>Link H3</a> <u>Underline H2</u></h3>
|
||||
<a href=#>Link</a> <u>Underline</u>
|
||||
|
||||
<td>
|
||||
|
||||
<pre>
|
||||
"Осень уже пришла!"-
|
||||
Шепнул мне на ухо ветер,
|
||||
Подкравшись к подушке моей.
|
||||
|
||||
Басе
|
||||
|
||||
</pre><br>
|
||||
|
||||
В этом тексте есть переход на следующую строку, но браузер
|
||||
его должен проигнорировать. Еще много пробелов. А тут есть
|
||||
@ -80,8 +100,19 @@
|
||||
корпус на территории НТУ «ХПИ»
|
||||
</p>
|
||||
|
||||
<pre><font color="#000">
|
||||
<font bg=#FFED00 style="background-color:#FFED00"> Заметки </font>
|
||||
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
|
||||
<font bg=#FFFBCE style="background-color:#FFFBCE"> Речка на Жукова </font>
|
||||
<font bg=#FFFBCE style="background-color:#FFFBCE"> Heroes 3 </font>
|
||||
<font bg=#FFFBCE style="background-color:#FFFBCE"> Рисостерон, куринабол </font>
|
||||
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
|
||||
</font></pre>
|
||||
|
||||
</table>
|
||||
|
||||
<hr color="#758999">
|
||||
<center>Zhitomyr 2008-2015</center>
|
||||
<center>Zhytomyr 2008-2025</center>
|
||||
|
||||
|
||||
</body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user