1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[iframes] Draw frame around iframe.

This commit is contained in:
Witold Filipczyk 2021-07-31 14:48:13 +02:00
parent 7a5adbc328
commit 9bf5494d10
4 changed files with 54 additions and 4 deletions

View File

@ -48,6 +48,7 @@ void add_iframeset_entry(struct iframeset_desc **parent,
iframe_desc = &iframeset_desc->iframe_desc[offset];
iframe_desc->name = stracpy(name);
iframe_desc->uri = get_uri(url, 0);
iframe_desc->x = 1;
iframe_desc->y = y;
iframe_desc->width = width;
iframe_desc->height = height;
@ -203,7 +204,7 @@ format_iframes(struct session *ses, struct iframeset_desc *ifsd,
struct iframe_desc *iframe_desc = &ifsd->iframe_desc[j];
struct document_view *doc_view;
o.box.x = op->box.x;
o.box.x = iframe_desc->x;
o.box.y = iframe_desc->y;
o.box.width = iframe_desc->width;

View File

@ -13,6 +13,7 @@ struct iframe_desc {
char *name;
struct uri *uri;
int x;
int y;
int width, height;
};

View File

@ -503,9 +503,9 @@ html_iframe_do(char *a, char *object_src,
}
if (height > 0) {
int y = html_context->part->cy;
int y = html_context->part->cy + 1;
char *url2;
ln_break(html_context, height + 1);
ln_break(html_context, height + 3);
url2 = join_urls(html_context->base_href, url);

View File

@ -17,6 +17,7 @@
#include "cache/cache.h"
#include "document/document.h"
#include "document/html/frames.h"
#include "document/html/iframes.h"
#include "document/options.h"
#include "document/refresh.h"
#include "document/renderer.h"
@ -165,6 +166,46 @@ draw_frame_lines(struct terminal *term, struct frameset_desc *frameset_desc,
}
}
static void
draw_iframe_lines(struct terminal *term, struct iframeset_desc *iframe_desc,
int xp, int yp, struct color_pair *colors)
{
int j;
assert(term && iframe_desc && iframe_desc->iframe_desc);
if_assert_failed return;
for (j = 0; j < iframe_desc->n; j++) {
struct el_box box;
int y = iframe_desc->iframe_desc[j].y - 1;
int x = iframe_desc->iframe_desc[j].x - 1;
int height = iframe_desc->iframe_desc[j].height + 1;
int width = iframe_desc->iframe_desc[j].width + 1;
set_box(&box, x, y + 1, 1, height - 1);
draw_box(term, &box, BORDER_SVLINE, SCREEN_ATTR_FRAME, colors);
set_box(&box, x + width, y + 1, 1, height - 1);
draw_box(term, &box, BORDER_SVLINE, SCREEN_ATTR_FRAME, colors);
set_box(&box, x + 1, y, width -1 , 1);
draw_box(term, &box, BORDER_SHLINE, SCREEN_ATTR_FRAME, colors);
set_box(&box, x + 1, y + height, width - 1, 1);
draw_box(term, &box, BORDER_SHLINE, SCREEN_ATTR_FRAME, colors);
draw_border_char(term, x, y, BORDER_SULCORNER, colors);
draw_border_char(term, x, y + height, BORDER_SDLCORNER, colors);
draw_border_char(term, x + width, y, BORDER_SURCORNER, colors);
draw_border_char(term, x + width, y + height, BORDER_SDRCORNER, colors);
draw_border_cross(term, x, y, BORDER_X_DOWN, colors);
}
}
static void
draw_clipboard(struct terminal *term, struct document_view *doc_view)
{
@ -288,13 +329,14 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
}
if (document_has_frames(doc_view->document)) {
draw_box(term, box, ' ', 0, &color);
draw_box(term, box, ' ', 0, &color);
draw_frame_lines(term, doc_view->document->frame_desc, box->x, box->y, &color);
if (vs->current_link == -1)
vs->current_link = 0;
return;
}
if (ses->navigate_mode == NAVIGATE_LINKWISE) {
check_vs(doc_view);
} else {
@ -362,6 +404,12 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
draw_view_status(ses, doc_view, active);
if (has_search_word(doc_view))
doc_view->last_x = doc_view->last_y = -1;
if (document_has_iframes(doc_view->document)) {
draw_iframe_lines(term, doc_view->document->iframe_desc, box->x, box->y, &color);
if (vs->current_link == -1)
vs->current_link = 0;
}
}
static void