changeset 1743:ebbf47417126

merge
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sun, 17 Oct 2010 14:20:16 +0200
parents 6ff5d5aeb9a5 (current diff) b0cb317b40e0 (diff)
children 49340e0f3414
files src/html.cc src/styleengine.cc src/web.cc
diffstat 4 files changed, 26 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/dw/types.cc	Thu Oct 14 09:04:52 2010 +0200
+++ b/dw/types.cc	Sun Oct 17 14:20:16 2010 +0200
@@ -177,9 +177,10 @@
    /** TODO Some more description */
    // If the scalar product is 0, it means that one point is on the second
    // line, so we check for <= 0, not < 0.
-   return
-      zOfVectorProduct (ax1 - bx1, ay1 - by1, bx2 - bx1, by2 - by1) *
-      zOfVectorProduct (ax2 - bx1, ay2 - by1, bx2 - bx1, by2 - by1) <= 0;
+   int z1 = zOfVectorProduct (ax1 - bx1, ay1 - by1, bx2 - bx1, by2 - by1);
+   int z2 = zOfVectorProduct (ax2 - bx1, ay2 - by1, bx2 - bx1, by2 - by1);
+
+   return (z1 <= 0 && z2 >= 0) || (z1 >= 0 && z2 <= 0); 
 }
 
 /**
--- a/src/html.cc	Thu Oct 14 09:04:52 2010 +0200
+++ b/src/html.cc	Sun Oct 17 14:20:16 2010 +0200
@@ -1178,13 +1178,13 @@
       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 &nbsp;) */
          Pword = a_Html_parse_entities(html, word, size);
@@ -1199,7 +1199,7 @@
             }
          }
          word2 = Pword;
-         word2_end = word2 + strlen(word2) - 1;
+         beyond_word2 = word2 + strlen(word2);
       }
       for (start = i = 0; word2[i]; start = i) {
          int len;
@@ -1209,7 +1209,7 @@
             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 ());
@@ -1218,7 +1218,7 @@
                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 ());
          }
@@ -2333,10 +2333,6 @@
             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);
       }
--- a/src/styleengine.cc	Thu Oct 14 09:04:52 2010 +0200
+++ b/src/styleengine.cc	Sun Oct 17 14:20:16 2010 +0200
@@ -240,14 +240,19 @@
       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;
 }
 
@@ -478,9 +483,8 @@
                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);
                }
             }
--- a/src/web.cc	Thu Oct 14 09:04:52 2010 +0200
+++ b/src/web.cc	Sun Oct 17 14:20:16 2010 +0200
@@ -92,12 +92,12 @@
 
    } 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);
 }