forked from KolibriOS/kolibrios
WebView 3.27: do not draw scroll for a short page, better handle wrong code
git-svn-id: svn://kolibrios.org@8490 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f2523cedaa
commit
0aaee5cee7
@ -115,6 +115,7 @@ void TWebBrowser::SetPageDefaults()
|
|||||||
cur_encoding = custom_encoding;
|
cur_encoding = custom_encoding;
|
||||||
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
|
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
|
||||||
}
|
}
|
||||||
|
list.SetFont(8, 14, 10011000b);
|
||||||
}
|
}
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||||
@ -150,7 +151,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
|||||||
Render();
|
Render();
|
||||||
NewLine();
|
NewLine();
|
||||||
} else {
|
} else {
|
||||||
AddCharToTheLine(0x0a);
|
AddCharToTheLine(' ');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
@ -159,7 +160,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
|||||||
if (!tab_len) tab_len = 4; else tab_len = 4 - tab_len;
|
if (!tab_len) tab_len = 4; else tab_len = 4 - tab_len;
|
||||||
for (j=0; j<tab_len; j++;) chrcat(#line,' ');
|
for (j=0; j<tab_len; j++;) chrcat(#line,' ');
|
||||||
} else {
|
} else {
|
||||||
AddCharToTheLine(0x09);
|
AddCharToTheLine(' ');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '&': // and so on
|
case '&': // and so on
|
||||||
@ -176,15 +177,8 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
|||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
if (!is_html) goto _DEFAULT;
|
if (!is_html) goto _DEFAULT;
|
||||||
|
if (!strchr("!/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ESBYTE[bufpos+1])) goto _DEFAULT;
|
||||||
bufpos++;
|
bufpos++;
|
||||||
switch (ESBYTE[bufpos]) {
|
|
||||||
case '!': case '/': case '?':
|
|
||||||
case 'a'...'z': case 'A'...'Z':
|
|
||||||
goto _TAG;
|
|
||||||
default:
|
|
||||||
goto _DEFAULT;
|
|
||||||
}
|
|
||||||
_TAG:
|
|
||||||
if (tag.parse(#bufpos, bufpointer + bufsize)) {
|
if (tag.parse(#bufpos, bufpointer + bufsize)) {
|
||||||
CheckForLineBreak();
|
CheckForLineBreak();
|
||||||
Render();
|
Render();
|
||||||
@ -314,6 +308,11 @@ void TWebBrowser::DrawPage()
|
|||||||
scroll_wv.start_x = list.x + list.w;
|
scroll_wv.start_x = list.x + list.w;
|
||||||
scroll_wv.start_y = list.y;
|
scroll_wv.start_y = list.y;
|
||||||
scroll_wv.size_y = list.h;
|
scroll_wv.size_y = list.h;
|
||||||
scrollbar_v_draw(#scroll_wv);
|
|
||||||
|
|
||||||
|
if (list.count <= list.visible) {
|
||||||
|
DrawBar(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x,
|
||||||
|
scroll_wv.size_y, bg_colors.get(0) & 0x00FFFFFF);
|
||||||
|
} else {
|
||||||
|
scrollbar_v_draw(#scroll_wv);
|
||||||
|
}
|
||||||
}
|
}
|
@ -31,6 +31,7 @@ bool _tag::parse(dword _bufpos, bufend)
|
|||||||
|
|
||||||
dword closepos;
|
dword closepos;
|
||||||
dword whitepos;
|
dword whitepos;
|
||||||
|
dword openpos;
|
||||||
|
|
||||||
if (name) strcpy(#prior, #name); else prior = '\0';
|
if (name) strcpy(#prior, #name); else prior = '\0';
|
||||||
name = '\0';
|
name = '\0';
|
||||||
@ -72,6 +73,19 @@ bool _tag::parse(dword _bufpos, bufend)
|
|||||||
bufpos = closepos;
|
bufpos = closepos;
|
||||||
} else {
|
} else {
|
||||||
//we have param
|
//we have param
|
||||||
|
while (chrlnum(whitepos, '\"', closepos - whitepos)%2) { //alt="Next>>"
|
||||||
|
/*
|
||||||
|
openpos = strchr(closepos+1, '<');
|
||||||
|
closepos = strchr(closepos+1, '>');
|
||||||
|
if (openpos) && (openpos < closepos) {
|
||||||
|
closepos = openpos - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (!openpos = strchr(closepos+1, '<')) break;
|
||||||
|
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)));
|
||||||
debug_tag();
|
debug_tag();
|
||||||
bufpos = closepos;
|
bufpos = closepos;
|
||||||
|
@ -52,16 +52,9 @@ void TWebBrowser::SetStyle()
|
|||||||
if (tag.is("html")) { t_html = tag.opened; return; }
|
if (tag.is("html")) { t_html = tag.opened; return; }
|
||||||
|
|
||||||
//TO BE REWORKED
|
//TO BE REWORKED
|
||||||
//td_x = td_w = tr_y = highest_td = 0;
|
|
||||||
//if (tag.is("table")) { tag_table(); return; }
|
//if (tag.is("table")) { tag_table(); return; }
|
||||||
//if (tag.is("td")) { tag_td(); return; }
|
|
||||||
//if (tag.is("tr")) { tag_tr(); return; }
|
//if (tag.is("tr")) { tag_tr(); return; }
|
||||||
|
//if (tag.is("td")) { tag_td(); return; }
|
||||||
if (tag.is("dd")) {
|
|
||||||
//NewLine();
|
|
||||||
//if (tag.opened) stolbec += 5; //may overflow!
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWebBrowser::tag_p()
|
void TWebBrowser::tag_p()
|
||||||
@ -101,6 +94,8 @@ void TWebBrowser::tag_font()
|
|||||||
void TWebBrowser::tag_div()
|
void TWebBrowser::tag_div()
|
||||||
{
|
{
|
||||||
if (streq(#tag.prior,"div")) && (tag.opened) return;
|
if (streq(#tag.prior,"div")) && (tag.opened) return;
|
||||||
|
if (streq(#tag.prior,"td")) return;
|
||||||
|
//if (streq(#tag.prior,"div")) return;
|
||||||
if (!tag.opened) && (style.font) text_colors.pop();
|
if (!tag.opened) && (style.font) text_colors.pop();
|
||||||
NewLine();
|
NewLine();
|
||||||
}
|
}
|
||||||
@ -287,6 +282,7 @@ void TWebBrowser::tag_img()
|
|||||||
if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
|
if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
|
||||||
|
|
||||||
strlcpy(#img_path, tag.value, sizeof(img_path)-1);
|
strlcpy(#img_path, tag.value, sizeof(img_path)-1);
|
||||||
|
replace_char(#img_path, ' ', '\0', sizeof(img_path));
|
||||||
get_absolute_url(#img_path, history.current());
|
get_absolute_url(#img_path, history.current());
|
||||||
|
|
||||||
if (check_is_the_adress_local(#img_path)) {
|
if (check_is_the_adress_local(#img_path)) {
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
// DATA //
|
// DATA //
|
||||||
// //
|
// //
|
||||||
//===================================================//
|
//===================================================//
|
||||||
char version[]="WebView 3.26";
|
|
||||||
|
|
||||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
|
||||||
|
|
||||||
bool debug_mode = false;
|
bool debug_mode = false;
|
||||||
bool show_images = true;
|
bool show_images = true;
|
||||||
|
|
||||||
@ -144,11 +140,13 @@ void main()
|
|||||||
|
|
||||||
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
||||||
|
|
||||||
scrollbar_v_mouse (#scroll_wv);
|
if (WB1.list.count > WB1.list.visible) {
|
||||||
if (scroll_wv.delta2) {
|
scrollbar_v_mouse (#scroll_wv);
|
||||||
WB1.list.first = scroll_wv.position;
|
if (scroll_wv.delta2) {
|
||||||
WB1.DrawPage();
|
WB1.list.first = scroll_wv.position;
|
||||||
break;
|
WB1.DrawPage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (links.hover(WB1.list.y, WB1.list.first))
|
if (links.hover(WB1.list.y, WB1.list.first))
|
||||||
@ -187,8 +185,9 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),
|
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2-random(80),GetScreenHeight()-WIN_H/2-random(80),
|
||||||
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
|
//DefineAndDrawWindow(0,0,
|
||||||
|
WIN_W,WIN_H,0x73,0,0,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
ProcessMenuClick();
|
ProcessMenuClick();
|
||||||
sc.get();
|
sc.get();
|
||||||
@ -410,11 +409,11 @@ void EventToggleDebugMode()
|
|||||||
|
|
||||||
void EventAllTabsClick(dword _n)
|
void EventAllTabsClick(dword _n)
|
||||||
{
|
{
|
||||||
if (http.transfer) return;
|
|
||||||
if (mouse.mkm) {
|
if (mouse.mkm) {
|
||||||
|
StopLoading();
|
||||||
EventTabClose(_n);
|
EventTabClose(_n);
|
||||||
} else {
|
} else {
|
||||||
EventTabClick(_n);
|
if (!http.transfer) EventTabClick(_n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
|
//===================================================//
|
||||||
|
// //
|
||||||
|
// CYRILLIC //
|
||||||
|
// //
|
||||||
|
//===================================================//
|
||||||
char buildin_page_error[] = FROM "res/page_not_found_ru.htm""\0";
|
char buildin_page_error[] = FROM "res/page_not_found_ru.htm""\0";
|
||||||
char buildin_page_home[] = FROM "res/homepage_ru.htm""\0";
|
char buildin_page_home[] = FROM "res/homepage_ru.htm""\0";
|
||||||
char buildin_page_help[] = FROM "res/help_ru.htm""\0";
|
char buildin_page_help[] = FROM "res/help_ru.htm""\0";
|
||||||
@ -31,6 +36,11 @@ char clear_cache_ok[] = "'WebView\n
|
|||||||
#define T_RENDERING "<22>¥¤¥à¨£ áâà ¨æë..."
|
#define T_RENDERING "<22>¥¤¥à¨£ áâà ¨æë..."
|
||||||
#define T_DONE_IN_SEC "ƒ®â®¢®: %i ᥪ"
|
#define T_DONE_IN_SEC "ƒ®â®¢®: %i ᥪ"
|
||||||
#else
|
#else
|
||||||
|
//===================================================//
|
||||||
|
// //
|
||||||
|
// ENGLISH //
|
||||||
|
// //
|
||||||
|
//===================================================//
|
||||||
char buildin_page_error[] = FROM "res/page_not_found_en.htm""\0";
|
char buildin_page_error[] = FROM "res/page_not_found_en.htm""\0";
|
||||||
char buildin_page_home[] = FROM "res/homepage_en.htm""\0";
|
char buildin_page_home[] = FROM "res/homepage_en.htm""\0";
|
||||||
char buildin_page_help[] = FROM "res/help_en.htm""\0";
|
char buildin_page_help[] = FROM "res/help_en.htm""\0";
|
||||||
@ -63,12 +73,18 @@ char clear_cache_ok[] = "'WebView\nThe cache has been cleared.' -tI";
|
|||||||
#define T_DONE_IN_SEC "Done in %i sec"
|
#define T_DONE_IN_SEC "Done in %i sec"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//===================================================//
|
||||||
|
// //
|
||||||
|
// GLOBAL //
|
||||||
|
// //
|
||||||
|
//===================================================//
|
||||||
|
|
||||||
char buildin_page_test[] = FROM "res/test.htm""\0";
|
char buildin_page_test[] = FROM "res/test.htm""\0";
|
||||||
|
|
||||||
#define URL_SERVICE_HISTORY "WebView:history"
|
#define URL_SERVICE_HISTORY "WebView:history"
|
||||||
#define URL_SERVICE_HOMEPAGE "WebView:home"
|
#define URL_SERVICE_HOMEPAGE "WebView:home"
|
||||||
#define URL_SERVICE_HELP "WebView:help"
|
#define URL_SERVICE_HELP "WebView:help"
|
||||||
#define URL_SERVICE_TEST "WebView:test"
|
#define URL_SERVICE_TEST "WebView:test"
|
||||||
|
|
||||||
char webview_shared[] = "WEBVIEW";
|
char webview_shared[] = "WEBVIEW";
|
||||||
|
|
||||||
@ -84,4 +100,11 @@ enum {
|
|||||||
TAB_CLOSE_ID = 900
|
TAB_CLOSE_ID = 900
|
||||||
};
|
};
|
||||||
|
|
||||||
char editbox_icons[] = FROM "res/editbox_icons.raw";
|
char editbox_icons[] = FROM "res/editbox_icons.raw";
|
||||||
|
|
||||||
|
#define WIN_W 850
|
||||||
|
#define WIN_H 920
|
||||||
|
|
||||||
|
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||||
|
|
||||||
|
char version[]="WebView 3.27";
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define TABS_MAX 5
|
#define TABS_MAX 5
|
||||||
|
|
||||||
TWebBrowser data[TABS_MAX+1]=0;
|
TWebBrowser tabdata[TABS_MAX+1]=0;
|
||||||
_history tabstory[TABS_MAX+1]=0;
|
_history tabstory[TABS_MAX+1]=0;
|
||||||
|
|
||||||
struct TAB
|
struct TAB
|
||||||
@ -36,7 +36,7 @@ bool TAB::close(int _tab_number)
|
|||||||
int i;
|
int i;
|
||||||
if (count==1) return false;
|
if (count==1) return false;
|
||||||
for (i=_tab_number; i<TABS_MAX; i++) {
|
for (i=_tab_number; i<TABS_MAX; i++) {
|
||||||
data[i] = data[i+1];
|
tabdata[i] = tabdata[i+1];
|
||||||
tabstory[i] = tabstory[i+1];
|
tabstory[i] = tabstory[i+1];
|
||||||
}
|
}
|
||||||
if (_tab_number<active) && (active>0) active--;
|
if (_tab_number<active) && (active>0) active--;
|
||||||
@ -48,13 +48,13 @@ bool TAB::close(int _tab_number)
|
|||||||
void TAB::save_state()
|
void TAB::save_state()
|
||||||
{
|
{
|
||||||
tabstory[active] = history;
|
tabstory[active] = history;
|
||||||
data[active] = WB1;
|
tabdata[active] = WB1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TAB::restore(int _id)
|
void TAB::restore(int _id)
|
||||||
{
|
{
|
||||||
tab.active = _id;
|
tab.active = _id;
|
||||||
WB1 = data[_id];
|
WB1 = tabdata[_id];
|
||||||
history = tabstory[_id];
|
history = tabstory[_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +90,8 @@ void DrawTab(int _id)
|
|||||||
bgcol=sc.work;
|
bgcol=sc.work;
|
||||||
border_bottom_color = sc.work_graph;
|
border_bottom_color = sc.work_graph;
|
||||||
}
|
}
|
||||||
if (data[_id].header) {
|
if (tabdata[_id].header) {
|
||||||
strncpy(#header_no_version, #data[_id].header, strlen(#data[_id].header)-sizeof(version)-2);
|
strncpy(#header_no_version, #tabdata[_id].header, strlen(#tabdata[_id].header)-sizeof(version)-2);
|
||||||
strncpy(#name, #header_no_version, tab_w-CLOSE_S/6-2);
|
strncpy(#name, #header_no_version, tab_w-CLOSE_S/6-2);
|
||||||
}
|
}
|
||||||
DrawBar(xxx, TOOLBAR_H, 1, TAB_H, sc.work_dark);
|
DrawBar(xxx, TOOLBAR_H, 1, TAB_H, sc.work_dark);
|
||||||
|
@ -16,15 +16,6 @@
|
|||||||
|
|
||||||
char a_libdir[43] = "/sys/lib/\0";
|
char a_libdir[43] = "/sys/lib/\0";
|
||||||
|
|
||||||
:inline void error_init(dword lirary_path)
|
|
||||||
{
|
|
||||||
char error_text[1024];
|
|
||||||
strcpy(#error_text, _TEXT_ERROR_ADD);
|
|
||||||
strcat(#error_text, lirary_path);
|
|
||||||
strcat(#error_text, "' -E");
|
|
||||||
notify(#error_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
// stdcall with 1 parameter
|
// stdcall with 1 parameter
|
||||||
:void dll_Load() {
|
:void dll_Load() {
|
||||||
asm {
|
asm {
|
||||||
@ -188,9 +179,8 @@ asm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:int load_dll2(dword dllname, import_table, byte need_init)
|
:void load_dll(dword dllname, import_table, byte need_init)
|
||||||
{
|
{
|
||||||
//dword dllentry=0;
|
|
||||||
// load DLL
|
// load DLL
|
||||||
$mov eax, 68
|
$mov eax, 68
|
||||||
$mov ebx, 19
|
$mov ebx, 19
|
||||||
@ -237,19 +227,18 @@ asm {
|
|||||||
#ifndef NO_DLL_INIT
|
#ifndef NO_DLL_INIT
|
||||||
IF (need_init) dll_Init (DSDWORD[EDX+4]);
|
IF (need_init) dll_Init (DSDWORD[EDX+4]);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return;
|
||||||
@exit01:
|
@exit01:
|
||||||
return -1;
|
error_init(dllname);
|
||||||
}
|
}
|
||||||
|
|
||||||
:byte load_dll(dword dllname, import_table, byte need_init)
|
:inline void error_init(dword lirary_path)
|
||||||
{
|
{
|
||||||
if (load_dll2(dllname, import_table, need_init))
|
char error_text[1024];
|
||||||
{
|
strcpy(#error_text, _TEXT_ERROR_ADD);
|
||||||
error_init(dllname);
|
strcat(#error_text, lirary_path);
|
||||||
return false;
|
strcat(#error_text, "' -E");
|
||||||
}
|
notify(#error_text);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user