Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8439 → Rev 8440

/programs/cmm/browser/TWB/TWB.c
247,7 → 247,7
goto _DEFAULT;
}
_TAG:
if (tag.parse_tag(#bufpos, bufpointer + bufsize)) {
if (tag.parse(#bufpos, bufpointer + bufsize)) {
CheckForLineBreak();
Paint();
$push cur_encoding
307,7 → 307,6
 
strcpy(#line, #new_line_text);
NewLine();
//while (CheckForLineBreak()==true) {};
return true;
}
//============================================================================================
/programs/cmm/browser/TWB/parse_tag.h
3,15 → 3,14
{
char name[32];
char prior[32];
char params[6000];
bool opened;
collection attributes;
collection values;
dword value;
bool is();
bool parse_tag();
bool parse();
void debug_tag();
bool get_next_param();
dword get_next_param();
dword get_value_of();
} tag=0;
 
24,10 → 23,11
}
}
 
bool _tag::parse_tag(dword _bufpos, bufend)
bool _tag::parse(dword _bufpos, bufend)
{
bool retok = true;
dword bufpos = ESDWORD[_bufpos];
dword params, paramsend;
 
dword closepos;
dword whitepos;
34,7 → 34,6
 
if (name) strcpy(#prior, #name); else prior = '\0';
name = '\0';
params = '\0';
attributes.drop();
values.drop();
 
47,6 → 46,7
bufpos++;
}
bufpos+=2;
retok = false;
goto _RET;
}
 
59,28 → 59,33
 
closepos = strchr(bufpos, '>');
whitepos = strchrw(bufpos, bufend-bufpos);
if (whitepos > closepos) {
 
if (debug_mode) {
if (!closepos) debugln("null closepos");
if (!whitepos) debugln("null whitepos");
}
 
if (!whitepos) || (whitepos > closepos) {
//no param
strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)));
debug_tag();
params = '\0';
bufpos = closepos;
} else {
//we have param
strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)));
strncpy(#params, whitepos, math.min(closepos - whitepos, sizeof(tag.params)));
debug_tag();
bufpos = closepos;
while (get_next_param());
}
 
if (!name) {
retok = false;
goto _RET;
params = malloc(closepos - whitepos + 1);
strncpy(params, whitepos, closepos - whitepos);
if (debug_mode) { debug("params: "); debugln(params+1); }
paramsend = params + closepos - whitepos;
while (paramsend = get_next_param(params, paramsend-1));
free(params);
}
 
if (name) {
strlwr(#name);
 
// ignore text inside the next tags
if (is("script")) || (is("style")) || (is("binary")) || (is("select")) {
strcpy(#prior, #name);
87,11 → 92,13
sprintf(#name, "</%s>", #prior);
if (strstri(bufpos, #name)) bufpos = EAX-1;
retok = false;
goto _RET;
} else {
if (name[strlen(#name)-1]=='/') name[strlen(#name)-1]=NULL; //for <br/>
}
} else {
retok = false;
}
 
if (name[strlen(#name)-1]=='/') name[strlen(#name)-1]=NULL; //for <br/>
 
_RET:
ESDWORD[_bufpos] = bufpos;
return retok;
104,63 → 111,58
if (!opened) debugch('/');
debug(#name);
debugln(">");
if (params) {
debug("params: ");
debugln(#params+1);
}
}
}
 
bool _tag::get_next_param()
dword _tag::get_next_param(dword ps, pe)
{
byte quotes = NULL;
int i;
// "ps" - param start
// "pe" - param end
// "q" - quote char
char q = NULL;
dword fixeq;
unsigned char val[6000];
unsigned char attr[6000];
 
if (!params) return false;
if (ESBYTE[pe] == '/') pe--;
while (pe>ps) && (__isWhite(ESBYTE[pe])) pe--;
i = strlen(#params) - 1;
if (params[i] == '/') i--;
while (i>0) && (__isWhite(params[i])) i--;
 
if (params[i] == '"') || (params[i] == '\'')
if (ESBYTE[pe] == '"') || (ESBYTE[pe] == '\'')
{
//remove quotes
quotes = params[i];
params[i] = '\0';
i--;
//remove quote
q = ESBYTE[pe];
ESBYTE[pe] = '\0';
pe--;
 
//find VAL start and copy
i = strrchr(#params, quotes);
strlcpy(#val, #params + i, sizeof(val)-1);
params[i] = '\0';
i--;
pe = strrchr(ps, q) + ps;
strlcpy(#val, pe, sizeof(val)-1);
ESBYTE[pe] = '\0';
pe--;
 
//find ATTR end
while (i > 0) && (params[i] != '=') i--;
params[i+1] = '\0';
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
ESBYTE[pe+1] = '\0';
}
else
{
//find VAL start and copy
while (i > 0) && (params[i] != '=') i--;
i++;
strlcpy(#val, #params + i, sizeof(val)-1);
 
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
pe++;
strlcpy(#val, pe, sizeof(val)-1);
//already have ATTR end
}
 
//find ATTR start and copy
while (i>0) && (!__isWhite(params[i])) i--;
strlcpy(#attr, #params + i + 1, sizeof(attr)-1);
params[i] = '\0';
while (pe>ps) && (!__isWhite(ESBYTE[pe])) pe--;
strlcpy(#attr, pe + 1, sizeof(attr)-1);
ESBYTE[pe] = '\0';
//fix case: src=./images/KolibriOS_logo2.jpg?sid=e8ece8b38b
i = strchr(#attr,'=');
if (!quotes) && (i) {
strlcpy(#val, i+1, sizeof(val)-1);
ESBYTE[i+1] = '\0';
fixeq = strchr(#attr,'=');
if (!q) && (fixeq) {
strlcpy(#val, fixeq+1, sizeof(val)-1);
ESBYTE[fixeq+1] = '\0';
}
strlwr(#attr);
strrtrim(#val);
174,7 → 176,8
debugch('\n');
}
 
return true;
if (pe==ps) return NULL;
return pe;
}
 
dword _tag::get_value_of(dword _attr_name)
/programs/cmm/browser/WebView.c
41,7 → 41,7
// DATA //
// //
//===================================================//
char version[]="WebView 3.1";
char version[]="WebView 3.11";
 
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
 
223,6 → 223,7
notify("'Too many redirects.' -E");
StopLoading();
redirect_count = 0;
if (http_get_type==IMG) goto _IMG_RES;
}
} else {
// Loading the page is complete, free resources
235,6 → 236,7
LoadInternalPage(cache.current_buf, cache.current_size);
}
else if (http_get_type==IMG) {
_IMG_RES:
cache.add(cur_img_url, http.content_pointer, http.content_received, IMG);
free(http.content_pointer);
GetImg(false);
934,6 → 936,7
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;
/programs/cmm/browser/const.h
12,7 → 12,7
-
ˆáâ®à¨ï|Ctrl+H
Œ¥­¥¤¦¥à § £à㧮ª|Ctrl+J
Žç¨áâ¨âì ªíè
Žç¨áâ¨âì ªíè|Ctrl+F5
Ž¡­®¢¨âì ¡à ã§¥à";
char link_menu[] =
"Žâªàëâì ¢ ­®¢®© ¢ª« ¤ª¥
44,7 → 44,7
-
History|Ctrl+H
Download Manager|Ctrl+J
Clear cache
Clear cache|Ctrl+F5
Update browser";
char link_menu[] =
"Open in new tab