Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/4cef0f955c3be33344361f84d600bccf1b28ce75
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/4cef0f955c3be33344361f84d600bccf1b28ce75
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/4cef0f955c3be33344361f84d600bccf1b28ce75

The branch, master has been updated
       via  4cef0f955c3be33344361f84d600bccf1b28ce75 (commit)
      from  2f672279014bb6ef2f7b9f346c58d20c7604bad9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=4cef0f955c3be33344361f84d600bccf1b28ce75
commit 4cef0f955c3be33344361f84d600bccf1b28ce75
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    pass the browser window to selection click handler
    
    this means the content handlers do not have to provide a separate
      method to extract their browser window and it can simply be
      passed in.

diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index 23d6078..33320aa 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -2383,15 +2383,3 @@ error:
 
        return error;
 }
-
-
-/* exported function documented in html/private.h */
-struct browser_window *html_get_browser_window(struct content *c)
-{
-       html_content *html = (html_content *) c;
-
-       assert(c != NULL);
-       assert(c->handler == &html_content_handler);
-
-       return html->bw;
-}
diff --git a/content/handlers/html/interaction.c 
b/content/handlers/html/interaction.c
index f2eae70..0a963dd 100644
--- a/content/handlers/html/interaction.c
+++ b/content/handlers/html/interaction.c
@@ -1220,6 +1220,7 @@ default_mouse_action(html_content *html,
                                               &pixel_offset);
 
                        if (selection_click(&html->sel,
+                                           html->bw,
                                            mouse,
                                            mas->text.box->byte_offset + idx)) {
                                /* key presses must be directed at the
diff --git a/content/handlers/html/private.h b/content/handlers/html/private.h
index dde61c2..ff20be8 100644
--- a/content/handlers/html/private.h
+++ b/content/handlers/html/private.h
@@ -230,15 +230,6 @@ void html__redraw_a_box(html_content *htmlc, struct box 
*box);
 
 
 /**
- * Get the browser window containing an HTML content
- *
- * \param c HTML content
- * \return the browser window
- */
-struct browser_window *html_get_browser_window(struct content *c);
-
-
-/**
  * Complete conversion of an HTML document
  *
  * \param htmlc Content to convert
diff --git a/content/handlers/text/textplain.c 
b/content/handlers/text/textplain.c
index 501ba1d..534b91d 100644
--- a/content/handlers/text/textplain.c
+++ b/content/handlers/text/textplain.c
@@ -706,7 +706,7 @@ textplain_mouse_action(struct content *c,
        browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
 
        idx = textplain_offset_from_coords(c, x, y, dir);
-       if (selection_click(&text->sel, mouse, idx)) {
+       if (selection_click(&text->sel, text->bw, mouse, idx)) {
 
                if (selection_dragging(&text->sel)) {
                        browser_window_set_drag_type(bw,
@@ -1634,15 +1634,3 @@ textplain_get_raw_data(struct content *c,
 
        return text->utf8_data + start;
 }
-
-
-/* exported interface documented in html/textplain.h */
-struct browser_window *textplain_get_browser_window(struct content *c)
-{
-       textplain_content *text = (textplain_content *) c;
-
-       assert(c != NULL);
-       assert(c->handler == &textplain_content_handler);
-
-       return text->bw;
-}
diff --git a/content/handlers/text/textplain.h 
b/content/handlers/text/textplain.h
index a2cfb5e..716397a 100644
--- a/content/handlers/text/textplain.h
+++ b/content/handlers/text/textplain.h
@@ -73,12 +73,4 @@ void textplain_coords_from_range(struct content *c,
 char *textplain_get_raw_data(struct content *c, unsigned start, unsigned end, 
size_t *plen);
 
 
-/**
- * Get the browser window containing a textplain content
- *
- * \param[in] c text/plain content
- * \return the browser window
- */
-struct browser_window *textplain_get_browser_window(struct content *c);
-
 #endif
diff --git a/desktop/selection.c b/desktop/selection.c
index 4bbcda9..47d51f8 100644
--- a/desktop/selection.c
+++ b/desktop/selection.c
@@ -78,21 +78,6 @@ typedef bool (*seln_traverse_handler)(const char *text, 
size_t length,
 
 
 /**
- * Get the browser window containing the content a selection object belongs to.
- *
- * \param  s   selection object
- * \return the browser window
- */
-static struct browser_window * selection_get_browser_window(struct selection 
*s)
-{
-       if (s->is_html)
-               return html_get_browser_window(s->c);
-       else
-               return textplain_get_browser_window(s->c);
-}
-
-
-/**
  * Label each text box in the given box subtree with its position
  * in a textual representation of the content.
  *
@@ -691,13 +676,14 @@ selection_init(struct selection *s,
 /* exported interface documented in desktop/selection.h */
 bool
 selection_click(struct selection *s,
+               struct browser_window *top,
                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 */
-       struct browser_window *top = selection_get_browser_window(s);
+
        top = browser_window_get_root(top);
 
        if (selection_defined(s)) {
diff --git a/desktop/selection.h b/desktop/selection.h
index ca0d19f..cfaf59b 100644
--- a/desktop/selection.h
+++ b/desktop/selection.h
@@ -28,6 +28,7 @@
 #include "content/handlers/css/utils.h"
 
 struct box;
+struct browser_window;
 
 typedef enum {
        DRAG_NONE,
@@ -166,7 +167,7 @@ void selection_set_position(struct selection *s, unsigned 
start, unsigned end);
  * \param idx byte offset within textual representation
  * \return true iff the click has been handled by the selection code
  */
-bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned 
idx);
+bool selection_click(struct selection *s, struct browser_window *top, 
browser_mouse_state mouse, unsigned idx);
 
 /**
  * Handles movements related to the selection, eg. dragging of start and


-----------------------------------------------------------------------

Summary of changes:
 content/handlers/html/html.c        |   12 ------------
 content/handlers/html/interaction.c |    1 +
 content/handlers/html/private.h     |    9 ---------
 content/handlers/text/textplain.c   |   14 +-------------
 content/handlers/text/textplain.h   |    8 --------
 desktop/selection.c                 |   18 ++----------------
 desktop/selection.h                 |    3 ++-
 7 files changed, 6 insertions(+), 59 deletions(-)

diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index 23d6078..33320aa 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -2383,15 +2383,3 @@ error:
 
        return error;
 }
-
-
-/* exported function documented in html/private.h */
-struct browser_window *html_get_browser_window(struct content *c)
-{
-       html_content *html = (html_content *) c;
-
-       assert(c != NULL);
-       assert(c->handler == &html_content_handler);
-
-       return html->bw;
-}
diff --git a/content/handlers/html/interaction.c 
b/content/handlers/html/interaction.c
index f2eae70..0a963dd 100644
--- a/content/handlers/html/interaction.c
+++ b/content/handlers/html/interaction.c
@@ -1220,6 +1220,7 @@ default_mouse_action(html_content *html,
                                               &pixel_offset);
 
                        if (selection_click(&html->sel,
+                                           html->bw,
                                            mouse,
                                            mas->text.box->byte_offset + idx)) {
                                /* key presses must be directed at the
diff --git a/content/handlers/html/private.h b/content/handlers/html/private.h
index dde61c2..ff20be8 100644
--- a/content/handlers/html/private.h
+++ b/content/handlers/html/private.h
@@ -230,15 +230,6 @@ void html__redraw_a_box(html_content *htmlc, struct box 
*box);
 
 
 /**
- * Get the browser window containing an HTML content
- *
- * \param c HTML content
- * \return the browser window
- */
-struct browser_window *html_get_browser_window(struct content *c);
-
-
-/**
  * Complete conversion of an HTML document
  *
  * \param htmlc Content to convert
diff --git a/content/handlers/text/textplain.c 
b/content/handlers/text/textplain.c
index 501ba1d..534b91d 100644
--- a/content/handlers/text/textplain.c
+++ b/content/handlers/text/textplain.c
@@ -706,7 +706,7 @@ textplain_mouse_action(struct content *c,
        browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
 
        idx = textplain_offset_from_coords(c, x, y, dir);
-       if (selection_click(&text->sel, mouse, idx)) {
+       if (selection_click(&text->sel, text->bw, mouse, idx)) {
 
                if (selection_dragging(&text->sel)) {
                        browser_window_set_drag_type(bw,
@@ -1634,15 +1634,3 @@ textplain_get_raw_data(struct content *c,
 
        return text->utf8_data + start;
 }
-
-
-/* exported interface documented in html/textplain.h */
-struct browser_window *textplain_get_browser_window(struct content *c)
-{
-       textplain_content *text = (textplain_content *) c;
-
-       assert(c != NULL);
-       assert(c->handler == &textplain_content_handler);
-
-       return text->bw;
-}
diff --git a/content/handlers/text/textplain.h 
b/content/handlers/text/textplain.h
index a2cfb5e..716397a 100644
--- a/content/handlers/text/textplain.h
+++ b/content/handlers/text/textplain.h
@@ -73,12 +73,4 @@ void textplain_coords_from_range(struct content *c,
 char *textplain_get_raw_data(struct content *c, unsigned start, unsigned end, 
size_t *plen);
 
 
-/**
- * Get the browser window containing a textplain content
- *
- * \param[in] c text/plain content
- * \return the browser window
- */
-struct browser_window *textplain_get_browser_window(struct content *c);
-
 #endif
diff --git a/desktop/selection.c b/desktop/selection.c
index 4bbcda9..47d51f8 100644
--- a/desktop/selection.c
+++ b/desktop/selection.c
@@ -78,21 +78,6 @@ typedef bool (*seln_traverse_handler)(const char *text, 
size_t length,
 
 
 /**
- * Get the browser window containing the content a selection object belongs to.
- *
- * \param  s   selection object
- * \return the browser window
- */
-static struct browser_window * selection_get_browser_window(struct selection 
*s)
-{
-       if (s->is_html)
-               return html_get_browser_window(s->c);
-       else
-               return textplain_get_browser_window(s->c);
-}
-
-
-/**
  * Label each text box in the given box subtree with its position
  * in a textual representation of the content.
  *
@@ -691,13 +676,14 @@ selection_init(struct selection *s,
 /* exported interface documented in desktop/selection.h */
 bool
 selection_click(struct selection *s,
+               struct browser_window *top,
                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 */
-       struct browser_window *top = selection_get_browser_window(s);
+
        top = browser_window_get_root(top);
 
        if (selection_defined(s)) {
diff --git a/desktop/selection.h b/desktop/selection.h
index ca0d19f..cfaf59b 100644
--- a/desktop/selection.h
+++ b/desktop/selection.h
@@ -28,6 +28,7 @@
 #include "content/handlers/css/utils.h"
 
 struct box;
+struct browser_window;
 
 typedef enum {
        DRAG_NONE,
@@ -166,7 +167,7 @@ void selection_set_position(struct selection *s, unsigned 
start, unsigned end);
  * \param idx byte offset within textual representation
  * \return true iff the click has been handled by the selection code
  */
-bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned 
idx);
+bool selection_click(struct selection *s, struct browser_window *top, 
browser_mouse_state mouse, unsigned idx);
 
 /**
  * Handles movements related to the selection, eg. dragging of start and


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to