Gitweb links:

...log 
http://git.netsurf-browser.org/libdom.git/shortlog/abfd646c26f2e00484266507523c420bcb9ea7b8
...commit 
http://git.netsurf-browser.org/libdom.git/commit/abfd646c26f2e00484266507523c420bcb9ea7b8
...tree 
http://git.netsurf-browser.org/libdom.git/tree/abfd646c26f2e00484266507523c420bcb9ea7b8

The branch, master has been updated
       via  abfd646c26f2e00484266507523c420bcb9ea7b8 (commit)
      from  529be5ca39c56adc5d0dabdc45f4c70f703bac15 (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/libdom.git/commit/?id=abfd646c26f2e00484266507523c420bcb9ea7b8
commit abfd646c26f2e00484266507523c420bcb9ea7b8
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    html_canvas_element: height and width have default values for canvasses
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/src/html/html_canvas_element.c b/src/html/html_canvas_element.c
index 2543e5b..8e5d3fc 100644
--- a/src/html/html_canvas_element.c
+++ b/src/html/html_canvas_element.c
@@ -152,10 +152,22 @@ dom_exception
 dom_html_canvas_element_get_width(dom_html_canvas_element *canvas,
                                  dom_ulong *width)
 {
-       return dom_html_element_get_dom_ulong_property(&canvas->base,
+       dom_exception exc;
+
+       exc = dom_html_element_get_dom_ulong_property(&canvas->base,
                                                     "width",
                                                     SLEN("width"),
                                                     width);
+
+       if (exc != DOM_NO_ERR)
+               return exc;
+
+       if (*width == (dom_ulong)-1) {
+               /* width not set on the canvas, default is 300px */
+               *width = 300;
+       }
+
+       return DOM_NO_ERR;
 }
 
 dom_exception
@@ -172,10 +184,22 @@ dom_exception
 dom_html_canvas_element_get_height(dom_html_canvas_element *canvas,
                                  dom_ulong *height)
 {
-       return dom_html_element_get_dom_ulong_property(&canvas->base,
+       dom_exception exc;
+
+       exc = dom_html_element_get_dom_ulong_property(&canvas->base,
                                                     "height",
                                                     SLEN("height"),
                                                     height);
+
+       if (exc != DOM_NO_ERR)
+               return exc;
+
+       if (*height == (dom_ulong)-1) {
+               /* height not set on the canvas, default is 150px */
+               *height = 150;
+       }
+
+       return DOM_NO_ERR;
 }
 
 dom_exception


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

Summary of changes:
 src/html/html_canvas_element.c |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/html/html_canvas_element.c b/src/html/html_canvas_element.c
index 2543e5b..8e5d3fc 100644
--- a/src/html/html_canvas_element.c
+++ b/src/html/html_canvas_element.c
@@ -152,10 +152,22 @@ dom_exception
 dom_html_canvas_element_get_width(dom_html_canvas_element *canvas,
                                  dom_ulong *width)
 {
-       return dom_html_element_get_dom_ulong_property(&canvas->base,
+       dom_exception exc;
+
+       exc = dom_html_element_get_dom_ulong_property(&canvas->base,
                                                     "width",
                                                     SLEN("width"),
                                                     width);
+
+       if (exc != DOM_NO_ERR)
+               return exc;
+
+       if (*width == (dom_ulong)-1) {
+               /* width not set on the canvas, default is 300px */
+               *width = 300;
+       }
+
+       return DOM_NO_ERR;
 }
 
 dom_exception
@@ -172,10 +184,22 @@ dom_exception
 dom_html_canvas_element_get_height(dom_html_canvas_element *canvas,
                                  dom_ulong *height)
 {
-       return dom_html_element_get_dom_ulong_property(&canvas->base,
+       dom_exception exc;
+
+       exc = dom_html_element_get_dom_ulong_property(&canvas->base,
                                                     "height",
                                                     SLEN("height"),
                                                     height);
+
+       if (exc != DOM_NO_ERR)
+               return exc;
+
+       if (*height == (dom_ulong)-1) {
+               /* height not set on the canvas, default is 150px */
+               *height = 150;
+       }
+
+       return DOM_NO_ERR;
 }
 
 dom_exception


-- 
Document Object Model library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to