forked from KolibriOS/kolibrios
WebView 3.21: small fixes
git-svn-id: svn://kolibrios.org@8454 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
27aa766598
commit
8c1db15f91
@ -83,8 +83,9 @@ struct TWebBrowser {
|
||||
//============================================================================================
|
||||
void TWebBrowser::Paint()
|
||||
{
|
||||
dword start_x, line_length, stolbec_len;
|
||||
dword text_color__;
|
||||
unsigned px; //paint x coordinate
|
||||
unsigned pw; //paint y coordinate
|
||||
dword pc; //paint color
|
||||
|
||||
if (style.title)
|
||||
{
|
||||
@ -101,37 +102,37 @@ void TWebBrowser::Paint()
|
||||
|
||||
if (line)
|
||||
{
|
||||
start_x = stolbec * list.font_w + BODY_MARGIN + list.x;
|
||||
stolbec_len = strlen(#line) * zoom;
|
||||
line_length = stolbec_len * list.font_w;
|
||||
px = stolbec * list.font_w + BODY_MARGIN + list.x;
|
||||
pw = strlen(#line) * zoom * list.font_w;
|
||||
stolbec += strlen(#line) * zoom;
|
||||
|
||||
style.cur_line_h = math.max(style.cur_line_h, list.item_h);
|
||||
|
||||
if (bg_colors.get_last() - bg_colors.get(0)) {
|
||||
canvas.DrawBar(start_x, draw_y, line_length, list.item_h, bg_colors.get_last());
|
||||
canvas.DrawBar(px, draw_y, pw, list.item_h, bg_colors.get_last());
|
||||
}
|
||||
|
||||
if (style.image) {
|
||||
canvas.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xF9DBCB);
|
||||
canvas.DrawBar(px, draw_y, pw, list.item_h-1, 0xF9DBCB);
|
||||
}
|
||||
if (style.button) {
|
||||
canvas.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc);
|
||||
canvas.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
|
||||
canvas.DrawBar(px, draw_y, pw, list.item_h - calc(zoom*2), 0xCCCccc);
|
||||
canvas.DrawBar(px, draw_y + list.item_h - calc(zoom*2), pw, zoom, 0x999999);
|
||||
}
|
||||
|
||||
text_color__ = text_colors.get_last();
|
||||
if (link) && (text_color__ == text_colors.get(0)) text_color__ = link_color_default;
|
||||
pc = text_colors.get_last();
|
||||
if (link) && (pc == text_colors.get(0)) pc = link_color_default;
|
||||
|
||||
canvas.WriteText(start_x, draw_y, list.font_type, text_color__, #line, NULL);
|
||||
if (style.b) canvas.WriteText(start_x+1, draw_y, list.font_type, text_color__, #line, NULL);
|
||||
if (style.s) canvas.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_color__);
|
||||
if (style.u) canvas.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_color__);
|
||||
canvas.WriteText(px, draw_y, list.font_type, pc, #line, NULL);
|
||||
if (style.b) canvas.WriteText(px+1, draw_y, list.font_type, pc, #line, NULL);
|
||||
if (style.s) canvas.DrawBar(px, list.item_h / 2 - zoom + draw_y, pw, zoom, pc);
|
||||
if (style.u) canvas.DrawBar(px, list.item_h - zoom - zoom + draw_y, pw, zoom, pc);
|
||||
if (link) {
|
||||
if (line[0]==' ') && (line[1]==NULL) {} else {
|
||||
canvas.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2)-1, line_length, zoom, link_color_default);
|
||||
links.add_text(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2)-1, zoom);
|
||||
canvas.DrawBar(px, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default);
|
||||
links.add_text(px, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom);
|
||||
}
|
||||
}
|
||||
stolbec += stolbec_len;
|
||||
if (debug_mode) debugln(#line);
|
||||
line = NULL;
|
||||
}
|
||||
@ -143,7 +144,7 @@ void TWebBrowser::SetPageDefaults()
|
||||
style.reset();
|
||||
link_color_default = 0x0000FF;
|
||||
link_color_active = 0xFF0000;
|
||||
//style.cur_line_h = list.item_h;
|
||||
style.cur_line_h = list.item_h;
|
||||
links.clear();
|
||||
anchors.clear();
|
||||
img_url.drop();
|
||||
|
@ -30,7 +30,7 @@ void TWebBrowser::SetStyle()
|
||||
if (tag.is("blockquote")) { style.blq = tag.opened; return; }
|
||||
if (tag.is("dl")) { if (tag.opened) NewLine(); return; }
|
||||
if (tag.is("tr")) { if (tag.opened) NewLine(); return; }
|
||||
if (tag.is("td")) { if (tag.opened) AddCharToTheLine(' '); return; }
|
||||
if (tag.is("td")) { /*if (tag.opened) AddCharToTheLine(' ');*/ return; }
|
||||
if (tag.is("button")) { style.button = tag.opened; stolbec++; return; }
|
||||
if (tag.is("w:r")) { if (!tag.opened) style.b = false; return; }
|
||||
if (tag.is("h1")) { tag_h1234_caption(); return; }
|
||||
@ -54,7 +54,7 @@ void TWebBrowser::SetStyle()
|
||||
if (tag.is("html")) { t_html = tag.opened; return; }
|
||||
if (tag.is("dd")) {
|
||||
//NewLine();
|
||||
//if (tag.opened) stolbec += 5; //stolbec overflow!
|
||||
//if (tag.opened) stolbec += 5; //may overflow!
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -265,6 +265,8 @@ void TWebBrowser::tag_img()
|
||||
dword cur_img;
|
||||
int img_x, img_y, img_w, img_h;
|
||||
|
||||
if (!tag.get_value_of("data-large-image"))
|
||||
if (!tag.get_value_of("data-src"))
|
||||
if (!tag.get_value_of("src")) return;
|
||||
|
||||
if (streqrp(tag.value, "data:")) {
|
||||
@ -281,6 +283,8 @@ void TWebBrowser::tag_img()
|
||||
}
|
||||
|
||||
if (!strcmp(tag.value + strrchr(tag.value, '.'), "svg")) goto NOIMG;
|
||||
if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
|
||||
|
||||
strlcpy(#img_path, tag.value, sizeof(img_path)-1);
|
||||
get_absolute_url(#img_path, history.current());
|
||||
|
||||
@ -302,17 +306,21 @@ IMGOK:
|
||||
img_h = ESDWORD[cur_img+8];
|
||||
img_w = ESDWORD[cur_img+4];
|
||||
|
||||
if (img_w / 6 + stolbec > list.column_max) {
|
||||
if (img_w / 8 + stolbec > list.column_max) {
|
||||
NewLine();
|
||||
}
|
||||
img_x = stolbec*list.font_w + 3;
|
||||
img_y = draw_y;
|
||||
|
||||
if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2;
|
||||
|
||||
img_w = math.min(img_w, canvas.bufw - img_x);
|
||||
|
||||
style.cur_line_h = math.max(list.item_h, img_h);
|
||||
|
||||
stolbec += img_w / 6;
|
||||
stolbec += img_w / 8;
|
||||
if (img_w % 8) stolbec++;
|
||||
|
||||
if (stolbec > list.column_max) {
|
||||
NewLine();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
// DATA //
|
||||
// //
|
||||
//===================================================//
|
||||
char version[]="WebView 3.2";
|
||||
char version[]="WebView 3.21";
|
||||
|
||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||
|
||||
@ -237,7 +237,11 @@ void main()
|
||||
}
|
||||
else if (http_get_type==IMG) {
|
||||
_IMG_RES:
|
||||
if (http.status_code >= 200) && (http.status_code < 300) {
|
||||
cache.add(cur_img_url, http.content_pointer, http.content_received, IMG);
|
||||
} else {
|
||||
cache.add(cur_img_url, 0, 0, IMG);
|
||||
}
|
||||
free(http.content_pointer);
|
||||
GetImg(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user