1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

[iframes] No progress today

This commit is contained in:
Witold Filipczyk 2021-07-28 21:22:47 +02:00
parent 2670444590
commit a945d47584
7 changed files with 45 additions and 39 deletions

View File

@ -171,7 +171,7 @@ redir:
doc_view = find_ifd(ses, iframe_desc->name, j, o->box.x, o->box.y);
if (doc_view) {
render_document(vs, doc_view, o);
assert(doc_view->document);
///assert(doc_view->document);
//doc_view->document->iframe = frame_desc;
}
o->plain = plain;

View File

@ -488,14 +488,6 @@ html_iframe_do(char *a, char *object_src,
html_focusable(html_context, a);
if (*name) {
put_link_line("IFrame: ", name, url,
html_context->options->framename, html_context);
} else {
put_link_line("", "IFrame", url,
html_context->options->framename, html_context);
}
if (!hstr) {
height = (150 + HTML_CHAR_HEIGHT - 1) / HTML_CHAR_HEIGHT;
} else {
@ -521,6 +513,14 @@ html_iframe_do(char *a, char *object_src,
html_context->special_f(html_context, SP_IFRAME, url2, name, y, width, height);
mem_free(url2);
}
} else {
if (*name) {
put_link_line("IFrame: ", name, url,
html_context->options->framename, html_context);
} else {
put_link_line("", "IFrame", url,
html_context->options->framename, html_context);
}
}
mem_free(name);

View File

@ -442,6 +442,7 @@ request_iframe(struct session *ses, char *name,
}
iframe = mem_calloc(1, sizeof(*iframe));
if (!iframe) return;
iframe->name = stracpy(name);
@ -855,6 +856,7 @@ request_additional_file(struct session *ses, char *name, struct uri *uri, int pr
}
ftl = mem_calloc(1, sizeof(*ftl));
if (!ftl) return NULL;
ftl->uri = get_uri_reference(uri);
@ -1468,6 +1470,23 @@ ses_find_frame(struct session *ses, char *name)
return NULL;
}
struct frame *
ses_find_iframe(struct session *ses, char *name)
{
struct location *loc = cur_loc(ses);
struct frame *iframe;
assertm(have_location(ses), "ses_request_frame: no location yet");
if_assert_failed return NULL;
foreachback (iframe, loc->iframes)
if (!c_strcasecmp(iframe->name, name))
return iframe;
return NULL;
}
void
set_session_referrer(struct session *ses, struct uri *referrer)
{

View File

@ -104,6 +104,7 @@ struct session_task {
/* TODO: union --pasky */
struct {
char *frame;
char *iframe;
struct location *location;
} target;
};
@ -306,6 +307,7 @@ void reload(struct session *, enum cache_mode);
void load_frames(struct session *, struct document_view *);
struct frame *ses_find_frame(struct session *, char *);
struct frame *ses_find_iframe(struct session *, char *);
void free_files(struct session *);
void display_timer(struct session *ses);

View File

@ -324,35 +324,7 @@ x:
copy_struct(&loc->download, &ses->loading);
}
if (loaded_in_frame == 2) {
struct frame *iframe;
assertm(have_location(ses), "no location yet");
if_assert_failed return NULL;
struct location *loc = cur_loc(ses);
iframe = loc->iframes.next;
if (!iframe) {
return NULL;
}
vs = &iframe->vs;
done_uri(vs->uri);
vs->uri = get_uri_reference(ses->loading_uri);
if (vs->doc_view) {
/* vs->doc_view itself will get detached in
* render_document_frames(), but that's too
* late for us. */
vs->doc_view->vs = NULL;
vs->doc_view = NULL;
}
#ifdef CONFIG_ECMASCRIPT
vs->ecmascript_fragile = 1;
#endif
} else if (ses->task.target.frame && *ses->task.target.frame) {
if (ses->task.target.frame && *ses->task.target.frame) {
struct frame *frame;
assertm(have_location(ses), "no location yet");
@ -364,6 +336,9 @@ x:
}
frame = ses_find_frame(ses, ses->task.target.frame);
if (!frame) {
frame = ses_find_iframe(ses, ses->task.target.frame);
}
if (!frame) {
if (!loaded_in_frame) {
del_from_history(&ses->history, loc);

View File

@ -1454,6 +1454,11 @@ current_frame(struct session *ses)
if (!current_frame_number--) return doc_view;
}
foreach (doc_view, ses->scrn_iframes) {
if (document_has_iframes(doc_view->document)) continue;
if (!current_frame_number--) return doc_view;
}
doc_view = ses->doc_view;
assert(doc_view && doc_view->document);

View File

@ -173,7 +173,8 @@ next_frame(struct session *ses, int p)
int n;
if (!have_location(ses)
|| (ses->doc_view && !document_has_frames(ses->doc_view->document)))
|| (ses->doc_view && !document_has_frames(ses->doc_view->document)
&& !document_has_iframes(ses->doc_view->document)))
return;
ses->navigate_mode = NAVIGATE_LINKWISE;
@ -185,6 +186,10 @@ next_frame(struct session *ses, int p)
if (!document_has_frames(doc_view->document))
n++;
}
foreach (doc_view, ses->scrn_iframes) {
if (!document_has_iframes(doc_view->document))
n++;
}
vs->current_link += p;
if (!n) n = 1;