summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-03-25 21:51:29 +0000
committerJames Bursa <james@netsurf-browser.org>2003-03-25 21:51:29 +0000
commit5d371fb47e0b1b1e43574cf674893b890067b9b6 (patch)
treeb0c79f42cbf1cc1b88b1923378b1147d6041b135 /render
parent6e0fdd2078c11ceec667de9b115408bb7688caa4 (diff)
downloadnetsurf-5d371fb47e0b1b1e43574cf674893b890067b9b6.tar.gz
netsurf-5d371fb47e0b1b1e43574cf674893b890067b9b6.tar.bz2
[project @ 2003-03-25 21:51:29 by bursa]
Show alt text for images. svn path=/import/netsurf/; revision=109
Diffstat (limited to 'render')
-rw-r--r--render/box.c23
-rw-r--r--render/html.c6
-rw-r--r--render/layout.c5
3 files changed, 22 insertions, 12 deletions
diff --git a/render/box.c b/render/box.c
index 96b0931d7..3fbbbb5aa 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1,5 +1,5 @@
/**
- * $Id: box.c,v 1.34 2003/03/04 11:59:35 bursa Exp $
+ * $Id: box.c,v 1.35 2003/03/25 21:51:29 bursa Exp $
*/
#include <assert.h>
@@ -13,6 +13,7 @@
#include "netsurf/riscos/font.h"
#include "netsurf/render/box.h"
#include "netsurf/utils/utils.h"
+#define NDEBUG
#include "netsurf/utils/log.h"
#include "netsurf/desktop/gui.h"
@@ -206,8 +207,15 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
} else if (strcmp((const char *) n->name, "img") == 0) {
LOG(("image"));
- box = box_image(n, style, href);
- add_img_element(elements, box->img);
+ /*box = box_image(n, style, href);
+ add_img_element(elements, box->img);*/
+ if (style->display == CSS_DISPLAY_INLINE) {
+ if ((s = (char *) xmlGetProp(n, (const xmlChar *) "alt"))) {
+ text = squash_whitespace(tolat1(s));
+ xfree(s);
+ }
+ }
+ /* TODO: block images, start fetch */
} else if (strcmp((const char *) n->name, "textarea") == 0) {
char * content = xmlNodeGetContent(n);
@@ -247,6 +255,9 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
} else if (n->type == XML_TEXT_NODE) {
text = squash_whitespace(tolat1(n->content));
+ }
+
+ if (text != 0) {
if (text[0] == ' ' && text[1] == 0) {
if (inline_container != 0) {
assert(inline_container->last != 0);
@@ -257,7 +268,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
}
}
- if (n->type == XML_TEXT_NODE ||
+ if (text != 0 ||
(box != 0 && style->display == CSS_DISPLAY_INLINE) ||
(n->type == XML_ELEMENT_NODE && (style->float_ == CSS_FLOAT_LEFT ||
style->float_ == CSS_FLOAT_RIGHT))) {
@@ -269,7 +280,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
box_add_child(parent, inline_container);
}
- if (n->type == XML_TEXT_NODE) {
+ if (text != 0) {
LOG(("text node"));
box = box_create(n, BOX_INLINE, parent_style, href);
box_add_child(inline_container, box);
@@ -305,7 +316,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
}
}
- if (n->type == XML_ELEMENT_NODE) {
+ if (n->type == XML_ELEMENT_NODE && text == 0) {
switch (style->display) {
case CSS_DISPLAY_BLOCK: /* blocks get a node in the box tree */
if (box == 0)
diff --git a/render/html.c b/render/html.c
index b41ca6ed2..39f1e5aa2 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1,5 +1,5 @@
/**
- * $Id: html.c,v 1.5 2003/03/04 11:59:35 bursa Exp $
+ * $Id: html.c,v 1.6 2003/03/25 21:51:29 bursa Exp $
*/
#include <assert.h>
@@ -92,11 +92,11 @@ int html_convert(struct content *c, unsigned int width, unsigned int height)
xml_to_box(c->data.html.markup, c->data.html.style, c->data.html.stylesheet,
&selector, 0, c->data.html.layout, 0, 0, c->data.html.fonts,
0, 0, 0, 0, &c->data.html.elements);
- box_dump(c->data.html.layout->children, 0);
+ /*box_dump(c->data.html.layout->children, 0);*/
LOG(("Layout document"));
layout_document(c->data.html.layout->children, width);
- box_dump(c->data.html.layout->children, 0);
+ /*box_dump(c->data.html.layout->children, 0);*/
c->width = c->data.html.layout->children->width;
c->height = c->data.html.layout->children->height;
diff --git a/render/layout.c b/render/layout.c
index 25f27844d..677329406 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -1,5 +1,5 @@
/**
- * $Id: layout.c,v 1.35 2003/03/08 21:25:56 bursa Exp $
+ * $Id: layout.c,v 1.36 2003/03/25 21:51:29 bursa Exp $
*/
#include <assert.h>
@@ -14,10 +14,9 @@
#include "netsurf/render/layout.h"
#include "netsurf/riscos/font.h"
#include "netsurf/utils/utils.h"
+#define NDEBUG
#include "netsurf/utils/log.h"
-#define DEBUG_LAYOUT
-
/**
* internal functions
*/