summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-02-01 04:45:55 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-02-01 04:45:55 +0000
commit9d342dad8010b622db27c3f7804076ec5cf03068 (patch)
tree6da41bdd3973bf6bdff94a9fce585b725f30a7d1 /render/box.c
parent99d4fb35295e4076124d2d223b6549c1098a8e46 (diff)
downloadnetsurf-9d342dad8010b622db27c3f7804076ec5cf03068.tar.gz
netsurf-9d342dad8010b622db27c3f7804076ec5cf03068.tar.bz2
[project @ 2004-02-01 04:45:55 by jmb]
Fix text-transform capitalization on inline elements. svn path=/import/netsurf/; revision=526
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/render/box.c b/render/box.c
index 4a9bdb9fc..d50b897cd 100644
--- a/render/box.c
+++ b/render/box.c
@@ -404,8 +404,13 @@ struct box * convert_xml_to_box(xmlNode * n, struct content *content,
break;
case CSS_TEXT_TRANSFORM_CAPITALIZE:
for (ch=0; ch!=box->length; ch++) {
- if (ch == 0) {
- box->text[ch] = toupper(box->text[ch]);
+ if (ch == 0) { /* first char in box */
+ if (inline_container && (inline_container->last->text && inline_container->last->space)) { /* end of previous box */
+ box->text[ch] = toupper(box->text[ch]);
+ }
+ else if (inline_container && (inline_container->last->prev && inline_container->last->prev->text && inline_container->last->prev->space)) { /* end of box before previous box */
+ box->text[ch] = toupper(box->text[ch]);
+ }
}
else if (!((box->text[ch-1] > 64 && box->text[ch-1] < 91) ||
(box->text[ch-1] > 96 && box->text[ch-1] < 123))) {
@@ -475,9 +480,13 @@ struct box * convert_xml_to_box(xmlNode * n, struct content *content,
break;
case CSS_TEXT_TRANSFORM_CAPITALIZE:
for (ch=0; ch!=box->length; ch++) {
- if (ch == 0) {
- box->text[ch] =
- toupper(box->text[ch]);
+ if (ch == 0) { /* first char in box */
+ if (inline_container && (inline_container->last->text && inline_container->last->space)) { /* end of previous box */
+ box->text[ch] = toupper(box->text[ch]);
+ }
+ else if (inline_container && (inline_container->last->prev && inline_container->last->prev->text && inline_container->last->prev->space)) { /* end of box before previous box */
+ box->text[ch] = toupper(box->text[ch]);
+ }
}
else if (!((box->text[ch-1] > 64 && box->text[ch-1] < 91) ||
(box->text[ch-1] > 96 && box->text[ch-1] < 123))) {
@@ -1268,6 +1277,8 @@ void box_dump(struct box * box, unsigned int depth)
}
if (box->text)
fprintf(stderr, "'%.*s' ", (int) box->length, box->text);
+ if (box->space)
+ fprintf(stderr, "space ");
if (box->object)
fprintf(stderr, "(object '%s') ", box->object->url);
if (box->style)