Author: jmb
Date: Sun Feb 28 10:19:50 2010
New Revision: 10088
URL:
http://source.netsurf-browser.org?rev=10088&view=rev
Log:
s/struct content/hlcache_handle/ in box*_at_point APIs
Modified:
branches/jmb/new-cache/render/box.c
branches/jmb/new-cache/render/box.h
Modified: branches/jmb/new-cache/render/box.c
URL:
http://source.netsurf-browser.org/branches/jmb/new-cache/render/box.c?rev...
==============================================================================
--- branches/jmb/new-cache/render/box.c (original)
+++ branches/jmb/new-cache/render/box.c Sun Feb 28 10:19:50 2010
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <string.h>
#include "content/content_protected.h"
+#include "content/hlcache.h"
#include "css/css.h"
#include "css/dump.h"
#include "desktop/scroll.h"
@@ -312,7 +313,7 @@
struct box *box_at_point(struct box *box, const int x, const int y,
int *box_x, int *box_y,
- struct content **content)
+ hlcache_handle **content)
{
int bx = *box_x, by = *box_y;
struct box *child, *sibling;
@@ -324,6 +325,7 @@
if (box->object) {
if (box->object->type == CONTENT_HTML &&
box->object->data.html.layout) {
+//newcache: object field of struct box needs to be a hlcache_handle *
*content = box->object;
box = box->object->data.html.layout;
} else {
@@ -503,19 +505,23 @@
/**
* Find the box containing an object at the given coordinates, if any.
*
- * \param c content to search, must have type CONTENT_HTML
+ * \param h content to search, must have type CONTENT_HTML
* \param x coordinates in document units
* \param y coordinates in document units
*/
-struct box *box_object_at_point(struct content *c, int x, int y)
-{
- struct box *box = c->data.html.layout;
+struct box *box_object_at_point(hlcache_handle *h, int x, int y)
+{
+ struct content *c = hlcache_handle_get_content(h);
+ struct box *box;
int box_x = 0, box_y = 0;
- struct content *content = c;
+ hlcache_handle *content = h;
struct box *object_box = 0;
+ assert(c != NULL);
assert(c->type == CONTENT_HTML);
+
+ box = c->data.html.layout;
while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
if (box->style && css_computed_visibility(box->style) ==
@@ -533,19 +539,23 @@
/**
* Find the box containing an href at the given coordinates, if any.
*
- * \param c content to search, must have type CONTENT_HTML
+ * \param h content to search, must have type CONTENT_HTML
* \param x coordinates in document units
* \param y coordinates in document units
*/
-struct box *box_href_at_point(struct content *c, int x, int y)
-{
- struct box *box = c->data.html.layout;
+struct box *box_href_at_point(hlcache_handle *h, int x, int y)
+{
+ struct content *c = hlcache_handle_get_content(h);
+ struct box *box;
int box_x = 0, box_y = 0;
- struct content *content = c;
+ hlcache_handle *content = h;
struct box *href_box = 0;
+ assert(c != NULL);
assert(c->type == CONTENT_HTML);
+
+ box = c->data.html.layout;
while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
if (box->style && css_computed_visibility(box->style) ==
Modified: branches/jmb/new-cache/render/box.h
URL:
http://source.netsurf-browser.org/branches/jmb/new-cache/render/box.h?rev...
==============================================================================
--- branches/jmb/new-cache/render/box.h (original)
+++ branches/jmb/new-cache/render/box.h Sun Feb 28 10:19:50 2010
@@ -307,9 +307,9 @@
void box_bounds(struct box *box, struct rect *r);
void box_coords(struct box *box, int *x, int *y);
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y, struct content **content);
-struct box *box_object_at_point(struct content *c, int x, int y);
-struct box *box_href_at_point(struct content *c, int x, int y);
+ int *box_x, int *box_y, struct hlcache_handle **content);
+struct box *box_object_at_point(struct hlcache_handle *h, int x, int y);
+struct box *box_href_at_point(struct hlcache_handle *h, int x, int y);
struct box *box_find_by_id(struct box *box, const char *id);
bool box_visible(struct box *box);
void box_dump(FILE *stream, struct box *box, unsigned int depth);