summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-08-13 13:55:57 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-08-13 13:55:57 +0100
commit68947c377ed358db310b32ee241db375e0b51de4 (patch)
tree1faa58fade481acdf35ccc5c7f56f51694c5aa40 /desktop
parent986bc5ff8332d39629f65177cc8232c5ec7c8791 (diff)
downloadnetsurf-68947c377ed358db310b32ee241db375e0b51de4.tar.gz
netsurf-68947c377ed358db310b32ee241db375e0b51de4.tar.bz2
Obtain font style in copy handler.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/selection.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/desktop/selection.c b/desktop/selection.c
index 6679be6bc..436117a89 100644
--- a/desktop/selection.c
+++ b/desktop/selection.c
@@ -747,7 +747,8 @@ static bool selection_copy_handler(const char *text, size_t length,
struct box *box, void *handle, const char *whitespace_text,
size_t whitespace_length)
{
- bool add_space = box != NULL ? box->space != 0 : false;
+ bool add_space = false;
+ plot_font_style_t style = *plot_style_font;
/* add any whitespace which precedes the text from this box */
if (whitespace_text != NULL && whitespace_length > 0) {
@@ -757,6 +758,19 @@ static bool selection_copy_handler(const char *text, size_t length,
}
}
+ if (box != NULL) {
+ /* HTML */
+ add_space = (box->space != 0);
+
+ if (box->style != NULL) {
+ /* Override default font style */
+ font_plot_style_from_css(box->style, &style);
+ } else {
+ /* If there's no style, there must be no text */
+ assert(box->text == NULL);
+ }
+ }
+
/* add the text from this box */
if (!gui_add_to_clipboard(text, length, add_space))
return false;