diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-07-06 18:34:34 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-07-06 18:34:34 +0100 |
commit | 3a9fa29ee53bef70a0e643847acc2fb374501f70 (patch) | |
tree | e9a8946c7655e03e4c9a9d702bbf36b1952a92df /desktop/browser.c | |
parent | caf918d2f28f600184036aef3f096024d3af62a7 (diff) | |
download | netsurf-3a9fa29ee53bef70a0e643847acc2fb374501f70.tar.gz netsurf-3a9fa29ee53bef70a0e643847acc2fb374501f70.tar.bz2 |
try and improve usage of browser window internals
Diffstat (limited to 'desktop/browser.c')
-rw-r--r-- | desktop/browser.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index dc2db723c..684035a0a 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -781,9 +781,18 @@ nserror browser_window_initialise_common(enum browser_window_create_flags flags, if (flags & BW_CREATE_CLONE) { assert(existing != NULL); + + /* clone history */ err = browser_window_history_clone(existing, bw); + + /* copy the scale */ + bw->scale = existing->scale; } else { + /* create history */ err = browser_window_history_create(bw); + + /* default scale */ + bw->scale = (float) nsoption_int(scale) / 100.0; } if (err != NSERROR_OK) @@ -793,7 +802,6 @@ nserror browser_window_initialise_common(enum browser_window_create_flags flags, bw->refresh_interval = -1; bw->drag_type = DRAGGING_NONE; - bw->scale = (float) nsoption_int(scale) / 100.0; bw->scroll_x = NULL; bw->scroll_y = NULL; @@ -1958,7 +1966,7 @@ nserror browser_window_navigate(struct browser_window *bw, /* Exported interface, documented in browser.h */ -nsurl * browser_window_get_url(struct browser_window *bw) +nsurl* browser_window_get_url(struct browser_window *bw) { assert(bw != NULL); @@ -1973,6 +1981,17 @@ nsurl * browser_window_get_url(struct browser_window *bw) return corestring_nsurl_about_blank; } +/* Exported interface, documented in browser.h */ +const char* browser_window_get_title(struct browser_window *bw) +{ + assert(bw != NULL); + + if (bw->current_content != NULL) { + return content_get_title(bw->current_content); + } + + return NULL; +} /* Exported interface, documented in browser.h */ struct history * browser_window_get_history(struct browser_window *bw) @@ -2436,14 +2455,7 @@ static void browser_window_set_scale_internal(struct browser_window *bw, } -/** - * Sets the scale of a browser window - * - * \param bw The browser window to scale - * \param scale The new scale - * \param all Scale all windows in the tree (ie work up aswell as down) - */ - +/* exported interface documented in desktop/browser.h */ void browser_window_set_scale(struct browser_window *bw, float scale, bool all) { while (bw->parent && all) @@ -2458,13 +2470,7 @@ void browser_window_set_scale(struct browser_window *bw, float scale, bool all) } -/** - * Gets the scale of a browser window - * - * \param bw The browser window to scale - * \return - */ - +/* exported interface documented in desktop/browser.h */ float browser_window_get_scale(struct browser_window *bw) { return bw->scale; |