summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-10-03 10:15:12 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-10-03 10:15:12 +0100
commitabfd646c26f2e00484266507523c420bcb9ea7b8 (patch)
treebb183360aed83cd91ba8f8f51dcdca34966e2ac0
parent529be5ca39c56adc5d0dabdc45f4c70f703bac15 (diff)
downloadlibdom-abfd646c26f2e00484266507523c420bcb9ea7b8.tar.gz
libdom-abfd646c26f2e00484266507523c420bcb9ea7b8.tar.bz2
html_canvas_element: height and width have default values for canvassesHEADmaster
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--src/html/html_canvas_element.c28
1 files 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