Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/313e5cabba172c79a0a8d2bab0b8a99c204616fc
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/313e5cabba172c79a0a8d2bab0b8a99c204616fc
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/313e5cabba172c79a0a8d2bab0b8a99c204616fc

The branch, master has been updated
       via  313e5cabba172c79a0a8d2bab0b8a99c204616fc (commit)
      from  aa0b916492b5be45cb37a579e8bc9ab98e5b68d1 (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=313e5cabba172c79a0a8d2bab0b8a99c204616fc
commit 313e5cabba172c79a0a8d2bab0b8a99c204616fc
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    ensure the html layout is present for text selection
    
    The text selection operations can be called regardless
      of when the html layout box tree is actually
      available (e.g. if it is still loading when opened)
    
    This change ensures the layout box tree is available before
      attempting to traverse it for a selection operation.

diff --git a/content/handlers/html/textselection.c 
b/content/handlers/html/textselection.c
index 51c6ce1..cc08aef 100644
--- a/content/handlers/html/textselection.c
+++ b/content/handlers/html/textselection.c
@@ -444,7 +444,11 @@ selection_copy(struct box *box,
  */
 static unsigned selection_label_subtree(struct box *box, unsigned idx)
 {
-       struct box *child = box->children;
+       struct box *child;
+
+       assert(box != NULL);
+
+       box = box->children;
 
        box->byte_offset = idx;
 
@@ -475,6 +479,10 @@ html_textselection_redraw(struct content *c,
        html_content *html = (html_content *)c;
        struct rdw_info rdw;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        rdw.inited = false;
 
        res = coords_from_range(html->layout, start_idx, end_idx, &rdw, false);
@@ -505,6 +513,10 @@ html_textselection_copy(struct content *c,
        save_text_whitespace before = WHITESPACE_NONE;
        bool first = true;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        return selection_copy(html->layout,
                              &html->len_ctx,
                              start_idx,
@@ -523,6 +535,10 @@ html_textselection_get_end(struct content *c, unsigned 
*end_idx)
        html_content *html = (html_content *)c;
        unsigned root_idx;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        root_idx = 0;
 
        *end_idx = selection_label_subtree(html->layout, root_idx);


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

Summary of changes:
 content/handlers/html/textselection.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/content/handlers/html/textselection.c 
b/content/handlers/html/textselection.c
index 51c6ce1..cc08aef 100644
--- a/content/handlers/html/textselection.c
+++ b/content/handlers/html/textselection.c
@@ -444,7 +444,11 @@ selection_copy(struct box *box,
  */
 static unsigned selection_label_subtree(struct box *box, unsigned idx)
 {
-       struct box *child = box->children;
+       struct box *child;
+
+       assert(box != NULL);
+
+       box = box->children;
 
        box->byte_offset = idx;
 
@@ -475,6 +479,10 @@ html_textselection_redraw(struct content *c,
        html_content *html = (html_content *)c;
        struct rdw_info rdw;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        rdw.inited = false;
 
        res = coords_from_range(html->layout, start_idx, end_idx, &rdw, false);
@@ -505,6 +513,10 @@ html_textselection_copy(struct content *c,
        save_text_whitespace before = WHITESPACE_NONE;
        bool first = true;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        return selection_copy(html->layout,
                              &html->len_ctx,
                              start_idx,
@@ -523,6 +535,10 @@ html_textselection_get_end(struct content *c, unsigned 
*end_idx)
        html_content *html = (html_content *)c;
        unsigned root_idx;
 
+       if (html->layout == NULL) {
+               return NSERROR_INVALID;
+       }
+
        root_idx = 0;
 
        *end_idx = selection_label_subtree(html->layout, root_idx);


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

Reply via email to