diff --git a/programs/cmm/browser/TWB/TWB.c b/programs/cmm/browser/TWB/TWB.c index 49d610519..ab011956a 100644 --- a/programs/cmm/browser/TWB/TWB.c +++ b/programs/cmm/browser/TWB/TWB.c @@ -68,6 +68,7 @@ struct TWebBrowser { void tag_a(); void tag_p(); void tag_img(); + void tag_kosicon(); void tag_div(); void tag_h1234_caption(); void tag_ol_ul_dt(); @@ -176,7 +177,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){ } } if (ESBYTE[bufpos] == '&') { - bufpos = GetUnicodeSymbol(#linebuf, sizeof(TWebBrowser.linebuf), bufpos+1, bufpointer+bufsize); + bufpos = GetUnicodeSymbol(#linebuf, sizeof(TWebBrowser.linebuf)-1, bufpos+1, bufpointer+bufsize); continue; } if (ESBYTE[bufpos] == '<') && (is_html) { diff --git a/programs/cmm/browser/TWB/parse_tag.h b/programs/cmm/browser/TWB/parse_tag.h index a39645b16..1efb57562 100644 --- a/programs/cmm/browser/TWB/parse_tag.h +++ b/programs/cmm/browser/TWB/parse_tag.h @@ -67,7 +67,7 @@ bool _tag::parse(dword _bufpos, bufend) if (!whitepos) || (whitepos > closepos) { //no param - strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name))); + strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)-1)); bufpos = closepos; } else { //we have param @@ -76,7 +76,7 @@ bool _tag::parse(dword _bufpos, bufend) if (openpos < strchr(closepos+1, '>')) break; if (!closepos = EAX) {closepos = bufend;break;} } - strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name))); + strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)-1)); bufpos = closepos; params = malloc(closepos - whitepos + 1); diff --git a/programs/cmm/browser/TWB/render.h b/programs/cmm/browser/TWB/render.h index f1968fb56..33bd1652f 100644 --- a/programs/cmm/browser/TWB/render.h +++ b/programs/cmm/browser/TWB/render.h @@ -151,7 +151,7 @@ bool TWebBrowser::RenderImage(dword cur_img) int img_x, img_y, img_w, img_h; dword imgbuf[44]; - if (!cur_img) return false; + if (!cur_img) || (!buf_data) return false; img_h = ESDWORD[cur_img+8]; img_w = ESDWORD[cur_img+4]; diff --git a/programs/cmm/browser/TWB/set_style.h b/programs/cmm/browser/TWB/set_style.h index 1f0e0393d..b04704c4b 100644 --- a/programs/cmm/browser/TWB/set_style.h +++ b/programs/cmm/browser/TWB/set_style.h @@ -10,6 +10,7 @@ void TWebBrowser::SetStyle() if (tag.is("a")) { tag_a(); return; } if (tag.is("p")) { tag_p(); return; } if (tag.is("img")) { tag_img(); return; } + if (tag.is("kosicon")) { tag_kosicon(); return; } if (tag.is("div")) { tag_div(); return; } if (tag.is("br")) { /*draw_x++;*/NewLine(); return; } if (tag.is("nav")) { style.nav = tag.opened; return; } @@ -266,6 +267,17 @@ void TWebBrowser::tag_h1234_caption() } } +void TWebBrowser::tag_kosicon() +{ + dword imgbuf[44]; + dword shared_i18 = memopen("ICONS18", NULL, SHM_READ); + if (shared_i18) && (tag.get_number_of("n")) { + if (draw_x + 18 > canvas.bufw) NewLine(); + canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18); + draw_x += 22; + } + +} void TWebBrowser::tag_img() { @@ -305,7 +317,7 @@ void TWebBrowser::tag_img() img_decode stdcall (cache.current_buf, cache.current_size, 0); if (EAX) goto IMGOK; else goto NOIMG; } else { - img_url.add(#img_path); + if (img_url.get_pos_by_name(#img_path)==-1) img_url.add(#img_path); goto NOIMG; } diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 83022c6b0..c3ee16334 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -79,7 +79,7 @@ char default_dir[] = "/sys"; od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" }; char editURL[URL_SIZE+1]; -edit_box omnibox_edit = {, 0, 0, 0xffffff, +edit_box omnibox_edit = {250, 0, 0, 0xffffff, 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; //===================================================// @@ -258,6 +258,7 @@ void main() free(http.content_pointer); GetImg(false); } + debugln("end evNetwork"); } break; default: @@ -516,7 +517,6 @@ bool GetLocalFileData(dword _path) bool GetUrl(dword _http_url) { char new_url_full[URL_SIZE+1]; - if (!strncmp(_http_url,"http:",5)) { http.get(_http_url); return true; @@ -571,10 +571,10 @@ void OpenPage(dword _open_URL) //INTERNAL PAGE history.add(#new_url); WB1.custom_encoding = -1; - if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)); - else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)); + if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)-1); + else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)-1); else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); - else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); + else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1); } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { //WEB PAGE @@ -589,7 +589,7 @@ void OpenPage(dword _open_URL) if (!http.transfer) { history.add(#new_url); - LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); + LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1); } } else { //LOCAL PAGE @@ -602,7 +602,7 @@ void OpenPage(dword _open_URL) strcpy(#new_url, "/tmp0/1/temp/word/document.xml"); } if (!GetLocalFileData(#new_url)) { - LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); + LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1); } } } @@ -712,7 +712,7 @@ void EventSubmitOmnibox() void LoadInternalPage(dword _bufdata, _in_bufsize){ if (!_bufdata) || (!_in_bufsize) { - LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); + LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1); } else { WB1.list.first = 0; //scroll page to the top DrawOmnibox(); @@ -920,7 +920,7 @@ dword GetAbsoluteActiveURL() void CheckContentType() { char content_type[64]; - if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image + if (http.header_field("content-type", #content_type, sizeof(content_type)-1)) // application || image if (content_type[0] == 'i') { EventDownloadAndOpenImage(http.cur_url); @@ -968,12 +968,14 @@ dword GetImg(bool _new) for (i = 0; i < WB1.img_url.count; i++) { cur_img_url = WB1.img_url.get(i); - if (debug_mode) - {debug("get img: ");debugln(cur_img_url);} if (cache.has(cur_img_url)==false) { prbar.max = WB1.img_url.count; prbar.value = i; - if (GetUrl(cur_img_url)) {DrawStatusBar(cur_img_url); DrawProgress(); return;} + if (GetUrl(cur_img_url)) { + DrawStatusBar(cur_img_url); + DrawProgress(); + return; + } } } if (_new) return; diff --git a/programs/cmm/browser/const.h b/programs/cmm/browser/const.h index 8843bed40..79b5621ae 100644 --- a/programs/cmm/browser/const.h +++ b/programs/cmm/browser/const.h @@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw"; #define DEFAULT_URL URL_SERVICE_HOMEPAGE -char version[]="WebView 3.83"; \ No newline at end of file +char version[]="WebView 3.84"; \ No newline at end of file diff --git a/programs/cmm/browser/res/test.htm b/programs/cmm/browser/res/test.htm index 434bbb40c..298349f9d 100644 --- a/programs/cmm/browser/res/test.htm +++ b/programs/cmm/browser/res/test.htm @@ -2,38 +2,39 @@
wiby.org -OSX network cards -Macintosh Garden -
Simplest:
-nostalgy.net.ru
+
|