re-indent browser window and cleanup comments
no functional change
This commit is contained in:
parent
ca20dab9cf
commit
b37fdcd7e2
|
@ -1,11 +1,7 @@
|
|||
/*
|
||||
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
||||
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
|
||||
* Copyright 2004 John Tytgat <joty@netsurf-browser.org>
|
||||
* Copyright 2006 Richard Wilson <info@tinct.net>
|
||||
* Copyright 2008 Michael Drake <tlsa@netsurf-browser.org>
|
||||
* Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
|
||||
* Copyright 2010 Daniel Silverstone <dsilvers@digital-scurf.org>
|
||||
* Copyright 2010 Vincent Sanders <vince@netsurf-browser.org>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
|
@ -28,11 +24,6 @@
|
|||
* Browser window creation and manipulation implementation.
|
||||
*/
|
||||
|
||||
/** smallest scale that can be applied to a browser window*/
|
||||
#define SCALE_MINIMUM 0.2
|
||||
/** largests scale that can be applied to a browser window*/
|
||||
#define SCALE_MAXIMUM 10.0
|
||||
|
||||
#include "utils/config.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -79,8 +70,19 @@
|
|||
#include "desktop/gui_internal.h"
|
||||
#include "desktop/textinput.h"
|
||||
|
||||
/**
|
||||
* smallest scale that can be applied to a browser window
|
||||
*/
|
||||
#define SCALE_MINIMUM 0.2
|
||||
|
||||
/** maximum frame depth */
|
||||
/**
|
||||
* largests scale that can be applied to a browser window
|
||||
*/
|
||||
#define SCALE_MAXIMUM 10.0
|
||||
|
||||
/**
|
||||
* maximum frame depth
|
||||
*/
|
||||
#define FRAME_DEPTH 8
|
||||
|
||||
/* Have to forward declare browser_window_destroy_internal */
|
||||
|
@ -101,16 +103,18 @@ static void browser_window_destroy_children(struct browser_window *bw)
|
|||
int i;
|
||||
|
||||
if (bw->children) {
|
||||
for (i = 0; i < (bw->rows * bw->cols); i++)
|
||||
for (i = 0; i < (bw->rows * bw->cols); i++) {
|
||||
browser_window_destroy_internal(&bw->children[i]);
|
||||
}
|
||||
free(bw->children);
|
||||
bw->children = NULL;
|
||||
bw->rows = 0;
|
||||
bw->cols = 0;
|
||||
}
|
||||
if (bw->iframes) {
|
||||
for (i = 0; i < bw->iframe_count; i++)
|
||||
for (i = 0; i < bw->iframe_count; i++) {
|
||||
browser_window_destroy_internal(&bw->iframes[i]);
|
||||
}
|
||||
free(bw->iframes);
|
||||
bw->iframes = NULL;
|
||||
bw->iframe_count = 0;
|
||||
|
@ -124,7 +128,8 @@ static void browser_window_destroy_children(struct browser_window *bw)
|
|||
* \param bw The browser window
|
||||
*/
|
||||
static void
|
||||
browser_window__free_fetch_parameters(struct browser_fetch_parameters *params) {
|
||||
browser_window__free_fetch_parameters(struct browser_fetch_parameters *params)
|
||||
{
|
||||
if (params->url != NULL) {
|
||||
nsurl_unref(params->url);
|
||||
params->url = NULL;
|
||||
|
@ -218,7 +223,8 @@ browser_window_set_selection(struct browser_window *bw,
|
|||
|
||||
assert(top != NULL);
|
||||
|
||||
if (bw != top->selection.bw && top->selection.bw != NULL &&
|
||||
if (bw != top->selection.bw &&
|
||||
top->selection.bw != NULL &&
|
||||
top->selection.bw->current_content != NULL) {
|
||||
/* clear old selection */
|
||||
content_clear_selection(top->selection.bw->current_content);
|
||||
|
@ -380,6 +386,11 @@ browser_window_download(struct browser_window *bw,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* recursively check browser windows for activity
|
||||
*
|
||||
* \param bw browser window to start checking from.
|
||||
*/
|
||||
static bool browser_window_check_throbber(struct browser_window *bw)
|
||||
{
|
||||
int children, index;
|
||||
|
@ -401,6 +412,7 @@ static bool browser_window_check_throbber(struct browser_window *bw)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -432,8 +444,9 @@ static nserror browser_window_stop_throbber(struct browser_window *bw)
|
|||
|
||||
bw->throbbing = false;
|
||||
|
||||
while (bw->parent)
|
||||
while (bw->parent) {
|
||||
bw = bw->parent;
|
||||
}
|
||||
|
||||
if (!browser_window_check_throbber(bw)) {
|
||||
res = guit->window->event(bw->window, GW_EVENT_STOP_THROBBER);
|
||||
|
@ -511,6 +524,7 @@ browser_window_favicon_callback(hlcache_handle *c,
|
|||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
@ -523,25 +537,27 @@ browser_window_favicon_callback(hlcache_handle *c,
|
|||
* \param bw A top level browser window.
|
||||
* \param link A link context or NULL to attempt fallback scanning.
|
||||
*/
|
||||
static void
|
||||
static nserror
|
||||
browser_window_update_favicon(hlcache_handle *c,
|
||||
struct browser_window *bw,
|
||||
struct content_rfc5988_link *link)
|
||||
{
|
||||
nsurl *nsref = NULL;
|
||||
nsurl *nsurl;
|
||||
nserror error;
|
||||
nserror res;
|
||||
|
||||
assert(c != NULL);
|
||||
assert(bw !=NULL);
|
||||
|
||||
if (bw->window == NULL)
|
||||
if (bw->window == NULL) {
|
||||
/* Not top-level browser window; not interested */
|
||||
return;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
/* already fetching the favicon - use that */
|
||||
if (bw->favicon.loading != NULL)
|
||||
return;
|
||||
if (bw->favicon.loading != NULL) {
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
bw->favicon.failed = false;
|
||||
|
||||
|
@ -568,10 +584,12 @@ browser_window_update_favicon(hlcache_handle *c,
|
|||
* that there's a favicon living at /favicon.ico */
|
||||
if ((lwc_string_caseless_isequal(scheme,
|
||||
corestring_lwc_http,
|
||||
&match) == lwc_error_ok && match) ||
|
||||
&match) == lwc_error_ok &&
|
||||
match) ||
|
||||
(lwc_string_caseless_isequal(scheme,
|
||||
corestring_lwc_https,
|
||||
&match) == lwc_error_ok && match)) {
|
||||
&match) == lwc_error_ok &&
|
||||
match)) {
|
||||
speculative_default = true;
|
||||
}
|
||||
|
||||
|
@ -579,33 +597,44 @@ browser_window_update_favicon(hlcache_handle *c,
|
|||
|
||||
if (speculative_default) {
|
||||
/* no favicon via link, try for the default location */
|
||||
error = nsurl_join(nsurl, "/favicon.ico", &nsurl);
|
||||
res = nsurl_join(nsurl, "/favicon.ico", &nsurl);
|
||||
} else {
|
||||
bw->favicon.failed = true;
|
||||
error = nsurl_create("resource:favicon.ico", &nsurl);
|
||||
res = nsurl_create("resource:favicon.ico", &nsurl);
|
||||
}
|
||||
if (error != NSERROR_OK) {
|
||||
if (res != NSERROR_OK) {
|
||||
NSLOG(netsurf, INFO,
|
||||
"Unable to create default location url");
|
||||
return;
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
nsurl = nsurl_ref(link->href);
|
||||
}
|
||||
|
||||
if (link == NULL) {
|
||||
NSLOG(netsurf, INFO, "fetching general favicon from '%s'",
|
||||
NSLOG(netsurf, INFO,
|
||||
"fetching general favicon from '%s'",
|
||||
nsurl_access(nsurl));
|
||||
} else {
|
||||
NSLOG(netsurf, INFO, "fetching favicon rel:%s '%s'",
|
||||
lwc_string_data(link->rel), nsurl_access(nsurl));
|
||||
NSLOG(netsurf, INFO,
|
||||
"fetching favicon rel:%s '%s'",
|
||||
lwc_string_data(link->rel),
|
||||
nsurl_access(nsurl));
|
||||
}
|
||||
|
||||
hlcache_handle_retrieve(nsurl, HLCACHE_RETRIEVE_SNIFF_TYPE,
|
||||
nsref, NULL, browser_window_favicon_callback,
|
||||
bw, NULL, CONTENT_IMAGE, &bw->favicon.loading);
|
||||
res = hlcache_handle_retrieve(nsurl,
|
||||
HLCACHE_RETRIEVE_SNIFF_TYPE,
|
||||
nsref,
|
||||
NULL,
|
||||
browser_window_favicon_callback,
|
||||
bw,
|
||||
NULL,
|
||||
CONTENT_IMAGE,
|
||||
&bw->favicon.loading);
|
||||
|
||||
nsurl_unref(nsurl);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -843,6 +872,7 @@ browser_window_content_done(struct browser_window *bw)
|
|||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle query responses from SSL requests
|
||||
*/
|
||||
|
@ -873,9 +903,11 @@ browser_window__handle_ssl_query_response(bool proceed, void *pw)
|
|||
|
||||
/* And then we navigate to the original loading parameters */
|
||||
bw->internal_nav = false;
|
||||
|
||||
return browser_window__navigate_internal(bw, &bw->loading_parameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unpack a "username:password" to components.
|
||||
*
|
||||
|
@ -935,6 +967,7 @@ browser_window__unpack_userpass(const char *userpass,
|
|||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a "username:password" from components.
|
||||
*
|
||||
|
@ -965,6 +998,7 @@ browser_window__build_userpass(const char *username,
|
|||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle a response from the UI when prompted for credentials
|
||||
*/
|
||||
|
@ -1003,6 +1037,7 @@ browser_window__handle_userpass_response(nsurl *url,
|
|||
return browser_window__navigate_internal(bw, &bw->loading_parameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle login request (BAD_AUTH) during fetch
|
||||
*
|
||||
|
@ -1083,6 +1118,7 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle a certificate verification request (BAD_CERTS) during a fetch
|
||||
*/
|
||||
|
@ -1144,6 +1180,7 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle errors during content fetch
|
||||
*/
|
||||
|
@ -1230,6 +1267,7 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
|
|||
sizeof(struct ssl_cert_info) * event->data.certs.num);
|
||||
bw->loading_ssl_info.num = event->data.certs.num;
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_LOG:
|
||||
browser_window_console_log(bw,
|
||||
event->data.log.src,
|
||||
|
@ -1237,6 +1275,7 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
|
|||
event->data.log.msglen,
|
||||
event->data.log.flags);
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_DOWNLOAD:
|
||||
assert(bw->loading_content == c);
|
||||
|
||||
|
@ -1281,24 +1320,28 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
|
|||
break;
|
||||
|
||||
case CONTENT_MSG_REDIRECT:
|
||||
if (urldb_add_url(event->data.redirect.from))
|
||||
if (urldb_add_url(event->data.redirect.from)) {
|
||||
urldb_update_url_visit_data(event->data.redirect.from);
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTENT_MSG_STATUS:
|
||||
if (event->data.explicit_status_text == NULL) {
|
||||
/* Object content's status text updated */
|
||||
const char *status = NULL;
|
||||
if (bw->loading_content != NULL)
|
||||
if (bw->loading_content != NULL) {
|
||||
/* Give preference to any loading content */
|
||||
status = content_get_status_message(
|
||||
bw->loading_content);
|
||||
}
|
||||
|
||||
if (status == NULL)
|
||||
if (status == NULL) {
|
||||
status = content_get_status_message(c);
|
||||
}
|
||||
|
||||
if (status != NULL)
|
||||
if (status != NULL) {
|
||||
browser_window_set_status(bw, status);
|
||||
}
|
||||
} else {
|
||||
/* Object content wants to set explicit message */
|
||||
browser_window_set_status(bw,
|
||||
|
@ -1423,22 +1466,26 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
|
|||
|
||||
switch(event->data.dragsave.type) {
|
||||
case CONTENT_SAVE_ORIG:
|
||||
guit->window->drag_save_object(root->window, save,
|
||||
guit->window->drag_save_object(root->window,
|
||||
save,
|
||||
GUI_SAVE_OBJECT_ORIG);
|
||||
break;
|
||||
|
||||
case CONTENT_SAVE_NATIVE:
|
||||
guit->window->drag_save_object(root->window, save,
|
||||
guit->window->drag_save_object(root->window,
|
||||
save,
|
||||
GUI_SAVE_OBJECT_NATIVE);
|
||||
break;
|
||||
|
||||
case CONTENT_SAVE_COMPLETE:
|
||||
guit->window->drag_save_object(root->window, save,
|
||||
guit->window->drag_save_object(root->window,
|
||||
save,
|
||||
GUI_SAVE_COMPLETE);
|
||||
break;
|
||||
|
||||
case CONTENT_SAVE_SOURCE:
|
||||
guit->window->drag_save_object(root->window, save,
|
||||
guit->window->drag_save_object(root->window,
|
||||
save,
|
||||
GUI_SAVE_SOURCE);
|
||||
break;
|
||||
}
|
||||
|
@ -1909,11 +1956,11 @@ browser_window_mouse_click_internal(struct browser_window *bw,
|
|||
|
||||
/* It's this child that contains the click; pass it
|
||||
* on to child. */
|
||||
browser_window_mouse_click_internal(child, mouse,
|
||||
x - child->x + scrollbar_get_offset(
|
||||
child->scroll_x),
|
||||
y - child->y + scrollbar_get_offset(
|
||||
child->scroll_y));
|
||||
browser_window_mouse_click_internal(
|
||||
child,
|
||||
mouse,
|
||||
x - child->x + scrollbar_get_offset(child->scroll_x),
|
||||
y - child->y + scrollbar_get_offset(child->scroll_y));
|
||||
|
||||
/* Mouse action was for this child, we're done */
|
||||
return;
|
||||
|
@ -1957,12 +2004,15 @@ browser_window_mouse_click_internal(struct browser_window *bw,
|
|||
scr_x > 0 && scr_x < SCROLLBAR_WIDTH) {
|
||||
status = scrollbar_mouse_status_to_message(
|
||||
scrollbar_mouse_action(
|
||||
bw->scroll_y, mouse,
|
||||
scr_x, scr_y));
|
||||
bw->scroll_y,
|
||||
mouse,
|
||||
scr_x,
|
||||
scr_y));
|
||||
pointer = BROWSER_POINTER_DEFAULT;
|
||||
|
||||
if (status != NULL)
|
||||
if (status != NULL) {
|
||||
browser_window_set_status(bw, status);
|
||||
}
|
||||
|
||||
browser_window_set_pointer(bw, pointer);
|
||||
return;
|
||||
|
@ -2032,11 +2082,12 @@ browser_window_mouse_track_internal(struct browser_window *bw,
|
|||
browser_window_get_position(drag_bw, true, &off_x, &off_y);
|
||||
|
||||
if (drag_bw->browser_window_type == BROWSER_WINDOW_FRAME) {
|
||||
browser_window_mouse_track_internal(drag_bw, mouse,
|
||||
x - off_x, y - off_y);
|
||||
browser_window_mouse_track_internal(drag_bw,
|
||||
mouse,
|
||||
x - off_x,
|
||||
y - off_y);
|
||||
|
||||
} else if (drag_bw->browser_window_type ==
|
||||
BROWSER_WINDOW_IFRAME) {
|
||||
} else if (drag_bw->browser_window_type == BROWSER_WINDOW_IFRAME) {
|
||||
browser_window_mouse_track_internal(drag_bw, mouse,
|
||||
x - off_x / bw->scale,
|
||||
y - off_y / bw->scale);
|
||||
|
@ -2102,9 +2153,10 @@ browser_window_mouse_track_internal(struct browser_window *bw,
|
|||
bw->drag.type == DRAGGING_NONE)) {
|
||||
/* Start a scrollbar drag, or continue existing drag */
|
||||
status = scrollbar_mouse_status_to_message(
|
||||
scrollbar_mouse_action(
|
||||
bw->scroll_x, mouse,
|
||||
scr_x, scr_y));
|
||||
scrollbar_mouse_action(bw->scroll_x,
|
||||
mouse,
|
||||
scr_x,
|
||||
scr_y));
|
||||
pointer = BROWSER_POINTER_DEFAULT;
|
||||
|
||||
if (status != NULL) {
|
||||
|
@ -2131,9 +2183,10 @@ browser_window_mouse_track_internal(struct browser_window *bw,
|
|||
bw->drag.type == DRAGGING_NONE)) {
|
||||
/* Start a scrollbar drag, or continue existing drag */
|
||||
status = scrollbar_mouse_status_to_message(
|
||||
scrollbar_mouse_action(
|
||||
bw->scroll_y, mouse,
|
||||
scr_x, scr_y));
|
||||
scrollbar_mouse_action(bw->scroll_y,
|
||||
mouse,
|
||||
scr_x,
|
||||
scr_y));
|
||||
pointer = BROWSER_POINTER_DEFAULT;
|
||||
|
||||
if (status != NULL) {
|
||||
|
@ -2215,19 +2268,22 @@ browser_window_scroll_at_point_internal(struct browser_window *bw,
|
|||
}
|
||||
|
||||
/* Try to scroll any current content */
|
||||
if (bw->current_content != NULL && content_scroll_at_point(
|
||||
bw->current_content, x, y, scrx, scry) == true)
|
||||
if (bw->current_content != NULL &&
|
||||
content_scroll_at_point(bw->current_content, x, y, scrx, scry) == true) {
|
||||
/* Scroll handled by current content */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Try to scroll this window, if scroll not already handled */
|
||||
if (handled_scroll == false) {
|
||||
if (bw->scroll_y && scrollbar_scroll(bw->scroll_y, scry))
|
||||
if (bw->scroll_y && scrollbar_scroll(bw->scroll_y, scry)) {
|
||||
handled_scroll = true;
|
||||
}
|
||||
|
||||
if (bw->scroll_x && scrollbar_scroll(bw->scroll_x, scrx))
|
||||
if (bw->scroll_x && scrollbar_scroll(bw->scroll_x, scrx)) {
|
||||
handled_scroll = true;
|
||||
}
|
||||
}
|
||||
|
||||
return handled_scroll;
|
||||
}
|
||||
|
@ -2270,7 +2326,8 @@ browser_window_drop_file_at_point_internal(struct browser_window *bw,
|
|||
continue;
|
||||
|
||||
/* Pass request into this child */
|
||||
return browser_window_drop_file_at_point_internal(bwc,
|
||||
return browser_window_drop_file_at_point_internal(
|
||||
bwc,
|
||||
(x - bwc->x),
|
||||
(y - bwc->y),
|
||||
file);
|
||||
|
@ -2786,8 +2843,10 @@ browser_window_get_features(struct browser_window *bw,
|
|||
data->main = NULL;
|
||||
data->form_features = CTX_FORM_NONE;
|
||||
|
||||
return browser_window__get_contextual_content(
|
||||
bw, x / bw->scale, y / bw->scale, data);
|
||||
return browser_window__get_contextual_content(bw,
|
||||
x / bw->scale,
|
||||
y / bw->scale,
|
||||
data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2920,13 +2979,21 @@ browser_window_create(enum browser_window_create_flags flags,
|
|||
}
|
||||
|
||||
if (url != NULL) {
|
||||
enum browser_window_nav_flags nav_flags = BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE;
|
||||
if (flags & BW_CREATE_UNVERIFIABLE)
|
||||
enum browser_window_nav_flags nav_flags;
|
||||
nav_flags = BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE;
|
||||
if (flags & BW_CREATE_UNVERIFIABLE) {
|
||||
nav_flags |= BW_NAVIGATE_UNVERIFIABLE;
|
||||
if (flags & BW_CREATE_HISTORY)
|
||||
}
|
||||
if (flags & BW_CREATE_HISTORY) {
|
||||
nav_flags |= BW_NAVIGATE_HISTORY;
|
||||
browser_window_navigate(ret, url, referrer, nav_flags, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
browser_window_navigate(ret,
|
||||
url,
|
||||
referrer,
|
||||
nav_flags,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (bw != NULL) {
|
||||
|
@ -3183,9 +3250,9 @@ browser_window_navigate(struct browser_window *bw,
|
|||
/* Compare new URL with existing one (ignoring fragments) */
|
||||
if ((bw->current_content != NULL) &&
|
||||
(hlcache_handle_get_url(bw->current_content) != NULL)) {
|
||||
same_url = nsurl_compare(url,
|
||||
hlcache_handle_get_url(
|
||||
bw->current_content),
|
||||
same_url = nsurl_compare(
|
||||
url,
|
||||
hlcache_handle_get_url(bw->current_content),
|
||||
NSURL_COMPLETE);
|
||||
}
|
||||
|
||||
|
@ -3279,7 +3346,7 @@ browser_window__navigate_internal_real(struct browser_window *bw,
|
|||
bool fetch_is_post = (params->post_urlenc != NULL || params->post_multipart != NULL);
|
||||
llcache_post_data post;
|
||||
hlcache_child_context child;
|
||||
nserror error;
|
||||
nserror res;
|
||||
hlcache_handle *c;
|
||||
|
||||
NSLOG(netsurf, INFO, "Loading '%s'", nsurl_access(params->url));
|
||||
|
@ -3313,20 +3380,23 @@ browser_window__navigate_internal_real(struct browser_window *bw,
|
|||
fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
|
||||
}
|
||||
|
||||
error = hlcache_handle_retrieve(params->url,
|
||||
res = hlcache_handle_retrieve(params->url,
|
||||
fetch_flags | HLCACHE_RETRIEVE_SNIFF_TYPE,
|
||||
params->referrer,
|
||||
fetch_is_post ? &post : NULL,
|
||||
browser_window_callback, bw,
|
||||
browser_window_callback,
|
||||
bw,
|
||||
params->parent_charset != NULL ? &child : NULL,
|
||||
CONTENT_ANY, &c);
|
||||
CONTENT_ANY,
|
||||
&c);
|
||||
|
||||
switch (error) {
|
||||
switch (res) {
|
||||
case NSERROR_OK:
|
||||
bw->loading_content = c;
|
||||
browser_window_start_throbber(bw);
|
||||
if (bw->internal_nav == false) {
|
||||
error = browser_window_refresh_url_bar_internal(bw, params->url);
|
||||
res = browser_window_refresh_url_bar_internal(bw,
|
||||
params->url);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3334,13 +3404,13 @@ browser_window__navigate_internal_real(struct browser_window *bw,
|
|||
/** \todo does this always try and download even
|
||||
* unverifiable content?
|
||||
*/
|
||||
error = guit->misc->launch_url(params->url);
|
||||
res = guit->misc->launch_url(params->url);
|
||||
break;
|
||||
|
||||
default: /* report error to user */
|
||||
browser_window_set_status(bw, messages_get_errorcode(error));
|
||||
browser_window_set_status(bw, messages_get_errorcode(res));
|
||||
/** @todo should the caller report the error? */
|
||||
guit->misc->warning(messages_get_errorcode(error), NULL);
|
||||
guit->misc->warning(messages_get_errorcode(res), NULL);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -3348,7 +3418,7 @@ browser_window__navigate_internal_real(struct browser_window *bw,
|
|||
/* Record time */
|
||||
nsu_getmonotonic_ms(&bw->last_action);
|
||||
|
||||
return error;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3499,8 +3569,8 @@ bool browser_window_up_available(struct browser_window *bw)
|
|||
|
||||
if (bw != NULL && bw->current_content != NULL) {
|
||||
nsurl *parent;
|
||||
nserror err = nsurl_parent(hlcache_handle_get_url(
|
||||
bw->current_content),
|
||||
nserror err;
|
||||
err = nsurl_parent(hlcache_handle_get_url(bw->current_content),
|
||||
&parent);
|
||||
if (err == NSERROR_OK) {
|
||||
result = nsurl_compare(hlcache_handle_get_url(
|
||||
|
@ -3828,8 +3898,8 @@ void browser_window_stop(struct browser_window *bw)
|
|||
bw->loading_content = NULL;
|
||||
}
|
||||
|
||||
if (bw->current_content != NULL && content_get_status(
|
||||
bw->current_content) != CONTENT_STATUS_DONE) {
|
||||
if (bw->current_content != NULL &&
|
||||
content_get_status(bw->current_content) != CONTENT_STATUS_DONE) {
|
||||
nserror error;
|
||||
assert(content_get_status(bw->current_content) ==
|
||||
CONTENT_STATUS_READY);
|
||||
|
@ -3859,13 +3929,16 @@ void browser_window_stop(struct browser_window *bw)
|
|||
|
||||
|
||||
/* Exported interface, documented in netsurf/browser_window.h */
|
||||
void browser_window_reload(struct browser_window *bw, bool all)
|
||||
nserror browser_window_reload(struct browser_window *bw, bool all)
|
||||
{
|
||||
hlcache_handle *c;
|
||||
unsigned int i;
|
||||
struct nsurl *reload_url;
|
||||
|
||||
if (bw->current_content == NULL || bw->loading_content != NULL)
|
||||
return;
|
||||
if ((bw->current_content) == NULL ||
|
||||
(bw->loading_content) != NULL) {
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
if (all && content_get_type(bw->current_content) == CONTENT_HTML) {
|
||||
struct html_stylesheet *sheets;
|
||||
|
@ -3894,8 +3967,10 @@ void browser_window_reload(struct browser_window *bw, bool all)
|
|||
|
||||
content_invalidate_reuse_data(bw->current_content);
|
||||
|
||||
browser_window_navigate(bw,
|
||||
hlcache_handle_get_url(bw->current_content),
|
||||
reload_url = hlcache_handle_get_url(bw->current_content);
|
||||
|
||||
return browser_window_navigate(bw,
|
||||
reload_url,
|
||||
NULL,
|
||||
BW_NAVIGATE_NONE,
|
||||
NULL,
|
||||
|
@ -3990,8 +4065,11 @@ nserror browser_window_schedule_reformat(struct browser_window *bw)
|
|||
|
||||
|
||||
/* exported function documented in netsurf/browser_window.h */
|
||||
void browser_window_reformat(struct browser_window *bw, bool background,
|
||||
int width, int height)
|
||||
void
|
||||
browser_window_reformat(struct browser_window *bw,
|
||||
bool background,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
hlcache_handle *c = bw->current_content;
|
||||
|
||||
|
@ -4079,10 +4157,14 @@ browser_window_find_target(struct browser_window *bw,
|
|||
|
||||
/* use the base target if we don't have one */
|
||||
c = bw->current_content;
|
||||
if (target == NULL && c != NULL && content_get_type(c) == CONTENT_HTML)
|
||||
if (target == NULL &&
|
||||
c != NULL &&
|
||||
content_get_type(c) == CONTENT_HTML) {
|
||||
target = html_get_base_target(c);
|
||||
if (target == NULL)
|
||||
}
|
||||
if (target == NULL) {
|
||||
target = TARGET_SELF;
|
||||
}
|
||||
|
||||
/* allow the simple case of target="_blank" to be ignored if requested
|
||||
*/
|
||||
|
@ -4365,6 +4447,7 @@ browser_window_console_log(struct browser_window *bw,
|
|||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in browser_private.h */
|
||||
nserror
|
||||
browser_window__reload_current_parameters(struct browser_window *bw)
|
||||
|
|
|
@ -302,8 +302,9 @@ void browser_window_stop(struct browser_window *bw);
|
|||
*
|
||||
* \param bw browser window
|
||||
* \param all whether to reload all objects associated with the page
|
||||
* \return NSERROR_OK on success else error code.
|
||||
*/
|
||||
void browser_window_reload(struct browser_window *bw, bool all);
|
||||
nserror browser_window_reload(struct browser_window *bw, bool all);
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue