1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-19 01:36:33 -04:00
Commit Graph

34 Commits

Author SHA1 Message Date
Jonas Fonseca
a4831fef2d Make it easier to work with DOM stack contexts outside of the callbacks
The problem is to get access to the context when it is not the first one
and it has to happen outside of the context callbacks. This changes the
memory management so that the context adder returns the context. To further
improve the use of contexts add a context destructor which makes it
possible to unregister (temporary) contexts.
2005-12-27 05:59:12 +01:00
Jonas Fonseca
af19f811e3 Simplify DOM node popping
.. by turning do_pop_dom_node() into pop_dom_node() and let pop_dom_state()
handle it's own logic for reaching the wanted state.
2005-12-27 04:42:28 +01:00
Jonas Fonseca
558e2736e4 search_dom_stack(): Use dom_string_casecmp() for comparison 2005-12-22 22:28:38 +01:00
Jonas Fonseca
4eae1d4882 Add a few comment and remove an obsolete one 2005-12-22 04:00:55 +01:00
Jonas Fonseca
9c720c2cc8 Rename the DOM tree renderer to DOM stack tracer
Use add_dom_stack_tracer(stack) to have stack activity traced. It is only
active when DOM_STACK_TRACE is defined.
2005-12-22 03:55:55 +01:00
Jonas Fonseca
6cb9a841b6 Add FIXME about optimizing walk_dom_nodes() 2005-12-22 03:20:11 +01:00
Jonas Fonseca
9360f88d65 search_dom_stack(): No need to inline this at least not while debugging 2005-12-21 13:48:37 +01:00
Jonas Fonseca
2a24ad9099 Introduce enum dom_stack_flag to make init_dom_stack() more obvious 2005-12-21 04:48:50 +01:00
Jonas Fonseca
632f12f82a init_dom_stack(): Drop unused object_size argument 2005-12-21 04:41:35 +01:00
Jonas Fonseca
f8d48e81eb Move the state_objects to the DOM stack contexts
This way all contexts are now separated, almost.
2005-12-21 04:38:04 +01:00
Jonas Fonseca
910c51abaf Remove the now unused DOM stack data member 2005-12-21 03:59:46 +01:00
Jonas Fonseca
c524655362 Add current member to struct dom_Stack which holds the current context 2005-12-21 01:32:43 +01:00
Jonas Fonseca
0faa8d7462 Add a data member to struct dom_stack_context (not used yet) 2005-12-21 01:25:50 +01:00
Jonas Fonseca
12a2f96920 Introduce struct dom_Stack_context
- For now it just stores the dom_stack_context_info reference.
 - Rename dom_stack members to contexts and contexts_size.
 - Use mem_alloc_align based rellocation scheme.
2005-12-21 01:15:19 +01:00
Jonas Fonseca
a77242738c Rename: add_dom_stack_callbacks() -> add_dom_stack_context() 2005-12-21 01:04:37 +01:00
Jonas Fonseca
3843be25af Rename: struct dom_stack_callbacks -> struct dom_stack_context_info 2005-12-21 00:58:22 +01:00
Jonas Fonseca
625725f0e9 Allow for multiple callbacks to be attached to the DOM stack 2005-12-20 20:27:20 +01:00
Jonas Fonseca
e309de8950 Introduce call_dom_stack_callbacks as a common way to call back 2005-12-20 20:01:18 +01:00
Jonas Fonseca
d6b125fa68 Drop the return value from dom_stack_callback_T
... since the feature with popping the node if the return value is NULL is
not used and it doesn't make a lot of sense with multiple callbacks.
2005-12-20 19:48:33 +01:00
Jonas Fonseca
990c5e0a26 Combine DOM stack push and pop callbacks into one struct 2005-12-20 19:20:04 +01:00
Jonas Fonseca
330c0174e5 Rename DOM stack iterators and make them include all states when iterating
They are now called: foreach{back,}_dom_stack_state (...) and the immutable
flag together with node type restricted stack searches should ensure that
the document root node never is popped.
2005-12-19 02:51:32 +01:00
Jonas Fonseca
051db70dd4 Add boolean immutable flag to the DOM stack state
Can be used to ensure the document root node never leaves the stack while
parsing.
2005-12-19 02:34:26 +01:00
Jonas Fonseca
ee1eba9689 Rename: dom_stack_has_parents() -> dom_stack_is_empty() (with negated value) 2005-12-19 02:15:36 +01:00
Jonas Fonseca
bc338207e7 do_pop_dom_node(): move dom_stack_has_parents() to assertion
All callers already checks if the stack is empty.
2005-12-19 02:05:43 +01:00
Jonas Fonseca
45861c68e1 pop_dom_state(): Drop unused left-over argument 2005-12-15 22:05:30 +01:00
Jonas Fonseca
27116d6385 Make the DOM stack and the SGML parser interface more general
They now both hold a single private data member. This means the parser now
holds the renderer data.
2005-12-12 17:41:09 +01:00
Jonas Fonseca
87aad88c96 Use dom_string throughout the DOM stack interface 2005-12-10 21:42:49 +01:00
Jonas Fonseca
4480a9a4cd Removes node from the DOM tree when using the SGML stream parser
That should free up some short-term memory.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
2005-12-08 03:02:27 +01:00
Jonas Fonseca
c7ad6f967b Introduce new pop_dom_state()
It's basically pop_dom_nodes() without the search part and is now used as a
backend in pop_dom_nodes(). Use it in parse_sgml_document() to avoid two
DOM stack searches in a row.
2005-12-05 19:40:35 +01:00
Jonas Fonseca
9aebb66bce Introduce separate push/pop callbacks
This should make it possible to do the SAX (parser stream thing) for XBEL.
And will also be used for fixing the end-tag highlighting.
2005-12-05 19:31:42 +01:00
Jonas Fonseca
65b504f093 Remove all traces of the element end-tag hilighting hack
End-tags will stay uncolored for the next few commits.
2005-12-05 11:21:08 +01:00
Jonas Fonseca
8f25d73013 Use separate data variables for storing DOM stack data
They will eventually have to share the stack.
2005-12-05 11:16:05 +01:00
Jonas Fonseca
208515c82f Fix access to free()d memory in the DOM stack state data
There already was one work-around in the code related to clearing of the
state data after popping. Instead of storing a pointer to the state data in
the state we now store the depth of the state (in the stack) and use a
macro to access the state data. The bug occurred when reallocating the
stack state objects and the stack data pointers wasn't updated to point to
the newly allocated data.
2005-12-05 11:11:06 +01:00
Jonas Fonseca
bccfbf8647 Rename DOM navigator -> stack
This is really a much more appropriate word since it never ended up being
more than just a stack. The rename also changes the symbol names to use the
much shorter "stack".
2005-11-15 10:43:52 +01:00