diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-04-23 23:32:21 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-04-23 23:32:21 +0100 |
commit | 974a4a21e16a2da85a66aae9b80eeca15ca26dd6 (patch) | |
tree | 4433113896c8f5aec5a3f4130b50f9a73075907c /desktop/gui_factory.c | |
parent | cdd53bcffb00819360b3e62ef41de6607aca2c76 (diff) | |
download | netsurf-974a4a21e16a2da85a66aae9b80eeca15ca26dd6.tar.gz netsurf-974a4a21e16a2da85a66aae9b80eeca15ca26dd6.tar.bz2 |
split out the layout glyph sizing and splitting API
This refactors the core "font" sizing API to be handled through gui
function tables similar to every other core/frontend calling API.
Diffstat (limited to 'desktop/gui_factory.c')
-rw-r--r-- | desktop/gui_factory.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index 0b168f405..c15603e1c 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -37,6 +37,7 @@ #include "desktop/gui_search.h" #include "desktop/gui_clipboard.h" #include "desktop/gui_utf8.h" +#include "desktop/gui_layout.h" #include "desktop/netsurf.h" /** @@ -644,6 +645,35 @@ static nserror verify_bitmap_register(struct gui_bitmap_table *gbt) return NSERROR_OK; } +/** + * verify layout table is valid + * + * \param glt The layout table to verify. + * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER. + */ +static nserror verify_layout_register(struct gui_layout_table *glt) +{ + /* check table is present */ + if (glt == NULL) { + return NSERROR_BAD_PARAMETER; + } + + /* check the mandantory fields are set */ + if (glt->width == NULL) { + return NSERROR_BAD_PARAMETER; + } + + if (glt->position == NULL) { + return NSERROR_BAD_PARAMETER; + } + + if (glt->split == NULL) { + return NSERROR_BAD_PARAMETER; + } + + return NSERROR_OK; +} + static void gui_default_quit(void) { } @@ -725,6 +755,8 @@ nserror netsurf_register(struct netsurf_table *gt) return NSERROR_BAD_PARAMETER; } + /* mandantory tables */ + /* miscellaneous table */ err = verify_misc_register(gt->misc); if (err != NSERROR_OK) { @@ -749,6 +781,14 @@ nserror netsurf_register(struct netsurf_table *gt) return err; } + /* layout table */ + err = verify_layout_register(gt->layout); + if (err != NSERROR_OK) { + return err; + } + + /* optional tables */ + /* file table */ if (gt->file == NULL) { gt->file = default_file_table; |