In ELinks, we have various interrelated structures: - struct document - struct view_state - struct document_view - struct ecmascript_interpreter - struct location
struct document is a canvas on which a (usually HTML) document has been rendered for some charset. It can be displayed on a terminal with minimal conversions. It can be kept in the formatted document cache when it is not being displayed. It can be displayed in multiple tabs at the same time, I think. But then there is also document.timeout, which AFAIK should be local to each tab. struct location is what is kept in the history of each tab. I don't understand why we have both struct view_state and struct document_view. When we're adding a member, how do we decide in which of the two structures it belongs? Back in August 2008, I searched for code that connects these structures to each other or disconnects them again, and wrote the following notes. But I'm sad to say that I didn't get anywhere From there. IIRC, this is relevant to bug 765 or 771. struct document *document_view::document; DETACH detach_formatted: doc_view->document = NULL; struct view_state *document_view::vs; ATTACH render_document: doc_view->vs = vs; DETACH render_document: vs->doc_view->vs = NULL; ATTACH render_document: doc_view->document = document; DETACH ses_forward: vs->doc_view->vs = NULL; ATTACH draw_formatted: ses->doc_view->vs = &cur_loc(ses)->vs; ATTACH goto_mark: vs->doc_view->vs = vs; DETACH detach_formatted: doc_view->vs = NULL; DETACH destroy_vs: vs->doc_view->vs = NULL; struct document_view *view_state::doc_view; DETACH render_document: vs->doc_view = NULL; ATTACH render_document: vs->doc_view = doc_view; DETACH ses_forward: vs->doc_view = NULL; ATTACH goto_mark: vs->doc_view = doc_view; DETACH detach_formatted: doc_view->vs->doc_view = NULL; DETACH destroy_vs: vs->doc_view = NULL; ATTACH copy_vs: copy_struct(dst, src); DETACH copy_vs: dst->doc_view = NULL; struct ecmascript_interpreter *view_state::ecmascript; DETACH ecmascript_put_interpreter: interpreter->vs->ecmascript = NULL; ATTACH ecmascript_reset_state: vs->ecmascript = ecmascript_get_interpreter(vs); RETACH goto_mark: vs->ecmascript = ecmascript; DETACH copy_vs: dst->ecmascript = NULL; struct view_state location::vs; FOLLOW render_document_frames: vs = &cur_loc(ses)->vs; FOLLOW render_document_frames: cur_loc(ses)->vs.current_link = n; FOLLOW l_current_url: struct view_state *vs = &cur_loc(lua_ses)->vs; FOLLOW script_hook_pre_format_html: struct view_state *vs = &cur_loc(ses)->vs; FOLLOW smjs_elinks_get_view_state: vs = &cur_loc(smjs_ses)->vs; MODIFY copy_location: copy_vs(&dst->vs, &src->vs); MODIFY destroy_location: destroy_vs(&loc->vs, 1); FOLLOW reload: loc->vs.ecmascript_fragile = 1; FOLLOW ses_forward: vs = &loc->vs; FOLLOW draw_frames: l = &cur_loc(ses)->vs.current_link; FOLLOW next_frame: vs = &cur_loc(ses)->vs; LIST_OF(struct frame) location::frames; struct view_state frame::vs; FOLLOW format_frame: vs = &frame->vs; MODIFY try_resolve_frame: ecmascript_reset_state(&target->vs); MODIFY copy_location: copy_vs(&new_frame->vs, &frame->vs); MODIFY destroy_location: destroy_vs(&frame->vs, 1); MODIFY request_frame: init_vs(&frame->vs, uri, -1); FOLLOW reload: vs = &frame->vs; CALLER GRAPHS ------------- detach_formatted // Parameter struct document_view *doc_view; detaches that from view_state and document. render_document // Parameters struct view_state *vs and struct document_view *doc_view; // attaches those to each other, calling detach_formatted(doc_view) and // detaching vs from any other document_view. format_frame format_frames @format_frames @render_document_frames @render_document_frames @dump_formatted render_document_frames update_status change_hook_insert_mode change_hooks... change_hook_ui @change_hooks unibar_set_property menubar_class... statusbar_class... init_session init_saved_session decode_session_info <INTERLINK_NORMAL_MAGIC>... decode_session_info handle_interlink_event <EVENT_INIT>... do_follow_url follow_url goto_uri... goto_uri_frame... goto_imgmap... tabwin_func <EVENT_ABORT>... l_current_document_formatted init_lua draw_formatted change_hook_css... toggle_document_option... show_http_error_document... display_timer... doc_loading_callback... tabwin_func <EVENT_REDRAW>... do_action <ACT_MAIN_BACKSPACE_PREFIX>... do_action <ACT_MAIN_FRAME_NEXT>... do_action <ACT_MAIN_FRAME_PREV>... do_action <ACT_MAIN_RERENDER>... text_typeahead_handler... link_typeahead_handler... toggle_plain_html... toggle_wrap_text... try_prefix_key... do_mouse_event... destroy_session tabwin_func <EVENT_ABORT>... dump_formatted dump_loading_callback dump_start dump_next @dump_loading_callback @dump_start init... copy_vs copy_location @ses_forward setup_session @init_session @goto_mark @set_mark ecmascript_put_interpreter ecmascript_reset_state... @render_document ecmascript_protocol_handler... js_try_resolve_frame... window_get... try_resolve_frame... window_get_property... call_onsubmit_and_submit... destroy_vs destroy_location... free_history... clean_unhistory... ses_history_move... @ses_forward setup_session... ses_forward tp_display... setup_download_handler... do_move <TASK_RELOAD>... @dump_formatted goto_mark try_mark_key <KP_MARK_GOTO> frame_ev_kbd frame_ev <EVENT_KBD> send_to_frame... do_mouse_event... send_kbd_event send_event... free_mark_by_index... set_mark @try_mark_key <KP_MARK_SET> done_marks...
pgp1vMFc9ijCr.pgp
Description: PGP signature
_______________________________________________ elinks-dev mailing list elinks-dev@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-dev