r7364 struggleyb - in /branches/struggleyb/domts-transform-perl/testutils: comparators.c comparators.h domts.h domtsasserts.h foreach.c foreach.h list.c list.h
by netsurf@semichrome.net
Author: struggleyb
Date: Wed Apr 29 06:54:01 2009
New Revision: 7364
URL: http://source.netsurf-browser.org?rev=7364&view=rev
Log:
Copy the list/comparators from origin code and add stub for foreach.h, which is used for the <for-each> element code generation in the XML testcase.
Added:
branches/struggleyb/domts-transform-perl/testutils/comparators.c
branches/struggleyb/domts-transform-perl/testutils/comparators.h
branches/struggleyb/domts-transform-perl/testutils/foreach.c
branches/struggleyb/domts-transform-perl/testutils/foreach.h
branches/struggleyb/domts-transform-perl/testutils/list.c
branches/struggleyb/domts-transform-perl/testutils/list.h
Modified:
branches/struggleyb/domts-transform-perl/testutils/domts.h
branches/struggleyb/domts-transform-perl/testutils/domtsasserts.h
Added: branches/struggleyb/domts-transform-perl/testutils/comparators.c
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/comparators.c (added)
+++ branches/struggleyb/domts-transform-perl/testutils/comparators.c Wed Apr 29 06:54:01 2009
@@ -1,0 +1,5 @@
+#include "comparators.h"
+
+int int_comparator(const int* a, const int* b) {
+ return (*a) - (*b);
+}
Added: branches/struggleyb/domts-transform-perl/testutils/comparators.h
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/comparators.h (added)
+++ branches/struggleyb/domts-transform-perl/testutils/comparators.h Wed Apr 29 06:54:01 2009
@@ -1,0 +1,18 @@
+/*
+ * This file is part of libdom test suite.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 James Shaw <jshaw(a)netsurf-browser.org>
+ */
+
+#ifndef comparators_h_
+#define comparators_h_
+
+/**
+ * A function pointer type for a comparator.
+ */
+typedef int (*comparator)(const void* a, const void* b);
+
+int int_comparator(const int* a, const int* b);
+
+#endif
Modified: branches/struggleyb/domts-transform-perl/testutils/domts.h
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/domts.h (original)
+++ branches/struggleyb/domts-transform-perl/testutils/domts.h Wed Apr 29 06:54:01 2009
@@ -3,6 +3,8 @@
#include <domtscondition.h>
#include <domtsasserts.h>
+#include <list.h>
+#include <foreach.h>
#include <utils.h>
dom_document *load(char *file, bool willBeModified);
Modified: branches/struggleyb/domts-transform-perl/testutils/domtsasserts.h
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/domtsasserts.h (original)
+++ branches/struggleyb/domts-transform-perl/testutils/domtsasserts.h Wed Apr 29 06:54:01 2009
@@ -1,5 +1,7 @@
#ifndef domtsasserts_h_
#define domtsasserts_h_
+
+#include <list.h>
/* Redefine assert, so we can simply use the standard assert mechanism
* within testcases and exit with the right output for the testrunner
@@ -22,11 +24,13 @@
bool is_equals_unsigned_long(unsigned long excepted, unsigned long actual, bool dummy);
bool is_equals_domstring(const char *excepted, dom_string *actual,
bool ignoreCase);
+bool is_equals_list(list *expected, list *actual, bool ignoreCase);
bool is_instanceof(const char *type, dom_node *node);
bool is_size_domnamednodemap(int size, dom_namednodemap *map);
bool is_size_domnodelist(int size, dom_nodelist *list);
+bool is_size_list(int size, list *list);
bool is_uri_equals(char *scheme, char *path, char *host,
char *file, char *query, char *fragment,
Added: branches/struggleyb/domts-transform-perl/testutils/foreach.c
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/foreach.c (added)
+++ branches/struggleyb/domts-transform-perl/testutils/foreach.c Wed Apr 29 06:54:01 2009
@@ -1,0 +1,31 @@
+#include "foreach.h"
+
+/* Generally, we use static variables to implement these iterator. */
+static int index_domnodelist = 0;
+static int index_list = 0;
+static int index_domnamednodemap = 0;
+
+void foreach_initialise_domnodelist(dom_nodelist *list)
+{
+}
+
+void foreach_initialise_list(list *list)
+{
+}
+
+void foreach_initialise_domnamednodemap(dom_namednodemap *map)
+{
+}
+
+
+bool get_next_domnodelist(dom_nodelist *list, dom_node **ret)
+{
+}
+
+bool get_next_list(list *list, void **ret)
+{
+}
+
+bool get_next_domnamednodemap(dom_namednodemap *map, dom_node **ret)
+{
+}
Added: branches/struggleyb/domts-transform-perl/testutils/foreach.h
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/foreach.h (added)
+++ branches/struggleyb/domts-transform-perl/testutils/foreach.h Wed Apr 29 06:54:01 2009
@@ -1,0 +1,24 @@
+#ifndef domts_foreach_h_
+#define domts_foreach_h_
+
+#include <dom/dom.h>
+
+/* The following six functions are used for the XML testcase's
+ <for-each> element.
+ And the <for-each> element can be converted to :
+
+ foreach_initialise_*(list);
+ while(get_next_*(list, ret)){
+ do the loop work.
+ }
+*/
+
+void foreach_initialise_domnodelist(dom_nodelist *list);
+void foreach_initialise_list(list *list);
+void foreach_initialise_domnamednodemap(dom_namednodemap *map);
+
+bool get_next_domnodelist(dom_nodelist *list, dom_node **ret);
+bool get_next_list(list *list, void **ret);
+bool get_next_domnamednodemap(dom_namednodemap *map, dom_node **ret);
+
+#endif
Added: branches/struggleyb/domts-transform-perl/testutils/list.c
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/list.c (added)
+++ branches/struggleyb/domts-transform-perl/testutils/list.c Wed Apr 29 06:54:01 2009
@@ -1,0 +1,154 @@
+/*
+ * This file is part of libdom test suite.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 James Shaw <jshaw(a)netsurf-browser.org>
+ */
+
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "comparators.h"
+#include "list.h"
+#include "testassert.h"
+
+/**
+ * Private helper function.
+ * Create a new list_elt and initialise it.
+ */
+struct list_elt* list_new_elt(void* data);
+
+struct list_elt* list_new_elt(void* data) {
+ struct list_elt* elt = malloc(sizeof(struct list_elt));
+ assert(elt != NULL);
+ elt->data = data;
+ elt->next = NULL;
+ return elt;
+}
+
+struct list* list_new(void)
+{
+ struct list* list = malloc(sizeof(struct list));
+ assert(list != NULL);
+ list->size = 0;
+ list->head = NULL;
+ list->tail = NULL;
+ return list;
+}
+
+void list_destroy(struct list* list)
+{
+ struct list_elt* elt = list->head;
+ while (elt != NULL) {
+ struct list_elt* nextElt = elt->next;
+ free(elt);
+ elt = nextElt;
+ }
+ free(list);
+}
+
+void list_add(struct list* list, void* data)
+{
+ struct list_elt* elt = list_new_elt(data);
+ struct list_elt* tail = list->tail;
+
+ /* if tail was set, make its 'next' ptr point to elt */
+ if (tail != NULL) {
+ tail->next = elt;
+ }
+
+ /* make elt the new tail */
+ list->tail = elt;
+
+ if (list->head == NULL) {
+ list->head = elt;
+ }
+
+ /* inc the size of the list */
+ list->size++;
+}
+
+bool list_remove(struct list* list, void* data)
+{
+ struct list_elt* prevElt = NULL;
+ struct list_elt* elt = list->head;
+
+ bool found = false;
+
+ while (elt != NULL) {
+ struct list_elt* nextElt = elt->next;
+
+ /* if data is identical, fix up pointers, and free the element */
+ if (data == elt->data) {
+ if (prevElt == NULL) {
+ list->head = nextElt;
+ } else {
+ prevElt->next = nextElt;
+ }
+ free(elt);
+ list->size--;
+ found = true;
+ break;
+ }
+
+ prevElt = elt;
+ elt = nextElt;
+ }
+
+ return found;
+}
+
+struct list* list_clone(struct list* list)
+{
+ struct list* newList = list_new();
+ struct list_elt* elt = list->head;
+
+ while (elt != NULL) {
+ list_add(newList, elt->data);
+ elt = elt->next;
+ }
+
+ return newList;
+}
+
+bool list_contains(struct list* list, void* data, comparator comparator)
+{
+ struct list_elt* elt = list->head;
+ while (elt != NULL) {
+ if (comparator(elt->data, data) == 0) {
+ return true;
+ }
+ elt = elt->next;
+ }
+ return false;
+}
+
+bool list_contains_all(struct list* superList, struct list* subList,
+ comparator comparator)
+{
+ struct list_elt* subElt = subList->head;
+ struct list* superListClone = list_clone(superList);
+
+ bool found = true;
+
+ while (subElt != NULL) {
+ struct list_elt* superElt = superListClone->head;
+
+ found = false;
+ while (superElt != NULL && found == false) {
+ if (comparator(subElt->data, superElt->data) == 0) {
+ found = true;
+ list_remove(superListClone, superElt->data);
+ }
+ superElt = superElt->next;
+ }
+
+ subElt = subElt->next;
+ }
+ free(superListClone);
+
+ return found;
+}
+
Added: branches/struggleyb/domts-transform-perl/testutils/list.h
URL: http://source.netsurf-browser.org/branches/struggleyb/domts-transform-per...
==============================================================================
--- branches/struggleyb/domts-transform-perl/testutils/list.h (added)
+++ branches/struggleyb/domts-transform-perl/testutils/list.h Wed Apr 29 06:54:01 2009
@@ -1,0 +1,57 @@
+/*
+ * This file is part of libdom test suite.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 James Shaw <jshaw(a)netsurf-browser.org>
+ */
+
+#ifndef list_h_
+#define list_h_
+
+#include <stdbool.h>
+
+#include "comparators.h"
+
+struct list_elt {
+ void* data;
+ struct list_elt* next;
+};
+
+typedef struct list {
+ unsigned int size;
+ struct list_elt* head;
+ struct list_elt* tail;
+} list;
+
+struct list* list_new(void);
+void list_destroy(struct list* list);
+
+/**
+ * Add data to the tail of the list.
+ */
+void list_add(struct list* list, void* data);
+
+/**
+ * Remove element containing data from list.
+ * The list element is freed, but the caller must free the data itself
+ * if necessary.
+ *
+ * Returns true if data was found in the list.
+ */
+bool list_remove(struct list* list, void* data);
+
+struct list* list_clone(struct list* list);
+
+/**
+ * Tests if data is equal to any element in the list.
+ */
+bool list_contains(struct list* list, void* data,
+ comparator comparator);
+
+/**
+ * Tests if superlist contains all elements in sublist. Order is not important.
+ */
+bool list_contains_all(struct list* superList, struct list* subList,
+ comparator comparator);
+
+#endif
13 years, 9 months
r7363 struggleyb - in /trunk/dom/include/dom: core/cdatasection.h core/doc_fragment.h core/entity_ref.h core/pi.h dom.h
by netsurf@semichrome.net
Author: struggleyb
Date: Wed Apr 29 06:31:03 2009
New Revision: 7363
URL: http://source.netsurf-browser.org?rev=7363&view=rev
Log:
Add dom_document_fragment, dom_cdata_section, dom_entity_reference, dom_processing_instruction to public DOM interface.
Added:
trunk/dom/include/dom/core/cdatasection.h
trunk/dom/include/dom/core/doc_fragment.h
trunk/dom/include/dom/core/entity_ref.h
trunk/dom/include/dom/core/pi.h
Modified:
trunk/dom/include/dom/dom.h
Added: trunk/dom/include/dom/core/cdatasection.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/cdatasection...
==============================================================================
--- trunk/dom/include/dom/core/cdatasection.h (added)
+++ trunk/dom/include/dom/core/cdatasection.h Wed Apr 29 06:31:03 2009
@@ -1,0 +1,12 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#ifndef dom_core_cdatasection_h_
+#define dom_core_cdatasection_h_
+
+typedef struct dom_cdata_section dom_cdata_section;
+
+#endif
Added: trunk/dom/include/dom/core/doc_fragment.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/doc_fragment...
==============================================================================
--- trunk/dom/include/dom/core/doc_fragment.h (added)
+++ trunk/dom/include/dom/core/doc_fragment.h Wed Apr 29 06:31:03 2009
@@ -1,0 +1,12 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+#ifndef dom_core_documentfragment_h_
+#define dom_core_documentfragment_h_
+
+typedef struct dom_document_fragment dom_document_fragment;
+
+#endif
Added: trunk/dom/include/dom/core/entity_ref.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/entity_ref.h...
==============================================================================
--- trunk/dom/include/dom/core/entity_ref.h (added)
+++ trunk/dom/include/dom/core/entity_ref.h Wed Apr 29 06:31:03 2009
@@ -1,0 +1,13 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_entityreference_h_
+#define dom_core_entityreference_h_
+
+typedef struct dom_entity_reference dom_entity_reference;
+
+#endif
Added: trunk/dom/include/dom/core/pi.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/pi.h?rev=736...
==============================================================================
--- trunk/dom/include/dom/core/pi.h (added)
+++ trunk/dom/include/dom/core/pi.h Wed Apr 29 06:31:03 2009
@@ -1,0 +1,13 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_processinginstruction_h_
+#define dom_core_processinginstruction_h_
+
+typedef struct dom_processing_instruction dom_processing_instruction;
+
+#endif
Modified: trunk/dom/include/dom/dom.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/dom.h?rev=7363&r1...
==============================================================================
--- trunk/dom/include/dom/dom.h (original)
+++ trunk/dom/include/dom/dom.h Wed Apr 29 06:31:03 2009
@@ -31,9 +31,13 @@
#include <dom/core/impllist.h>
#include <dom/core/namednodemap.h>
#include <dom/core/node.h>
+#include <dom/core/cdatasection.h>
+#include <dom/core/doc_fragment.h>
+#include <dom/core/entity_ref.h>
#include <dom/core/nodelist.h>
#include <dom/core/string.h>
#include <dom/core/text.h>
+#include <dom/core/pi.h>
typedef enum dom_namespace {
DOM_NAMESPACE_NULL = 0,
13 years, 9 months
r7362 jmb - in /trunk/netsurftest: haveproblems/centred-list-items.html works/floated-list-items.html
by netsurf@semichrome.net
Author: jmb
Date: Wed Apr 29 05:49:30 2009
New Revision: 7362
URL: http://source.netsurf-browser.org?rev=7362&view=rev
Log:
Some test data for lists. One broken, one not.
Added:
trunk/netsurftest/haveproblems/centred-list-items.html
trunk/netsurftest/works/floated-list-items.html
Added: trunk/netsurftest/haveproblems/centred-list-items.html
URL: http://source.netsurf-browser.org/trunk/netsurftest/haveproblems/centred-...
==============================================================================
--- trunk/netsurftest/haveproblems/centred-list-items.html (added)
+++ trunk/netsurftest/haveproblems/centred-list-items.html Wed Apr 29 05:49:30 2009
@@ -1,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+<style type="text/css">
+ul > li { text-align: center; }
+</style>
+</head>
+<body>
+<p>Centred list items. Bullets not centred:
+<ul>
+ <li>one
+ <li>two
+ <li>three
+</ul>
+</body>
+</html>
Added: trunk/netsurftest/works/floated-list-items.html
URL: http://source.netsurf-browser.org/trunk/netsurftest/works/floated-list-it...
==============================================================================
--- trunk/netsurftest/works/floated-list-items.html (added)
+++ trunk/netsurftest/works/floated-list-items.html Wed Apr 29 05:49:30 2009
@@ -1,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+<style type="text/css">
+ol { clear: both; }
+ol > li { float: left; width: 5em; }
+</style>
+</head>
+<body>
+<ol>
+ <li>one
+ <li>two
+ <li>three
+</ol>
+</body>
+</html>
13 years, 9 months
r7361 jmb - /trunk/netsurf/render/box_construct.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Apr 29 05:44:20 2009
New Revision: 7361
URL: http://source.netsurf-browser.org?rev=7361&view=rev
Log:
Fix numbering of floated list items
Modified:
trunk/netsurf/render/box_construct.c
Modified: trunk/netsurf/render/box_construct.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box_construct.c?re...
==============================================================================
--- trunk/netsurf/render/box_construct.c (original)
+++ trunk/netsurf/render/box_construct.c Wed Apr 29 05:44:20 2009
@@ -460,20 +460,7 @@
author))
return false;
} else {
- if (style->float_ == CSS_FLOAT_LEFT ||
- style->float_ == CSS_FLOAT_RIGHT) {
- /* float: insert a float box between the parent and
- * current node */
- parent = box_create(0, href, target, title, 0, content);
- if (!parent)
- return false;
- if (style->float_ == CSS_FLOAT_LEFT)
- parent->type = BOX_FLOAT_LEFT;
- else
- parent->type = BOX_FLOAT_RIGHT;
- box_add_child(*inline_container, parent);
- }
-
+ /* list item: compute marker, then treat as non-inline box */
if (style->display == CSS_DISPLAY_LIST_ITEM) {
struct box *marker;
marker = box_create(style, 0, 0, title, 0, content);
@@ -503,9 +490,32 @@
case CSS_LIST_STYLE_TYPE_LOWER_ROMAN:
case CSS_LIST_STYLE_TYPE_UPPER_ALPHA:
case CSS_LIST_STYLE_TYPE_UPPER_ROMAN:
- if (parent->last && parent->last->list_marker)
- marker->rows = parent->last->
+ if (parent->last) {
+ struct box *last = parent->last;
+
+ /* Drill down into last child of parent
+ * to find the list marker (if any)
+ *
+ * Floated list boxes end up as:
+ *
+ * parent
+ * BOX_INLINE_CONTAINER
+ * BOX_FLOAT_{LEFT,RIGHT}
+ * BOX_BLOCK <-- list box
+ * ...
+ */
+ while (last != NULL) {
+ if (last->list_marker != NULL)
+ break;
+
+ last = last->last;
+ }
+
+ if (last && last->list_marker) {
+ marker->rows = last->
list_marker->rows + 1;
+ }
+ }
marker->text = talloc_array(content, char, 20);
if (!marker->text)
return false;
@@ -528,6 +538,20 @@
}
box->list_marker = marker;
marker->parent = box;
+ }
+
+ /* float: insert a float box between the parent and
+ * current node. Note: new parent will be the float */
+ if (style->float_ == CSS_FLOAT_LEFT ||
+ style->float_ == CSS_FLOAT_RIGHT) {
+ parent = box_create(0, href, target, title, 0, content);
+ if (!parent)
+ return false;
+ if (style->float_ == CSS_FLOAT_LEFT)
+ parent->type = BOX_FLOAT_LEFT;
+ else
+ parent->type = BOX_FLOAT_RIGHT;
+ box_add_child(*inline_container, parent);
}
/* non-inline box: add to tree and recurse */
13 years, 9 months
r7360 MarkieB - in /branches/MarkieB/favs: gtk/dialogs/gtk_source.c gtk/gtk_scaffolding.h gtk/res/netsurf.glade render/favicon.h render/html.c
by netsurf@semichrome.net
Author: MarkieB
Date: Wed Apr 29 02:29:10 2009
New Revision: 7360
URL: http://source.netsurf-browser.org?rev=7360&view=rev
Log:
tidy code; indentation, spaces in function prototypes
g_free after g_strconcat
reinstate accelerator for view source omitted during versioning for view source patch
clear unnecessary debugging includes
Modified:
branches/MarkieB/favs/gtk/dialogs/gtk_source.c
branches/MarkieB/favs/gtk/gtk_scaffolding.h
branches/MarkieB/favs/gtk/res/netsurf.glade
branches/MarkieB/favs/render/favicon.h
branches/MarkieB/favs/render/html.c
Modified: branches/MarkieB/favs/gtk/dialogs/gtk_source.c
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/gtk/dialogs/gtk_s...
==============================================================================
--- branches/MarkieB/favs/gtk/dialogs/gtk_source.c (original)
+++ branches/MarkieB/favs/gtk/dialogs/gtk_source.c Wed Apr 29 02:29:10 2009
@@ -106,113 +106,116 @@
void nsgtk_source_dialog_init(GtkWindow *parent, struct browser_window *bw)
{
+ if (bw->current_content->type != CONTENT_HTML)
+ return;
+
if (option_source_tab) {
nsgtk_source_tab_init(parent, bw);
return;
}
- if (bw->current_content->type == CONTENT_HTML) {
- glade_Location = g_strconcat(res_dir_location, "source.glade",
- NULL);
- glade_File = glade_xml_new(glade_Location, NULL, NULL);
- if (glade_File == NULL) {
- LOG(("error loading glade tree"));
- }
-
- char *data = NULL;
-
- utf8_convert_ret r = utf8_from_enc(
- bw->current_content->source_data,
- bw->current_content->data.html.encoding,
- bw->current_content->source_size,
- &data);
- if (r == UTF8_CONVERT_NOMEM) {
- warn_user("NoMemory",0);
- return;
- } else if (r == UTF8_CONVERT_BADENC) {
- warn_user("EncNotRec",0);
- return;
- }
-
- GtkWindow *wndSource = GTK_WINDOW(glade_xml_get_widget(
- glade_File, "wndSource"));
- GtkWidget *cutbutton = glade_xml_get_widget(
- glade_File, "source_cut");
- GtkWidget *pastebutton = glade_xml_get_widget(
- glade_File, "source_paste");
- GtkWidget *deletebutton = glade_xml_get_widget(
- glade_File, "source_delete");
- GtkWidget *printbutton = glade_xml_get_widget(
- glade_File, "source_print");
- gtk_widget_set_sensitive(cutbutton, FALSE);
- gtk_widget_set_sensitive(pastebutton, FALSE);
- gtk_widget_set_sensitive(deletebutton, FALSE);
- /* for now */
- gtk_widget_set_sensitive(printbutton, FALSE);
-
- struct nsgtk_source_window *thiswindow =
- malloc(sizeof(struct nsgtk_source_window));
- if (thiswindow == NULL) {
- free(data);
- warn_user("NoMemory", 0);
- return;
- }
-
- thiswindow->url = strdup(bw->current_content->url);
- if (thiswindow->url == NULL) {
- free(thiswindow);
- free(data);
- warn_user("NoMemory", 0);
- return;
- }
-
- thiswindow->data = data;
+
+ glade_Location = g_strconcat(res_dir_location, "source.glade",
+ NULL);
+ glade_File = glade_xml_new(glade_Location, NULL, NULL);
+ if (glade_File == NULL) {
+ LOG(("error loading glade tree"));
+ }
+ g_free(glade_Location);
+
+ char *data = NULL;
+
+ utf8_convert_ret r = utf8_from_enc(
+ bw->current_content->source_data,
+ bw->current_content->data.html.encoding,
+ bw->current_content->source_size,
+ &data);
+ if (r == UTF8_CONVERT_NOMEM) {
+ warn_user("NoMemory",0);
+ return;
+ } else if (r == UTF8_CONVERT_BADENC) {
+ warn_user("EncNotRec",0);
+ return;
+ }
+
+ GtkWindow *wndSource = GTK_WINDOW(glade_xml_get_widget(
+ glade_File, "wndSource"));
+ GtkWidget *cutbutton = glade_xml_get_widget(
+ glade_File, "source_cut");
+ GtkWidget *pastebutton = glade_xml_get_widget(
+ glade_File, "source_paste");
+ GtkWidget *deletebutton = glade_xml_get_widget(
+ glade_File, "source_delete");
+ GtkWidget *printbutton = glade_xml_get_widget(
+ glade_File, "source_print");
+ gtk_widget_set_sensitive(cutbutton, FALSE);
+ gtk_widget_set_sensitive(pastebutton, FALSE);
+ gtk_widget_set_sensitive(deletebutton, FALSE);
+ /* for now */
+ gtk_widget_set_sensitive(printbutton, FALSE);
+
+ struct nsgtk_source_window *thiswindow =
+ malloc(sizeof(struct nsgtk_source_window));
+ if (thiswindow == NULL) {
+ free(data);
+ warn_user("NoMemory", 0);
+ return;
+ }
+
+ thiswindow->url = strdup(bw->current_content->url);
+ if (thiswindow->url == NULL) {
+ free(thiswindow);
+ free(data);
+ warn_user("NoMemory", 0);
+ return;
+ }
+
+ thiswindow->data = data;
+
+ thiswindow->sourcewindow = wndSource;
+ thiswindow->bw = bw;
+
+ char *title = malloc(strlen(bw->current_content->url)
+ + SLEN("Source of ") + 1);
+ if (title == NULL) {
+ free(thiswindow->url);
+ free(thiswindow);
+ free(data);
+ warn_user("NoMemory", 0);
+ return;
+ }
+ sprintf(title, "Source of %s", bw->current_content->url);
+
+ thiswindow->next = nsgtk_source_list;
+ thiswindow->prev = NULL;
+ if (nsgtk_source_list != NULL)
+ nsgtk_source_list->prev = thiswindow;
+ nsgtk_source_list = thiswindow;
+
+ nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
+
+ gtk_window_set_title(wndSource, title);
- thiswindow->sourcewindow = wndSource;
- thiswindow->bw = bw;
-
- char *title = malloc(strlen(bw->current_content->url)
- + SLEN("Source of ") + 1);
- if (title == NULL) {
- free(thiswindow->url);
- free(thiswindow);
- free(data);
- warn_user("NoMemory", 0);
- return;
- }
- sprintf(title, "Source of %s", bw->current_content->url);
-
- thiswindow->next = nsgtk_source_list;
- thiswindow->prev = NULL;
- if (nsgtk_source_list != NULL)
- nsgtk_source_list->prev = thiswindow;
- nsgtk_source_list = thiswindow;
-
- nsgtk_attach_source_menu_handlers(glade_File, thiswindow);
-
- gtk_window_set_title(wndSource, title);
+ g_signal_connect(G_OBJECT(wndSource), "destroy",
+ G_CALLBACK(nsgtk_source_destroy_event),
+ thiswindow);
+ g_signal_connect(G_OBJECT(wndSource), "delete-event",
+ G_CALLBACK(nsgtk_source_delete_event),
+ thiswindow);
+
+ GtkTextView *sourceview = GTK_TEXT_VIEW(
+ glade_xml_get_widget(glade_File,
+ "source_view"));
+ PangoFontDescription *fontdesc =
+ pango_font_description_from_string("Monospace 8");
+
+ thiswindow->gv = sourceview;
+ gtk_widget_modify_font(GTK_WIDGET(sourceview), fontdesc);
+ GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
+ gtk_text_buffer_set_text(tb, thiswindow->data, -1);
- g_signal_connect(G_OBJECT(wndSource), "destroy",
- G_CALLBACK(nsgtk_source_destroy_event),
- thiswindow);
- g_signal_connect(G_OBJECT(wndSource), "delete-event",
- G_CALLBACK(nsgtk_source_delete_event),
- thiswindow);
-
- GtkTextView *sourceview = GTK_TEXT_VIEW(
- glade_xml_get_widget(glade_File,
- "source_view"));
- PangoFontDescription *fontdesc =
- pango_font_description_from_string("Monospace 8");
-
- thiswindow->gv = sourceview;
- gtk_widget_modify_font(GTK_WIDGET(sourceview), fontdesc);
- GtkTextBuffer *tb = gtk_text_view_get_buffer(sourceview);
- gtk_text_buffer_set_text(tb, thiswindow->data, -1);
-
- gtk_widget_show(GTK_WIDGET(wndSource));
-
- free(title);
- }
+ gtk_widget_show(GTK_WIDGET(wndSource));
+
+ free(title);
}
void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
@@ -236,8 +239,10 @@
FILE *f = fopen(filename, "w");
fprintf(f, "%s", ndata);
fclose(f);
- struct browser_window *newbw = browser_window_create(g_strconcat(
- "file://", filename, NULL), bw, NULL, false, true);
+ filename = g_strconcat("file://", filename, NULL);
+ struct browser_window *newbw = browser_window_create(filename, bw,
+ NULL, false, true);
+ g_free(filename);
if (newbw->current_content)
newbw->current_content->title = g_strconcat("source of ",
bw->current_content->url , NULL);
Modified: branches/MarkieB/favs/gtk/gtk_scaffolding.h
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/gtk/gtk_scaffoldi...
==============================================================================
--- branches/MarkieB/favs/gtk/gtk_scaffolding.h (original)
+++ branches/MarkieB/favs/gtk/gtk_scaffolding.h Wed Apr 29 02:29:10 2009
@@ -32,12 +32,12 @@
gboolean nsgtk_scaffolding_is_busy(nsgtk_scaffolding *scaffold);
-GtkWindow *nsgtk_scaffolding_get_window (struct gui_window *g);
-GtkNotebook *nsgtk_scaffolding_get_notebook (struct gui_window *g);
+GtkWindow *nsgtk_scaffolding_get_window(struct gui_window *g);
+GtkNotebook *nsgtk_scaffolding_get_notebook(struct gui_window *g);
GtkEntry *nsgtk_scaffolding_get_urlbar(struct gui_window *g);
GtkToolbar *nsgtk_scaffolding_get_toolbar(struct gui_window *g);
-void nsgtk_scaffolding_set_top_level (struct gui_window *gw);
+void nsgtk_scaffolding_set_top_level(struct gui_window *gw);
void nsgtk_scaffolding_destroy(nsgtk_scaffolding *scaffold);
Modified: branches/MarkieB/favs/gtk/res/netsurf.glade
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/gtk/res/netsurf.g...
==============================================================================
--- branches/MarkieB/favs/gtk/res/netsurf.glade (original)
+++ branches/MarkieB/favs/gtk/res/netsurf.glade Wed Apr 29 02:29:10 2009
@@ -422,6 +422,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">View S_ource</property>
<property name="use_underline">True</property>
+ <accelerator key="F8" modifiers="" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image28">
<property name="visible">True</property>
Modified: branches/MarkieB/favs/render/favicon.h
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/favicon.h?...
==============================================================================
--- branches/MarkieB/favs/render/favicon.h (original)
+++ branches/MarkieB/favs/render/favicon.h Wed Apr 29 02:29:10 2009
@@ -45,7 +45,7 @@
HHTEXTICO = 0x17e966a2,
/* text/icon */
HHAPPLICATIONICO = 0x087b6fb4,
- /*application/icon*/
+ /* application/icon */
HHSUFICO = 0x0b887ec0,
/* ico */
HHSUFPNG = 0x0b889dea,
Modified: branches/MarkieB/favs/render/html.c
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/html.c?rev...
==============================================================================
--- branches/MarkieB/favs/render/html.c (original)
+++ branches/MarkieB/favs/render/html.c Wed Apr 29 02:29:10 2009
@@ -36,9 +36,6 @@
#include "desktop/gui.h"
#include "desktop/options.h"
#include "image/bitmap.h"
-#include "image/png.h"
-#include "image/gif.h"
-#include "image/ico.h"
#include "render/box.h"
#include "render/favicon.h"
#include "render/font.h"
13 years, 9 months
r7359 tlsa - /trunk/netsurf/render/box.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Apr 28 16:24:11 2009
New Revision: 7359
URL: http://source.netsurf-browser.org?rev=7359&view=rev
Log:
Allow box at point to search descendant space of boxes with no style.
Modified:
trunk/netsurf/render/box.c
Modified: trunk/netsurf/render/box.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box.c?rev=7359&r1=...
==============================================================================
--- trunk/netsurf/render/box.c (original)
+++ trunk/netsurf/render/box.c Tue Apr 28 16:24:11 2009
@@ -470,7 +470,8 @@
*physically = true;
return true;
}
- if (box->style && box->style->overflow == CSS_OVERFLOW_VISIBLE) {
+ if ((box->style && box->style->overflow == CSS_OVERFLOW_VISIBLE) ||
+ !box->style) {
if (box->x + box->descendant_x0 <= x &&
x < box->x + box->descendant_x1 &&
box->y + box->descendant_y0 <= y &&
13 years, 9 months
r7358 tlsa - in /trunk/netsurf/render: box_construct.c layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Apr 28 15:13:10 2009
New Revision: 7358
URL: http://source.netsurf-browser.org?rev=7358&view=rev
Log:
Move handling of TR height attribute from box construction to layout and add support for height property on TR.
Modified:
trunk/netsurf/render/box_construct.c
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/box_construct.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box_construct.c?re...
==============================================================================
--- trunk/netsurf/render/box_construct.c (original)
+++ trunk/netsurf/render/box_construct.c Tue Apr 28 15:13:10 2009
@@ -562,52 +562,6 @@
xmlFree(s);
}
- /* transfer <tr height="n"> down to the <td> elements */
- /* \todo move this into box_get_style() */
- if (strcmp((const char *) n->name, "tr") == 0) {
- if ((s = (char *) xmlGetProp(n,
- (const xmlChar *) "height"))) {
- float value = atof(s);
- if (value < 0 || strlen(s) == 0) {
- /* ignore negative values and height="" */
- } else if (strrchr(s, '%')) {
- /* the specification doesn't make clear what
- * percentage heights mean, so ignore them */
- } else {
- /* The tree is not normalized yet, so accept
- * cells not in rows and rows not in row
- * groups. */
- struct box *child;
- float current;
- for (child = box->children; child;
- child = child->next) {
- if (child->style->height.height ==
- CSS_HEIGHT_LENGTH)
- current = css_len2px(
- &child->style->height.
- value.length,
- child->style);
- else
- current = 0;
- if (child->type == BOX_TABLE_CELL &&
- value > current) {
- /* Row height exceeds cell
- * height, increase cell height
- * to row height */
- child->style->height.height =
- CSS_HEIGHT_LENGTH;
- child->style->height.value.
- length.unit =
- CSS_UNIT_PX;
- child->style->height.value.
- length.value = value;
- }
- }
- }
- xmlFree(s);
- }
- }
-
/* fetch any background image for this box */
if (style->background_image.type == CSS_BACKGROUND_IMAGE_URI) {
if (!html_fetch_object(content, style->background_image.uri,
@@ -925,6 +879,7 @@
((strcmp((const char *) n->name, "iframe") == 0) ||
(strcmp((const char *) n->name, "td") == 0) ||
(strcmp((const char *) n->name, "th") == 0) ||
+ (strcmp((const char *) n->name, "tr") == 0) ||
(strcmp((const char *) n->name, "img") == 0) ||
(strcmp((const char *) n->name, "object") == 0) ||
(strcmp((const char *) n->name, "applet") == 0))) {
@@ -932,8 +887,8 @@
if (value <= 0 || strlen(s) == 0) {
/* ignore negative values and height="" */
} else if (strrchr(s, '%')) {
- /* the specification doesn't make clear what
- * percentage heights mean, so ignore them */
+ style->height.height = CSS_HEIGHT_PERCENT;
+ style->height.value.percent = value;
} else {
style->height.height = CSS_HEIGHT_LENGTH;
style->height.value.length.unit = CSS_UNIT_PX;
@@ -2328,7 +2283,7 @@
gadget->box = box;
box->type = BOX_INLINE_BLOCK;
-
+
/* Just render the contents */
return true;
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=7358&...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Tue Apr 28 15:13:10 2009
@@ -2772,6 +2772,11 @@
int row_group_height = 0;
for (row = row_group->children; row; row = row->next) {
int row_height = 0;
+ if (row->style->height.height == CSS_HEIGHT_LENGTH) {
+ row_height = (int) css_len2px(&row->style->
+ height.value.length,
+ row->style);
+ }
for (c = row->children; c; c = c->next) {
assert(c->style);
c->width = xs[c->start_column + c->columns] -
@@ -2807,6 +2812,10 @@
if (c->height < h)
c->height = h;
}
+ /* specified row height is treated as a minimum
+ */
+ if (c->height < row_height)
+ c->height = row_height;
c->x = xs[c->start_column] + c->border[LEFT];
c->y = c->border[TOP];
for (i = 0; i != c->columns; i++) {
13 years, 9 months
r7357 MarkieB - in /branches/MarkieB/favs/render: favicon.c favicon.h
by netsurf@semichrome.net
Author: MarkieB
Date: Tue Apr 28 14:28:35 2009
New Revision: 7357
URL: http://source.netsurf-browser.org?rev=7357&view=rev
Log:
correctly nest switch case
adjust copyright notice
remove unnecessary comment, add necessary comment
Modified:
branches/MarkieB/favs/render/favicon.c
branches/MarkieB/favs/render/favicon.h
Modified: branches/MarkieB/favs/render/favicon.c
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/favicon.c?...
==============================================================================
--- branches/MarkieB/favs/render/favicon.c (original)
+++ branches/MarkieB/favs/render/favicon.c Tue Apr 28 14:28:35 2009
@@ -128,6 +128,11 @@
}
LOG(("icon node found"));
switch(favicon_hash(rel)) {
+ /* give points for rel attributes, kind of arbitrary
+ * in an attempt to test how closely standards are
+ * being respected; the reason apple-touch-icon scores
+ * less is that the appearance of such is really
+ * specific to the iphone style */
case HHICON:
LOG(("icon"));
score = 3;
@@ -148,6 +153,9 @@
if ((type = (char *) xmlGetProp(node,
(const xmlChar *) "type")) != NULL) {
switch(favicon_hash(type)) {
+ /* here we score highest for "image/type"
+ * mime types, lower scores for "type/ico"
+ * mime types, no score for no type */
case HHIMAGEPNG:
score += 5;
break;
@@ -188,6 +196,9 @@
if (suf != NULL) {
suf ++;
switch(favicon_hash(suf)) {
+ /* here the largest bonus points of all
+ * attributes, notably for .ico, .png, .gif
+ * as the standards support; less for .jpg */
case HHSUFICO:
score += 10;
break;
@@ -290,81 +301,79 @@
unsigned int i = p2;
switch (msg) {
- case CONTENT_MSG_LOADING:
- /* check that the favicon is really a correct image
- * type */
+ case CONTENT_MSG_LOADING:
+ /* check that the favicon is really a correct image
+ * type */
+
+ if ((icon->type == CONTENT_ICO) ||
+ (icon->type == CONTENT_PNG) ||
+ (icon->type == CONTENT_GIF)) {
- if ((icon->type == CONTENT_ICO) ||
- (icon->type == CONTENT_PNG) ||
- (icon->type == CONTENT_GIF)) {
-
- /* may need call to content_open() */
-
- } else {
- c->data.html.favicon = 0;
- LOG(("%s is not a favicon", icon->url));
- content_add_error(c, "NotFavIco", 0);
- html_set_status(c, messages_get("NotFavIco"));
- content_broadcast(c, CONTENT_MSG_STATUS, data);
- content_remove_user(icon,
- favicon_callback,
- (intptr_t) c, i);
- if (!icon->user_list->next) {
- /* we were the only user and we
- * don't want this content, so
- * stop it fetching and mark it
- * as having an error so it gets
- * removed from the cache next time
- * content_clean() gets called */
- fetch_abort(icon->fetch);
- icon->fetch = 0;
- icon->status = CONTENT_STATUS_ERROR;
- }
- }
- break;
-
- case CONTENT_MSG_READY:
- break;
-
- case CONTENT_MSG_DONE:
- LOG(("got favicon '%s'", icon->url));
- break;
-
- case CONTENT_MSG_LAUNCH:
- /* Fall through */
- case CONTENT_MSG_ERROR:
- LOG(("favicon %s failed: %s", icon->url, data.error));
- /* The favicon we were fetching may have been
- * redirected, in that case, the object pointers
- * will differ, so ensure that the object that's
- * in error is still in use by us before invalidating
- * the pointer */
- if (c->data.html.favicon == icon) {
- c->data.html.favicon = 0;
- content_add_error(c, "?", 0);
- }
- break;
-
- case CONTENT_MSG_STATUS:
- html_set_status(c, icon->status_message);
+ } else {
+ c->data.html.favicon = 0;
+ LOG(("%s is not a favicon", icon->url));
+ content_add_error(c, "NotFavIco", 0);
+ html_set_status(c, messages_get("NotFavIco"));
content_broadcast(c, CONTENT_MSG_STATUS, data);
- break;
-
- case CONTENT_MSG_NEWPTR:
- c->data.html.favicon = icon;
- break;
-
- case CONTENT_MSG_AUTH:
+ content_remove_user(icon,
+ favicon_callback,
+ (intptr_t) c, i);
+ if (!icon->user_list->next) {
+ /* we were the only user and we
+ * don't want this content, so
+ * stop it fetching and mark it
+ * as having an error so it gets
+ * removed from the cache next time
+ * content_clean() gets called */
+ fetch_abort(icon->fetch);
+ icon->fetch = 0;
+ icon->status = CONTENT_STATUS_ERROR;
+ }
+ }
+ break;
+
+ case CONTENT_MSG_READY:
+ break;
+
+ case CONTENT_MSG_DONE:
+ LOG(("got favicon '%s'", icon->url));
+ break;
+
+ case CONTENT_MSG_LAUNCH:
+ /* Fall through */
+ case CONTENT_MSG_ERROR:
+ LOG(("favicon %s failed: %s", icon->url, data.error));
+ /* The favicon we were fetching may have been
+ * redirected, in that case, the object pointers
+ * will differ, so ensure that the object that's
+ * in error is still in use by us before invalidating
+ * the pointer */
+ if (c->data.html.favicon == icon) {
c->data.html.favicon = 0;
content_add_error(c, "?", 0);
- break;
-
- case CONTENT_MSG_SSL:
- c->data.html.favicon = 0;
- content_add_error(c, "?", 0);
- break;
-
- default:
- assert(0);
+ }
+ break;
+
+ case CONTENT_MSG_STATUS:
+ html_set_status(c, icon->status_message);
+ content_broadcast(c, CONTENT_MSG_STATUS, data);
+ break;
+
+ case CONTENT_MSG_NEWPTR:
+ c->data.html.favicon = icon;
+ break;
+
+ case CONTENT_MSG_AUTH:
+ c->data.html.favicon = 0;
+ content_add_error(c, "?", 0);
+ break;
+
+ case CONTENT_MSG_SSL:
+ c->data.html.favicon = 0;
+ content_add_error(c, "?", 0);
+ break;
+
+ default:
+ assert(0);
}
}
Modified: branches/MarkieB/favs/render/favicon.h
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/favicon.h?...
==============================================================================
--- branches/MarkieB/favs/render/favicon.h (original)
+++ branches/MarkieB/favs/render/favicon.h Tue Apr 28 14:28:35 2009
@@ -1,5 +1,4 @@
/*
- * Copyright 2007 James Bursa <bursa(a)users.sourceforge.net>
* Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin(a)dfgh.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
13 years, 9 months
r7356 MarkieB - in /branches/MarkieB/favs/render: favicon.c favicon.h html.c
by netsurf@semichrome.net
Author: MarkieB
Date: Tue Apr 28 14:12:30 2009
New Revision: 7356
URL: http://source.netsurf-browser.org?rev=7356&view=rev
Log:
refactor code favicon functions favicon_
enum for favicon string hashes
Modified:
branches/MarkieB/favs/render/favicon.c
branches/MarkieB/favs/render/favicon.h
branches/MarkieB/favs/render/html.c
Modified: branches/MarkieB/favs/render/favicon.c
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/favicon.c?...
==============================================================================
--- branches/MarkieB/favs/render/favicon.c (original)
+++ branches/MarkieB/favs/render/favicon.c Tue Apr 28 14:12:30 2009
@@ -28,12 +28,12 @@
#include "utils/url.h"
#include "utils/utils.h"
-static char *html_get_icon_ref(struct content *c, xmlNode *html);
-static void html_favicon_callback(content_msg msg, struct content *icon,
+static char *favicon_get_icon_ref(struct content *c, xmlNode *html);
+static void favicon_callback(content_msg msg, struct content *icon,
intptr_t p1, intptr_t p2, union content_msg_data data);
-static unsigned long hash(char *str);
-
-unsigned long hash(char *str)
+static unsigned long favicon_hash(char *str);
+
+unsigned long favicon_hash(char *str)
{
if (str == NULL)
return 0;
@@ -49,7 +49,7 @@
* \param html xml node of html element
* \return pointer to url; NULL for no icon
*/
-char *html_get_icon_ref(struct content *c, xmlNode *html)
+char *favicon_get_icon_ref(struct content *c, xmlNode *html)
{
xmlNode *node;
char *rel, *type, *href, *url, *suf, *url2;
@@ -127,7 +127,7 @@
continue;
}
LOG(("icon node found"));
- switch(hash(rel)) {
+ switch(favicon_hash(rel)) {
case HHICON:
LOG(("icon"));
score = 3;
@@ -147,7 +147,7 @@
* scoring system may be modified in the future */
if ((type = (char *) xmlGetProp(node,
(const xmlChar *) "type")) != NULL) {
- switch(hash(type)) {
+ switch(favicon_hash(type)) {
case HHIMAGEPNG:
score += 5;
break;
@@ -187,7 +187,7 @@
suf = strrchr(href, '.');
if (suf != NULL) {
suf ++;
- switch(hash(suf)) {
+ switch(favicon_hash(suf)) {
case HHSUFICO:
score += 10;
break;
@@ -253,13 +253,13 @@
* \return true for success, false for error
*/
-bool html_get_icon(struct content *c, xmlNode *html)
+bool favicon_get_icon(struct content *c, xmlNode *html)
{
union content_msg_data msg_data;
- char *url = html_get_icon_ref(c, html);
+ char *url = favicon_get_icon_ref(c, html);
struct content *favcontent = NULL;
if (url != NULL)
- favcontent = fetchcache(url, html_favicon_callback,
+ favcontent = fetchcache(url, favicon_callback,
(intptr_t) c, 0, c->width, c->height, true, 0,
0, false, false);
free(url);
@@ -268,7 +268,7 @@
c->data.html.favicon = favcontent;
- fetchcache_go(favcontent, c->url, html_favicon_callback,
+ fetchcache_go(favcontent, c->url, favicon_callback,
(intptr_t) c, 0, c->width, c->height,
0, 0, false, c->url);
@@ -283,7 +283,7 @@
* Callback for fetchcache() for linked favicon
*/
-void html_favicon_callback(content_msg msg, struct content *icon,
+void favicon_callback(content_msg msg, struct content *icon,
intptr_t p1, intptr_t p2, union content_msg_data data)
{
struct content *c = (struct content *) p1;
@@ -307,7 +307,7 @@
html_set_status(c, messages_get("NotFavIco"));
content_broadcast(c, CONTENT_MSG_STATUS, data);
content_remove_user(icon,
- html_favicon_callback,
+ favicon_callback,
(intptr_t) c, i);
if (!icon->user_list->next) {
/* we were the only user and we
Modified: branches/MarkieB/favs/render/favicon.h
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/favicon.h?...
==============================================================================
--- branches/MarkieB/favs/render/favicon.h (original)
+++ branches/MarkieB/favs/render/favicon.h Tue Apr 28 14:12:30 2009
@@ -20,6 +20,45 @@
#ifndef __NETSURF_RENDER_FAVICON_H__
#define __NETSURF_RENDER_FAVICON_H__
-bool html_get_icon(struct content *c, xmlNode *html);
+typedef enum {
+ HHICON = 0x7c98572e,
+ /* icon */
+ HHSHORTCUTICON = 0xfcbccdca,
+ /* shortcut icon */
+ HHAPPLETOUCHICON = 0x024c6ddd,
+ /* apple-touch-icon */
+ HHIMAGEPNG = 0x7382417c,
+ /* image/png */
+ HHIMAGEGIF = 0x73821a8d,
+ /* image/gif */
+ HHIMAGEVNDMICROSOFTICON = 0xdae02bba,
+ /* image.vnd.microsoft.icon */
+ HHIMAGEJPEG = 0xe3c72f5d,
+ /* image/jpeg */
+ HHIMAGEJPG = 0x73822838,
+ /* image/jpg */
+ HHIMAGEICO = 0x73822252,
+ /* image/ico */
+ HHIMAGEICON = 0xe3c66d00,
+ /* image/icon */
+ HHIMAGEXICON = 0x0e3e78e5,
+ /* image/x-icon */
+ HHTEXTICO = 0x17e966a2,
+ /* text/icon */
+ HHAPPLICATIONICO = 0x087b6fb4,
+ /*application/icon*/
+ HHSUFICO = 0x0b887ec0,
+ /* ico */
+ HHSUFPNG = 0x0b889dea,
+ /* png */
+ HHSUFGIF = 0x0b8876fb,
+ /* gif */
+ HHSUFJPG = 0x0b888486,
+ /* jpg */
+ HHSUFJPEG = 0x7c99198b
+ /* jpeg */
+} favicon_string_hash;
+
+bool favicon_get_icon(struct content *c, xmlNode *html);
#endif
Modified: branches/MarkieB/favs/render/html.c
URL: http://source.netsurf-browser.org/branches/MarkieB/favs/render/html.c?rev...
==============================================================================
--- branches/MarkieB/favs/render/html.c (original)
+++ branches/MarkieB/favs/render/html.c Tue Apr 28 14:12:30 2009
@@ -404,7 +404,7 @@
return false;
/* get icon */
- html_get_icon(c, html);
+ favicon_get_icon(c, html);
/* Retrieve forms from parser */
c->data.html.forms = binding_get_forms(c->data.html.parser_binding);
13 years, 9 months
r7355 dsilvers - /trunk/tools/svn/netsurf-review-diff-list
by netsurf@semichrome.net
Author: dsilvers
Date: Tue Apr 28 10:25:15 2009
New Revision: 7355
URL: http://source.netsurf-browser.org?rev=7355&view=rev
Log:
Oops, missed one domain change
Modified:
trunk/tools/svn/netsurf-review-diff-list
Modified: trunk/tools/svn/netsurf-review-diff-list
URL: http://source.netsurf-browser.org/trunk/tools/svn/netsurf-review-diff-lis...
==============================================================================
--- trunk/tools/svn/netsurf-review-diff-list (original)
+++ trunk/tools/svn/netsurf-review-diff-list Tue Apr 28 10:25:15 2009
@@ -80,7 +80,7 @@
test "x$PRECISFILE" = "x" || rm $PRECISFILE
test "x$PRECISBKP" = "x" || mv $PRECISBKP /tmp/precis
-HEADER="From: ${NETSURF_REALNAME} <${NETSURF_USERNAME}(a)simtec.co.uk>
+HEADER="From: ${NETSURF_REALNAME} <${NETSURF_USERNAME}(a)netsurf-browser.org>
To: NetSurf Development List <netsurf-dev(a)netsurf-browser.org>
Subject: Review: $*
13 years, 9 months