WebView: omit lists inside <nav> tag for better readability

git-svn-id: svn://kolibrios.org@9302 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-11-22 18:30:51 +00:00
parent 0726cf15e7
commit ba3c6816a1
3 changed files with 8 additions and 4 deletions

View File

@ -19,7 +19,8 @@ struct STYLE {
pre, pre,
blq, blq,
button, button,
image; image,
nav, header;
LIST tag_list; LIST tag_list;
dword title; dword title;
dword cur_line_h; dword cur_line_h;
@ -28,8 +29,8 @@ struct STYLE {
void STYLE::reset() void STYLE::reset()
{ {
b = u = s = h = blq = pre = title = false; b = u = s = h = font = pre = blq =
font = false; title = button = image = nav = header = false;
cur_line_h = NULL; cur_line_h = NULL;
tag_list.reset(); tag_list.reset();
} }

View File

@ -12,6 +12,7 @@ void TWebBrowser::SetStyle()
if (tag.is("img")) { tag_img(); return; } if (tag.is("img")) { tag_img(); return; }
if (tag.is("div")) { tag_div(); return; } if (tag.is("div")) { tag_div(); return; }
if (tag.is("br")) { /*draw_x++;*/NewLine(); return; } if (tag.is("br")) { /*draw_x++;*/NewLine(); return; }
if (tag.is("nav")) { style.nav = tag.opened; return; }
if (tag.is("header")) { NewLine(); return; } if (tag.is("header")) { NewLine(); return; }
if (tag.is("article")) { NewLine(); return; } if (tag.is("article")) { NewLine(); return; }
if (tag.is("footer")) { NewLine(); return; } if (tag.is("footer")) { NewLine(); return; }
@ -177,6 +178,7 @@ void TWebBrowser::tag_ol_ul_dt()
break; break;
case 'u': case 'u':
case 'o': case 'o':
if (style.nav) && (style.tag_list.level) NewLine();
style.tag_list.upd_level(tag.opened, type); style.tag_list.upd_level(tag.opened, type);
if (!tag.opened) && (!style.pre) NewLine(); if (!tag.opened) && (!style.pre) NewLine();
} }
@ -184,6 +186,7 @@ void TWebBrowser::tag_ol_ul_dt()
void TWebBrowser::tag_li() void TWebBrowser::tag_li()
{ {
if (style.nav) return;
if (tag.opened) { if (tag.opened) {
if (!style.tag_list.level) style.tag_list.upd_level(1, 'u'); if (!style.tag_list.level) style.tag_list.upd_level(1, 'u');
if (!style.pre) NewLine(); if (!style.pre) NewLine();

View File

@ -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.61"; char version[]="WebView 3.62";