[project @ 2003-10-17 23:47:13 by jmb]
Add text-decoration support. Overline needs work. a:link defaults to being underlined. svn path=/import/netsurf/; revision=368
This commit is contained in:
parent
13d6923b5e
commit
c97107af5c
|
@ -39,7 +39,7 @@ RMEnsure MimeMap 0.10 Error NetSurf requires MimeMap 0.10 or later
|
|||
|
||||
| drag the 'next' slot in the task manager to something huge and ridiculous,
|
||||
| and/or increase the number below
|
||||
Wimpslot -min 2000k
|
||||
Wimpslot -min 2750k -max 2750k
|
||||
|
||||
Set NetSurf$running "yes"
|
||||
<NetSurf$Dir>.!RunImage 2><NetSurf$Dir>.stderr
|
||||
|
|
|
@ -27,7 +27,7 @@ h5 { font-size: medium; font-style: italic; }
|
|||
h6 { font-size: medium; font-style: italic; }
|
||||
b, strong { font-weight: bold; }
|
||||
i, em { font-style: italic; }
|
||||
a:link { color: #00f; }
|
||||
a:link { color: #00f; text-decoration: line-through; }
|
||||
th { font-weight: bold; }
|
||||
td { text-align: left; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$Id: TODO-CSS,v 1.3 2003/10/09 15:46:30 bursa Exp $
|
||||
$Id: TODO-CSS,v 1.4 2003/10/17 23:47:13 jmb Exp $
|
||||
|
||||
TODO-CSS file for NetSurf.
|
||||
|
||||
|
@ -77,14 +77,14 @@ See TODO-HTML for HTML related TODOs.
|
|||
- size
|
||||
- table-layout
|
||||
+ text-align
|
||||
- text-decoration
|
||||
= text-decoration (not blink. overline needs positioning right)
|
||||
- text-indent
|
||||
- text-shadow
|
||||
- text-transform
|
||||
- top
|
||||
- unicode-bidi
|
||||
- vertical-align
|
||||
- visibility
|
||||
= visibility (not collapse)
|
||||
= white-space
|
||||
- widows
|
||||
+ width
|
||||
|
|
|
@ -47,6 +47,7 @@ const struct css_style css_base_style = {
|
|||
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_ABSOLUTE, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_LEFT,
|
||||
CSS_TEXT_DECORATION_NONE,
|
||||
CSS_VISIBILITY_VISIBLE,
|
||||
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_NORMAL
|
||||
|
@ -64,6 +65,7 @@ const struct css_style css_empty_style = {
|
|||
{ CSS_HEIGHT_INHERIT, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_INHERIT,
|
||||
CSS_TEXT_DECORATION_INHERIT,
|
||||
CSS_VISIBILITY_INHERIT,
|
||||
{ CSS_WIDTH_INHERIT, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_INHERIT
|
||||
|
@ -81,6 +83,7 @@ const struct css_style css_blank_style = {
|
|||
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_INHERIT,
|
||||
CSS_TEXT_DECORATION_NONE,
|
||||
CSS_VISIBILITY_INHERIT,
|
||||
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_INHERIT
|
||||
|
@ -709,6 +712,8 @@ void css_cascade(struct css_style * const style, const struct css_style * const
|
|||
style->line_height = apply->line_height;
|
||||
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
|
||||
style->text_align = apply->text_align;
|
||||
if (apply->text_decoration != CSS_TEXT_DECORATION_INHERIT)
|
||||
style->text_decoration = apply->text_decoration;
|
||||
if (apply->visibility != CSS_VISIBILITY_INHERIT)
|
||||
style->visibility = apply->visibility;
|
||||
if (apply->width.width != CSS_WIDTH_INHERIT)
|
||||
|
@ -780,6 +785,8 @@ void css_merge(struct css_style * const style, const struct css_style * const ap
|
|||
style->line_height = apply->line_height;
|
||||
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
|
||||
style->text_align = apply->text_align;
|
||||
if (apply->text_decoration != CSS_TEXT_DECORATION_INHERIT)
|
||||
style->text_decoration = apply->text_decoration;
|
||||
if (apply->visibility != CSS_VISIBILITY_INHERIT)
|
||||
style->visibility = apply->visibility;
|
||||
if (apply->width.width != CSS_WIDTH_INHERIT)
|
||||
|
|
|
@ -68,6 +68,7 @@ struct css_style {
|
|||
} line_height;
|
||||
|
||||
css_text_align text_align;
|
||||
css_text_decoration text_decoration;
|
||||
|
||||
css_visibility visibility;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ css_list_style_position outside inside
|
|||
css_list_style_type disc circle square decimal lower_alpha lower_roman upper_alpha upper_roman none
|
||||
css_margin auto length percent
|
||||
css_text_align inherit left right center justify
|
||||
css_text_decoration none blink line_through overline underline
|
||||
css_text_decoration none blink line-through overline underline inherit
|
||||
css_text_transform none capitalize lowercase uppercase
|
||||
css_vertical_align baseline bottom middle sub super text_bottom text_top top percent
|
||||
css_visibility inherit visible hidden
|
||||
|
|
|
@ -50,6 +50,7 @@ static void parse_font_weight(struct css_style * const s, const struct css_node
|
|||
static void parse_height(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_line_height(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_text_align(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_text_decoration(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_visibility(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_width(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_white_space(struct css_style * const s, const struct css_node * const v);
|
||||
|
@ -70,6 +71,7 @@ static const struct property_entry property_table[] = {
|
|||
{ "height", parse_height },
|
||||
{ "line-height", parse_line_height },
|
||||
{ "text-align", parse_text_align },
|
||||
{ "text-decoration", parse_text_decoration },
|
||||
{ "visibility", parse_visibility },
|
||||
{ "white-space", parse_white_space },
|
||||
{ "width", parse_width },
|
||||
|
@ -518,6 +520,16 @@ void parse_text_align(struct css_style * const s, const struct css_node * const
|
|||
s->text_align = z;
|
||||
}
|
||||
|
||||
void parse_text_decoration(struct css_style * const s, const struct css_node * const v)
|
||||
{
|
||||
css_text_decoration z;
|
||||
if (v->type != CSS_NODE_IDENT || v->next != 0)
|
||||
return;
|
||||
z = css_text_decoration_parse(v->data);
|
||||
if (z != CSS_TEXT_DECORATION_UNKNOWN)
|
||||
s->text_decoration = z;
|
||||
}
|
||||
|
||||
void parse_visibility(struct css_style * const s, const struct css_node * const v)
|
||||
{
|
||||
css_visibility z;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "netsurf/render/html.h"
|
||||
#include "netsurf/riscos/gui.h"
|
||||
#include "netsurf/utils/log.h"
|
||||
#include "netsurf/utils/utils.h"
|
||||
|
||||
|
||||
static void html_redraw_box(struct content *content, struct box * box,
|
||||
|
@ -282,12 +283,52 @@ void html_redraw_box(struct content *content, struct box * box,
|
|||
|
||||
colourtrans_set_font_colours(box->font->handle, current_background_color << 8,
|
||||
box->style->color << 8, 14, 0, 0, 0);
|
||||
|
||||
font_paint(box->font->handle, box->text,
|
||||
if (box->style->text_decoration == CSS_TEXT_DECORATION_NONE) {
|
||||
font_paint(box->font->handle, box->text,
|
||||
font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH,
|
||||
x, y - (int) (box->height * 1.5),
|
||||
NULL, NULL, (int) box->length);
|
||||
|
||||
}
|
||||
else if (box->style->text_decoration == CSS_TEXT_DECORATION_UNDERLINE) {
|
||||
char ulctrl[3];
|
||||
char *temp = xcalloc(strlen(box->text)+4,
|
||||
sizeof(char));
|
||||
sprintf(ulctrl, "%c%c%c", (char)25, (char)230,
|
||||
(char)10);
|
||||
sprintf(temp, "%s%s", ulctrl, box->text);
|
||||
font_paint(box->font->handle, temp,
|
||||
font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH,
|
||||
x, y - (int) (box->height * 1.5),
|
||||
NULL, NULL, (int) box->length + 4);
|
||||
xfree(temp);
|
||||
}
|
||||
else if (box->style->text_decoration == CSS_TEXT_DECORATION_LINE_THROUGH){
|
||||
char ulctrl[3];
|
||||
char *temp = xcalloc(strlen(box->text)+4,
|
||||
sizeof(char));
|
||||
sprintf(ulctrl, "%c%c%c", (char)25, (char)95,
|
||||
(char)10);
|
||||
sprintf(temp, "%s%s", ulctrl, box->text);
|
||||
font_paint(box->font->handle, temp,
|
||||
font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH,
|
||||
x, y - (int) (box->height * 1.5),
|
||||
NULL, NULL, (int) box->length + 4);
|
||||
xfree(temp);
|
||||
LOG(("line-through"));
|
||||
}
|
||||
else {
|
||||
char ulctrl[3];
|
||||
char *temp = xcalloc(strlen(box->text)+4,
|
||||
sizeof(char));
|
||||
sprintf(ulctrl, "%c%c%c", (char)25, (char)127,
|
||||
(char)10);
|
||||
sprintf(temp, "%s%s", ulctrl, box->text);
|
||||
font_paint(box->font->handle, temp,
|
||||
font_OS_UNITS | font_GIVEN_FONT | font_KERN | font_GIVEN_LENGTH,
|
||||
x, y - (int) (box->height * 1.5),
|
||||
NULL, NULL, (int) box->length + 4);
|
||||
xfree(temp);
|
||||
}
|
||||
} else {
|
||||
for (c = box->children; c != 0; c = c->next)
|
||||
if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
|
||||
|
|
Loading…
Reference in New Issue