From 19db672bfd0ba98bd2015d5c09d843f43668303d Mon Sep 17 00:00:00 2001 From: corvid Date: Thu, 14 Oct 2010 02:47:46 +0000 Subject: fix use of a_Utf8_ideographic() --- src/html.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/html.cc b/src/html.cc index d728713e..fe049e39 100644 --- a/src/html.cc +++ b/src/html.cc @@ -1183,13 +1183,13 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) dFree(Pword); } else { - const char *word2, *word2_end; + const char *word2, *beyond_word2; Pword = NULL; if (!memchr(word,'&', size)) { /* No entities */ word2 = word; - word2_end = word + size - 1; + beyond_word2 = word + size; } else { /* Collapse white-space entities inside the word (except  ) */ Pword = a_Html_parse_entities(html, word, size); @@ -1204,7 +1204,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) } } word2 = Pword; - word2_end = word2 + strlen(word2) - 1; + beyond_word2 = word2 + strlen(word2); } for (start = i = 0; word2[i]; start = i) { int len; @@ -1214,7 +1214,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) Html_process_space(html, word2 + start, i - start); } else if (!strncmp(word2+i, utf8_zero_width_space, 3)) { i += 3; - } else if (a_Utf8_ideographic(word2+i, word2_end, &len)) { + } else if (a_Utf8_ideographic(word2+i, beyond_word2, &len)) { i += len; HT2TB(html)->addText(word2 + start, i - start, html->styleEngine->wordStyle ()); @@ -1223,7 +1223,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size) i += len; } while (word2[i] && !isspace(word2[i]) && strncmp(word2+i, utf8_zero_width_space, 3) && - (!a_Utf8_ideographic(word2+i, word2_end, &len))); + (!a_Utf8_ideographic(word2+i, beyond_word2, &len))); HT2TB(html)->addText(word2 + start, i - start, html->styleEngine->wordStyle ()); } -- cgit v1.2.3 From 573d04aecfd5eb4869f9cb02c2f87ddf1fd44d21 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 14 Oct 2010 09:55:28 +0200 Subject: set border-width to 0 if border-style is 'hidden' --- src/styleengine.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/styleengine.cc b/src/styleengine.cc index c7820760..67212fb7 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -208,14 +208,19 @@ void StyleEngine::postprocessAttrs (dw::core::style::StyleAttrs *attrs) { attrs->borderColor.left = attrs->color; if (attrs->borderColor.right == NULL) attrs->borderColor.right = attrs->color; - /* computed value of border-width is 0 if border-style is 'none' */ - if (attrs->borderStyle.top == BORDER_NONE) + /* computed value of border-width is 0 if border-style + is 'none' or 'hidden' */ + if (attrs->borderStyle.top == BORDER_NONE || + attrs->borderStyle.top == BORDER_HIDDEN) attrs->borderWidth.top = 0; - if (attrs->borderStyle.bottom == BORDER_NONE) + if (attrs->borderStyle.bottom == BORDER_NONE || + attrs->borderStyle.bottom == BORDER_HIDDEN) attrs->borderWidth.bottom = 0; - if (attrs->borderStyle.left == BORDER_NONE) + if (attrs->borderStyle.left == BORDER_NONE || + attrs->borderStyle.left == BORDER_HIDDEN) attrs->borderWidth.left = 0; - if (attrs->borderStyle.right == BORDER_NONE) + if (attrs->borderStyle.right == BORDER_NONE || + attrs->borderStyle.right == BORDER_HIDDEN) attrs->borderWidth.right = 0; } -- cgit v1.2.3 From b52e67fd0ddec3263a73edf04fa7aeb616120435 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 15 Oct 2010 11:37:44 +0200 Subject: don't try to set lineHeight if illegal value 'auto' is specified Testcase:
foo
foo
foo
This only fixes the use of uninitialzed values in this case. The real fix will be to drop the invalid declaration in the CSS parser. This needs to be implemented with a later commit. Reported-by: Jeremy Henty --- src/styleengine.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/styleengine.cc b/src/styleengine.cc index 67212fb7..e078542c 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -451,9 +451,8 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { if (CSS_LENGTH_TYPE (p->value.intVal) == CSS_LENGTH_TYPE_NONE) { attrs->lineHeight = createPerLength(CSS_LENGTH_VALUE(p->value.intVal)); - } else { - computeValue (&lineHeight, p->value.intVal, attrs->font, - attrs->font->size); + } else if (computeValue (&lineHeight, p->value.intVal, + attrs->font, attrs->font->size)) { attrs->lineHeight = createAbsLength(lineHeight); } } -- cgit v1.2.3 From 21d55d46536fcd702a5ae742554e8d353ba64cf9 Mon Sep 17 00:00:00 2001 From: corvid Date: Fri, 15 Oct 2010 19:33:01 +0000 Subject: clearer msg when can't display something as image --- src/web.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/web.cc b/src/web.cc index 17302b1c..74435ad6 100644 --- a/src/web.cc +++ b/src/web.cc @@ -89,12 +89,12 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web, } else { /* A non-RootUrl. At this moment we only handle image-children */ - if (!dStrncasecmp(Type, "image/", 6)) + if (!dStrncasecmp(Type, "image/", 6)) { dw = (Widget*) a_Mime_set_viewer(Type, Web, Call, Data); - } - - if (!dw) { - MSG_HTTP("unhandled MIME type: \"%s\"\n", Type); + } else { + MSG_HTTP("'%s' cannot be displayed as image; has media type '%s'\n", + URL_STR(Web->url), Type); + } } return (dw ? 1 : -1); } -- cgit v1.2.3 From dfed92dee228ad426baeb89dd8896ce4db80278a Mon Sep 17 00:00:00 2001 From: corvid Date: Fri, 15 Oct 2010 20:58:04 +0000 Subject: needn't add extra closing point to image map polygons noticed by Johannes. --- src/html.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/html.cc b/src/html.cc index fe049e39..278868a5 100644 --- a/src/html.cc +++ b/src/html.cc @@ -2345,10 +2345,6 @@ static void Html_tag_open_area(DilloHtml *html, const char *tag, int tagsize) shape = poly = new Polygon(); for (i = 0; i < (coords->size() / 2); i++) poly->addPoint(coords->get(2*i), coords->get(2*i + 1)); - if (i) { - /* be sure to close it */ - poly->addPoint(coords->get(0), coords->get(1)); - } } delete(coords); } -- cgit v1.2.3