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

Move find_tag to document/document

This commit is contained in:
Jonas Fonseca 2007-08-31 02:09:40 +02:00 committed by Witold Filipczyk
parent 4e9982332e
commit 0da7f5a670
5 changed files with 24 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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"