changeset 274:1deca4cad4c4

- Implemented OBJECT as link (similar to FRAME).
author jcid
date Tue, 10 Jun 2008 15:13:03 +0200
parents 09c0f943fac1
children 9c08c5255dd0
files ChangeLog src/html.cc src/misc.c
diffstat 3 files changed, 52 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 10 01:02:25 2008 +0200
+++ b/ChangeLog	Tue Jun 10 15:13:03 2008 +0200
@@ -106,6 +106,7 @@
  - Fixed a segfault bug in Nav.c.
  - Switched from charset to content-type for handling data.
  - Moved charset decoding into cache.
+ - Implemented OBJECT as link (similar to FRAME).
    Patches: place (AKA corvid)
 +- Fixed a problem with locally-installed dpis.
  - Added code for optional image loading (nice interface) very advanced!
--- a/src/html.cc	Tue Jun 10 01:02:25 2008 +0200
+++ b/src/html.cc	Tue Jun 10 15:13:03 2008 +0200
@@ -2653,6 +2653,55 @@
 }
 
 /*
+ * <OBJECT>
+ * Simply provide a link if the object is something downloadable.
+ */
+static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize)
+{
+   StyleAttrs style_attrs;
+   Style *style;
+   DilloUrl *url, *base_url = NULL;
+   const char *attrbuf;
+
+   if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "codebase"))) {
+      base_url = a_Html_url_new(html, attrbuf, NULL, 0, 0, 0, 0);
+   }
+   
+   if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "data"))) {
+      url = a_Html_url_new(html, attrbuf, URL_STR(base_url), 0, 0, 0,
+                           (base_url != NULL));
+      dReturn_if_fail ( url != NULL );
+
+      style_attrs = *S_TOP(html)->style;
+
+      if (a_Capi_get_flags(url) & CAPI_IsCached) {
+         style_attrs.color = Color::createSimple (
+            HT2LT(html),
+            html->visited_color
+/*
+            a_Color_vc(html->visited_color,
+                       S_TOP(html)->style->color->getColor(),
+                       html->link_color,
+                       S_TOP(html)->style->backgroundColor->getColor()),
+*/
+            );
+      } else {
+         style_attrs.color = Color::createSimple(HT2LT(html),
+                                                 html->link_color);
+      }
+
+      style_attrs.textDecoration |= TEXT_DECORATION_UNDERLINE;
+      style_attrs.x_link = Html_set_new_link(html, &url);
+      style_attrs.cursor = CURSOR_POINTER;
+
+      style = Style::create (HT2LT(html), &style_attrs);
+      DW2TB(html->dw)->addText(dStrdup("[OBJECT]"), style);
+      style->unref ();
+   }
+   a_Url_free(base_url);
+}
+
+/*
  * Test and extract the link from a javascript instruction.
  */
 static const char* Html_get_javascript_link(DilloHtml *html)
@@ -3430,7 +3479,7 @@
  {"meta", B8(100001),'F',0, Html_tag_open_meta, Html_tag_close_default},
  /* noframes 1011 */
  /* noscript 1011 */
- /* object 11xxxx */
+ {"object", B8(111101),'R',2, Html_tag_open_object, Html_tag_close_default},
  {"ol", B8(011010),'R',2, Html_tag_open_ol, Html_tag_close_par},
  /* optgroup */
  {"option", B8(010001),'O',1, Html_tag_open_option, Html_tag_close_default},
--- a/src/misc.c	Tue Jun 10 01:02:25 2008 +0200
+++ b/src/misc.c	Tue Jun 10 15:13:03 2008 +0200
@@ -285,7 +285,7 @@
    int i;
    int st = -1;
 
-   MSG("Type check:  [Srv: %s  Det: %s]\n", EntryType, DetectedType);
+   _MSG("Type check:  [Srv: %s  Det: %s]\n", EntryType, DetectedType);
 
    if (!EntryType)
       return 0; /* there's no mismatch without server type */