r4067 tlsa - /trunk/netsurf/desktop/selection.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Mar 31 23:22:14 2008
New Revision: 4067
URL: http://source.netsurf-browser.org?rev=4067&view=rev
Log:
Remove unused variable. Update copyright.
Modified:
trunk/netsurf/desktop/selection.c
Modified: trunk/netsurf/desktop/selection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.c?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.c (original)
+++ trunk/netsurf/desktop/selection.c Mon Mar 31 23:22:14 2008
@@ -1,5 +1,6 @@
/*
* Copyright 2005 Adrian Lees <adrianl(a)users.sourceforge.net>
+ * Copyright 2008 Michael Drake <tlsa(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -449,7 +450,6 @@
void *handle, seln_whitespace *before, bool *first)
{
struct box *child;
- size_t box_length;
const char *whitespace_text = "";
size_t whitespace_length = 0;
@@ -513,7 +513,6 @@
whitespace_text = NULL;
}
- box_length = box->length + box->space; /* include trailing space */
if (num_space == NUMBER_SPACE(box->byte_offset) &&
box->type != BOX_BR) {
unsigned start_offset;
15 years, 8 months
r4066 tlsa - /trunk/netsurf/desktop/selection.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Mar 31 22:52:12 2008
New Revision: 4066
URL: http://source.netsurf-browser.org?rev=4066&view=rev
Log:
Suppress the box->space spaces after BRs in copied/saved text selections.
Modified:
trunk/netsurf/desktop/selection.c
Modified: trunk/netsurf/desktop/selection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.c?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.c (original)
+++ trunk/netsurf/desktop/selection.c Mon Mar 31 22:52:12 2008
@@ -514,7 +514,8 @@
}
box_length = box->length + box->space; /* include trailing space */
- if (num_space == NUMBER_SPACE(box->byte_offset)) {
+ if (num_space == NUMBER_SPACE(box->byte_offset) &&
+ box->type != BOX_BR) {
unsigned start_offset;
unsigned end_offset;
15 years, 8 months
r4065 jmb - /trunk/netsurf/gtk/gtk_scaffolding.c
by netsurf@semichrome.net
Author: jmb
Date: Mon Mar 31 20:10:19 2008
New Revision: 4065
URL: http://source.netsurf-browser.org?rev=4065&view=rev
Log:
Fix crash when attempting to dump non HTML content (Dobos D. Calin)
Modified:
trunk/netsurf/gtk/gtk_scaffolding.c
Modified: trunk/netsurf/gtk/gtk_scaffolding.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_scaffolding.c?rev...
==============================================================================
--- trunk/netsurf/gtk/gtk_scaffolding.c (original)
+++ trunk/netsurf/gtk/gtk_scaffolding.c Mon Mar 31 20:10:19 2008
@@ -584,8 +584,15 @@
} else {
struct browser_window *bw;
bw = nsgtk_get_browser_window(gw->top_level);
- box_dump(fh, bw->current_content->data.html.layout->children,
- 0);
+
+ if (bw->current_content &&
+ bw->current_content->type ==
+ CONTENT_HTML) {
+ box_dump(fh,
+ bw->current_content->data.html.layout,
+ 0);
+ }
+
fclose(fh);
}
15 years, 8 months
r4064 tlsa - in /trunk/netsurf: desktop/selection.c desktop/selection.h riscos/textselection.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Mar 31 19:59:23 2008
New Revision: 4064
URL: http://source.netsurf-browser.org?rev=4064&view=rev
Log:
Tidy up.
Modified:
trunk/netsurf/desktop/selection.c
trunk/netsurf/desktop/selection.h
trunk/netsurf/riscos/textselection.c
Modified: trunk/netsurf/desktop/selection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.c?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.c (original)
+++ trunk/netsurf/desktop/selection.c Mon Mar 31 19:59:23 2008
@@ -80,13 +80,15 @@
} seln_whitespace;
static bool redraw_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text);
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length);
static void selection_redraw(struct selection *s, unsigned start_idx,
unsigned end_idx);
static unsigned selection_label_subtree(struct selection *s, struct box *node,
unsigned idx);
static bool save_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text);
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length);
static bool selected_part(struct box *box, unsigned start_idx, unsigned end_idx,
unsigned *start_offset, unsigned *end_offset);
static bool traverse_tree(struct box *box, unsigned start_idx, unsigned end_idx,
@@ -214,7 +216,7 @@
*/
unsigned selection_label_subtree(struct selection *s, struct box *node,
- unsigned idx)
+ unsigned idx)
{
struct box *child = node->children;
@@ -244,7 +246,7 @@
*/
bool selection_click(struct selection *s, browser_mouse_state mouse,
- unsigned idx)
+ unsigned idx)
{
browser_mouse_state modkeys =
(mouse & (BROWSER_MOUSE_MOD_1 | BROWSER_MOUSE_MOD_2));
@@ -340,7 +342,8 @@
* \param idx byte offset within text representation
*/
-void selection_track(struct selection *s, browser_mouse_state mouse, unsigned idx)
+void selection_track(struct selection *s, browser_mouse_state mouse,
+ unsigned idx)
{
if (!SAME_SPACE(s, idx))
return;
@@ -448,6 +451,7 @@
struct box *child;
size_t box_length;
const char *whitespace_text = "";
+ size_t whitespace_length = 0;
/* we can prune this subtree, it's after the selection */
assert(box);
@@ -486,15 +490,19 @@
switch (*before) {
case WHITESPACE_TWO_NEW_LINES:
whitespace_text = "\n\n";
+ whitespace_length = 2;
break;
case WHITESPACE_ONE_NEW_LINE:
whitespace_text = "\n";
+ whitespace_length = 1;
break;
case WHITESPACE_TAB:
whitespace_text = "\t";
+ whitespace_length = 1;
break;
case WHITESPACE_NONE:
whitespace_text = "";
+ break;
default:
whitespace_text = "";
break;
@@ -514,7 +522,8 @@
&end_offset)) {
if (!handler(box->text + start_offset, min(box->length,
end_offset) - start_offset,
- box, handle, whitespace_text))
+ box, handle, whitespace_text,
+ whitespace_length))
return false;
if (before) {
*first = false;
@@ -562,7 +571,7 @@
*/
bool selection_traverse(struct selection *s, seln_traverse_handler handler,
- void *handle)
+ void *handle)
{
struct content *c;
seln_whitespace before = WHITESPACE_NONE;
@@ -583,7 +592,7 @@
const char *text = textplain_get_raw_data(c, s->start_idx,
s->end_idx, &length);
- if (text && !handler(text, length, NULL, handle, NULL))
+ if (text && !handler(text, length, NULL, handle, NULL, 0))
return false;
return true;
@@ -594,17 +603,19 @@
* Selection traversal handler for redrawing the screen when the selection
* has been altered.
*
- * \param text pointer to text string
- * \param length length of text to be appended (bytes)
- * \param box pointer to text box being (partially) added
- * \param handle unused handle, we don't need one
- * \param whitespace_text whitespace to place before text for formatting
- * may be NULL
+ * \param text pointer to text string
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box being (partially) added
+ * \param handle unused handle, we don't need one
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
+ * \param whitespace_length length of whitespace_text
* \return true iff successful and traversal should continue
*/
bool redraw_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text)
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length)
{
if (box) {
struct rdw_info *r = (struct rdw_info*)handle;
@@ -885,21 +896,22 @@
/**
* Selection traversal handler for saving the text to a file.
*
- * \param text pointer to text being added, or NULL for newline
- * \param length length of text to be appended (bytes)
- * \param box pointer to text box (or NULL for textplain content)
- * \param handle our save_state workspace pointer
- * \param whitespace_text whitespace to place before text for formatting
- * may be NULL
+ * \param text pointer to text being added, or NULL for newline
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box (or NULL for textplain content)
+ * \param handle our save_state workspace pointer
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
+ * \param whitespace_length length of whitespace_text
* \return true iff the file writing succeeded and traversal should continue.
*/
bool save_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text)
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length)
{
struct save_state *sv = handle;
size_t new_length;
- size_t whitespace_length;
int space = 0;
assert(sv);
@@ -907,12 +919,8 @@
if (box->space > 0)
space = 1;
- if (whitespace_text) {
- whitespace_length = strlen(whitespace_text);
+ if (whitespace_text)
length += whitespace_length;
- } else {
- whitespace_length = 0;
- }
new_length = sv->length + whitespace_length + length + space;
if (new_length >= sv->alloc) {
Modified: trunk/netsurf/desktop/selection.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.h?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.h (original)
+++ trunk/netsurf/desktop/selection.h Mon Mar 31 19:59:23 2008
@@ -55,7 +55,8 @@
typedef bool (*seln_traverse_handler)(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text);
+ struct box *box, void *handle, const char *whitespace_text,
+ size_t whitespace_length);
struct selection *selection_create(struct browser_window *bw);
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 Mar 31 19:59:23 2008
@@ -61,7 +61,8 @@
static size_t clip_length = 0;
static bool copy_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text);
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length);
static void ro_gui_discard_clipboard_contents(void);
static void ro_gui_dragging_bounced(wimp_message *message);
@@ -189,22 +190,24 @@
* Selection traversal routine for appending text to the current contents
* of the clipboard.
*
- * \param text pointer to text being added, or NULL for newline
- * \param length length of text to be appended (bytes)
- * \param box pointer to text box, or NULL if from textplain
- * \param handle unused handle, we don't need one
- * \param whitespace_text whitespace to place before text for formatting
- * may be NULL
+ * \param text pointer to text being added, or NULL for newline
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box, or NULL if from textplain
+ * \param handle unused handle, we don't need one
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
+ * \param whitespace_length length of whitespace_text
* \return true iff successful and traversal should continue
*/
bool copy_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text)
+ void *handle, const char *whitespace_text,
+ size_t whitespace_length)
{
/* add any whitespace which precedes the text from this box */
if (whitespace_text) {
if (!gui_add_to_clipboard(whitespace_text,
- strlen(whitespace_text), false)) {
+ whitespace_length, false)) {
return false;
}
}
15 years, 8 months
r4063 tlsa - in /trunk/netsurf: desktop/selection.c desktop/selection.h riscos/textselection.c
by netsurf@semichrome.net
Author: tlsa
Date: Mon Mar 31 19:04:36 2008
New Revision: 4063
URL: http://source.netsurf-browser.org?rev=4063&view=rev
Log:
Fix formatting of copied or saved text selections.
Modified:
trunk/netsurf/desktop/selection.c
trunk/netsurf/desktop/selection.h
trunk/netsurf/riscos/textselection.c
Modified: trunk/netsurf/desktop/selection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.c?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.c (original)
+++ trunk/netsurf/desktop/selection.c Mon Mar 31 19:04:36 2008
@@ -17,7 +17,8 @@
*/
/** \file
- * Text selection within browser windows, (implementation, platform-independent)
+ * Text selection within browser windows,
+ * (implementation, platform independent)
*/
#include <assert.h>
@@ -71,18 +72,26 @@
size_t alloc;
};
-static bool redraw_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle);
-static void selection_redraw(struct selection *s, unsigned start_idx, unsigned end_idx);
+typedef enum {
+ WHITESPACE_NONE,
+ WHITESPACE_TAB,
+ WHITESPACE_ONE_NEW_LINE,
+ WHITESPACE_TWO_NEW_LINES
+} seln_whitespace;
+
+static bool redraw_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text);
+static void selection_redraw(struct selection *s, unsigned start_idx,
+ unsigned end_idx);
static unsigned selection_label_subtree(struct selection *s, struct box *node,
unsigned idx);
-static bool save_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle);
+static bool save_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text);
static bool selected_part(struct box *box, unsigned start_idx, unsigned end_idx,
unsigned *start_offset, unsigned *end_offset);
static bool traverse_tree(struct box *box, unsigned start_idx, unsigned end_idx,
unsigned int num_space, seln_traverse_handler handler,
- void *handle);
+ void *handle, seln_whitespace *before, bool *first);
static struct box *get_box(struct box *b, unsigned offset, int *pidx);
@@ -204,7 +213,8 @@
* \return updated position
*/
-unsigned selection_label_subtree(struct selection *s, struct box *node, unsigned idx)
+unsigned selection_label_subtree(struct selection *s, struct box *node,
+ unsigned idx)
{
struct box *child = node->children;
@@ -233,9 +243,11 @@
* \return true iff the click has been handled by the selection code
*/
-bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned idx)
-{
- browser_mouse_state modkeys = (mouse & (BROWSER_MOUSE_MOD_1 | BROWSER_MOUSE_MOD_2));
+bool selection_click(struct selection *s, browser_mouse_state mouse,
+ unsigned idx)
+{
+ browser_mouse_state modkeys =
+ (mouse & (BROWSER_MOUSE_MOD_1 | BROWSER_MOUSE_MOD_2));
int pos = -1; /* 0 = inside selection, 1 = after it */
if (!SAME_SPACE(s, idx))
@@ -424,15 +436,18 @@
* \param num_space number space of the selection
* \param handler handler function to call
* \param handle handle to pass
+ * \param before type of whitespace to place before next encountered text
+ * \param first whether this is the first box with text
* \return false iff traversal abandoned part-way through
*/
bool traverse_tree(struct box *box, unsigned start_idx, unsigned end_idx,
unsigned int num_space, seln_traverse_handler handler,
- void *handle)
+ void *handle, seln_whitespace *before, bool *first)
{
struct box *child;
size_t box_length;
+ const char *whitespace_text = "";
/* we can prune this subtree, it's after the selection */
assert(box);
@@ -442,30 +457,75 @@
/* read before calling the handler in case it modifies the tree */
child = box->children;
+ /* If nicely formatted output of the selected text is required, work
+ * out what whitespace should be placed before the next bit of text */
+ if (before) {
+ if (*before < WHITESPACE_TWO_NEW_LINES &&
+ (box->type == BOX_BLOCK ||
+ box->type == BOX_TABLE ||
+ box->type == BOX_FLOAT_LEFT ||
+ box->type == BOX_FLOAT_RIGHT) &&
+ !box->list_marker) {
+ *before = WHITESPACE_TWO_NEW_LINES;
+ }
+ else if (*before < WHITESPACE_ONE_NEW_LINE &&
+ (box->type == BOX_TABLE_ROW ||
+ box->type == BOX_BR ||
+ (box->type != BOX_TABLE_ROW &&
+ box->list_marker))) {
+ *before = WHITESPACE_ONE_NEW_LINE;
+ }
+ else if (*before < WHITESPACE_TAB &&
+ box->type == BOX_TABLE_CELL) {
+ *before = WHITESPACE_TAB;
+ }
+
+ if (*first) {
+ whitespace_text = "";
+ } else {
+ switch (*before) {
+ case WHITESPACE_TWO_NEW_LINES:
+ whitespace_text = "\n\n";
+ break;
+ case WHITESPACE_ONE_NEW_LINE:
+ whitespace_text = "\n";
+ break;
+ case WHITESPACE_TAB:
+ whitespace_text = "\t";
+ break;
+ case WHITESPACE_NONE:
+ whitespace_text = "";
+ default:
+ whitespace_text = "";
+ break;
+ }
+ }
+ }
+ else {
+ whitespace_text = NULL;
+ }
+
box_length = box->length + box->space; /* include trailing space */
- if (IS_TEXT(box) && (num_space == NUMBER_SPACE(box->byte_offset))) {
+ if (num_space == NUMBER_SPACE(box->byte_offset)) {
unsigned start_offset;
unsigned end_offset;
- if (selected_part(box, start_idx, end_idx, &start_offset, &end_offset) &&
- !handler(box->text + start_offset,
- min(box->length, end_offset) - start_offset,
- (end_offset >= box->length), box, handle))
+ if (selected_part(box, start_idx, end_idx, &start_offset,
+ &end_offset)) {
+ if (!handler(box->text + start_offset, min(box->length,
+ end_offset) - start_offset,
+ box, handle, whitespace_text))
return false;
- }
- else {
- /* make a guess at where the newlines should go */
- if (box->byte_offset >= start_idx &&
- box->byte_offset < end_idx) {
-
- if (!handler(NULL, 0, false, NULL, handle))
- return false;
+ if (before) {
+ *first = false;
+ *before = WHITESPACE_NONE;
+ }
}
}
/* find the first child that could lie partially within the selection;
- this is important at the top-levels of the tree for pruning subtrees
- that lie entirely before the selection */
+ * this is important at the top-levels of the tree for pruning subtrees
+ * that lie entirely before the selection */
if (child) {
struct box *next = child->next;
@@ -476,10 +536,12 @@
}
while (child) {
- /* read before calling the handler in case it modifies the tree */
+ /* read before calling the handler in case it modifies
+ * the tree */
struct box *next = child->next;
- if (!traverse_tree(child, start_idx, end_idx, num_space, handler, handle))
+ if (!traverse_tree(child, start_idx, end_idx, num_space,
+ handler, handle, before, first))
return false;
child = next;
@@ -491,31 +553,37 @@
/**
- * Traverse the current selection, calling the handler function (with its handle)
- * for all boxes that lie (partially) within the given range
+ * Traverse the current selection, calling the handler function (with its
+ * handle) for all boxes that lie (partially) within the given range
*
* \param handler handler function to call
* \param handle handle to pass
* \return false iff traversal abandoned part-way through
*/
-bool selection_traverse(struct selection *s, seln_traverse_handler handler, void *handle)
+bool selection_traverse(struct selection *s, seln_traverse_handler handler,
+ void *handle)
{
struct content *c;
+ seln_whitespace before = WHITESPACE_NONE;
+ bool first = true;
if (!selection_defined(s))
return true; /* easy case, nothing to do */
if (s->root)
- return traverse_tree(s->root, s->start_idx, s->end_idx, NUMBER_SPACE(s->max_idx), handler, handle);
+ return traverse_tree(s->root, s->start_idx, s->end_idx,
+ NUMBER_SPACE(s->max_idx), handler, handle,
+ &before, &first);
c = s->bw->current_content;
if (!c) return true;
size_t length;
- const char *text = textplain_get_raw_data(c, s->start_idx, s->end_idx, &length);
-
- if (text && !handler(text, length, false, NULL, handle))
+ const char *text = textplain_get_raw_data(c, s->start_idx,
+ s->end_idx, &length);
+
+ if (text && !handler(text, length, NULL, handle, NULL))
return false;
return true;
@@ -526,16 +594,17 @@
* Selection traversal handler for redrawing the screen when the selection
* has been altered.
*
- * \param text pointer to text string
- * \param length length of text to be appended (bytes)
- * \param space text string should be followed by a trailing space
- * \param box pointer to text box being (partially) added
- * \param handle unused handle, we don't need one
+ * \param text pointer to text string
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box being (partially) added
+ * \param handle unused handle, we don't need one
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
* \return true iff successful and traversal should continue
*/
-bool redraw_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle)
+bool redraw_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text)
{
if (box) {
struct rdw_info *r = (struct rdw_info*)handle;
@@ -543,7 +612,7 @@
int x, y;
/* \todo - it should be possible to reduce the redrawn area by
- considering the 'text', 'length' and 'space' parameters */
+ * considering the 'text', 'length' and 'space' parameters */
box_coords(box, &x, &y);
width = box->padding[LEFT] + box->width + box->padding[RIGHT];
@@ -583,13 +652,16 @@
rdw.inited = false;
if (s->root) {
- if (!traverse_tree(s->root, start_idx, end_idx, NUMBER_SPACE(s->max_idx), redraw_handler, &rdw))
+ if (!traverse_tree(s->root, start_idx, end_idx,
+ NUMBER_SPACE(s->max_idx), redraw_handler, &rdw,
+ NULL, NULL))
return;
}
else {
struct content *c = s->bw->current_content;
if (c && c->type == CONTENT_TEXTPLAIN && end_idx > start_idx) {
- textplain_coords_from_range(c, start_idx, end_idx, &rdw.r);
+ textplain_coords_from_range(c, start_idx,
+ end_idx, &rdw.r);
rdw.inited = true;
}
}
@@ -813,28 +885,36 @@
/**
* Selection traversal handler for saving the text to a file.
*
- * \param text pointer to text being added, or NULL for newline
- * \param length length of text to be appended (bytes)
- * \param space trailing space required after text
- * \param box pointer to text box (or NULL for textplain content)
- * \param handle our save_state workspace pointer
+ * \param text pointer to text being added, or NULL for newline
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box (or NULL for textplain content)
+ * \param handle our save_state workspace pointer
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
* \return true iff the file writing succeeded and traversal should continue.
*/
-bool save_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle)
+bool save_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text)
{
struct save_state *sv = handle;
size_t new_length;
+ size_t whitespace_length;
+ int space = 0;
assert(sv);
- if (!text) {
- text = "\n";
- length = 1;
- }
-
- new_length = sv->length + length + space;
+ if (box->space > 0)
+ space = 1;
+
+ if (whitespace_text) {
+ whitespace_length = strlen(whitespace_text);
+ length += whitespace_length;
+ } else {
+ whitespace_length = 0;
+ }
+
+ new_length = sv->length + whitespace_length + length + space;
if (new_length >= sv->alloc) {
size_t new_alloc = sv->alloc + (sv->alloc / 4);
char *new_block;
@@ -847,11 +927,14 @@
sv->block = new_block;
sv->alloc = new_alloc;
}
-
- memcpy(sv->block + sv->length, text, length);
+ if (whitespace_text) {
+ memcpy(sv->block + sv->length, whitespace_text,
+ whitespace_length);
+ }
+ memcpy(sv->block + sv->length + whitespace_length, text, length);
sv->length += length;
- if (space)
+ if (space == 1)
sv->block[sv->length++] = ' ';
return true;
@@ -880,6 +963,19 @@
free(sv.block);
return false;
}
+
+ /* add newline at end */
+ sv.length++;
+ if (sv.length > sv.alloc) {
+ char *new_block;
+
+ new_block = realloc(sv.block, sv.length);
+ if (!new_block) return false;
+
+ sv.block = new_block;
+ sv.alloc = sv.length;
+ }
+ sv.block[sv.length - 1] = '\n';
if (!sv.block)
return false;
Modified: trunk/netsurf/desktop/selection.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.h?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.h (original)
+++ trunk/netsurf/desktop/selection.h Mon Mar 31 19:04:36 2008
@@ -55,7 +55,7 @@
typedef bool (*seln_traverse_handler)(const char *text, size_t length,
- bool space, struct box *box, void *handle);
+ struct box *box, void *handle, const char *whitespace_text);
struct selection *selection_create(struct browser_window *bw);
@@ -86,8 +86,10 @@
struct box *selection_get_start(struct selection *s, int *pidx);
struct box *selection_get_end(struct selection *s, int *pidx);
-bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned idx);
-void selection_track(struct selection *s, browser_mouse_state mouse, unsigned idx);
+bool selection_click(struct selection *s, browser_mouse_state mouse,
+ unsigned idx);
+void selection_track(struct selection *s, browser_mouse_state mouse,
+ unsigned idx);
/** Handles completion of a drag operation */
/* void selection_drag_end(struct selection *s); */
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 Mar 31 19:04:36 2008
@@ -60,8 +60,8 @@
static size_t clip_alloc = 0;
static size_t clip_length = 0;
-static bool copy_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle);
+static bool copy_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text);
static void ro_gui_discard_clipboard_contents(void);
static void ro_gui_dragging_bounced(wimp_message *message);
@@ -189,22 +189,30 @@
* Selection traversal routine for appending text to the current contents
* of the clipboard.
*
- * \param text pointer to text being added, or NULL for newline
- * \param length length of text to be appended (bytes)
- * \param space trailing space required after text
- * \param box pointer to text box, or NULL if from textplain
- * \param handle unused handle, we don't need one
+ * \param text pointer to text being added, or NULL for newline
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box, or NULL if from textplain
+ * \param handle unused handle, we don't need one
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
* \return true iff successful and traversal should continue
*/
-bool copy_handler(const char *text, size_t length, bool space,
- struct box *box, void *handle)
-{
- if (!text) {
- text = "\n";
- length = 1;
- }
- return gui_add_to_clipboard(text, length, space);
+bool copy_handler(const char *text, size_t length, struct box *box,
+ void *handle, const char *whitespace_text)
+{
+ /* add any whitespace which precedes the text from this box */
+ if (whitespace_text) {
+ if (!gui_add_to_clipboard(whitespace_text,
+ strlen(whitespace_text), false)) {
+ return false;
+ }
+ }
+ /* add the text from this box */
+ if (!gui_add_to_clipboard(text, length, box->space))
+ return false;
+
+ return true;
}
15 years, 8 months
r4062 bursa - in /trunk/libsvgtiny: makefile svgtiny_gradient.c svgtiny_internal.h svgtiny_list.c
by netsurf@semichrome.net
Author: bursa
Date: Sun Mar 30 02:14:46 2008
New Revision: 4062
URL: http://source.netsurf-browser.org?rev=4062&view=rev
Log:
Add svgtiny_list and convert gradient plotting to use it.
Added:
trunk/libsvgtiny/svgtiny_list.c
Modified:
trunk/libsvgtiny/makefile
trunk/libsvgtiny/svgtiny_gradient.c
trunk/libsvgtiny/svgtiny_internal.h
Modified: trunk/libsvgtiny/makefile
URL: http://source.netsurf-browser.org/trunk/libsvgtiny/makefile?rev=4062&r1=4...
==============================================================================
--- trunk/libsvgtiny/makefile (original)
+++ trunk/libsvgtiny/makefile Sun Mar 30 02:14:46 2008
@@ -5,7 +5,7 @@
# Copyright 2008 James Bursa <james(a)semichrome.net>
#
-SOURCE = svgtiny.c svgtiny_gradient.c colors.c
+SOURCE = svgtiny.c svgtiny_gradient.c svgtiny_list.c colors.c
HDRS = svgtiny.h svgtiny_internal.h
CFLAGS = -std=c99 -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
@@ -18,8 +18,8 @@
ifeq ($(TARGET),riscos)
GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin
GCCSDK_INSTALL_ENV ?= /home/riscos/env
-CC ?= $(GCCSDK_INSTALL_CROSSBIN)/gcc
-AR ?= $(GCCSDK_INSTALL_CROSSBIN)/ar
+CC = $(GCCSDK_INSTALL_CROSSBIN)/gcc
+AR = $(GCCSDK_INSTALL_CROSSBIN)/ar
CFLAGS += -Driscos -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include \
-I$(GCCSDK_INSTALL_ENV)/include/libxml2
LIBS = -L$(GCCSDK_INSTALL_ENV)/lib -lxml2 -lz
Modified: trunk/libsvgtiny/svgtiny_gradient.c
URL: http://source.netsurf-browser.org/trunk/libsvgtiny/svgtiny_gradient.c?rev...
==============================================================================
--- trunk/libsvgtiny/svgtiny_gradient.c (original)
+++ trunk/libsvgtiny/svgtiny_gradient.c Sun Mar 30 02:14:46 2008
@@ -288,10 +288,10 @@
struct grad_point {
float x, y, r;
};
- struct grad_point *pts = malloc(n * steps * sizeof pts[0]);
+ struct svgtiny_list *pts = svgtiny_list_create(
+ sizeof (struct grad_point));
if (!pts)
return svgtiny_OUT_OF_MEMORY;
- unsigned int pts_count = 0;
float min_r = 1000;
unsigned int min_pt = 0;
for (unsigned int j = 0; j != n; ) {
@@ -314,14 +314,18 @@
r0 = ((x0_trans - gradient_x0) * gradient_dx +
(y0_trans - gradient_y0) * gradient_dy) /
gradient_norm_squared;
- pts[pts_count].x = x0;
- pts[pts_count].y = y0;
- pts[pts_count].r = r0;
+ struct grad_point *point = svgtiny_list_push(pts);
+ if (!point) {
+ svgtiny_list_free(pts);
+ return svgtiny_OUT_OF_MEMORY;
+ }
+ point->x = x0;
+ point->y = y0;
+ point->r = r0;
if (r0 < min_r) {
min_r = r0;
- min_pt = pts_count;
- }
- pts_count++;
+ min_pt = svgtiny_list_size(pts) - 1;
+ }
/* end point (x1, y1) */
if (segment_type == svgtiny_PATH_LINE) {
@@ -377,14 +381,18 @@
(y_trans - gradient_y0) * gradient_dy) /
gradient_norm_squared;
fprintf(stderr, "(%g %g [%g]) ", x, y, r);
- pts[pts_count].x = x;
- pts[pts_count].y = y;
- pts[pts_count].r = r;
+ struct grad_point *point = svgtiny_list_push(pts);
+ if (!point) {
+ svgtiny_list_free(pts);
+ return svgtiny_OUT_OF_MEMORY;
+ }
+ point->x = x;
+ point->y = y;
+ point->r = r;
if (r < min_r) {
min_r = r;
- min_pt = pts_count;
+ min_pt = svgtiny_list_size(pts) - 1;
}
- pts_count++;
}
fprintf(stderr, "\n");
@@ -392,8 +400,8 @@
x0 = x1;
y0 = y1;
}
- fprintf(stderr, "pts_count %i, min_pt %i, min_r %.3f\n",
- pts_count, min_pt, min_r);
+ fprintf(stderr, "pts size %i, min_pt %i, min_r %.3f\n",
+ svgtiny_list_size(pts), min_pt, min_r);
/* render triangles */
unsigned int stop_count = state->linear_gradient_stop_count;
@@ -407,10 +415,13 @@
blue0 = blue1 = svgtiny_BLUE(state->gradient_stop[0].color);
unsigned int t, a, b;
t = min_pt;
- a = (min_pt + 1) % pts_count;
- b = min_pt == 0 ? pts_count - 1 : min_pt - 1;
+ a = (min_pt + 1) % svgtiny_list_size(pts);
+ b = min_pt == 0 ? svgtiny_list_size(pts) - 1 : min_pt - 1;
while (a != b) {
- float mean_r = (pts[t].r + pts[a].r + pts[b].r) / 3;
+ struct grad_point *point_t = svgtiny_list_get(pts, t);
+ struct grad_point *point_a = svgtiny_list_get(pts, a);
+ struct grad_point *point_b = svgtiny_list_get(pts, b);
+ float mean_r = (point_t->r + point_a->r + point_b->r) / 3;
/*fprintf(stderr, "triangle: t %i %.3f a %i %.3f b %i %.3f "
"mean_r %.3f\n",
t, pts[t].r, a, pts[a].r, b, pts[b].r,
@@ -436,14 +447,14 @@
if (!p)
return svgtiny_OUT_OF_MEMORY;
p[0] = svgtiny_PATH_MOVE;
- p[1] = pts[t].x;
- p[2] = pts[t].y;
+ p[1] = point_t->x;
+ p[2] = point_t->y;
p[3] = svgtiny_PATH_LINE;
- p[4] = pts[a].x;
- p[5] = pts[a].y;
+ p[4] = point_a->x;
+ p[5] = point_a->y;
p[6] = svgtiny_PATH_LINE;
- p[7] = pts[b].x;
- p[8] = pts[b].y;
+ p[7] = point_b->x;
+ p[8] = point_b->y;
p[9] = svgtiny_PATH_CLOSE;
svgtiny_transform_path(p, 10, state);
struct svgtiny_shape *shape = svgtiny_add_shape(state);
@@ -472,12 +483,12 @@
shape->stroke = svgtiny_RGB(0, 0, 0xff);
#endif
state->diagram->shape_count++;
- if (pts[a].r < pts[b].r) {
+ if (point_a->r < point_b->r) {
t = a;
- a = (a + 1) % pts_count;
+ a = (a + 1) % svgtiny_list_size(pts);
} else {
t = b;
- b = b == 0 ? pts_count - 1 : b - 1;
+ b = b == 0 ? svgtiny_list_size(pts) - 1 : b - 1;
}
}
@@ -510,19 +521,20 @@
/* render triangle vertices with r values for debugging */
#ifdef GRADIENT_DEBUG
- for (unsigned int i = 0; i != pts_count; i++) {
+ for (unsigned int i = 0; i != pts->size; i++) {
+ struct grad_point *point = svgtiny_list_get(pts, i);
struct svgtiny_shape *shape = svgtiny_add_shape(state);
if (!shape)
return svgtiny_OUT_OF_MEMORY;
char *text = malloc(20);
if (!text)
return svgtiny_OUT_OF_MEMORY;
- sprintf(text, "%i=%.3f", i, pts[i].r);
+ sprintf(text, "%i=%.3f", i, point->r);
shape->text = text;
- shape->text_x = state->ctm.a * pts[i].x +
- state->ctm.c * pts[i].y + state->ctm.e;
- shape->text_y = state->ctm.b * pts[i].x +
- state->ctm.d * pts[i].y + state->ctm.f;
+ shape->text_x = state->ctm.a * point->x +
+ state->ctm.c * point->y + state->ctm.e;
+ shape->text_y = state->ctm.b * point->x +
+ state->ctm.d * point->y + state->ctm.f;
shape->fill = svgtiny_RGB(0, 0, 0);
shape->stroke = svgtiny_TRANSPARENT;
state->diagram->shape_count++;
@@ -542,7 +554,11 @@
shape->path_length = n;
shape->fill = svgtiny_TRANSPARENT;
state->diagram->shape_count++;
- }
+ } else {
+ free(p);
+ }
+
+ svgtiny_list_free(pts);
return svgtiny_OK;
}
Modified: trunk/libsvgtiny/svgtiny_internal.h
URL: http://source.netsurf-browser.org/trunk/libsvgtiny/svgtiny_internal.h?rev...
==============================================================================
--- trunk/libsvgtiny/svgtiny_internal.h (original)
+++ trunk/libsvgtiny/svgtiny_internal.h Sun Mar 30 02:14:46 2008
@@ -47,6 +47,7 @@
} gradient_transform;
};
+struct svgtiny_list;
/* svgtiny.c */
float svgtiny_parse_length(const char *s, int viewport_size,
@@ -65,6 +66,16 @@
struct svgtiny_parse_state *state);
xmlNode *svgtiny_find_element_by_id(xmlNode *node, const char *id);
+/* svgtiny_list.c */
+struct svgtiny_list *svgtiny_list_create(size_t item_size);
+unsigned int svgtiny_list_size(struct svgtiny_list *list);
+svgtiny_code svgtiny_list_resize(struct svgtiny_list *list,
+ unsigned int new_size);
+void *svgtiny_list_get(struct svgtiny_list *list,
+ unsigned int i);
+void *svgtiny_list_push(struct svgtiny_list *list);
+void svgtiny_list_free(struct svgtiny_list *list);
+
/* colors.gperf */
const struct svgtiny_named_color *
svgtiny_color_lookup(register const char *str,
Added: trunk/libsvgtiny/svgtiny_list.c
URL: http://source.netsurf-browser.org/trunk/libsvgtiny/svgtiny_list.c?rev=406...
==============================================================================
--- trunk/libsvgtiny/svgtiny_list.c (added)
+++ trunk/libsvgtiny/svgtiny_list.c Sun Mar 30 02:14:46 2008
@@ -1,0 +1,125 @@
+/*
+ * This file is part of Libsvgtiny
+ * Licensed under the MIT License,
+ * http://opensource.org/licenses/mit-license.php
+ * Copyright 2008 James Bursa <james(a)semichrome.net>
+ */
+
+/**
+ * A svgtiny_list is a managed array of objects. It grows in chunks to reduce
+ * calls to realloc(), but keeps wasted space low.
+ */
+
+#include <assert.h>
+#include "svgtiny.h"
+#include "svgtiny_internal.h"
+
+
+struct svgtiny_list {
+ unsigned int size; /* number of slots used */
+ unsigned int allocated; /* number of slots allocated (>= size) */
+ size_t item_size; /* size of each slot / bytes */
+ char *items; /* array of slots */
+};
+
+
+/**
+ * Create an empty svgtiny_list.
+ */
+
+struct svgtiny_list *svgtiny_list_create(size_t item_size)
+{
+ struct svgtiny_list *list = malloc(sizeof *list);
+ if (!list)
+ return 0;
+ list->size = 0;
+ list->allocated = 0;
+ list->item_size = item_size;
+ list->items = 0;
+ return list;
+}
+
+
+/**
+ * Return the number of objects in a list.
+ */
+
+unsigned int svgtiny_list_size(struct svgtiny_list *list)
+{
+ return list->size;
+}
+
+
+/**
+ * Set the number of objects in a list. If the size is increased, the new
+ * objects are not initialized in any way.
+ *
+ * The allocation size formula is taken from Python's list:
+ * http://svn.python.org/view/python/trunk/Objects/listobject.c?view=markup
+ *
+ * Objects may have moved after this call. Use svgtiny_list_get() to get new
+ * pointers.
+ */
+
+svgtiny_code svgtiny_list_resize(struct svgtiny_list *list,
+ unsigned int new_size)
+{
+ unsigned int new_allocated;
+ void *new_items;
+
+ if (new_size <= list->allocated) {
+ list->size = new_size;
+ return svgtiny_OK;
+ }
+
+ new_allocated = (new_size >> 3) + (new_size < 9 ? 3 : 6) + new_size;
+ if (new_size == 0)
+ new_allocated = 0;
+ new_items = realloc(list->items, new_allocated * list->item_size);
+ if (!new_items)
+ return svgtiny_OUT_OF_MEMORY;
+
+ list->size = new_size;
+ list->allocated = new_allocated;
+ list->items = new_items;
+
+ return svgtiny_OK;
+}
+
+
+/**
+ * Return a pointer to an object in a list.
+ */
+
+void *svgtiny_list_get(struct svgtiny_list *list,
+ unsigned int i)
+{
+ assert(i < list->size);
+ return (void *) (list->items + i * list->item_size);
+}
+
+
+/**
+ * Add space for one object to a list and return a pointer to it.
+ */
+
+void *svgtiny_list_push(struct svgtiny_list *list)
+{
+ svgtiny_code code;
+ code = svgtiny_list_resize(list, list->size + 1);
+ if (code != svgtiny_OK)
+ return 0;
+ return svgtiny_list_get(list, list->size - 1);
+}
+
+
+/**
+ * Free an entire list.
+ */
+
+void svgtiny_list_free(struct svgtiny_list *list)
+{
+ free(list->items);
+ free(list);
+}
+
15 years, 8 months
r4060 tlsa - /trunk/netsurf/Docs/BUILDING-GTK
by netsurf@semichrome.net
Author: tlsa
Date: Sat Mar 29 23:26:37 2008
New Revision: 4060
URL: http://source.netsurf-browser.org?rev=4060&view=rev
Log:
Restructure and update.
Modified:
trunk/netsurf/Docs/BUILDING-GTK
Modified: trunk/netsurf/Docs/BUILDING-GTK
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/BUILDING-GTK?rev=406...
==============================================================================
--- trunk/netsurf/Docs/BUILDING-GTK (original)
+++ trunk/netsurf/Docs/BUILDING-GTK Sat Mar 29 23:26:37 2008
@@ -1,6 +1,16 @@
--------------------------------------------------------------------------------
- Build Instructions for GTK NetSurf 21 March 2008
+ Build Instructions for GTK NetSurf 29 March 2008
--------------------------------------------------------------------------------
+
+ This document provides instructions for building the GTK version of NetSurf
+ and provides guidance on obtaining NetSurf's build dependencies.
+
+ GTK NetSurf has been tested on Debian, Ubuntu, Fedora 8, FreeBSD, NetBSD and
+ Solaris 10.
+
+
+ Building and executing NetSurf
+=================================
To build GTK NetSurf on a UNIX-like platform, provided you have the relevant
build dependencies installed, simply run:
@@ -12,7 +22,7 @@
may need to "make clean" before attempting to build after installing the
dependencies.
- Run NetSurf by executing the 'netsurf' shell script:
+ Run NetSurf by executing the "netsurf" shell script:
$ ./netsurf
@@ -20,16 +30,18 @@
sets up some environment variables which enable NetSurf to find its
resources.
- Tested on Debian, Ubuntu, Fedora 8, FreeBSD, NetBSD and Solaris 10.
-
- If you're packaging NetSurf, see the PACKAGING-GTK document.
+ If you are packaging NetSurf, see the PACKAGING-GTK document.
Obtaining NetSurf's dependencies
==================================
- Assuming you have GCC and GNU Make etc installed install the dependencies
- for your system. Instructions for specific systems are below:
+ Many of NetSurf's dependencies are packaged on various operating systems.
+ The remainder must be installed manually.
+
+
+ Package installation
+----------------------
Debian-like OS:
@@ -41,6 +53,29 @@
$ yum install libglade2-devel curl-devel libxml2-devel libmng-devel
$ yum install librsvg2-devel lcms-devel re2c
+
+ Librosprite
+-------------
+
+ Sprite file support is enabled by default. This requires librosprite to be
+ built and installed. If you don't want to do this, remove all references to
+ librosprite in the Makefile and remove the following line from utils/config.h:
+
+ #define WITH_NSSPRITE
+
+ To build librosprite, check out from svn://svn.rjek.com/jshaw/libsprite/trunk
+ Build and install it:
+
+ $ sudo make install
+
+ Optionally, specify an install prefix:
+
+ $ PREFIX=/path/to/install make install
+
+
+ Lemon
+-------
+
If your distribution does not package 'lemon' (Fedora doesn't) then you'll
need to download it and build it yourself. You may find it comes with the
SQLite packages (SQLite's parser is built with lemon). If not, try this:
@@ -51,6 +86,10 @@
$ sed -e's!lempar.c!/usr/local/share/lemon/lempar.c!' lemon.c > lem.c
$ gcc -o /usr/local/bin/lemon lem.c
+
+ General requirements
+----------------------
+
NetSurf requires at minimum GTK 2.8. Earlier versions will not work. It also
depends on Cairo for rendering, but you should have this already with
versions of GTK 2.8 or later.
@@ -58,21 +97,3 @@
This will pull in loads of things, like all the GTK dev libraries, the PNG
and JPEG libraries, colour management libraries, zlib, OpenSSL etc that
NetSurf also depends on.
-
- Compiling Sprite file support for GTK
-=======================================
- By default, sprite rendering is enabled. This requires librosprite to be
- built and installed. If you don't want to do this, remove the following line
- from utils/config.h:
-
- #define WITH_NSSPRITE
-
- Remove all references to librosprite in the Makefile.
-
- To build librosprite, check out from svn://svn.rjek.com/jshaw/libsprite/trunk
- Build and install it:
-
- $ make install
-
- Optionally, specify an install prefix:
- $ PREFIX=/path/to/install make install
15 years, 8 months
r4059 tlsa - in /trunk/netsurf/desktop: selection.c selection.h
by netsurf@semichrome.net
Author: tlsa
Date: Sat Mar 29 22:26:04 2008
New Revision: 4059
URL: http://source.netsurf-browser.org?rev=4059&view=rev
Log:
Selection adjustments always change the selection end when click is inside the existing selection.
Modified:
trunk/netsurf/desktop/selection.c
trunk/netsurf/desktop/selection.h
Modified: trunk/netsurf/desktop/selection.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.c?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.c (original)
+++ trunk/netsurf/desktop/selection.c Sat Mar 29 22:26:04 2008
@@ -188,7 +188,6 @@
s->defined = false;
s->start_idx = 0;
s->end_idx = 0;
- s->last_was_end = true;
s->drag_state = DRAG_NONE;
selection_reinit(s, root);
@@ -277,7 +276,7 @@
if (!selection_defined(s))
return false; /* ignore Adjust drags */
- if (pos > 0 || (!pos && s->last_was_end)) {
+ if (pos >= 0) {
selection_set_end(s, idx);
s->drag_state = DRAG_END;
@@ -301,7 +300,7 @@
if (!selection_defined(s))
return false;
- if (pos > 0 || (!pos && s->last_was_end))
+ if (pos >= 0)
selection_set_end(s, idx);
else
selection_set_start(s, idx);
@@ -622,7 +621,6 @@
s->defined = false;
s->start_idx = 0;
s->end_idx = 0;
- s->last_was_end = true;
if (redraw && was_defined)
selection_redraw(s, old_start, old_end);
@@ -672,7 +670,6 @@
unsigned old_start = s->start_idx;
s->start_idx = offset;
- s->last_was_end = false;
s->defined = (s->start_idx < s->end_idx);
if (was_defined) {
@@ -699,7 +696,6 @@
unsigned old_end = s->end_idx;
s->end_idx = offset;
- s->last_was_end = true;
s->defined = (s->start_idx < s->end_idx);
if (was_defined) {
Modified: trunk/netsurf/desktop/selection.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/selection.h?rev=4...
==============================================================================
--- trunk/netsurf/desktop/selection.h (original)
+++ trunk/netsurf/desktop/selection.h Sat Mar 29 22:26:04 2008
@@ -49,7 +49,6 @@
unsigned end_idx;
bool defined;
- bool last_was_end;
seln_drag_state drag_state;
};
15 years, 8 months
r4058 tlsa - /trunk/netsurf/render/box_construct.c
by netsurf@semichrome.net
Author: tlsa
Date: Sat Mar 29 19:51:00 2008
New Revision: 4058
URL: http://source.netsurf-browser.org?rev=4058&view=rev
Log:
Only record that the HTML alignment was set by a table element if it is actually set.
Modified:
trunk/netsurf/render/box_construct.c
Modified: trunk/netsurf/render/box_construct.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box_construct.c?re...
==============================================================================
--- trunk/netsurf/render/box_construct.c (original)
+++ trunk/netsurf/render/box_construct.c Sat Mar 29 19:51:00 2008
@@ -1243,13 +1243,14 @@
else if (strcasecmp(s, "left") == 0)
markup_track->align = ALIGN_LEFT;
xmlFree(s);
- }
- /* Need to remember if we're in a table, so that any alignment
- * rules set on the table's elements won't get overridden by the
- * default alignment of a cell with no align attribute.
- * At this point, we're in a table if the element isn't a div */
- if (strcmp((const char *) n->name, "div") != 0)
- markup_track->table = true;
+ /* Need to remember if we're in a table, so that any
+ * alignment rules set on the table's elements won't
+ * get overridden by the default alignment of a cell
+ * with no align attribute. At this point, we're in a
+ * table if the element isn't a div */
+ if (strcmp((const char *) n->name, "div") != 0)
+ markup_track->table = true;
+ }
}
/* Table cells without an align value have a default implied
* alignment. */
15 years, 8 months