WebView 3.14: fix critical regression with file download

git-svn-id: svn://kolibrios.org@8444 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-18 12:55:55 +00:00
parent becbfa3198
commit 408000706a
4 changed files with 47 additions and 47 deletions

View File

@ -165,21 +165,6 @@ void TWebBrowser::SetPageDefaults()
}
}
//============================================================================================
void TWebBrowser::AddCharToTheLine(unsigned char _char)
{
dword line_len;
if (_char<=15) _char=' ';
line_len = strlen(#line);
if (!style.pre) && (_char == ' ')
{
if (line[line_len-1]==' ') return; //no double spaces
if (!stolbec) && (!line) return; //no paces at the beginning of the line
if (link) && (line_len==0) return;
}
if (line_len < sizeof(line)) chrcat(#line, _char);
CheckForLineBreak();
}
//============================================================================================
void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
char unicode_symbol[10];
dword j;
@ -282,6 +267,21 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
}
}
//============================================================================================
void TWebBrowser::AddCharToTheLine(unsigned char _char)
{
dword line_len;
if (_char<=15) _char=' ';
line_len = strlen(#line);
if (!style.pre) && (_char == ' ')
{
if (line[line_len-1]==' ') return; //no double spaces
if (!stolbec) && (!line) return; //no paces at the beginning of the line
if (link) && (line_len==0) return;
}
if (line_len < sizeof(line)) chrcat(#line, _char);
CheckForLineBreak();
}
//============================================================================================
bool TWebBrowser::CheckForLineBreak()
{
int line_break_pos;
@ -309,17 +309,6 @@ bool TWebBrowser::CheckForLineBreak()
return true;
}
//============================================================================================
void TWebBrowser::ChangeEncoding(int _new_encoding)
{
if (cur_encoding == _new_encoding) return;
cur_encoding = _new_encoding;
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
if (header) {
ChangeCharset(cur_encoding, "CP866", #header);
DrawTitle(#header);
}
}
//============================================================================================
void TWebBrowser::NewLine()
{
static int empty_line=0;
@ -342,6 +331,17 @@ void TWebBrowser::NewLine()
stolbec += style.tag_list.level * 5;
}
//============================================================================================
void TWebBrowser::ChangeEncoding(int _new_encoding)
{
if (cur_encoding == _new_encoding) return;
cur_encoding = _new_encoding;
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
if (header) {
ChangeCharset(cur_encoding, "CP866", #header);
DrawTitle(#header);
}
}
//============================================================================================
scroll_bar scroll_wv =
{ 15,NULL,NULL,NULL,0,2,NULL,
0,0,0xeeeeee,0xBBBbbb,0xeeeeee};

View File

@ -142,14 +142,14 @@ dword _tag::get_next_param(dword ps, pe)
//find ATTR end
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
ESBYTE[pe+1] = '\0';
ESBYTE[pe] = '\0';
}
else
{
//find VAL start and copy
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
pe++;
strlcpy(#val, pe, sizeof(val)-1);
strlcpy(#val, pe+1, sizeof(val)-1);
ESBYTE[pe] = '\0';
//already have ATTR end
}

View File

@ -1,6 +1,6 @@
void TWebBrowser::SetStyle()
{
if (tag.get_value_of("name=")) || (tag.get_value_of("id=")) {
if (tag.get_value_of("name")) || (tag.get_value_of("id")) {
anchors.add(tag.value, draw_y);
if (anchors.current) && (streq(tag.value, #anchors.current+1)) {
list.first = draw_y;
@ -77,8 +77,8 @@ void TWebBrowser::tag_font()
style.bg_color = page_bg;
if (tag.opened)
{
if (tag.get_value_of("bg=")) style.bg_color = GetColor(tag.value);
if (tag.get_value_of("color=")) {
if (tag.get_value_of("bg")) style.bg_color = GetColor(tag.value);
if (tag.get_value_of("color")) {
text_colors.add(GetColor(tag.value));
} else {
text_colors.add(text_colors.get_last());
@ -96,7 +96,7 @@ void TWebBrowser::tag_div()
void TWebBrowser::tag_iframe()
{
if (tag.get_value_of("src=")) {
if (tag.get_value_of("src")) {
NewLine();
strcpy(#line, "IFRAME: ");
Paint();
@ -114,7 +114,7 @@ void TWebBrowser::tag_a()
{
if (tag.opened)
{
if (tag.get_value_of("href=")) && (!strstr(tag.value,"javascript:"))
if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:"))
{
link = true;
links.add_link(tag.value);
@ -127,8 +127,8 @@ void TWebBrowser::tag_a()
void TWebBrowser::tag_meta_xml()
{
if (custom_encoding == -1) if (tag.get_value_of("charset="))
|| (tag.get_value_of("content=")) || (tag.get_value_of("encoding="))
if (custom_encoding == -1) if (tag.get_value_of("charset"))
|| (tag.get_value_of("content")) || (tag.get_value_of("encoding"))
{
EDX = strrchr(tag.value, '=') + tag.value; //search in content=
if (ESBYTE[EDX] == '"') EDX++;
@ -139,8 +139,8 @@ void TWebBrowser::tag_meta_xml()
else if (streqrp(EDX,"iso-8859-5")) || (streqrp(EDX,"iso8859-5")) ChangeEncoding(CH_ISO8859_5);
else if (streqrp(EDX,"koi8-r")) || (streqrp(EDX,"koi8-u")) ChangeEncoding(CH_KOI8);
}
if (streq(tag.get_value_of("http-equiv="), "refresh")) && (tag.get_value_of("content=")) {
if (tag.value = strstri(tag.value, "url=")) strcpy(#redirect, tag.value);
if (streq(tag.get_value_of("http-equiv"), "refresh")) && (tag.get_value_of("content")) {
if (tag.value = strstri(tag.value, "url")) strcpy(#redirect, tag.value);
}
}
@ -187,7 +187,7 @@ void TWebBrowser::tag_li()
void TWebBrowser::tag_hr()
{
EAX = 0x999999;
if (tag.get_value_of("color=")) GetColor(tag.value);
if (tag.get_value_of("color")) GetColor(tag.value);
$push eax;
NewLine();
$pop edi;
@ -201,10 +201,10 @@ void TWebBrowser::tag_hr()
void TWebBrowser::tag_body()
{
t_body = tag.opened;
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=")) {
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")) {
style.bg_color = page_bg = GetColor(tag.value);
canvas.Fill(0, page_bg);
}
@ -260,7 +260,7 @@ void TWebBrowser::tag_img()
dword cur_img;
int img_x, img_y, img_w, img_h;
if (!tag.get_value_of("src=")) goto NOIMG;
if (!tag.get_value_of("src")) goto NOIMG;
if (streqrp(tag.value, "data:")) {
if (!strstr(tag.value, "base64,")) goto NOIMG;
@ -334,7 +334,7 @@ IMGOK:
return;
NOIMG:
if (tag.get_value_of("title=")) || (tag.get_value_of("alt=")) {
if (tag.get_value_of("title")) || (tag.get_value_of("alt")) {
strncpy(#img_path, tag.value, sizeof(line)-3);
sprintf(#line, "[%s]", #img_path);
} else {

View File

@ -41,7 +41,7 @@
// DATA //
// //
//===================================================//
char version[]="WebView 3.12";
char version[]="WebView 3.14";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
@ -904,7 +904,7 @@ void CheckContentType()
EventDownloadAndOpenImage(http.cur_url);
StopLoading();
}if (content_type[0] == 'a') {
EventOpenDownloader(history.current());
EventOpenDownloader(http.cur_url);
StopLoading();
}
}