r12530 jmb - in /branches/jmb/dom-alloc-purge/src/core: namednodemap.c nodelist.c nodelist.h
by netsurf@semichrome.net
Author: jmb
Date: Tue Jun 28 15:44:51 2011
New Revision: 12530
URL: http://source.netsurf-browser.org?rev=12530&view=rev
Log:
Fix up nodelist and namednodemap implementations
Modified:
branches/jmb/dom-alloc-purge/src/core/namednodemap.c
branches/jmb/dom-alloc-purge/src/core/nodelist.c
branches/jmb/dom-alloc-purge/src/core/nodelist.h
Modified: branches/jmb/dom-alloc-purge/src/core/namednodemap.c
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/n...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/namednodemap.c (original)
+++ branches/jmb/dom-alloc-purge/src/core/namednodemap.c Tue Jun 28 15:44:51 2011
@@ -7,6 +7,7 @@
*/
#include <assert.h>
+#include <stdlib.h>
#include <dom/core/element.h>
#include <dom/core/node.h>
@@ -23,7 +24,7 @@
* DOM named node map
*/
struct dom_namednodemap {
- struct dom_document *owner; /**< Owning document */
+ dom_document *owner; /**< Owning document */
void *priv; /**< Private data */
@@ -53,13 +54,13 @@
* explicitly reference it. The client must unref the map once it is
* finished with it.
*/
-dom_exception _dom_namednodemap_create(struct dom_document *doc,
+dom_exception _dom_namednodemap_create(dom_document *doc,
void *priv, struct nnm_operation *opt,
- struct dom_namednodemap **map)
-{
- struct dom_namednodemap *m;
-
- m = _dom_document_alloc(doc, NULL, sizeof(struct dom_namednodemap));
+ dom_namednodemap **map)
+{
+ dom_namednodemap *m;
+
+ m = malloc(sizeof(dom_namednodemap));
if (m == NULL)
return DOM_NO_MEM_ERR;
@@ -80,7 +81,7 @@
*
* \param map The map to claim a reference on
*/
-void dom_namednodemap_ref(struct dom_namednodemap *map)
+void dom_namednodemap_ref(dom_namednodemap *map)
{
assert(map != NULL);
map->refcnt++;
@@ -94,7 +95,7 @@
* If the reference count reaches zero, any memory claimed by the
* map will be released
*/
-void dom_namednodemap_unref(struct dom_namednodemap *map)
+void dom_namednodemap_unref(dom_namednodemap *map)
{
if (map == NULL)
return;
@@ -104,7 +105,7 @@
map->opt->namednodemap_destroy(map->priv);
/* Destroy the map object */
- _dom_document_alloc(map->owner, map, 0);
+ free(map);
}
}
@@ -115,7 +116,7 @@
* \param length Pointer to location to receive length
* \return DOM_NO_ERR.
*/
-dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map,
+dom_exception dom_namednodemap_get_length(dom_namednodemap *map,
unsigned long *length)
{
assert(map->opt != NULL);
@@ -133,8 +134,8 @@
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
*/
-dom_exception _dom_namednodemap_get_named_item(struct dom_namednodemap *map,
- dom_string *name, struct dom_node **node)
+dom_exception _dom_namednodemap_get_named_item(dom_namednodemap *map,
+ dom_string *name, dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_get_named_item(map->priv, name, node);
@@ -164,8 +165,8 @@
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
*/
-dom_exception _dom_namednodemap_set_named_item(struct dom_namednodemap *map,
- struct dom_node *arg, struct dom_node **node)
+dom_exception _dom_namednodemap_set_named_item(dom_namednodemap *map,
+ dom_node *arg, dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_set_named_item(map->priv, arg, node);
@@ -186,8 +187,8 @@
* should unref the node once it has finished with it.
*/
dom_exception _dom_namednodemap_remove_named_item(
- struct dom_namednodemap *map, dom_string *name,
- struct dom_node **node)
+ dom_namednodemap *map, dom_string *name,
+ dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_remove_named_item(map->priv, name, node);
@@ -207,8 +208,8 @@
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
*/
-dom_exception _dom_namednodemap_item(struct dom_namednodemap *map,
- unsigned long index, struct dom_node **node)
+dom_exception _dom_namednodemap_item(dom_namednodemap *map,
+ unsigned long index, dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_item(map->priv, index, node);
@@ -231,8 +232,8 @@
* should unref the node once it has finished with it.
*/
dom_exception _dom_namednodemap_get_named_item_ns(
- struct dom_namednodemap *map, dom_string *namespace,
- dom_string *localname, struct dom_node **node)
+ dom_namednodemap *map, dom_string *namespace,
+ dom_string *localname, dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_get_named_item_ns(map->priv, namespace,
@@ -269,8 +270,8 @@
* should unref the node once it has finished with it.
*/
dom_exception _dom_namednodemap_set_named_item_ns(
- struct dom_namednodemap *map, struct dom_node *arg,
- struct dom_node **node)
+ dom_namednodemap *map, dom_node *arg,
+ dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_set_named_item_ns(map->priv, arg, node);
@@ -296,8 +297,8 @@
* should unref the node once it has finished with it.
*/
dom_exception _dom_namednodemap_remove_named_item_ns(
- struct dom_namednodemap *map, dom_string *namespace,
- dom_string *localname, struct dom_node **node)
+ dom_namednodemap *map, dom_string *namespace,
+ dom_string *localname, dom_node **node)
{
assert(map->opt != NULL);
return map->opt->namednodemap_remove_named_item_ns(map->priv, namespace,
@@ -308,8 +309,8 @@
* Compare whether two NamedNodeMap are equal.
*
*/
-bool _dom_namednodemap_equal(struct dom_namednodemap *m1,
- struct dom_namednodemap *m2)
+bool _dom_namednodemap_equal(dom_namednodemap *m1,
+ dom_namednodemap *m2)
{
assert(m1->opt != NULL);
return (m1->opt == m2->opt && m1->opt->namednodemap_equal(m1->priv,
@@ -322,7 +323,7 @@
* \param map The dom_namednodemap
* \param priv The private data to change to
*/
-void _dom_namednodemap_update(struct dom_namednodemap *map, void *priv)
+void _dom_namednodemap_update(dom_namednodemap *map, void *priv)
{
map->priv = priv;
}
Modified: branches/jmb/dom-alloc-purge/src/core/nodelist.c
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/n...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/nodelist.c (original)
+++ branches/jmb/dom-alloc-purge/src/core/nodelist.c Tue Jun 28 15:44:51 2011
@@ -5,15 +5,15 @@
* Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
* Copyright 2009 Bo Yang <struggleyb.nku(a)gmail.com>
*/
+
#include <assert.h>
+#include <stdlib.h>
#include <dom/core/node.h>
#include <dom/core/document.h>
#include <dom/core/nodelist.h>
#include <dom/core/string.h>
-#include <libwapcaplet/libwapcaplet.h>
-
#include "core/document.h"
#include "core/node.h"
#include "core/nodelist.h"
@@ -24,24 +24,24 @@
* DOM node list
*/
struct dom_nodelist {
- struct dom_document *owner; /**< Owning document */
-
- struct dom_node_internal *root;
+ dom_document *owner; /**< Owning document */
+
+ dom_node_internal *root;
/**< Root of applicable subtree */
nodelist_type type; /**< Type of this list */
union {
struct {
- struct lwc_string_s *name;
+ dom_string *name;
/**< Tag name to match */
bool any_name; /**< The name is '*' */
} n;
struct {
bool any_namespace; /**< The namespace is '*' */
bool any_localname; /**< The localname is '*' */
- struct lwc_string_s *namespace; /**< Namespace */
- struct lwc_string_s *localname; /**< Localname */
+ dom_string *namespace; /**< Namespace */
+ dom_string *localname; /**< Localname */
} ns; /**< Data for namespace matching */
} data;
@@ -65,14 +65,14 @@
* The returned list will already be referenced, so the client need not
* do so explicitly. The client must unref the list once finished with it.
*/
-dom_exception _dom_nodelist_create(struct dom_document *doc, nodelist_type type,
- struct dom_node_internal *root, struct lwc_string_s *tagname,
- struct lwc_string_s *namespace, struct lwc_string_s *localname,
- struct dom_nodelist **list)
-{
- struct dom_nodelist *l;
-
- l = _dom_document_alloc(doc, NULL, sizeof(struct dom_nodelist));
+dom_exception _dom_nodelist_create(dom_document *doc, nodelist_type type,
+ dom_node_internal *root, dom_string *tagname,
+ dom_string *namespace, dom_string *localname,
+ dom_nodelist **list)
+{
+ dom_nodelist *l;
+
+ l = malloc(sizeof(dom_nodelist));
if (l == NULL)
return DOM_NO_MEM_ERR;
@@ -87,35 +87,34 @@
if (type == DOM_NODELIST_BY_NAME) {
assert(tagname != NULL);
l->data.n.any_name = false;
- if (lwc_string_length(tagname) == 1) {
- const char *ch = lwc_string_data(tagname);
+ if (_dom_string_byte_length(tagname) == 1) {
+ const char *ch = _dom_string_data(tagname);
if (*ch == '*') {
l->data.n.any_name = true;
}
}
- lwc_string_ref(tagname);
- l->data.n.name = tagname;
+ l->data.n.name = dom_string_ref(tagname);
} else if (type == DOM_NODELIST_BY_NAMESPACE) {
l->data.ns.any_localname = false;
l->data.ns.any_namespace = false;
if (localname != NULL) {
- if (lwc_string_length(localname) == 1) {
- const char *ch = lwc_string_data(localname);
+ if (_dom_string_byte_length(localname) == 1) {
+ const char *ch = _dom_string_data(localname);
if (*ch == '*') {
l->data.ns.any_localname = true;
}
}
- lwc_string_ref(localname);
+ dom_string_ref(localname);
}
if (namespace != NULL) {
- if (lwc_string_length(namespace) == 1) {
- const char *ch = lwc_string_data(namespace);
+ if (_dom_string_byte_length(namespace) == 1) {
+ const char *ch = _dom_string_data(namespace);
if (*ch == '*') {
l->data.ns.any_namespace = true;
}
}
- lwc_string_ref(namespace);
+ dom_string_ref(namespace);
}
l->data.ns.namespace = namespace;
@@ -134,7 +133,7 @@
*
* \param list The list to claim a reference on
*/
-void dom_nodelist_ref(struct dom_nodelist *list)
+void dom_nodelist_ref(dom_nodelist *list)
{
assert(list != NULL);
list->refcnt++;
@@ -148,27 +147,26 @@
* If the reference count reaches zero, any memory claimed by the
* list will be released
*/
-void dom_nodelist_unref(struct dom_nodelist *list)
+void dom_nodelist_unref(dom_nodelist *list)
{
if (list == NULL)
return;
if (--list->refcnt == 0) {
- struct dom_node_internal *owner =
- (struct dom_node_internal *) list->owner;
+ dom_node_internal *owner = (dom_node_internal *) list->owner;
switch (list->type) {
case DOM_NODELIST_CHILDREN:
/* Nothing to do */
break;
case DOM_NODELIST_BY_NAMESPACE:
if (list->data.ns.namespace != NULL)
- lwc_string_unref(list->data.ns.namespace);
+ dom_string_unref(list->data.ns.namespace);
if (list->data.ns.localname != NULL)
- lwc_string_unref(list->data.ns.localname);
+ dom_string_unref(list->data.ns.localname);
break;
case DOM_NODELIST_BY_NAME:
assert(list->data.n.name != NULL);
- lwc_string_unref(list->data.n.name);
+ dom_string_unref(list->data.n.name);
break;
}
@@ -178,7 +176,7 @@
_dom_document_remove_nodelist(list->owner, list);
/* Destroy the list object */
- _dom_document_alloc(list->owner, list, 0);
+ free(list);
/* And release our reference on the owning document
* This must be last as, otherwise, it's possible that
@@ -194,10 +192,9 @@
* \param length Pointer to location to receive length
* \return DOM_NO_ERR.
*/
-dom_exception dom_nodelist_get_length(struct dom_nodelist *list,
- unsigned long *length)
-{
- struct dom_node_internal *cur = list->root->first_child;
+dom_exception dom_nodelist_get_length(dom_nodelist *list, unsigned long *length)
+{
+ dom_node_internal *cur = list->root->first_child;
unsigned long len = 0;
/* Traverse data structure */
@@ -206,21 +203,21 @@
if (list->type == DOM_NODELIST_CHILDREN) {
len++;
} else if (list->type == DOM_NODELIST_BY_NAME) {
- /* Here, we compare two lwc_string pointer directly */
if (list->data.n.any_name == true || (
cur->name != NULL &&
- cur->name == list->data.n.name)) {
+ dom_string_isequal(cur->name,
+ list->data.n.name))) {
if (cur->type == DOM_ELEMENT_NODE)
len++;
}
} else {
- if (list->data.ns.any_namespace == true ||
- cur->namespace ==
- list->data.ns.namespace) {
+ if (list->data.ns.any_namespace == true ||
+ dom_string_isequal(cur->namespace,
+ list->data.ns.namespace)) {
if (list->data.ns.any_localname == true ||
(cur->name != NULL &&
- cur->name ==
- list->data.ns.localname)) {
+ dom_string_isequal(cur->name,
+ list->data.ns.localname))) {
if (cur->type == DOM_ELEMENT_NODE)
len++;
}
@@ -242,7 +239,7 @@
} else {
/* No children or siblings.
* Find first unvisited relation. */
- struct dom_node_internal *parent = cur->parent;
+ dom_node_internal *parent = cur->parent;
while (parent != list->root &&
cur == parent->last_child) {
@@ -274,10 +271,10 @@
* The returned node will have had its reference count increased. The client
* should unref the node once it has finished with it.
*/
-dom_exception _dom_nodelist_item(struct dom_nodelist *list,
- unsigned long index, struct dom_node **node)
-{
- struct dom_node_internal *cur = list->root->first_child;
+dom_exception _dom_nodelist_item(dom_nodelist *list,
+ unsigned long index, dom_node **node)
+{
+ dom_node_internal *cur = list->root->first_child;
unsigned long count = 0;
/* Traverse data structure */
@@ -288,19 +285,20 @@
} else if (list->type == DOM_NODELIST_BY_NAME) {
if (list->data.n.any_name == true || (
cur->name != NULL &&
- cur->name == list->data.n.name)) {
+ dom_string_isequal(cur->name,
+ list->data.n.name))) {
if (cur->type == DOM_ELEMENT_NODE)
count++;
}
} else {
if (list->data.ns.any_namespace == true ||
(cur->namespace != NULL &&
- cur->namespace ==
- list->data.ns.namespace)) {
+ dom_string_isequal(cur->namespace,
+ list->data.ns.namespace))) {
if (list->data.ns.any_localname == true ||
(cur->name != NULL &&
- cur->name ==
- list->data.ns.localname)) {
+ dom_string_isequal(cur->name,
+ list->data.ns.localname))) {
if (cur->type == DOM_ELEMENT_NODE)
count++;
}
@@ -327,7 +325,7 @@
} else {
/* No children or siblings.
* Find first unvisited relation. */
- struct dom_node_internal *parent = cur->parent;
+ dom_node_internal *parent = cur->parent;
while (parent != list->root &&
cur == parent->last_child) {
@@ -343,7 +341,7 @@
if (cur != NULL) {
dom_node_ref(cur);
}
- *node = (struct dom_node *) cur;
+ *node = (dom_node *) cur;
return DOM_NO_ERR;
}
@@ -359,9 +357,9 @@
* \param localname Local part of nodes in list (or NULL)
* \return true if list matches, false otherwise
*/
-bool _dom_nodelist_match(struct dom_nodelist *list, nodelist_type type,
- struct dom_node_internal *root, struct lwc_string_s *tagname,
- struct lwc_string_s *namespace, struct lwc_string_s *localname)
+bool _dom_nodelist_match(dom_nodelist *list, nodelist_type type,
+ dom_node_internal *root, dom_string *tagname,
+ dom_string *namespace, dom_string *localname)
{
if (list->root != root)
return false;
@@ -374,12 +372,12 @@
}
if (list->type == DOM_NODELIST_BY_NAME) {
- return (list->data.n.name == tagname);
+ return dom_string_isequal(list->data.n.name, tagname);
}
if (list->type == DOM_NODELIST_BY_NAMESPACE) {
- return (list->data.ns.namespace == namespace) &&
- (list->data.ns.localname == localname);
+ return dom_string_isequal(list->data.ns.namespace, namespace) &&
+ dom_string_isequal(list->data.ns.localname, localname);
}
return false;
@@ -392,7 +390,7 @@
* \param l2 The other list
* \reutrn true for equal, false otherwise.
*/
-bool _dom_nodelist_equal(struct dom_nodelist *l1, struct dom_nodelist *l2)
+bool _dom_nodelist_equal(dom_nodelist *l1, dom_nodelist *l2)
{
return _dom_nodelist_match(l1, l1->type, l2->root, l2->data.n.name,
l2->data.ns.namespace, l2->data.ns.localname);
Modified: branches/jmb/dom-alloc-purge/src/core/nodelist.h
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/n...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/nodelist.h (original)
+++ branches/jmb/dom-alloc-purge/src/core/nodelist.h Tue Jun 28 15:44:51 2011
@@ -15,7 +15,6 @@
struct dom_document;
struct dom_node;
struct dom_nodelist;
-struct lwc_string_s;
/**
* The NodeList type
@@ -28,14 +27,14 @@
/* Create a nodelist */
dom_exception _dom_nodelist_create(struct dom_document *doc, nodelist_type type,
- struct dom_node_internal *root, struct lwc_string_s *tagname,
- struct lwc_string_s *namespace, struct lwc_string_s *localname,
+ struct dom_node_internal *root, dom_string *tagname,
+ dom_string *namespace, dom_string *localname,
struct dom_nodelist **list);
/* Match a nodelist instance against a set of nodelist creation parameters */
bool _dom_nodelist_match(struct dom_nodelist *list, nodelist_type type,
- struct dom_node_internal *root, struct lwc_string_s *tagname,
- struct lwc_string_s *namespace, struct lwc_string_s *localname);
+ struct dom_node_internal *root, dom_string *tagname,
+ dom_string *namespace, dom_string *localname);
bool _dom_nodelist_equal(struct dom_nodelist *l1, struct dom_nodelist *l2);
#define dom_nodelist_equal(l1, l2) _dom_nodelist_equal( \
11 years, 11 months
r12529 tlsa - in /trunk/netsurf: content/ desktop/ image/ render/ riscos/ riscos/content-handlers/ riscos/gui/
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 15:17:39 2011
New Revision: 12529
URL: http://source.netsurf-browser.org?rev=12529&view=rev
Log:
Unify content_redraw params in content_redraw_data struct. Core and RISC OS content handlers updated.
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/content.h
trunk/netsurf/content/content_protected.h
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/print.c
trunk/netsurf/desktop/thumbnail.c
trunk/netsurf/desktop/tree.c
trunk/netsurf/image/bmp.c
trunk/netsurf/image/gif.c
trunk/netsurf/image/ico.c
trunk/netsurf/image/jpeg.c
trunk/netsurf/image/mng.c
trunk/netsurf/image/nssprite.c
trunk/netsurf/image/png.c
trunk/netsurf/image/rsvg.c
trunk/netsurf/image/svg.c
trunk/netsurf/image/webp.c
trunk/netsurf/render/html_internal.h
trunk/netsurf/render/html_redraw.c
trunk/netsurf/render/textplain.c
trunk/netsurf/riscos/content-handlers/artworks.c
trunk/netsurf/riscos/content-handlers/draw.c
trunk/netsurf/riscos/content-handlers/sprite.c
trunk/netsurf/riscos/gui/url_bar.c
trunk/netsurf/riscos/print.c
trunk/netsurf/riscos/save_draw.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=125...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Tue Jun 28 15:17:39 2011
@@ -489,10 +489,8 @@
* redraw function if it doesn't exist.
*/
-bool content_redraw(hlcache_handle *h, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool content_redraw(hlcache_handle *h, struct content_redraw_data *data,
+ const struct rect *clip)
{
struct content *c = hlcache_handle_get_content(h);
@@ -508,9 +506,7 @@
return true;
}
- return c->handler->redraw(c, x, y, width, height,
- clip, scale, background_colour,
- repeat_x, repeat_y);
+ return c->handler->redraw(c, data, clip);
}
Modified: trunk/netsurf/content/content.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=125...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Tue Jun 28 15:17:39 2011
@@ -94,6 +94,27 @@
struct llcache_handle *download;
};
+
+struct content_redraw_data {
+ int x; /** coordinate for top-left of redraw */
+ int y; /** coordinate for top-left of redraw */
+
+ /** dimensions to render content at
+ * (for scaling contents with intrinsic dimensions) */
+ int width; /* horizontal */
+ int height; /* vertical */
+
+ /** the background colour */
+ colour background_colour;
+
+ /** Scale for redraw
+ * (for scaling contents without intrinsic dimensions) */
+ float scale; /* scale factor */
+
+ bool repeat_x; /* whether content is tiled in x direction */
+ bool repeat_y; /* whether content is tiled in y direction */
+};
+
/* The following are for hlcache */
void content_destroy(struct content *c);
@@ -127,10 +148,8 @@
browser_mouse_state mouse, int x, int y);
void content_mouse_action(struct hlcache_handle *h, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
-bool content_redraw(struct hlcache_handle *h, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data,
+ const struct rect *clip);
void content_open(struct hlcache_handle *h, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params);
Modified: trunk/netsurf/content/content_protected.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_protected...
==============================================================================
--- trunk/netsurf/content/content_protected.h (original)
+++ trunk/netsurf/content/content_protected.h Tue Jun 28 15:17:39 2011
@@ -54,10 +54,8 @@
browser_mouse_state mouse, int x, int y);
void (*mouse_action)(struct content *c, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
- bool (*redraw)(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+ bool (*redraw)(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
void (*open)(struct content *c, struct browser_window *bw,
struct content *page,
struct box *box,
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=125...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Jun 28 15:17:39 2011
@@ -100,6 +100,7 @@
int height = 0;
bool plot_ok = true;
content_type content_type;
+ struct content_redraw_data data;
if (bw == NULL) {
LOG(("NULL browser window"));
@@ -131,10 +132,20 @@
plot_ok &= plot.rectangle(clip->x0, clip->y0,
clip->x1, clip->y1, plot_style_fill_white);
}
+
+ /* Set up content redraw data */
+ data.x = x;
+ data.y = y;
+ data.width = width;
+ data.height = height;
+
+ data.background_colour = 0xFFFFFF;
+ data.scale = bw->scale;
+ data.repeat_x = false;
+ data.repeat_y = false;
/* Render the content */
- plot_ok &= content_redraw(bw->current_content, x, y, width, height,
- clip, bw->scale, 0xFFFFFF, false, false);
+ plot_ok &= content_redraw(bw->current_content, &data, clip);
if (bw->browser_window_type != BROWSER_WINDOW_IFRAME &&
plot.option_knockout)
Modified: trunk/netsurf/desktop/print.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/print.c?rev=12529...
==============================================================================
--- trunk/netsurf/desktop/print.c (original)
+++ trunk/netsurf/desktop/print.c Tue Jun 28 15:17:39 2011
@@ -122,6 +122,7 @@
struct print_settings *settings)
{
struct rect clip;
+ struct content_redraw_data data;
plot = *(printer->plotter);
html_redraw_printing_top_cropped = INT_MAX;
@@ -130,14 +131,21 @@
clip.y0 = 0;
clip.x1 = page_content_width * settings->scale;
clip.y1 = page_content_height * settings->scale;
-
+
+ data.x = 0;
+ data.y = -done_height;
+ data.width = 0;
+ data.height = 0;
+ data.background_colour = 0xFFFFFF;
+ data.scale = settings->scale;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
html_redraw_printing = true;
html_redraw_printing_border = clip.y1;
-
+
printer->print_next_page();
- if (!content_redraw(printed_content, 0, -done_height,
- 0, 0,
- &clip, settings->scale, 0xffffff, false, false))
+ if (!content_redraw(printed_content, &data, &clip))
return false;
done_height += page_content_height -
Modified: trunk/netsurf/desktop/thumbnail.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/thumbnail.c?rev=1...
==============================================================================
--- trunk/netsurf/desktop/thumbnail.c (original)
+++ trunk/netsurf/desktop/thumbnail.c Tue Jun 28 15:17:39 2011
@@ -60,6 +60,7 @@
int width, int height)
{
struct rect clip;
+ struct content_redraw_data data;
float scale;
bool plot_ok = true;
@@ -86,9 +87,19 @@
/* Find the scale we're using */
scale = thumbnail_get_redraw_scale(content, width);
+ /* Set up content redraw data */
+ data.x = 0;
+ data.y = 0;
+ data.width = width;
+ data.height = height;
+
+ data.background_colour = 0xFFFFFF;
+ data.scale = scale;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
/* Render the content */
- plot_ok &= content_redraw(content, 0, 0, width, height, &clip, scale,
- 0xFFFFFF, false, false);
+ plot_ok &= content_redraw(content, &data, &clip);
if (plot.option_knockout)
knockout_plot_end();
Modified: trunk/netsurf/desktop/tree.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/tree.c?rev=12529&...
==============================================================================
--- trunk/netsurf/desktop/tree.c (original)
+++ trunk/netsurf/desktop/tree.c Tue Jun 28 15:17:39 2011
@@ -1655,10 +1655,21 @@
if (c.x1 > c.x0 && c.y1 > c.y0) {
/* Valid clip rectangles only */
+ struct content_redraw_data data;
+
plot.clip(&c);
- content_redraw(icon , x, y + icon_inset,
- TREE_ICON_SIZE, TREE_ICON_SIZE,
- &c, 1, 0, false, false);
+
+ data.x = x;
+ data.y = y + icon_inset;
+ data.width = TREE_ICON_SIZE;
+ data.height = TREE_ICON_SIZE;
+
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
+ content_redraw(icon, &data, &c);
/* Restore previous clipping area */
plot.clip(clip);
Modified: trunk/netsurf/image/bmp.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/bmp.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/bmp.c (original)
+++ trunk/netsurf/image/bmp.c Tue Jun 28 15:17:39 2011
@@ -197,10 +197,8 @@
return true;
}
-static bool nsbmp_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
nsbmp_content *bmp = (nsbmp_content *) c;
bitmap_flags_t flags = BITMAPF_NONE;
@@ -211,13 +209,13 @@
c->bitmap = bmp->bmp->bitmap;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/image/gif.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/gif.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/gif.c (original)
+++ trunk/netsurf/image/gif.c Tue Jun 28 15:17:39 2011
@@ -338,10 +338,8 @@
return res;
}
-static bool nsgif_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool nsgif_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
nsgif_content *gif = (nsgif_content *) c;
bitmap_flags_t flags = BITMAPF_NONE;
@@ -352,16 +350,16 @@
c->bitmap = gif->gif->frame_image;
- if ((width == -1) && (height == -1))
+ if ((data->width == -1) && (data->height == -1))
return true;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/image/ico.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/ico.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/ico.c (original)
+++ trunk/netsurf/image/ico.c Tue Jun 28 15:17:39 2011
@@ -157,13 +157,11 @@
}
-static bool nsico_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
nsico_content *ico = (nsico_content *) c;
- struct bmp_image *bmp = ico_find(ico->ico, width, height);
+ struct bmp_image *bmp = ico_find(ico->ico, data->width, data->height);
bitmap_flags_t flags = BITMAPF_NONE;
if (!bmp->decoded)
@@ -172,12 +170,13 @@
c->bitmap = bmp->bitmap;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height, c->bitmap, background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/image/jpeg.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/jpeg.c?rev=12529&r1...
==============================================================================
--- trunk/netsurf/image/jpeg.c (original)
+++ trunk/netsurf/image/jpeg.c Tue Jun 28 15:17:39 2011
@@ -277,21 +277,18 @@
/**
* Redraw a CONTENT_JPEG with appropriate tiling.
*/
-static bool nsjpeg_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool nsjpeg_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
bitmap_flags_t flags = BITMAPF_NONE;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height,
- c->bitmap, background_colour,
- flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/image/mng.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/mng.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/mng.c (original)
+++ trunk/netsurf/image/mng.c Tue Jun 28 15:17:39 2011
@@ -67,10 +67,8 @@
unsigned int size);
static bool nsmng_convert(struct content *c);
static void nsmng_destroy(struct content *c);
-static bool nsmng_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool nsmng_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror nsmng_clone(const struct content *old, struct content **newc);
static content_type nsmng_content_type(lwc_string *mime_type);
@@ -687,10 +685,8 @@
}
-bool nsmng_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool nsmng_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
nsmng_content *mng = (nsmng_content *) c;
bool ret;
@@ -704,14 +700,13 @@
mng->opaque_test_pending = false;
}
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- ret = plot.bitmap(x, y, width, height,
- c->bitmap, background_colour,
- flags);
+ ret = plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
/* Check if we need to restart the animation
*/
Modified: trunk/netsurf/image/nssprite.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/nssprite.c?rev=1252...
==============================================================================
--- trunk/netsurf/image/nssprite.c (original)
+++ trunk/netsurf/image/nssprite.c Tue Jun 28 15:17:39 2011
@@ -50,10 +50,8 @@
bool quirks, struct content **c);
static bool nssprite_convert(struct content *c);
static void nssprite_destroy(struct content *c);
-static bool nssprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool nssprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror nssprite_clone(const struct content *old, struct content **newc);
static content_type nssprite_content_type(lwc_string *mime_type);
@@ -240,20 +238,18 @@
* Redraw a CONTENT_SPRITE.
*/
-bool nssprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool nssprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
bitmap_flags_t flags = BITMAPF_NONE;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height,
- c->bitmap, background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/image/png.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/png.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/png.c (original)
+++ trunk/netsurf/image/png.c Tue Jun 28 15:17:39 2011
@@ -362,23 +362,21 @@
}
-static bool nspng_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool nspng_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
nspng_content *png_c = (nspng_content *) c;
bitmap_flags_t flags = BITMAPF_NONE;
assert(png_c->bitmap != NULL);
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height,
- png_c->bitmap, background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ png_c->bitmap, data->background_colour, flags);
}
static nserror nspng_clone(const struct content *old_c, struct content **new_c)
Modified: trunk/netsurf/image/rsvg.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/rsvg.c?rev=12529&r1...
==============================================================================
--- trunk/netsurf/image/rsvg.c (original)
+++ trunk/netsurf/image/rsvg.c Tue Jun 28 15:17:39 2011
@@ -229,22 +229,20 @@
return true;
}
-static bool rsvg_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+static bool rsvg_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
bitmap_flags_t flags = BITMAPF_NONE;
assert(c->bitmap != NULL);
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height,
- c->bitmap, background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
static void rsvg_destroy(struct content *c)
Modified: trunk/netsurf/image/svg.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/svg.c?rev=12529&r1=...
==============================================================================
--- trunk/netsurf/image/svg.c (original)
+++ trunk/netsurf/image/svg.c Tue Jun 28 15:17:39 2011
@@ -51,10 +51,8 @@
static bool svg_convert(struct content *c);
static void svg_destroy(struct content *c);
static void svg_reformat(struct content *c, int width, int height);
-static bool svg_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool svg_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror svg_clone(const struct content *old, struct content **newc);
static content_type svg_content_type(lwc_string *mime_type);
@@ -285,21 +283,22 @@
* Redraw a CONTENT_SVG.
*/
-bool svg_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
-{
- if ((width <= 0) && (height <= 0)) {
+bool svg_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
+{
+ int x = data->x;
+ int y = data->y;
+
+ if ((data->width <= 0) && (data->height <= 0)) {
/* No point trying to plot SVG if it does not occupy a valid
* area */
return true;
}
- if ((repeat_x == false) && (repeat_y == false)) {
+ if ((data->repeat_x == false) && (data->repeat_y == false)) {
/* Simple case: SVG is not tiled */
- return svg_redraw_internal(c, x, y, width, height,
- clip, scale, background_colour);
+ return svg_redraw_internal(c, x, y, data->width, data->height,
+ clip, data->scale, data->background_colour);
} else {
/* Tiled redraw required. SVG repeats to extents of clip
* rectangle, in x, y or both directions */
@@ -307,26 +306,27 @@
/* Find the redraw boundaries to loop within */
x0 = x;
- if (repeat_x) {
- for (; x0 > clip->x0; x0 -= width);
+ if (data->repeat_x) {
+ for (; x0 > clip->x0; x0 -= data->width);
x1 = clip->x1;
} else {
x1 = x + 1;
}
y0 = y;
- if (repeat_y) {
- for (; y0 > clip->y0; y0 -= height);
+ if (data->repeat_y) {
+ for (; y0 > clip->y0; y0 -= data->height);
y1 = clip->y1;
} else {
y1 = y + 1;
}
/* Repeatedly plot the SVG across the area */
- for (y = y0; y < y1; y += height) {
- for (x = x0; x < x1; x += width) {
+ for (y = y0; y < y1; y += data->height) {
+ for (x = x0; x < x1; x += data->width) {
if (!svg_redraw_internal(c, x, y,
- width, height, clip, scale,
- background_colour)) {
+ data->width, data->height,
+ clip, data->scale,
+ data->background_colour)) {
return false;
}
}
Modified: trunk/netsurf/image/webp.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/webp.c?rev=12529&r1...
==============================================================================
--- trunk/netsurf/image/webp.c (original)
+++ trunk/netsurf/image/webp.c Tue Jun 28 15:17:39 2011
@@ -47,10 +47,8 @@
bool quirks, struct content **c);
static bool webp_convert(struct content *c);
static void webp_destroy(struct content *c);
-static bool webp_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool webp_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror webp_clone(const struct content *old, struct content **newc);
static content_type webp_content_type(lwc_string *mime_type);
@@ -213,20 +211,18 @@
* Redraw a CONTENT_WEBP.
*/
-bool webp_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool webp_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
bitmap_flags_t flags = BITMAPF_NONE;
- if (repeat_x)
+ if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
- if (repeat_y)
+ if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return plot.bitmap(x, y, width, height,
- c->bitmap, background_colour, flags);
+ return plot.bitmap(data->x, data->y, data->width, data->height,
+ c->bitmap, data->background_colour, flags);
}
Modified: trunk/netsurf/render/html_internal.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_internal.h?re...
==============================================================================
--- trunk/netsurf/render/html_internal.h (original)
+++ trunk/netsurf/render/html_internal.h Tue Jun 28 15:17:39 2011
@@ -103,10 +103,8 @@
void html_set_status(html_content *c, const char *extra);
/* in render/html_redraw.c */
-bool html_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+bool html_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
/* in render/html_interaction.c */
void html_mouse_track(struct content *c, struct browser_window *bw,
Modified: trunk/netsurf/render/html_redraw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_redraw.c?rev=...
==============================================================================
--- trunk/netsurf/render/html_redraw.c (original)
+++ trunk/netsurf/render/html_redraw.c Tue Jun 28 15:17:39 2011
@@ -97,23 +97,16 @@
/**
* Draw a CONTENT_HTML using the current set of plotters (plot).
*
- * \param c content of type CONTENT_HTML
- * \param x coordinate for top-left of redraw
- * \param y coordinate for top-left of redraw
- * \param width available width (not used for HTML redraw)
- * \param height available height (not used for HTML redraw)
- * \param clip clip rectangle
- * \param scale scale for redraw
- * \param background_colour the background colour
+ * \param c content of type CONTENT_HTML
+ * \param data redraw data for this content redraw
+ * \param clip current clip region
* \return true if successful, false otherwise
*
* x, y, clip_[xy][01] are in target coordinates.
*/
-bool html_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool html_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
html_content *html = (html_content *) c;
struct box *box;
@@ -121,7 +114,7 @@
bool select, select_only;
plot_style_t pstyle_fill_bg = {
.fill_type = PLOT_OP_TYPE_SOLID,
- .fill_colour = background_colour,
+ .fill_colour = data->background_colour,
};
box = html->layout;
@@ -138,8 +131,8 @@
select = true;
/* check if the redraw rectangle is completely inside of the
select menu */
- select_only = form_clip_inside_select_menu(control, scale,
- clip);
+ select_only = form_clip_inside_select_menu(control,
+ data->scale, clip);
}
if (!select_only) {
@@ -152,8 +145,8 @@
result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
&pstyle_fill_bg);
- result &= html_redraw_box(html, box, x, y, clip,
- scale, pstyle_fill_bg.fill_colour);
+ result &= html_redraw_box(html, box, data->x, data->y, clip,
+ data->scale, pstyle_fill_bg.fill_colour);
}
if (select) {
@@ -165,8 +158,8 @@
menu_y += box->height + box->border[BOTTOM].width +
box->padding[BOTTOM] + box->padding[TOP];
result &= form_redraw_select_menu(html->visible_select_menu,
- x + menu_x, y + menu_y,
- current_redraw_browser->scale, clip);
+ data->x + menu_x, data->y + menu_y,
+ data->scale, clip);
}
return result;
@@ -650,14 +643,21 @@
return false;
if (box->object && width != 0 && height != 0) {
+ struct content_redraw_data obj_data;
+
x_scrolled = x - scrollbar_get_offset(box->scroll_x) * scale;
y_scrolled = y - scrollbar_get_offset(box->scroll_y) * scale;
- if (!content_redraw(box->object,
- x_scrolled + padding_left,
- y_scrolled + padding_top,
- width, height, &r, scale,
- current_background_color,
- false, false))
+
+ obj_data.x = x_scrolled + padding_left;
+ obj_data.y = y_scrolled + padding_top;
+ obj_data.width = width;
+ obj_data.height = height;
+ obj_data.background_colour = current_background_color;
+ obj_data.scale = scale;
+ obj_data.repeat_x = false;
+ obj_data.repeat_y = false;
+
+ if (!content_redraw(box->object, &obj_data, &r))
return false;
} else if (box->iframe) {
@@ -2182,14 +2182,22 @@
}
/* valid clipping rectangles only */
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
+ struct content_redraw_data bg_data;
+
if (!plot.clip(&r))
return false;
- if (!content_redraw(
- background->background, x, y,
- ceilf(width * scale),
- ceilf(height * scale), &r,
- scale, *background_colour,
- repeat_x, repeat_y))
+
+ bg_data.x = x;
+ bg_data.y = y;
+ bg_data.width = ceilf(width * scale);
+ bg_data.height = ceilf(height * scale);
+ bg_data.background_colour = *background_colour;
+ bg_data.scale = scale;
+ bg_data.repeat_x = repeat_x;
+ bg_data.repeat_y = repeat_y;
+
+ if (!content_redraw(background->background,
+ &bg_data, &r))
return false;
}
}
@@ -2323,13 +2331,21 @@
}
/* valid clipping rectangles only */
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
+ struct content_redraw_data bg_data;
+
if (!plot.clip(&r))
return false;
- if (!content_redraw(box->background, x, y,
- ceilf(width * scale),
- ceilf(height * scale), &r,
- scale, *background_colour,
- repeat_x, repeat_y))
+
+ bg_data.x = x;
+ bg_data.y = y;
+ bg_data.width = ceilf(width * scale);
+ bg_data.height = ceilf(height * scale);
+ bg_data.background_colour = *background_colour;
+ bg_data.scale = scale;
+ bg_data.repeat_x = repeat_x;
+ bg_data.repeat_y = repeat_y;
+
+ if (!content_redraw(box->background, &bg_data, &r))
return false;
}
}
Modified: trunk/netsurf/render/textplain.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/textplain.c?rev=12...
==============================================================================
--- trunk/netsurf/render/textplain.c (original)
+++ trunk/netsurf/render/textplain.c Tue Jun 28 15:17:39 2011
@@ -102,10 +102,8 @@
browser_mouse_state mouse, int x, int y);
static void textplain_reformat(struct content *c, int width, int height);
static void textplain_destroy(struct content *c);
-static bool textplain_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool redraw_x, bool redraw_y);
+static bool textplain_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror textplain_clone(const struct content *old,
struct content **newc);
static content_type textplain_content_type(lwc_string *mime_type);
@@ -668,33 +666,28 @@
/**
* Draw a CONTENT_TEXTPLAIN using the current set of plotters (plot).
*
- * \param c content of type CONTENT_TEXTPLAIN
- * \param x coordinate for top-left of redraw
- * \param y coordinate for top-left of redraw
- * \param width available width
- * \param height available height
- * \param clip clip rectangle
- * \param scale scale for redraw
- * \param background_colour the background colour
+ * \param c content of type CONTENT_TEXTPLAIN
+ * \param data redraw data for this content redraw
+ * \param clip current clip region
* \return true if successful, false otherwise
*
* x, y, clip_[xy][01] are in target coordinates.
*/
-bool textplain_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool textplain_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
textplain_content *text = (textplain_content *) c;
struct browser_window *bw = current_redraw_browser;
char *utf8_data = text->utf8_data;
long lineno;
+ int x = data->x;
+ int y = data->y;
unsigned long line_count = text->physical_line_count;
float line_height = textplain_line_height();
- float scaled_line_height = line_height * scale;
- long line0 = (clip->y0 - y * scale) / scaled_line_height - 1;
- long line1 = (clip->y1 - y * scale) / scaled_line_height + 1;
+ float scaled_line_height = line_height * data->scale;
+ long line0 = (clip->y0 - y * data->scale) / scaled_line_height - 1;
+ long line1 = (clip->y1 - y * data->scale) / scaled_line_height + 1;
struct textplain_line *line = text->physical_line;
size_t length;
plot_style_t *plot_style_highlight;
@@ -718,19 +711,19 @@
return true;
/* choose a suitable background colour for any highlighted text */
- if ((background_colour & 0x808080) == 0x808080)
+ if ((data->background_colour & 0x808080) == 0x808080)
plot_style_highlight = plot_style_fill_black;
else
plot_style_highlight = plot_style_fill_white;
/* Set up font plot style */
- textplain_style.background = background_colour;
-
- x = (x + MARGIN) * scale;
- y = (y + MARGIN) * scale;
+ textplain_style.background = data->background_colour;
+
+ x = (x + MARGIN) * data->scale;
+ y = (y + MARGIN) * data->scale;
for (lineno = line0; lineno != line1; lineno++) {
const char *text = utf8_data + line[lineno].start;
- int tab_width = textplain_tab_width * scale;
+ int tab_width = textplain_tab_width * data->scale;
size_t offset = 0;
int tx = x;
@@ -752,7 +745,7 @@
line[lineno].start + offset, 0,
&textplain_style,
tx, y + (lineno * scaled_line_height),
- clip, line_height, scale, false))
+ clip, line_height, data->scale, false))
return false;
if (next_offset >= length)
@@ -761,7 +754,7 @@
/* locate end of string and align to next tab position */
if (nsfont.font_width(&textplain_style, &text[offset],
next_offset - offset, &width))
- tx += (int)(width * scale);
+ tx += (int)(width * data->scale);
ntx = x + ((1 + (tx - x) / tab_width) * tab_width);
Modified: trunk/netsurf/riscos/content-handlers/artworks.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/content-handlers/a...
==============================================================================
--- trunk/netsurf/riscos/content-handlers/artworks.c (original)
+++ trunk/netsurf/riscos/content-handlers/artworks.c Tue Jun 28 15:17:39 2011
@@ -110,10 +110,8 @@
bool quirks, struct content **c);
static bool artworks_convert(struct content *c);
static void artworks_destroy(struct content *c);
-static bool artworks_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool artworks_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror artworks_clone(const struct content *old, struct content **newc);
static content_type artworks_content_type(lwc_string *mime_type);
@@ -331,10 +329,8 @@
* Redraw a CONTENT_ARTWORKS.
*/
-bool artworks_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool artworks_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
static const ns_os_vdu_var_list vars = {
os_MODEVAR_XEIG_FACTOR,
@@ -367,15 +363,16 @@
&aw->render_workspace);
/* Scaled image. Transform units (65536*OS units) */
- matrix.entries[0][0] = width * 65536 / c->width;
+ matrix.entries[0][0] = data->width * 65536 / c->width;
matrix.entries[0][1] = 0;
matrix.entries[1][0] = 0;
- matrix.entries[1][1] = height * 65536 / c->height;
+ matrix.entries[1][1] = data->height * 65536 / c->height;
/* Draw units. (x,y) = bottom left */
- matrix.entries[2][0] = ro_plot_origin_x * 256 + x * 512 -
- aw->x0 * width / c->width;
- matrix.entries[2][1] = ro_plot_origin_y * 256 - (y + height) * 512 -
- aw->y0 * height / c->height;
+ matrix.entries[2][0] = ro_plot_origin_x * 256 + data->x * 512 -
+ aw->x0 * data->width / c->width;
+ matrix.entries[2][1] = ro_plot_origin_y * 256 -
+ (data->y + data->height) * 512 -
+ aw->y0 * data->height / c->height;
info.ditherx = ro_plot_origin_x;
info.dithery = ro_plot_origin_y;
@@ -392,16 +389,18 @@
info.clip_y1 = ((c->height - clip_y0) * 512) + aw->y0 + 511;
}
else {
- info.clip_x0 = (clip_x0 * 512 / scale) + aw->x0 - 511;
- info.clip_y0 = ((c->height - (clip_y1 / scale)) * 512) + aw->y0 - 511;
- info.clip_x1 = (clip_x1 * 512 / scale) + aw->x0 + 511;
- info.clip_y1 = ((c->height - (clip_y0 / scale)) * 512) + aw->y0 + 511;
+ info.clip_x0 = (clip_x0 * 512 / data->scale) + aw->x0 - 511;
+ info.clip_y0 = ((c->height - (clip_y1 / data->scale)) * 512) +
+ aw->y0 - 511;
+ info.clip_x1 = (clip_x1 * 512 / data->scale) + aw->x0 + 511;
+ info.clip_y1 = ((c->height - (clip_y0 / data->scale)) * 512) +
+ aw->y0 + 511;
}
info.print_lowx = 0;
info.print_lowy = 0;
info.print_handle = 0;
- info.bgcolour = 0x20000000 | background_colour;
+ info.bgcolour = 0x20000000 | data->background_colour;
error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals);
if (error) {
Modified: trunk/netsurf/riscos/content-handlers/draw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/content-handlers/d...
==============================================================================
--- trunk/netsurf/riscos/content-handlers/draw.c (original)
+++ trunk/netsurf/riscos/content-handlers/draw.c Tue Jun 28 15:17:39 2011
@@ -50,10 +50,8 @@
bool quirks, struct content **c);
static bool draw_convert(struct content *c);
static void draw_destroy(struct content *c);
-static bool draw_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool draw_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror draw_clone(const struct content *old, struct content **newc);
static content_type draw_content_type(lwc_string *mime_type);
@@ -208,16 +206,14 @@
* Redraw a CONTENT_DRAW.
*/
-bool draw_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool draw_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
draw_content *draw = (draw_content *) c;
os_trfm matrix;
const char *source_data;
unsigned long source_size;
- const void *data;
+ const void *src_data;
os_error *error;
if (plot.flush && !plot.flush())
@@ -227,20 +223,21 @@
return false;
source_data = content__get_source_data(c, &source_size);
- data = source_data;
+ src_data = source_data;
/* Scaled image. Transform units (65536*OS units) */
- matrix.entries[0][0] = width * 65536 / c->width;
+ matrix.entries[0][0] = data->width * 65536 / c->width;
matrix.entries[0][1] = 0;
matrix.entries[1][0] = 0;
- matrix.entries[1][1] = height * 65536 / c->height;
+ matrix.entries[1][1] = data->height * 65536 / c->height;
/* Draw units. (x,y) = bottom left */
- matrix.entries[2][0] = ro_plot_origin_x * 256 + x * 512 -
- draw->x0 * width / c->width;
- matrix.entries[2][1] = ro_plot_origin_y * 256 - (y + height) * 512 -
- draw->y0 * height / c->height;
-
- error = xdrawfile_render(0, (drawfile_diagram *) data,
+ matrix.entries[2][0] = ro_plot_origin_x * 256 + data->x * 512 -
+ draw->x0 * data->width / c->width;
+ matrix.entries[2][1] = ro_plot_origin_y * 256 -
+ (data->y + data->height) * 512 -
+ draw->y0 * data->height / c->height;
+
+ error = xdrawfile_render(0, (drawfile_diagram *) src_data,
(int) source_size, &matrix, 0, 0);
if (error) {
LOG(("xdrawfile_render: 0x%x: %s",
Modified: trunk/netsurf/riscos/content-handlers/sprite.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/content-handlers/s...
==============================================================================
--- trunk/netsurf/riscos/content-handlers/sprite.c (original)
+++ trunk/netsurf/riscos/content-handlers/sprite.c Tue Jun 28 15:17:39 2011
@@ -52,10 +52,8 @@
bool quirks, struct content **c);
static bool sprite_convert(struct content *c);
static void sprite_destroy(struct content *c);
-static bool sprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y);
+static bool sprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip);
static nserror sprite_clone(const struct content *old, struct content **newc);
static content_type sprite_content_type(lwc_string *mime_type);
@@ -208,10 +206,8 @@
* Redraw a CONTENT_SPRITE.
*/
-bool sprite_redraw(struct content *c, int x, int y,
- int width, int height, const struct rect *clip,
- float scale, colour background_colour,
- bool repeat_x, bool repeat_y)
+bool sprite_redraw(struct content *c, struct content_redraw_data *data,
+ const struct rect *clip)
{
sprite_content *sprite = (sprite_content *) c;
@@ -219,12 +215,12 @@
return false;
return image_redraw(sprite->data,
- ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2,
- width, height,
+ ro_plot_origin_x + data->x * 2,
+ ro_plot_origin_y - data->y * 2,
+ data->width, data->height,
c->width,
c->height,
- background_colour,
+ data->background_colour,
false, false, false,
IMAGE_PLOT_OS);
}
Modified: trunk/netsurf/riscos/gui/url_bar.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui/url_bar.c?rev=...
==============================================================================
--- trunk/netsurf/riscos/gui/url_bar.c (original)
+++ trunk/netsurf/riscos/gui/url_bar.c Tue Jun 28 15:17:39 2011
@@ -581,6 +581,8 @@
xwimp_plot_icon(&icon);
} else {
+ struct content_redraw_data data;
+
xwimp_set_colour(wimp_COLOUR_WHITE);
xos_plot(os_MOVE_TO,
(redraw->box.x0 - redraw->xscroll) +
@@ -598,13 +600,18 @@
clip.x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2;
clip.y1 = (ro_plot_origin_y - redraw->clip.y1) / 2;
- content_redraw(url_bar->favicon_content,
- (url_bar->favicon_extent.x0 +
- url_bar->favicon_offset.x) / 2,
- (url_bar->favicon_offset.y -
- url_bar->favicon_extent.y1) / 2,
- url_bar->favicon_width, url_bar->favicon_height,
- &clip, 1, 0, false, false);
+ data.x = (url_bar->favicon_extent.x0 +
+ url_bar->favicon_offset.x) / 2;
+ data.y = (url_bar->favicon_offset.y -
+ url_bar->favicon_extent.y1) / 2;
+ data.width = url_bar->favicon_width;
+ data.height = url_bar->favicon_height;
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
+ content_redraw(url_bar->favicon_content, &data, &clip);
}
}
Modified: trunk/netsurf/riscos/print.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/print.c?rev=12529&...
==============================================================================
--- trunk/netsurf/riscos/print.c (original)
+++ trunk/netsurf/riscos/print.c Tue Jun 28 15:17:39 2011
@@ -688,18 +688,25 @@
}
while (more) {
+ struct content_redraw_data data;
+
LOG(("redrawing area: [(%d, %d), (%d, %d)]",
b.x0, b.y0, b.x1, b.y1));
clip.x0 = (b.x0 - ro_plot_origin_x) / 2;
clip.y0 = (ro_plot_origin_y - b.y1) / 2;
clip.x1 = (b.x1 - ro_plot_origin_x) / 2;
clip.y1 = (ro_plot_origin_y - b.y0) / 2;
- if (!content_redraw(h, 0, 0,
- content_get_width(h),
- content_get_height(h),
- &clip,
- print_scale,
- 0xFFFFFF, false, false)) {
+
+ data.x = 0;
+ data.y = 0;
+ data.width = content_get_width(h);
+ data.height = content_get_height(h);
+ data.background_colour = 0xFFFFFF;
+ data.scale = print_scale;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
+ if (!content_redraw(h, &data, &clip)) {
error_message = "redraw error";
goto error;
}
@@ -795,6 +802,7 @@
{
unsigned int i;
struct rect clip;
+ struct content_redraw_data data;
const char *error_message = 0;
os_error *error;
@@ -806,10 +814,17 @@
clip.x0 = clip.y0 = INT_MIN;
clip.x1 = clip.y1 = INT_MAX;
+ data.x = 0;
+ data.y = 0;
+ data.width = content_get_width(h);
+ data.height = content_get_height(h);
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
plot = print_fonts_plotters;
- if (!content_redraw(h, 0, 0, content_get_width(h),
- content_get_height(h),
- &clip, 1, 0xffffff, false, false)) {
+ if (!content_redraw(h, &data, &clip)) {
if (print_fonts_error)
return print_fonts_error;
return "Declaring fonts failed.";
Modified: trunk/netsurf/riscos/save_draw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/save_draw.c?rev=12...
==============================================================================
--- trunk/netsurf/riscos/save_draw.c (original)
+++ trunk/netsurf/riscos/save_draw.c Tue Jun 28 15:17:39 2011
@@ -90,6 +90,7 @@
pencil_code code;
char *drawfile_buffer;
struct rect clip;
+ struct content_redraw_data data;
size_t drawfile_size;
os_error *error;
@@ -105,11 +106,17 @@
clip.x0 = clip.y0 = INT_MIN;
clip.x1 = clip.y1 = INT_MAX;
+ data.x = 0;
+ data.y = -ro_save_draw_height;
+ data.width = ro_save_draw_width;
+ data.height = ro_save_draw_height;
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
+
plot = ro_save_draw_plotters;
- if (!content_redraw(h, 0, -ro_save_draw_height,
- ro_save_draw_width, ro_save_draw_height,
- &clip, 1, 0xFFFFFF, false, false))
- {
+ if (!content_redraw(h, &data, &clip)) {
pencil_free(ro_save_draw_diagram);
return false;
}
11 years, 11 months
r12528 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 14:42:31 2011
New Revision: 12528
URL: http://source.netsurf-browser.org?rev=12528&view=rev
Log:
Prevent iframes with display:inline and percentage width from getting a width of AUTO during minmax layout phase.
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=12528...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Tue Jun 28 14:42:31 2011
@@ -3192,6 +3192,10 @@
if (0 < width + fixed)
width += fixed;
} else if (b->flags & IFRAME) {
+ /* TODO: handle percentage widths properly */
+ if (width == AUTO)
+ width = 400;
+
fixed = frac = 0;
calculate_mbp_width(b->style, LEFT, true, true, true,
&fixed, &frac);
@@ -3231,7 +3235,8 @@
#endif
assert(b != first);
- assert(0 <= *line_min && *line_min <= *line_max);
+ assert(0 <= *line_min);
+ assert(*line_min <= *line_max);
return b;
}
11 years, 11 months
r12526 chris_y - /trunk/netsurf/!NetSurf/Resources/it/Messages
by netsurf@semichrome.net
Author: chris_y
Date: Tue Jun 28 12:49:49 2011
New Revision: 12526
URL: http://source.netsurf-browser.org?rev=12526&view=rev
Log:
Update from Samir Hawamdeh
Modified:
trunk/netsurf/!NetSurf/Resources/it/Messages
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Tue Jun 28 12:49:49 2011
@@ -1,6 +1,6 @@
-# Italian messages for NetSurf 2.7/3.0 Development (Revision 12313)
+# Italian messages for NetSurf 2.7/3.0 Development (Revision 12464)
# Translated by Samir Hawamdeh (http://www.betatesting.it/backforthefuture)
-# 10.05.2011
+# 27.06.2011
# =========================================================================
#
# Description
@@ -305,7 +305,7 @@
SaveIFF:Salva come IFF...
ObjShow:Mostra oggetto
SelectFile:Seleziona file...
-ExternalApp:Open in external application
+ExternalApp:Apri con un'applicazione esterna
# Treeview interface tokens
# =========================
11 years, 11 months
r12525 tlsa - in /trunk/netsurf: desktop/browser.h desktop/plotters.h desktop/shape.h framebuffer/gui.c render/box.h riscos/save_draw.c utils/types.h
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 10:18:48 2011
New Revision: 12525
URL: http://source.netsurf-browser.org?rev=12525&view=rev
Log:
Move rectangle type to utils/types.h
Added:
trunk/netsurf/utils/types.h
Removed:
trunk/netsurf/desktop/shape.h
Modified:
trunk/netsurf/desktop/browser.h
trunk/netsurf/desktop/plotters.h
trunk/netsurf/framebuffer/gui.c
trunk/netsurf/render/box.h
trunk/netsurf/riscos/save_draw.c
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=125...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Tue Jun 28 10:18:48 2011
@@ -31,8 +31,8 @@
#include "content/content.h"
#include "desktop/gui.h"
#include "desktop/mouse.h"
-#include "desktop/shape.h"
#include "render/html.h"
+#include "utils/types.h"
struct box;
struct hlcache_handle;
Modified: trunk/netsurf/desktop/plotters.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/plotters.h?rev=12...
==============================================================================
--- trunk/netsurf/desktop/plotters.h (original)
+++ trunk/netsurf/desktop/plotters.h Tue Jun 28 10:18:48 2011
@@ -27,7 +27,7 @@
#include "css/css.h"
#include "content/content.h"
#include "desktop/plot_style.h"
-#include "desktop/shape.h"
+#include "utils/types.h"
struct bitmap;
Removed: trunk/netsurf/desktop/shape.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/shape.h?rev=12524...
==============================================================================
--- trunk/netsurf/desktop/shape.h (original)
+++ trunk/netsurf/desktop/shape.h (removed)
@@ -1,32 +1,0 @@
-/*
- * Copyright 2011 Michael Drake <tlsa(a)netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Core shapes.
- */
-
-#ifndef _NETSURF_DESKTOP_SHAPE_H_
-#define _NETSURF_DESKTOP_SHAPE_H_
-
-/* Rectangle coordinates */
-struct rect {
- int x0, y0; /* Top left */
- int x1, y1; /* Bottom right */
-};
-
-#endif
Modified: trunk/netsurf/framebuffer/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/gui.c?rev=125...
==============================================================================
--- trunk/netsurf/framebuffer/gui.c (original)
+++ trunk/netsurf/framebuffer/gui.c Tue Jun 28 10:18:48 2011
@@ -36,11 +36,11 @@
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
#include "desktop/options.h"
-#include "desktop/shape.h"
#include "utils/filepath.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/schedule.h"
+#include "utils/types.h"
#include "utils/url.h"
#include "utils/utils.h"
#include "desktop/textinput.h"
Modified: trunk/netsurf/render/box.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box.h?rev=12525&r1...
==============================================================================
--- trunk/netsurf/render/box.h (original)
+++ trunk/netsurf/render/box.h Tue Jun 28 10:18:48 2011
@@ -92,8 +92,8 @@
#include <libxml/HTMLparser.h>
#include "desktop/browser.h"
-#include "desktop/shape.h"
#include "css/css.h"
+#include "utils/types.h"
struct box;
struct column;
Modified: trunk/netsurf/riscos/save_draw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/save_draw.c?rev=12...
==============================================================================
--- trunk/netsurf/riscos/save_draw.c (original)
+++ trunk/netsurf/riscos/save_draw.c Tue Jun 28 10:18:48 2011
@@ -32,11 +32,11 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/plotters.h"
-#include "desktop/shape.h"
#include "riscos/bitmap.h"
#include "riscos/gui.h"
#include "riscos/save_draw.h"
#include "utils/log.h"
+#include "utils/types.h"
#include "utils/utils.h"
static bool ro_save_draw_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
Added: trunk/netsurf/utils/types.h
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/types.h?rev=12525&v...
==============================================================================
--- trunk/netsurf/utils/types.h (added)
+++ trunk/netsurf/utils/types.h Tue Jun 28 10:18:48 2011
@@ -1,0 +1,32 @@
+/*
+ * Copyright 2011 Michael Drake <tlsa(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Core types.
+ */
+
+#ifndef _NETSURF_UTILS_TYPES_H_
+#define _NETSURF_UTILS_TYPES_H_
+
+/* Rectangle coordinates */
+struct rect {
+ int x0, y0; /* Top left */
+ int x1, y1; /* Bottom right */
+};
+
+#endif
11 years, 11 months
r12524 tlsa - in /trunk/netsurf: desktop/gui.h desktop/search.c desktop/search.h render/html_redraw.c render/textplain.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 07:30:56 2011
New Revision: 12524
URL: http://source.netsurf-browser.org?rev=12524&view=rev
Log:
Make search_term_highlighted a core function.
Modified:
trunk/netsurf/desktop/gui.h
trunk/netsurf/desktop/search.c
trunk/netsurf/desktop/search.h
trunk/netsurf/render/html_redraw.c
trunk/netsurf/render/textplain.c
Modified: trunk/netsurf/desktop/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/gui.h?rev=12524&r...
==============================================================================
--- trunk/netsurf/desktop/gui.h (original)
+++ trunk/netsurf/desktop/gui.h Tue Jun 28 07:30:56 2011
@@ -135,11 +135,6 @@
void gui_launch_url(const char *url);
-bool gui_search_term_highlighted(struct gui_window *g,
- unsigned start_offset, unsigned end_offset,
- unsigned *start_idx, unsigned *end_idx,
- struct search_context *context);
-
struct ssl_cert_info;
void gui_cert_verify(const char *url, const struct ssl_cert_info *certs,
Modified: trunk/netsurf/desktop/search.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/search.c?rev=1252...
==============================================================================
--- trunk/netsurf/desktop/search.c (original)
+++ trunk/netsurf/desktop/search.c Tue Jun 28 07:30:56 2011
@@ -598,7 +598,7 @@
* Determines whether any portion of the given text box should be
* selected because it matches the current search string.
*
- * \param g gui window
+ * \param bw browser window
* \param start_offset byte offset within text of string to be checked
* \param end_offset byte offset within text
* \param start_idx byte offset within string of highlight start
@@ -606,12 +606,12 @@
* \return true iff part of the box should be highlighted
*/
-bool gui_search_term_highlighted(struct gui_window *g,
+bool search_term_highlighted(struct browser_window *bw,
unsigned start_offset, unsigned end_offset,
unsigned *start_idx, unsigned *end_idx,
struct search_context *context)
{
- if (g == context->bw->window) {
+ if (bw == context->bw) {
struct list_entry *a;
for(a = context->found->next; a; a = a->next)
if (a->sel && selection_defined(a->sel) &&
Modified: trunk/netsurf/desktop/search.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/search.h?rev=1252...
==============================================================================
--- trunk/netsurf/desktop/search.h (original)
+++ trunk/netsurf/desktop/search.h Tue Jun 28 07:30:56 2011
@@ -88,4 +88,9 @@
struct search_callbacks *callbacks, void *p);
void search_show_all(bool all, struct search_context *context);
+bool search_term_highlighted(struct browser_window *bw,
+ unsigned start_offset, unsigned end_offset,
+ unsigned *start_idx, unsigned *end_idx,
+ struct search_context *context);
+
#endif
Modified: trunk/netsurf/render/html_redraw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_redraw.c?rev=...
==============================================================================
--- trunk/netsurf/render/html_redraw.c (original)
+++ trunk/netsurf/render/html_redraw.c Tue Jun 28 07:30:56 2011
@@ -35,7 +35,6 @@
#include "content/content_protected.h"
#include "css/css.h"
#include "css/utils.h"
-#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
@@ -877,8 +876,8 @@
/* what about the current search operation, if any? */
if (!highlighted && (current_redraw_browser->search_context
!= NULL) &&
- gui_search_term_highlighted(
- current_redraw_browser->window,
+ search_term_highlighted(
+ current_redraw_browser,
offset, offset + len,
&start_idx, &end_idx,
current_redraw_browser->
Modified: trunk/netsurf/render/textplain.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/textplain.c?rev=12...
==============================================================================
--- trunk/netsurf/render/textplain.c (original)
+++ trunk/netsurf/render/textplain.c Tue Jun 28 07:30:56 2011
@@ -785,8 +785,7 @@
if (!highlighted && (bw->search_context
!= NULL)) {
unsigned start_idx, end_idx;
- if (gui_search_term_highlighted(
- bw->window,
+ if (search_term_highlighted(bw,
tab_ofst, tab_ofst + 1,
&start_idx, &end_idx,
bw->search_context))
11 years, 11 months
r12523 tlsa - /trunk/netsurf/beos/beos_gui.cpp
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 07:18:56 2011
New Revision: 12523
URL: http://source.netsurf-browser.org?rev=12523&view=rev
Log:
Remove search function that's implemented in the core.
Modified:
trunk/netsurf/beos/beos_gui.cpp
Modified: trunk/netsurf/beos/beos_gui.cpp
URL: http://source.netsurf-browser.org/trunk/netsurf/beos/beos_gui.cpp?rev=125...
==============================================================================
--- trunk/netsurf/beos/beos_gui.cpp (original)
+++ trunk/netsurf/beos/beos_gui.cpp Tue Jun 28 07:18:56 2011
@@ -1006,14 +1006,6 @@
}
-bool gui_search_term_highlighted(struct gui_window *g,
- unsigned start_offset, unsigned end_offset,
- unsigned *start_idx, unsigned *end_idx)
-{
- return false;
-}
-
-
/**
* Display a warning for a serious problem (eg memory exhaustion).
*
11 years, 11 months
r12522 tlsa - in /trunk/netsurf: desktop/browser.c desktop/browser.h render/form.c render/form.h render/html_interaction.c render/html_internal.h render/html_redraw.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 06:15:39 2011
New Revision: 12522
URL: http://source.netsurf-browser.org?rev=12522&view=rev
Log:
Core form select widget now associated with HTML contents. Don't use current_redraw_browser for select widget redraw. Fixes core select widget in iframes.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/render/form.c
trunk/netsurf/render/form.h
trunk/netsurf/render/html_interaction.c
trunk/netsurf/render/html_internal.h
trunk/netsurf/render/html_redraw.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=125...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Jun 28 06:15:39 2011
@@ -1455,8 +1455,6 @@
assert(bw);
assert(url);
-
- bw->visible_select_menu = NULL;
if (bw->parent != NULL) {
/* Not root window; don't set a URL in GUI URL bar */
@@ -1804,12 +1802,7 @@
break;
case DRAGGING_OTHER:
-
- if (bw->visible_select_menu != NULL) {
- form_select_mouse_drag_end(bw->visible_select_menu,
- mouse, x, y);
- bw->drag_type = DRAGGING_NONE;
- }
+ /* Drag handled by content handler */
break;
default:
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=125...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Tue Jun 28 06:15:39 2011
@@ -184,8 +184,6 @@
/** search context for free text search */
struct search_context *search_context;
-
- struct form_control *visible_select_menu;
/** cache of the currently displayed status text. */
char *status_text; /**< Current status bar text. */
Modified: trunk/netsurf/render/form.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/form.c?rev=12522&r...
==============================================================================
--- trunk/netsurf/render/form.c (original)
+++ trunk/netsurf/render/form.c Tue Jun 28 06:15:39 2011
@@ -46,6 +46,7 @@
#include "render/font.h"
#include "render/form.h"
#include "render/html.h"
+#include "render/html_internal.h"
#include "render/layout.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -67,7 +68,7 @@
bool scroll_capture;
select_menu_redraw_callback callback;
void *client_data;
- struct browser_window *bw;
+ struct content *c;
};
static plot_style_t plot_style_fill_selected = {
@@ -868,7 +869,7 @@
bool form_open_select_menu(void *client_data,
struct form_control *control,
select_menu_redraw_callback callback,
- struct browser_window *bw)
+ struct content *c)
{
int i, line_height_with_spacing, scroll;
struct form_option *option;
@@ -876,45 +877,48 @@
plot_font_style_t fstyle;
int total_height;
struct form_select_menu *menu;
-
+
/* if the menu is opened for the first time */
if (control->data.select.menu == NULL) {
-
+
menu = calloc(1, sizeof (struct form_select_menu));
if (menu == NULL) {
warn_user("NoMemory", 0);
return false;
}
-
+
control->data.select.menu = menu;
-
+
box = control->box;
menu->width = box->width +
box->border[RIGHT].width +
box->border[LEFT].width +
box->padding[RIGHT] + box->padding[LEFT];
-
+
font_plot_style_from_css(control->box->style,
&fstyle);
menu->f_size = fstyle.size;
-
- menu->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2), FMUL(nscss_screen_dpi, INTTOFIX((fstyle.size / FONT_SIZE_SCALE))))), F_72));
-
+
+ menu->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2),
+ FMUL(nscss_screen_dpi,
+ INTTOFIX(fstyle.size / FONT_SIZE_SCALE)))),
+ F_72));
+
line_height_with_spacing = menu->line_height +
menu->line_height *
SELECT_LINE_SPACING;
-
+
total_height = control->data.select.num_items *
line_height_with_spacing;
menu->height = total_height;
-
+
scroll = 0;
if (menu->height > MAX_SELECT_HEIGHT) {
-
+
menu->height = MAX_SELECT_HEIGHT;
-
+
if (control->data.select.num_selected > 0) {
i = 0;
option = control->data.select.items;
@@ -922,7 +926,7 @@
option = option->next;
i++;
}
-
+
if ((i + 1) * line_height_with_spacing >
MAX_SELECT_HEIGHT)
scroll = (i + 1) *
@@ -942,12 +946,12 @@
free(menu);
return false;
}
- menu->bw = bw;
+ menu->c = c;
}
else menu = control->data.select.menu;
-
+
menu->callback(client_data, 0, 0, menu->width, menu->height);
-
+
return true;
}
@@ -1143,7 +1147,8 @@
void form_select_menu_clicked(struct form_control *control, int x, int y)
{
struct form_select_menu *menu = control->data.select.menu;
- struct form_option *option;
+ struct form_option *option;
+ html_content *html = (html_content *)menu->c;
int line_height, line_height_with_spacing;
int item_bottom_y;
int scroll, i;
@@ -1163,9 +1168,11 @@
i++;
}
- if (option != NULL)
- form_select_process_selection(menu->bw->current_content,
+ if (option != NULL) {
+ /* TODO: going via the bw to get a hlcache_handle is nasty */
+ form_select_process_selection(html->bw->current_content,
control, i);
+ }
menu->callback(menu->client_data, 0, 0, menu->width, menu->height);
}
@@ -1278,6 +1285,7 @@
{
struct form_control *control = client_data;
struct form_select_menu *menu = control->data.select.menu;
+ html_content *html = (html_content *)menu->c;
switch (scrollbar_data->msg) {
case SCROLLBAR_MSG_REDRAW:
@@ -1295,10 +1303,10 @@
menu->height);
break;
case SCROLLBAR_MSG_SCROLL_START:
- browser_window_set_drag_type(menu->bw, DRAGGING_OTHER);
+ browser_window_set_drag_type(html->bw, DRAGGING_OTHER);
menu->scroll_capture = true;
- gui_window_box_scroll_start(menu->bw->window,
+ gui_window_box_scroll_start(html->bw->window,
scrollbar_data->x0, scrollbar_data->y0,
scrollbar_data->x1, scrollbar_data->y1);
break;
@@ -1399,18 +1407,18 @@
void form_select_menu_callback(void *client_data,
int x, int y, int width, int height)
{
- struct browser_window *bw = client_data;
+ html_content *html = client_data;
int menu_x, menu_y;
struct box *box;
- box = bw->visible_select_menu->box;
+ box = html->visible_select_menu->box;
box_coords(box, &menu_x, &menu_y);
menu_x -= box->border[LEFT].width;
menu_y += box->height + box->border[BOTTOM].width +
box->padding[BOTTOM] +
box->padding[TOP];
- browser_window_redraw_rect(bw, menu_x + x, menu_y + y,
+ content__request_redraw((struct content *)html, menu_x + x, menu_y + y,
width, height);
}
Modified: trunk/netsurf/render/form.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/form.h?rev=12522&r...
==============================================================================
--- trunk/netsurf/render/form.h (original)
+++ trunk/netsurf/render/form.h Tue Jun 28 06:15:39 2011
@@ -156,7 +156,7 @@
bool form_open_select_menu(void *client_data,
struct form_control *control,
select_menu_redraw_callback redraw_callback,
- struct browser_window *bw);
+ struct content *c);
void form_select_menu_callback(void *client_data,
int x, int y, int width, int height);
void form_free_select_menu(struct form_control *control);
Modified: trunk/netsurf/render/html_interaction.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_interaction.c...
==============================================================================
--- trunk/netsurf/render/html_interaction.c (original)
+++ trunk/netsurf/render/html_interaction.c Tue Jun 28 06:15:39 2011
@@ -145,22 +145,29 @@
html_content *html = (html_content *) c;
- if (bw->visible_select_menu != NULL) {
- box = bw->visible_select_menu->box;
+ if (bw->drag_type != DRAGGING_NONE && !mouse &&
+ html->visible_select_menu != NULL) {
+ /* drag end: select menu */
+ form_select_mouse_drag_end(html->visible_select_menu,
+ mouse, x, y);
+ }
+
+ if (html->visible_select_menu != NULL) {
+ box = html->visible_select_menu->box;
box_coords(box, &box_x, &box_y);
box_x -= box->border[LEFT].width;
box_y += box->height + box->border[BOTTOM].width +
box->padding[BOTTOM] + box->padding[TOP];
- status = form_select_mouse_action(bw->visible_select_menu,
+ status = form_select_mouse_action(html->visible_select_menu,
mouse, x - box_x, y - box_y);
if (status != NULL)
browser_window_set_status(bw, status);
else {
int width, height;
- form_select_get_dimensions(bw->visible_select_menu,
+ form_select_get_dimensions(html->visible_select_menu,
&width, &height);
- bw->visible_select_menu = NULL;
+ html->visible_select_menu = NULL;
browser_window_redraw_rect(bw, box_x, box_y,
width, height);
}
@@ -169,7 +176,7 @@
if (bw->drag_type != DRAGGING_NONE && !mouse &&
html->scrollbar != NULL) {
- /* Scrollbar drag end */
+ /* drag end: scrollbar */
html_overflow_scroll_drag_end(html->scrollbar, mouse, x, y);
}
@@ -321,10 +328,10 @@
pointer = GUI_POINTER_MENU;
if (mouse & BROWSER_MOUSE_CLICK_1 &&
option_core_select_menu) {
- bw->visible_select_menu = gadget;
- form_open_select_menu(bw, gadget,
+ html->visible_select_menu = gadget;
+ form_open_select_menu(c, gadget,
form_select_menu_callback,
- bw);
+ c);
pointer = GUI_POINTER_DEFAULT;
} else if (mouse & BROWSER_MOUSE_CLICK_1)
gui_create_form_select_menu(bw, gadget);
Modified: trunk/netsurf/render/html_internal.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_internal.h?re...
==============================================================================
--- trunk/netsurf/render/html_internal.h (original)
+++ trunk/netsurf/render/html_internal.h Tue Jun 28 06:15:39 2011
@@ -88,6 +88,10 @@
/** Scrollbar capturing all mouse events, updated to any active HTML
* scrollbar, or NULL when no scrollbar drags active */
struct scrollbar *scrollbar;
+
+ /** Open core-handled form SELECT menu,
+ * or NULL if none currently open. */
+ struct form_control *visible_select_menu;
} html_content;
Modified: trunk/netsurf/render/html_redraw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_redraw.c?rev=...
==============================================================================
--- trunk/netsurf/render/html_redraw.c (original)
+++ trunk/netsurf/render/html_redraw.c Tue Jun 28 06:15:39 2011
@@ -134,9 +134,8 @@
select = false;
select_only = false;
if (current_redraw_browser != NULL &&
- current_redraw_browser->visible_select_menu != NULL) {
- struct form_control *control =
- current_redraw_browser->visible_select_menu;
+ html->visible_select_menu != NULL) {
+ struct form_control *control = html->visible_select_menu;
select = true;
/* check if the redraw rectangle is completely inside of the
select menu */
@@ -160,14 +159,13 @@
if (select) {
int menu_x, menu_y;
- box = current_redraw_browser->visible_select_menu->box;
+ box = html->visible_select_menu->box;
box_coords(box, &menu_x, &menu_y);
menu_x -= box->border[LEFT].width;
menu_y += box->height + box->border[BOTTOM].width +
box->padding[BOTTOM] + box->padding[TOP];
- result &= form_redraw_select_menu(
- current_redraw_browser->visible_select_menu,
+ result &= form_redraw_select_menu(html->visible_select_menu,
x + menu_x, y + menu_y,
current_redraw_browser->scale, clip);
}
11 years, 11 months
r12521 tlsa - /trunk/netsurf/render/html_interaction.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 05:07:53 2011
New Revision: 12521
URL: http://source.netsurf-browser.org?rev=12521&view=rev
Log:
Use interface for turning off drag.
Modified:
trunk/netsurf/render/html_interaction.c
Modified: trunk/netsurf/render/html_interaction.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_interaction.c...
==============================================================================
--- trunk/netsurf/render/html_interaction.c (original)
+++ trunk/netsurf/render/html_interaction.c Tue Jun 28 05:07:53 2011
@@ -197,8 +197,9 @@
browser_window_set_status(bw, status);
return;
}
-
- bw->drag_type = DRAGGING_NONE;
+
+ /* Content related drags handled by now */
+ browser_window_set_drag_type(bw, DRAGGING_NONE);
/* search the box tree for a link, imagemap, form control, or
* box with scrollbars */
11 years, 11 months