summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-03-15 00:00:45 +0000
committerVincent Sanders <vince@kyllikki.org>2015-03-15 00:00:45 +0000
commit8a99b045bc48e0c5eb89129ea8ee034c72b955de (patch)
treef2dabbca020b91b41ab3f476fca1ed2378f8ced2 /desktop
parent52b50db3a6f1d52b3c9e18b36121f487c09de906 (diff)
downloadnetsurf-8a99b045bc48e0c5eb89129ea8ee034c72b955de.tar.gz
netsurf-8a99b045bc48e0c5eb89129ea8ee034c72b955de.tar.bz2
Remove url from content thumbnailers API
The content thumbnailers for each frontend were being provided the contents url. This was only ever used to call the urldb thumbnail setting API. This changes it so the single callsite that passed a valid url adds the bitmap to that url itself in desktop_history.c instead of forcing every frontend to require the urldb API. Additionally the old API could pass the url as NULL which was causing asserts where this was not an expected parameter value. Because of this this fixes bug #2286 which was also present in the monkey frontend as both called nsurl_access() on the url without the NULL check and caused an assertion.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser_history.c24
-rw-r--r--desktop/thumbnail.h4
2 files changed, 17 insertions, 11 deletions
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index fb76097ed..dc04a16c1 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -512,13 +512,21 @@ nserror browser_window_history_add(struct browser_window *bw,
if (bitmap == NULL) {
LOG(("Creating thumbnail for %s", nsurl_access(nsurl)));
bitmap = bitmap_create(WIDTH, HEIGHT,
- BITMAP_NEW | BITMAP_CLEAR_MEMORY |
- BITMAP_OPAQUE);
- if ((bitmap != NULL) &&
- (thumbnail_create(content, bitmap, nsurl) == false)) {
- /* Thumbnailing failed. Ignore it silently */
- bitmap_destroy(bitmap);
- bitmap = NULL;
+ BITMAP_NEW | BITMAP_CLEAR_MEMORY |
+ BITMAP_OPAQUE);
+ if (bitmap != NULL) {
+ if (thumbnail_create(content, bitmap)) {
+ /* Successful thumbnail so register it
+ * with the url.
+ */
+ urldb_set_thumbnail(nsurl, bitmap);
+ } else {
+ /* Thumbnailing failed. Ignore it
+ * silently but clean up bitmap.
+ */
+ bitmap_destroy(bitmap);
+ bitmap = NULL;
+ }
}
}
entry->bitmap = bitmap;
@@ -555,7 +563,7 @@ nserror browser_window_history_update(struct browser_window *bw,
free(history->current->page.title);
history->current->page.title = title;
- thumbnail_create(content, history->current->bitmap, NULL);
+ thumbnail_create(content, history->current->bitmap);
return NSERROR_OK;
}
diff --git a/desktop/thumbnail.h b/desktop/thumbnail.h
index ecf8fa6f2..ef31f7ec3 100644
--- a/desktop/thumbnail.h
+++ b/desktop/thumbnail.h
@@ -28,7 +28,6 @@
struct hlcache_handle;
struct redraw_context;
struct bitmap;
-struct nsurl;
/**
* Redraw a content for thumbnailing
@@ -51,7 +50,6 @@ bool thumbnail_redraw(struct hlcache_handle *content, int width, int height,
/* In platform specific thumbnail.c. */
-bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap,
- struct nsurl *url);
+bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap);
#endif