From 5d34b4bff6beb3c94bf460abd538bb5f424d9dad Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Fri, 31 Aug 2007 02:09:40 +0200 Subject: [PATCH 1/2] Move find_tag to document/document --- src/document/document.c | 12 ++++++++++++ src/document/document.h | 12 ++++++++++++ src/document/html/renderer.c | 23 ----------------------- src/document/html/renderer.h | 2 -- src/viewer/text/draw.c | 1 - 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/document/document.c b/src/document/document.c index d65dca2ab..7f4c9014b 100644 --- a/src/document/document.c +++ b/src/document/document.c @@ -182,6 +182,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 cc8cde915..44e61f564 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, @@ -245,4 +255,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 9a5ce7ac5..5cb61d6cc 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, @@ -2334,15 +2323,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 316b28ede..82e206071 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 2ca42fcf1..07df0f7fb 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" From 8489f04cc9d166ed6d239788d93fe0d044f7d503 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Fri, 31 Aug 2007 02:10:15 +0200 Subject: [PATCH 2/2] renderer: Fix unnecessary inclusions of document/html/renderer --- src/dialogs/document.c | 1 - src/dialogs/info.c | 2 +- src/session/session.c | 2 +- src/viewer/text/link.c | 1 - src/viewer/text/textarea.c | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/dialogs/document.c b/src/dialogs/document.c index ba55ea2bf..8ff7b4446 100644 --- a/src/dialogs/document.c +++ b/src/dialogs/document.c @@ -17,7 +17,6 @@ #include "cache/cache.h" #include "dialogs/document.h" #include "document/document.h" -#include "document/html/renderer.h" #include "document/view.h" #include "globhist/globhist.h" #include "intl/gettext/libintl.h" diff --git a/src/dialogs/info.c b/src/dialogs/info.c index f987aee07..2227ae41b 100644 --- a/src/dialogs/info.c +++ b/src/dialogs/info.c @@ -18,7 +18,7 @@ #include "config/kbdbind.h" #include "config/options.h" #include "dialogs/info.h" -#include "document/html/renderer.h" +#include "document/renderer.h" #include "intl/gettext/libintl.h" #include "main/select.h" #include "main/timer.h" diff --git a/src/session/session.c b/src/session/session.c index cdb44aa14..709809639 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -18,8 +18,8 @@ #include "config/options.h" #include "dialogs/menu.h" #include "dialogs/status.h" +#include "document/document.h" #include "document/html/frames.h" -#include "document/html/renderer.h" #include "document/refresh.h" #include "document/view.h" #include "globhist/globhist.h" diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index f93fe2812..ffc3819e5 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -16,7 +16,6 @@ #include "dialogs/status.h" #include "document/document.h" #include "document/forms.h" -#include "document/html/renderer.h" #include "document/options.h" #include "document/view.h" #include "ecmascript/ecmascript.h" diff --git a/src/viewer/text/textarea.c b/src/viewer/text/textarea.c index b7a2cba47..f72bb25cf 100644 --- a/src/viewer/text/textarea.c +++ b/src/viewer/text/textarea.c @@ -21,7 +21,6 @@ #include "bfu/dialog.h" #include "document/document.h" #include "document/forms.h" -#include "document/html/renderer.h" #include "document/view.h" #include "intl/gettext/libintl.h" #include "session/session.h"