[project @ 2003-03-25 21:51:29 by bursa]

Show alt text for images.

svn path=/import/netsurf/; revision=109
This commit is contained in:
James Bursa 2003-03-25 21:51:29 +00:00
parent 6e0fdd2078
commit 5d371fb47e
4 changed files with 27 additions and 17 deletions

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/**
* $Id: gui.c,v 1.22 2003/03/15 15:53:20 bursa Exp $
* $Id: gui.c,v 1.23 2003/03/25 21:51:29 bursa Exp $
*/
#include "netsurf/riscos/font.h"
@ -1525,15 +1525,15 @@ void ro_gui_window_click(gui_window* g, wimp_pointer* pointer)
if (pointer->buttons == wimp_CLICK_MENU)
{
/* check for mouse gestures */
mouseaction ma = ro_gui_try_mouse_action();
/* mouseaction ma = ro_gui_try_mouse_action();
if (ma == mouseaction_NONE)
{
{*/
os_t now;
int z;
os_mouse(&x, &y, &z, &now);
ro_gui_create_menu((wimp_menu*) &browser_menu, x - 64, y, g);
}
/* }
else
{
fprintf(stderr, "MOUSE GESTURE %d\n", ma);
@ -1551,7 +1551,7 @@ void ro_gui_window_click(gui_window* g, wimp_pointer* pointer)
browser_window_open_location_historical(g->data.browser.bw, g->data.browser.bw->url);
break;
}
}
}*/
}
else if (g->data.browser.bw->current_content != NULL)
{