diff --git a/src/document/document.c b/src/document/document.c index 105fec0a..372eee07 100644 --- a/src/document/document.c +++ b/src/document/document.c @@ -197,6 +197,18 @@ release_document(struct document *document) move_to_top_of_list(format_cache, document); } +int +find_tag(struct document *document, unsigned char *name, int namelen) +{ + struct tag *tag; + + foreach (tag, document->tags) + if (!strlcasecmp(tag->name, -1, name, namelen)) + return tag->y; + + return -1; +} + /* Formatted document cache management */ /* ECMAScript doesn't like anything like CSS since it doesn't modify the diff --git a/src/document/document.h b/src/document/document.h index 66545679..43b350fb 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -48,6 +48,16 @@ struct point { }; +/* Tags are used for ``id''s or anchors in the document referenced by the + * fragment part of the URI. */ +struct tag { + LIST_HEAD(struct tag); + + int x, y; + unsigned char name[1]; /* must be last of struct. --Zas */ +}; + + enum link_type { LINK_HYPERTEXT, LINK_MAP, @@ -260,4 +270,6 @@ extern struct module document_module; * For now, we only support simple printable character. */ #define accesskey_string_to_unicode(s) (((s)[0] && !(s)[1] && isprint((s)[0])) ? (s)[0] : 0) +int find_tag(struct document *document, unsigned char *name, int namelen); + #endif diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index ad9476e3..d6042f47 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -45,17 +45,6 @@ /* Types and structs */ -/* Tags are used for ``id''s or anchors in the document referenced by the - * fragment part of the URI. */ -/* FIXME: This and find_tag() should be part of the general infrastructure - * in document/document.*. --pasky */ -struct tag { - LIST_HEAD(struct tag); - - int x, y; - unsigned char name[1]; /* must be last of struct. --Zas */ -}; - enum link_state { LINK_STATE_NONE, LINK_STATE_NEW, @@ -2339,15 +2328,3 @@ render_html_document(struct cache_entry *cached, struct document *document, } #endif } - -int -find_tag(struct document *document, unsigned char *name, int namelen) -{ - struct tag *tag; - - foreach (tag, document->tags) - if (!strlcasecmp(tag->name, -1, name, namelen)) - return tag->y; - - return -1; -} diff --git a/src/document/html/renderer.h b/src/document/html/renderer.h index 316b28ed..82e20607 100644 --- a/src/document/html/renderer.h +++ b/src/document/html/renderer.h @@ -68,6 +68,4 @@ void free_table_cache(void); struct part *format_html_part(struct html_context *html_context, unsigned char *, unsigned char *, int, int, int, struct document *, int, int, unsigned char *, int); -int find_tag(struct document *document, unsigned char *name, int namelen); - #endif diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 60933153..65af2d9c 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -17,7 +17,6 @@ #include "cache/cache.h" #include "document/document.h" #include "document/html/frames.h" -#include "document/html/renderer.h" #include "document/options.h" #include "document/refresh.h" #include "document/renderer.h"