r12520 tlsa - /trunk/netsurf/render/html_redraw.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Jun 28 03:56:37 2011
New Revision: 12520
URL: http://source.netsurf-browser.org?rev=12520&view=rev
Log:
Pass the content object down through html_redraw. Make overflow scrollbars used content for scrollbar, rather than browser window. Fixes overflow scrollbars in iframes.
Modified:
trunk/netsurf/render/html_redraw.c
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 03:56:37 2011
@@ -54,10 +54,10 @@
#include "utils/utils.h"
-static bool html_redraw_box(struct box *box, int x, int y,
+static bool html_redraw_box(html_content *html, struct box *box, int x, int y,
const struct rect *clip, float scale,
colour current_background_color);
-static bool html_redraw_box_children(struct box *box,
+static bool html_redraw_box_children(html_content *html, struct box *box,
int x_parent, int y_parent, const struct rect *clip,
float scale, colour current_background_color);
static bool html_redraw_text_box(struct box *box, int x, int y,
@@ -154,7 +154,7 @@
result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
&pstyle_fill_bg);
- result &= html_redraw_box(box, x, y, clip,
+ result &= html_redraw_box(html, box, x, y, clip,
scale, pstyle_fill_bg.fill_colour);
}
@@ -244,6 +244,7 @@
/**
* Recursively draw a box.
*
+ * \param html html content
* \param box box to draw
* \param x_parent coordinate of parent box
* \param y_parent coordinate of parent box
@@ -256,7 +257,8 @@
* x, y, clip_[xy][01] are in target coordinates.
*/
-bool html_redraw_box(struct box *box, int x_parent, int y_parent,
+bool html_redraw_box(html_content *html, struct box *box,
+ int x_parent, int y_parent,
const struct rect *clip, float scale,
colour current_background_color)
{
@@ -387,7 +389,7 @@
CSS_VISIBILITY_HIDDEN) {
if ((plot.group_start) && (!plot.group_start("hidden box")))
return false;
- if (!html_redraw_box_children(box, x_parent, y_parent,
+ if (!html_redraw_box_children(html, box, x_parent, y_parent,
&r, scale, current_background_color))
return false;
return ((!plot.group_end) || (plot.group_end()));
@@ -691,7 +693,7 @@
return false;
} else {
- if (!html_redraw_box_children(box, x_parent, y_parent, &r,
+ if (!html_redraw_box_children(html, box, x_parent, y_parent, &r,
scale, current_background_color))
return false;
}
@@ -703,7 +705,7 @@
/* list marker */
if (box->list_marker)
- if (!html_redraw_box(box->list_marker,
+ if (!html_redraw_box(html, box->list_marker,
x_parent + box->x -
scrollbar_get_offset(box->scroll_x),
y_parent + box->y -
@@ -723,10 +725,8 @@
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
- /* TODO: pass content down, so we don't need
- * current_redraw_browser here */
- if (!box_handle_scrollbars(hlcache_handle_get_content(current_redraw_browser->current_content), box,
- has_x_scroll, has_y_scroll))
+ if (!box_handle_scrollbars((struct content *)html,
+ box, has_x_scroll, has_y_scroll))
return false;
if (box->scroll_x != NULL)
@@ -755,6 +755,7 @@
/**
* Draw the various children of a box.
*
+ * \param html html content
* \param box box to draw children of
* \param x_parent coordinate of parent box
* \param y_parent coordinate of parent box
@@ -764,7 +765,8 @@
* \return true if successful, false otherwise
*/
-bool html_redraw_box_children(struct box *box, int x_parent, int y_parent,
+bool html_redraw_box_children(html_content *html, struct box *box,
+ int x_parent, int y_parent,
const struct rect *clip, float scale,
colour current_background_color)
{
@@ -773,7 +775,7 @@
for (c = box->children; c; c = c->next) {
if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
- if (!html_redraw_box(c,
+ if (!html_redraw_box(html, c,
x_parent + box->x -
scrollbar_get_offset(box->scroll_x),
y_parent + box->y -
@@ -782,7 +784,7 @@
return false;
}
for (c = box->float_children; c; c = c->next_float)
- if (!html_redraw_box(c,
+ if (!html_redraw_box(html, c,
x_parent + box->x -
scrollbar_get_offset(box->scroll_x),
y_parent + box->y -
11 years, 11 months
r12519 tlsa - in /trunk/netsurf: desktop/browser.c desktop/browser.h desktop/textinput.c render/box.c render/box.h render/html.c render/html.h render/html_interaction.c render/html_internal.h render/html_redraw.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 17:21:15 2011
New Revision: 12519
URL: http://source.netsurf-browser.org?rev=12519&view=rev
Log:
HTML contents manage box scrollbars, rather than browser_windows.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/desktop/textinput.c
trunk/netsurf/render/box.c
trunk/netsurf/render/box.h
trunk/netsurf/render/html.c
trunk/netsurf/render/html.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 Mon Jun 27 17:21:15 2011
@@ -633,8 +633,6 @@
browser_window_remove_caret(bw);
- bw->scrollbar = NULL;
-
if (bw->window)
gui_window_new_content(bw->window);
@@ -708,7 +706,6 @@
else if (c == bw->current_content) {
bw->current_content = NULL;
browser_window_remove_caret(bw);
- bw->scrollbar = NULL;
selection_init(bw->sel, NULL);
}
@@ -1803,6 +1800,7 @@
}
selection_drag_end(bw->sel);
}
+ bw->drag_type = DRAGGING_NONE;
break;
case DRAGGING_OTHER:
@@ -1810,19 +1808,14 @@
if (bw->visible_select_menu != NULL) {
form_select_mouse_drag_end(bw->visible_select_menu,
mouse, x, y);
- }
-
- if (bw->scrollbar != NULL) {
- html_overflow_scroll_drag_end(bw->scrollbar,
- mouse, x, y);
+ bw->drag_type = DRAGGING_NONE;
}
break;
default:
- break;
- }
-
- bw->drag_type = DRAGGING_NONE;
+ bw->drag_type = DRAGGING_NONE;
+ break;
+ }
}
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 Mon Jun 27 17:21:15 2011
@@ -114,10 +114,6 @@
unsigned int drag_resize_up : 1;
unsigned int drag_resize_down : 1;
- /** Scroll capturing all mouse events, updated to any active HTML
- * scrollbar, or NULL when no scrollbar drags active */
- struct scrollbar *scrollbar;
-
/** Current fetch is download */
bool download;
@@ -196,11 +192,6 @@
int status_text_len; /**< Length of the ::status_text buffer. */
int status_match; /**< Number of times an idempotent status-set operation was performed. */
int status_miss; /**< Number of times status was really updated. */
-};
-
-struct browser_scrollbar_data {
- struct browser_window *bw;
- struct box *box;
};
extern struct browser_window *current_redraw_browser;
Modified: trunk/netsurf/desktop/textinput.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/textinput.c?rev=1...
==============================================================================
--- trunk/netsurf/desktop/textinput.c (original)
+++ trunk/netsurf/desktop/textinput.c Mon Jun 27 17:21:15 2011
@@ -37,6 +37,7 @@
#include "render/box.h"
#include "render/font.h"
#include "render/form.h"
+#include "render/html_internal.h"
#include "render/layout.h"
#include "utils/log.h"
#include "utils/talloc.h"
@@ -2168,7 +2169,7 @@
textarea->width = width;
textarea->height = height;
layout_calculate_descendant_bboxes(textarea);
- box_handle_scrollbars(bw, textarea,
+ box_handle_scrollbars(c, textarea,
box_hscrollbar_present(textarea),
box_vscrollbar_present(textarea));
}
@@ -2263,6 +2264,8 @@
bool ensure_caret_visible(struct browser_window *bw, struct box *textarea)
{
+ html_content *html = (html_content *)
+ hlcache_handle_get_content(bw->current_content);
int cx, cy;
int scrollx, scrolly;
@@ -2302,14 +2305,14 @@
return false;
if (textarea->scroll_x != NULL) {
- bw->scrollbar = textarea->scroll_x;
+ html->scrollbar = textarea->scroll_x;
scrollbar_set(textarea->scroll_x, scrollx, false);
- bw->scrollbar = NULL;
+ html->scrollbar = NULL;
}
if (textarea->scroll_y != NULL) {
- bw->scrollbar = textarea->scroll_x;
+ html->scrollbar = textarea->scroll_x;
scrollbar_set(textarea->scroll_y, scrolly, false);
- bw->scrollbar = NULL;
+ html->scrollbar = NULL;
}
return true;
Modified: trunk/netsurf/render/box.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box.c?rev=12519&r1...
==============================================================================
--- trunk/netsurf/render/box.c (original)
+++ trunk/netsurf/render/box.c Mon Jun 27 17:21:15 2011
@@ -999,16 +999,16 @@
* Applies the given scroll setup to a box. This includes scroll
* creation/deletion as well as scroll dimension updates.
*
- * \param bw browser window in which the box is located
+ * \param c content in which the box is located
* \param box the box to handle the scrolls for
* \param bottom whether the horizontal scrollbar should be present
* \param right whether the vertical scrollbar should be present
* \return true on success false otherwise
*/
-bool box_handle_scrollbars(struct browser_window *bw, struct box *box,
+bool box_handle_scrollbars(struct content *c, struct box *box,
bool bottom, bool right)
{
- struct browser_scrollbar_data *data;
+ struct html_scrollbar_data *data;
int visible_width, visible_height;
int full_width, full_height;
@@ -1043,13 +1043,13 @@
if (right) {
if (box->scroll_y == NULL) {
- data = malloc(sizeof(struct browser_scrollbar_data));
+ data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
LOG(("malloc failed"));
warn_user("NoMemory", 0);
return false;
}
- data->bw = bw;
+ data->c = c;
data->box = box;
if (!scrollbar_create(false, visible_height,
full_height, visible_height,
@@ -1063,13 +1063,13 @@
}
if (bottom) {
if (box->scroll_x == NULL) {
- data = malloc(sizeof(struct browser_scrollbar_data));
+ data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
LOG(("malloc failed"));
warn_user("NoMemory", 0);
return false;
}
- data->bw = bw;
+ data->c = c;
data->box = box;
if (!scrollbar_create(true,
visible_width -
Modified: trunk/netsurf/render/box.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box.h?rev=12519&r1...
==============================================================================
--- trunk/netsurf/render/box.h (original)
+++ trunk/netsurf/render/box.h Mon Jun 27 17:21:15 2011
@@ -331,7 +331,7 @@
void box_dump(FILE *stream, struct box *box, unsigned int depth);
bool box_extract_link(const char *rel, const char *base, char **result);
-bool box_handle_scrollbars(struct browser_window *bw, struct box *box,
+bool box_handle_scrollbars(struct content *c, struct box *box,
bool bottom, bool right);
bool box_vscrollbar_present(const struct box *box);
bool box_hscrollbar_present(const struct box *box);
Modified: trunk/netsurf/render/html.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html.c?rev=12519&r...
==============================================================================
--- trunk/netsurf/render/html.c (original)
+++ trunk/netsurf/render/html.c Mon Jun 27 17:21:15 2011
@@ -242,6 +242,7 @@
c->page = NULL;
c->box = NULL;
c->font_func = &nsfont;
+ c->scrollbar = NULL;
nerror = http_parameter_list_find_item(params, "charset", &charset);
if (nerror == NSERROR_OK) {
Modified: trunk/netsurf/render/html.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html.h?rev=12519&r...
==============================================================================
--- trunk/netsurf/render/html.h (original)
+++ trunk/netsurf/render/html.h Mon Jun 27 17:21:15 2011
@@ -83,6 +83,11 @@
/** Bitmap of acceptable content types */
content_type permitted_types;
bool background; /**< This object is a background image. */
+};
+
+struct html_scrollbar_data {
+ struct content *c;
+ struct box *box;
};
/** Frame tree (<frameset>, <frame>) */
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 Mon Jun 27 17:21:15 2011
@@ -142,6 +142,7 @@
plot_font_style_t fstyle;
int scroll_mouse_x = 0, scroll_mouse_y = 0;
int padding_left, padding_right, padding_top, padding_bottom;
+ html_content *html = (html_content *) c;
if (bw->visible_select_menu != NULL) {
@@ -166,24 +167,30 @@
return;
}
- if (bw->scrollbar != NULL) {
- struct browser_scrollbar_data *data =
- scrollbar_get_data(bw->scrollbar);
+ if (bw->drag_type != DRAGGING_NONE && !mouse &&
+ html->scrollbar != NULL) {
+ /* Scrollbar drag end */
+ html_overflow_scroll_drag_end(html->scrollbar, mouse, x, y);
+ }
+
+ if (html->scrollbar != NULL) {
+ struct html_scrollbar_data *data =
+ scrollbar_get_data(html->scrollbar);
box = data->box;
box_coords(box, &box_x, &box_y);
- if (scrollbar_is_horizontal(bw->scrollbar)) {
+ if (scrollbar_is_horizontal(html->scrollbar)) {
scroll_mouse_x = x - box_x ;
scroll_mouse_y = y - (box_y + box->padding[TOP] +
box->height + box->padding[BOTTOM] -
SCROLLBAR_WIDTH);
- status = scrollbar_mouse_action(bw->scrollbar, mouse,
+ status = scrollbar_mouse_action(html->scrollbar, mouse,
scroll_mouse_x, scroll_mouse_y);
} else {
scroll_mouse_x = x - (box_x + box->padding[LEFT] +
box->width + box->padding[RIGHT] -
SCROLLBAR_WIDTH);
scroll_mouse_y = y - box_y;
- status = scrollbar_mouse_action(bw->scrollbar, mouse,
+ status = scrollbar_mouse_action(html->scrollbar, mouse,
scroll_mouse_x, scroll_mouse_y);
}
@@ -750,13 +757,13 @@
/**
- * Callback for in-page scrolls.
+ * Callback for in-page scrollbars.
*/
void html_overflow_scroll_callback(void *client_data,
struct scrollbar_msg_data *scrollbar_data)
{
- struct browser_scrollbar_data *data = client_data;
- struct browser_window *bw = data->bw;
+ struct html_scrollbar_data *data = client_data;
+ html_content *html = (html_content *)data->c;
struct box *box = data->box;
int x, y, box_x, box_y, diff_x, diff_y;
@@ -779,27 +786,28 @@
diff_x;
y = box_y + scrollbar_get_offset(box->scroll_y);
}
- browser_window_redraw_rect(bw,
+ content__request_redraw((struct content *)html,
x + scrollbar_data->x0,
y + scrollbar_data->y0,
scrollbar_data->x1 - scrollbar_data->x0,
scrollbar_data->y1 - scrollbar_data->y0);
break;
case SCROLLBAR_MSG_MOVED:
- html_redraw_a_box(bw->current_content, box);
+ html_redraw_a_box(html->bw->current_content, box);
break;
case SCROLLBAR_MSG_SCROLL_START:
- browser_window_set_drag_type(bw, DRAGGING_OTHER);
-
- bw->scrollbar = scrollbar_data->scrollbar;
- gui_window_box_scroll_start(bw->window,
+ browser_window_set_drag_type(html->bw, DRAGGING_OTHER);
+
+ html->scrollbar = scrollbar_data->scrollbar;
+ gui_window_box_scroll_start(html->bw->window,
scrollbar_data->x0, scrollbar_data->y0,
scrollbar_data->x1, scrollbar_data->y1);
break;
case SCROLLBAR_MSG_SCROLL_FINISHED:
- bw->scrollbar = NULL;
+ html->scrollbar = NULL;
- browser_window_set_pointer(bw, GUI_POINTER_DEFAULT);
+ browser_window_set_pointer(html->bw,
+ GUI_POINTER_DEFAULT);
break;
}
}
@@ -817,7 +825,7 @@
browser_mouse_state mouse, int x, int y)
{
int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
- struct browser_scrollbar_data *data = scrollbar_get_data(scrollbar);
+ struct html_scrollbar_data *data = scrollbar_get_data(scrollbar);
struct box *box;
box = data->box;
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 Mon Jun 27 17:21:15 2011
@@ -84,6 +84,10 @@
struct html_content *page;
/** Box containing this, or NULL if not an object. */
struct box *box;
+
+ /** Scrollbar capturing all mouse events, updated to any active HTML
+ * scrollbar, or NULL when no scrollbar drags active */
+ struct scrollbar *scrollbar;
} 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 Mon Jun 27 17:21:15 2011
@@ -723,7 +723,9 @@
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
- if (!box_handle_scrollbars(current_redraw_browser, box,
+ /* TODO: pass content down, so we don't need
+ * current_redraw_browser here */
+ if (!box_handle_scrollbars(hlcache_handle_get_content(current_redraw_browser->current_content), box,
has_x_scroll, has_y_scroll))
return false;
11 years, 11 months
r12518 tlsa - in /trunk/netsurf/content: content.c content_protected.h
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 16:37:37 2011
New Revision: 12518
URL: http://source.netsurf-browser.org?rev=12518&view=rev
Log:
Enable content redraw request without hlcache_handle.
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/content_protected.h
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 Mon Jun 27 16:37:37 2011
@@ -435,7 +435,7 @@
/**
* Request a redraw of an area of a content
*
- * \param h Content handle
+ * \param h high-level cache handle
* \param x x co-ord of left edge
* \param y y co-ord of top edge
* \param width Width of rectangle
@@ -444,7 +444,23 @@
void content_request_redraw(struct hlcache_handle *h,
int x, int y, int width, int height)
{
- struct content *c = hlcache_handle_get_content(h);
+ content__request_redraw(hlcache_handle_get_content(h),
+ x, y, width, height);
+}
+
+
+/**
+ * Request a redraw of an area of a content
+ *
+ * \param c Content
+ * \param x x co-ord of left edge
+ * \param y y co-ord of top edge
+ * \param width Width of rectangle
+ * \param height Height of rectangle
+ */
+void content__request_redraw(struct content *c,
+ int x, int y, int width, int height)
+{
union content_msg_data data;
if (c == NULL)
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 Mon Jun 27 16:37:37 2011
@@ -154,6 +154,8 @@
void content__reformat(struct content *c, bool background,
int width, int height);
+void content__request_redraw(struct content *c,
+ int x, int y, int width, int height);
bool content__set_title(struct content *c, const char *title);
11 years, 11 months
r12517 tlsa - /trunk/netsurf/desktop/browser.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 13:35:39 2011
New Revision: 12517
URL: http://source.netsurf-browser.org?rev=12517&view=rev
Log:
Remove obsolete comment.
Modified:
trunk/netsurf/desktop/browser.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 Mon Jun 27 13:35:39 2011
@@ -1672,9 +1672,6 @@
if (c == NULL && bw->drag_type != DRAGGING_FRAME)
return;
- /* detect end of drag operation in case the platform-specific code
- doesn't call browser_mouse_drag_end() (RISC OS code does) */
-
if (bw->drag_type != DRAGGING_NONE && !mouse) {
browser_window_mouse_drag_end(bw, mouse, x, y);
}
11 years, 11 months
r12516 tlsa - in /trunk/netsurf/desktop: browser.c browser.h
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 13:19:47 2011
New Revision: 12516
URL: http://source.netsurf-browser.org?rev=12516&view=rev
Log:
browser_window_mouse_drag_end is private now, and can be removed once contents handle all their own interaction.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
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 Mon Jun 27 13:19:47 2011
@@ -89,6 +89,8 @@
static void browser_window_find_target_internal(struct browser_window *bw,
const char *target, int depth, struct browser_window *page,
int *rdepth, struct browser_window **bw_target);
+static void browser_window_mouse_drag_end(struct browser_window *bw,
+ browser_mouse_state mouse, int x, int y);
/* exported interface, documented in browser.h */
bool browser_window_redraw(struct browser_window *bw, int x, int y,
@@ -1654,7 +1656,7 @@
/**
- * Handle mouse movements in a browser window.
+ * Handle non-click mouse action in a browser window. (drag ends, movements)
*
* \param bw browser window
* \param mouse state of mouse buttons and modifier keys
@@ -1771,7 +1773,8 @@
* \param x coordinate of mouse
* \param y coordinate of mouse
*
- * TODO: MOVE content specific stuff out
+ * TODO: Remove this function, once these things are associated with content,
+ * rather than bw.
*/
void browser_window_mouse_drag_end(struct browser_window *bw,
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 Mon Jun 27 13:19:47 2011
@@ -245,8 +245,6 @@
browser_mouse_state mouse, int x, int y);
void browser_window_mouse_track(struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
-void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
struct browser_window *browser_window_find_target(
struct browser_window *bw, const char *target,
browser_mouse_state mouse);
11 years, 11 months
r12515 tlsa - in /trunk/netsurf: amiga/gui.c atari/browser_win.c beos/beos_window.cpp cocoa/BrowserView.m gtk/window.c riscos/textselection.c riscos/window.c windows/drawable.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 12:45:17 2011
New Revision: 12515
URL: http://source.netsurf-browser.org?rev=12515&view=rev
Log:
Frond ends signal end of drag with call to browser_window_mouse_track.
Modified:
trunk/netsurf/amiga/gui.c
trunk/netsurf/atari/browser_win.c
trunk/netsurf/beos/beos_window.cpp
trunk/netsurf/cocoa/BrowserView.m
trunk/netsurf/gtk/window.c
trunk/netsurf/riscos/textselection.c
trunk/netsurf/riscos/window.c
trunk/netsurf/windows/drawable.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=12515&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Mon Jun 27 12:45:17 2011
@@ -1251,7 +1251,7 @@
}
else
{
- browser_window_mouse_drag_end(gwin->bw, 0, x, y);
+ browser_window_mouse_track(gwin->bw, 0, x, y);
}
gwin->mouse_state=0;
break;
@@ -1287,7 +1287,7 @@
}
else
{
- browser_window_mouse_drag_end(gwin->bw, 0, x, y);
+ browser_window_mouse_track(gwin->bw, 0, x, y);
}
gwin->mouse_state=0;
break;
Modified: trunk/netsurf/atari/browser_win.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/browser_win.c?rev=1...
==============================================================================
--- trunk/netsurf/atari/browser_win.c (original)
+++ trunk/netsurf/atari/browser_win.c Mon Jun 27 12:45:17 2011
@@ -158,7 +158,8 @@
LOG(("Drag for %d ended", i));
bmstate &= ~( BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_1 ) ;
if( within ) {
- browser_window_mouse_drag_end(
+ /* drag end */
+ browser_window_mouse_track(
gw->browser->bw, 0, nx, ny
);
}
@@ -167,7 +168,8 @@
bmstate &= ~( BROWSER_MOUSE_HOLDING_2 | BROWSER_MOUSE_DRAG_2 ) ;
LOG(("Drag for %d ended", i));
if( within ) {
- browser_window_mouse_drag_end(
+ /* drag end */
+ browser_window_mouse_track(
gw->browser->bw, 0, nx, ny
);
}
Modified: trunk/netsurf/beos/beos_window.cpp
URL: http://source.netsurf-browser.org/trunk/netsurf/beos/beos_window.cpp?rev=...
==============================================================================
--- trunk/netsurf/beos/beos_window.cpp (original)
+++ trunk/netsurf/beos/beos_window.cpp Mon Jun 27 12:45:17 2011
@@ -867,7 +867,7 @@
where.x / gui->bw->scale,
where.y / gui->bw->scale);
else
- browser_window_mouse_drag_end(gui->bw, (browser_mouse_state)0,
+ browser_window_mouse_track(gui->bw, (browser_mouse_state)0,
where.x, where.y);
gui->mouse.state = 0;
Modified: trunk/netsurf/cocoa/BrowserView.m
URL: http://source.netsurf-browser.org/trunk/netsurf/cocoa/BrowserView.m?rev=1...
==============================================================================
--- trunk/netsurf/cocoa/BrowserView.m (original)
+++ trunk/netsurf/cocoa/BrowserView.m Mon Jun 27 12:45:17 2011
@@ -241,7 +241,7 @@
if (isDragging) {
isDragging = NO;
- browser_window_mouse_drag_end( browser, modifierFlags, location.x, location.y );
+ browser_window_mouse_track( browser, (browser_mouse_state)0, location.x, location.y );
} else {
modifierFlags |= BROWSER_MOUSE_CLICK_1;
if ([theEvent clickCount] == 2) modifierFlags |= BROWSER_MOUSE_DOUBLE_CLICK;
Modified: trunk/netsurf/gtk/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/window.c?rev=12515&r1...
==============================================================================
--- trunk/netsurf/gtk/window.c (original)
+++ trunk/netsurf/gtk/window.c Mon Jun 27 12:45:17 2011
@@ -323,7 +323,7 @@
event->x / g->bw->scale,
event->y / g->bw->scale);
} else {
- browser_window_mouse_drag_end(g->bw, 0, event->x / g->bw->scale,
+ browser_window_mouse_track(g->bw, 0, event->x / g->bw->scale,
event->y / g->bw->scale);
}
Modified: trunk/netsurf/riscos/textselection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/textselection.c?re...
==============================================================================
--- trunk/netsurf/riscos/textselection.c (original)
+++ trunk/netsurf/riscos/textselection.c Mon Jun 27 12:45:17 2011
@@ -183,7 +183,7 @@
}
if (ro_gui_window_to_window_pos(g, drag->final.x0, drag->final.y0, &pos))
- browser_window_mouse_drag_end(g->bw, 0, pos.x, pos.y);
+ browser_window_mouse_track(g->bw, 0, pos.x, pos.y);
}
Modified: trunk/netsurf/riscos/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/window.c?rev=12515...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Mon Jun 27 12:45:17 2011
@@ -3636,7 +3636,7 @@
}
if (ro_gui_window_to_window_pos(g, drag->final.x0, drag->final.y0, &pos))
- browser_window_mouse_drag_end(g->bw, 0, pos.x, pos.y);
+ browser_window_mouse_track(g->bw, 0, pos.x, pos.y);
}
Modified: trunk/netsurf/windows/drawable.c
URL: http://source.netsurf-browser.org/trunk/netsurf/windows/drawable.c?rev=12...
==============================================================================
--- trunk/netsurf/windows/drawable.c (original)
+++ trunk/netsurf/windows/drawable.c Mon Jun 27 12:45:17 2011
@@ -371,10 +371,10 @@
(x + gw->scrollx) / gw->bw->scale,
(y + gw->scrolly) / gw->bw->scale);
} else {
- browser_window_mouse_drag_end(gw->bw,
- 0,
- (x + gw->scrollx) / gw->bw->scale,
- (y + gw->scrolly) / gw->bw->scale);
+ browser_window_mouse_track(gw->bw,
+ 0,
+ (x + gw->scrollx) / gw->bw->scale,
+ (y + gw->scrolly) / gw->bw->scale);
}
gw->mouse->state = 0;
11 years, 11 months
r12514 tlsa - in /trunk/netsurf: desktop/browser.c desktop/browser.h render/form.c render/html_interaction.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 12:29:49 2011
New Revision: 12514
URL: http://source.netsurf-browser.org?rev=12514&view=rev
Log:
Fix bw->drag_type to be aware of remaining drag types.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/render/form.c
trunk/netsurf/render/html_interaction.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 Mon Jun 27 12:29:49 2011
@@ -222,6 +222,13 @@
bw->y = y;
break;
}
+}
+
+/* exported interface, documented in browser.h */
+void browser_window_set_drag_type(struct browser_window *bw,
+ browser_drag_type type)
+{
+ bw->drag_type = type;
}
/**
@@ -1770,20 +1777,9 @@
void browser_window_mouse_drag_end(struct browser_window *bw,
browser_mouse_state mouse, int x, int y)
{
-
- if (bw->visible_select_menu != NULL) {
- form_select_mouse_drag_end(bw->visible_select_menu, mouse,
- x, y);
- return;
- }
-
- if (bw->scrollbar != NULL) {
- html_overflow_scroll_drag_end(bw->scrollbar, mouse, x, y);
- return;
- }
-
switch (bw->drag_type) {
- case DRAGGING_SELECTION: {
+ case DRAGGING_SELECTION:
+ {
hlcache_handle *h = bw->current_content;
if (h) {
int dir = -1;
@@ -1807,7 +1803,20 @@
}
selection_drag_end(bw->sel);
}
- break;
+ break;
+
+ case DRAGGING_OTHER:
+
+ if (bw->visible_select_menu != NULL) {
+ form_select_mouse_drag_end(bw->visible_select_menu,
+ mouse, x, y);
+ }
+
+ if (bw->scrollbar != NULL) {
+ html_overflow_scroll_drag_end(bw->scrollbar,
+ mouse, x, y);
+ }
+ break;
default:
break;
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 Mon Jun 27 12:29:49 2011
@@ -55,6 +55,15 @@
void *p);
+typedef enum {
+ DRAGGING_NONE,
+ DRAGGING_SELECTION,
+ DRAGGING_PAGE_SCROLL,
+ DRAGGING_FRAME,
+ DRAGGING_OTHER
+} browser_drag_type;
+
+
/** Browser window data. */
struct browser_window {
@@ -91,12 +100,7 @@
char *frag_id;
/** Current drag status. */
- enum {
- DRAGGING_NONE,
- DRAGGING_SELECTION,
- DRAGGING_PAGE_SCROLL,
- DRAGGING_FRAME
- } drag_type;
+ browser_drag_type drag_type;
/** Mouse position at start of current scroll drag. */
int drag_start_x;
@@ -323,11 +327,21 @@
* Set the position of the current browser window with respect to the parent
* browser window
*
- * \param bw browser window to get the position of
+ * \param bw browser window to set the position of
* \param x x position of bw
* \param y y position of bw
*/
void browser_window_set_position(struct browser_window *bw, int x, int y);
+
+/*
+ * Set the position of the current browser window with respect to the parent
+ * browser window
+ *
+ * \param bw browser window to set the type of the current drag for
+ * \param type drag type
+ */
+void browser_window_set_drag_type(struct browser_window *bw,
+ browser_drag_type type);
/* In platform specific hotlist.c. */
Modified: trunk/netsurf/render/form.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/form.c?rev=12514&r...
==============================================================================
--- trunk/netsurf/render/form.c (original)
+++ trunk/netsurf/render/form.c Mon Jun 27 12:29:49 2011
@@ -1295,6 +1295,8 @@
menu->height);
break;
case SCROLLBAR_MSG_SCROLL_START:
+ browser_window_set_drag_type(menu->bw, DRAGGING_OTHER);
+
menu->scroll_capture = true;
gui_window_box_scroll_start(menu->bw->window,
scrollbar_data->x0, scrollbar_data->y0,
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 Mon Jun 27 12:29:49 2011
@@ -789,6 +789,8 @@
html_redraw_a_box(bw->current_content, box);
break;
case SCROLLBAR_MSG_SCROLL_START:
+ browser_window_set_drag_type(bw, DRAGGING_OTHER);
+
bw->scrollbar = scrollbar_data->scrollbar;
gui_window_box_scroll_start(bw->window,
scrollbar_data->x0, scrollbar_data->y0,
11 years, 11 months
r12513 tlsa - in /trunk/netsurf/riscos: textselection.c window.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Jun 27 11:16:21 2011
New Revision: 12513
URL: http://source.netsurf-browser.org?rev=12513&view=rev
Log:
Simplify browser_window_mouse_drag_end calls.
Modified:
trunk/netsurf/riscos/textselection.c
trunk/netsurf/riscos/window.c
Modified: trunk/netsurf/riscos/textselection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/textselection.c?re...
==============================================================================
--- trunk/netsurf/riscos/textselection.c (original)
+++ trunk/netsurf/riscos/textselection.c Mon Jun 27 11:16:21 2011
@@ -183,10 +183,7 @@
}
if (ro_gui_window_to_window_pos(g, drag->final.x0, drag->final.y0, &pos))
- browser_window_mouse_drag_end(g->bw,
- ro_gui_mouse_click_state(pointer.buttons,
- wimp_BUTTON_CLICK_DRAG),
- pos.x, pos.y);
+ browser_window_mouse_drag_end(g->bw, 0, pos.x, pos.y);
}
Modified: trunk/netsurf/riscos/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/window.c?rev=12513...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Mon Jun 27 11:16:21 2011
@@ -3636,10 +3636,7 @@
}
if (ro_gui_window_to_window_pos(g, drag->final.x0, drag->final.y0, &pos))
- browser_window_mouse_drag_end(g->bw,
- ro_gui_mouse_click_state(pointer.buttons,
- wimp_BUTTON_CLICK_DRAG),
- pos.x, pos.y);
+ browser_window_mouse_drag_end(g->bw, 0, pos.x, pos.y);
}
11 years, 11 months
r12512 jmb - in /branches/jmb/dom-alloc-purge/src/core: comment.c comment.h
by netsurf@semichrome.net
Author: jmb
Date: Sun Jun 26 15:49:52 2011
New Revision: 12512
URL: http://source.netsurf-browser.org?rev=12512&view=rev
Log:
Fix up comment node implementation
Modified:
branches/jmb/dom-alloc-purge/src/core/comment.c
branches/jmb/dom-alloc-purge/src/core/comment.h
Modified: branches/jmb/dom-alloc-purge/src/core/comment.c
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/c...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/comment.c (original)
+++ branches/jmb/dom-alloc-purge/src/core/comment.c Sun Jun 26 15:49:52 2011
@@ -5,6 +5,8 @@
* Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
* Copyright 2009 Bo Yang <struggleyb.nku(a)gmail.com>
*/
+
+#include <stdlib.h>
#include "core/characterdata.h"
#include "core/comment.h"
@@ -16,7 +18,7 @@
* A DOM Comment node
*/
struct dom_comment {
- struct dom_characterdata base; /**< Base node */
+ dom_characterdata base; /**< Base node */
};
static struct dom_node_protect_vtable comment_protect_vtable = {
@@ -37,15 +39,15 @@
*
* The returned node will already be referenced.
*/
-dom_exception _dom_comment_create(struct dom_document *doc,
- struct lwc_string_s *name, dom_string *value,
- struct dom_comment **result)
+dom_exception _dom_comment_create(dom_document *doc,
+ dom_string *name, dom_string *value,
+ dom_comment **result)
{
- struct dom_comment *c;
+ dom_comment *c;
dom_exception err;
/* Allocate the comment node */
- c = _dom_document_alloc(doc, NULL, sizeof(struct dom_comment));
+ c = malloc(sizeof(dom_comment));
if (c == NULL)
return DOM_NO_MEM_ERR;
@@ -57,7 +59,7 @@
err = _dom_characterdata_initialise(&c->base, doc, DOM_COMMENT_NODE,
name, value);
if (err != DOM_NO_ERR) {
- _dom_document_alloc(doc, c, 0);
+ free(c);
return err;
}
@@ -69,19 +71,17 @@
/**
* Destroy a comment node
*
- * \param doc The owning document
* \param comment The node to destroy
*
* The contents of ::comment will be destroyed and ::comment will be freed
*/
-void _dom_comment_destroy(struct dom_document *doc,
- struct dom_comment *comment)
+void _dom_comment_destroy(dom_comment *comment)
{
/* Finalise base class contents */
- _dom_characterdata_finalise(doc, &comment->base);
+ _dom_characterdata_finalise(&comment->base);
/* Free node */
- _dom_document_alloc(doc, comment, 0);
+ free(comment);
}
@@ -89,35 +89,30 @@
/* The protected virtual functions */
/* The virtual destroy function */
-void __dom_comment_destroy(struct dom_node_internal *node)
+void __dom_comment_destroy(dom_node_internal *node)
{
- struct dom_document *doc;
- doc = dom_node_get_owner(node);
-
- _dom_comment_destroy(doc, (struct dom_comment *) node);
+ _dom_comment_destroy((dom_comment *) node);
}
-/* The memory allocation function of this class */
-dom_exception _dom_comment_alloc(struct dom_document *doc,
- struct dom_node_internal *n, struct dom_node_internal **ret)
+/* The copy constructor of this class */
+dom_exception _dom_comment_copy(dom_node_internal *old,
+ dom_node_internal **copy)
{
- UNUSED(n);
- dom_comment *c;
-
- c = _dom_document_alloc(doc, NULL, sizeof(struct dom_comment));
- if (c == NULL)
+ dom_comment *new_comment;
+ dom_exception err;
+
+ new_comment = malloc(sizeof(dom_comment));
+ if (new_comment == NULL)
return DOM_NO_MEM_ERR;
-
- *ret = (dom_node_internal *) c;
- dom_node_set_owner(*ret, doc);
+
+ err = dom_characterdata_copy_internal(old, new_comment);
+ if (err != DOM_NO_ERR) {
+ free(new_comment);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_comment;
return DOM_NO_ERR;
}
-/* The copy constructor of this class */
-dom_exception _dom_comment_copy(struct dom_node_internal *new,
- struct dom_node_internal *old)
-{
- return _dom_characterdata_copy(new, old);
-}
-
Modified: branches/jmb/dom-alloc-purge/src/core/comment.h
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/c...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/comment.h (original)
+++ branches/jmb/dom-alloc-purge/src/core/comment.h Sun Jun 26 15:49:52 2011
@@ -13,28 +13,23 @@
struct dom_comment;
struct dom_document;
-struct lwc_string_s;
dom_exception _dom_comment_create(struct dom_document *doc,
- struct lwc_string_s *name, dom_string *value,
- struct dom_comment **result);
+ dom_string *name, dom_string *value,
+ dom_comment **result);
#define _dom_comment_initialise _dom_characterdata_initialise
#define _dom_comment_finalise _dom_characterdata_finalise
-void _dom_comment_destroy(struct dom_document *doc,
- struct dom_comment *comment);
+void _dom_comment_destroy(dom_comment *comment);
/* Following comes the protected vtable */
-void __dom_comment_destroy(struct dom_node_internal *node);
-dom_exception _dom_comment_alloc(struct dom_document *doc,
- struct dom_node_internal *n, struct dom_node_internal **ret);
-dom_exception _dom_comment_copy(struct dom_node_internal *new,
- struct dom_node_internal *old);
+void __dom_comment_destroy(dom_node_internal *node);
+dom_exception _dom_comment_copy(dom_node_internal *old,
+ dom_node_internal **copy);
#define DOM_COMMENT_PROTECT_VTABLE \
__dom_comment_destroy, \
- _dom_comment_alloc, \
_dom_comment_copy
#endif
11 years, 11 months
r12511 jmb - in /branches/jmb/dom-alloc-purge/src/core: characterdata.c characterdata.h text.c text.h
by netsurf@semichrome.net
Author: jmb
Date: Sun Jun 26 15:39:45 2011
New Revision: 12511
URL: http://source.netsurf-browser.org?rev=12511&view=rev
Log:
Fix up text node copy constructor
Modified:
branches/jmb/dom-alloc-purge/src/core/characterdata.c
branches/jmb/dom-alloc-purge/src/core/characterdata.h
branches/jmb/dom-alloc-purge/src/core/text.c
branches/jmb/dom-alloc-purge/src/core/text.h
Modified: branches/jmb/dom-alloc-purge/src/core/characterdata.c
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/c...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/characterdata.c (original)
+++ branches/jmb/dom-alloc-purge/src/core/characterdata.c Sun Jun 26 15:39:45 2011
@@ -448,22 +448,38 @@
/*----------------------------------------------------------------------*/
-/* The protected virtual functions of Node, see core/node.h for details
- *
- * @note: the three following API never be called directly from the virtual
- * functions dispatch mechanism, they are here for the code consistent.
- */
+/* The protected virtual functions of Node, see core/node.h for details */
void _dom_characterdata_destroy(struct dom_node_internal *node)
{
assert("Should never be here" == NULL);
UNUSED(node);
}
-/* The copy constructor of this class
- * The sub-class of characterdata should call this API */
+/* The copy constructor of this class */
dom_exception _dom_characterdata_copy(dom_node_internal *old,
dom_node_internal **copy)
{
- return _dom_node_copy(old, copy);
-}
-
+ dom_characterdata *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_characterdata));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_characterdata_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_characterdata_copy_internal(dom_node_internal *old,
+ dom_node_internal *new)
+{
+ return dom_node_copy_internal(old, new);
+}
+
Modified: branches/jmb/dom-alloc-purge/src/core/characterdata.h
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/c...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/characterdata.h (original)
+++ branches/jmb/dom-alloc-purge/src/core/characterdata.h Sun Jun 26 15:39:45 2011
@@ -72,4 +72,10 @@
extern struct dom_characterdata_vtable characterdata_vtable;
+dom_exception _dom_characterdata_copy_internal(dom_node_internal *old,
+ dom_node_internal *new);
+#define dom_characterdata_copy_internal(o, n) \
+ _dom_characterdata_copy_internal( \
+ (dom_node_internal *) (o), (dom_node_internal *) (n))
+
#endif
Modified: branches/jmb/dom-alloc-purge/src/core/text.c
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/t...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/text.c (original)
+++ branches/jmb/dom-alloc-purge/src/core/text.c Sun Jun 26 15:39:45 2011
@@ -297,15 +297,27 @@
}
/* The copy constructor of this class */
-dom_exception _dom_text_copy(struct dom_node_internal *new,
- struct dom_node_internal *old)
+dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy)
{
dom_text *ot = (dom_text *) old;
- dom_text *nt = (dom_text *) new;
-
- nt->element_content_whitespace = ot->element_content_whitespace;
-
- return _dom_characterdata_copy(new, old);
+ dom_text *new_text;
+ dom_exception err;
+
+ new_text = malloc(sizeof(dom_text));
+ if (new_text == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_characterdata_copy_internal(old, new_text);
+ if (err != DOM_NO_ERR) {
+ free(new_text);
+ return err;
+ }
+
+ new_text->element_content_whitespace = ot->element_content_whitespace;
+
+ *copy = (dom_node_internal *) new_text;
+
+ return DOM_NO_ERR;
}
/*----------------------------------------------------------------------*/
Modified: branches/jmb/dom-alloc-purge/src/core/text.h
URL: http://source.netsurf-browser.org/branches/jmb/dom-alloc-purge/src/core/t...
==============================================================================
--- branches/jmb/dom-alloc-purge/src/core/text.h (original)
+++ branches/jmb/dom-alloc-purge/src/core/text.h Sun Jun 26 15:39:45 2011
@@ -62,8 +62,7 @@
void __dom_text_destroy(struct dom_node_internal *node);
dom_exception _dom_text_alloc(struct dom_document *doc,
struct dom_node_internal *n, struct dom_node_internal **ret);
-dom_exception _dom_text_copy(struct dom_node_internal *new,
- struct dom_node_internal *old);
+dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy);
#define DOM_TEXT_PROTECT_VTABLE \
__dom_text_destroy, \
11 years, 11 months