More work on about:imagecache entry listing table.

svn path=/trunk/netsurf/; revision=13855
This commit is contained in:
Michael Drake 2012-04-12 13:43:57 +00:00
parent e2e69d29bb
commit cdee9e985e
3 changed files with 57 additions and 28 deletions

View File

@ -181,24 +181,28 @@ body#configlist .null-content {
* about:imagecache
*/
table.imagecachelist {
p.imagecachelist {
border-spacing: 0px;
margin-top: 1.2em;
margin-bottom: 1.2em;
display: table;
}
table.imagecachelist tr:nth-child(2n+3) {
p.imagecachelist a:nth-child(2n+3) {
background: #e8edff;
}
table.imagecachelist th {
p.imagecachelist strong, p.imagecachelist a {
display: table-row;
}
p.imagecachelist strong span {
background: #c8d5ff;
padding: 2px;
text-align: left;
}
table.imagecachelist td {
p.imagecachelist span {
border-top: 1px solid #bcf;
padding: 2px;
padding: 2px 0.5em;
display: table-cell;
}

View File

@ -242,29 +242,30 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
/* image cache entry table */
slen = snprintf(buffer, sizeof buffer,
"<table class=\"imagecachelist\">\n"
"<tr>"
"<th>Entry</th>"
"<th>Content Key</th>"
"<th>Redraw<br>Count</th>"
"<th>Conversion<br>Count</th>"
"<th>Last Redraw</th>"
"<th>Bitmap Age</th>"
"<th>Bitmap Size</th>"
"<th>Source URL</th>"
"</tr>\n");
"<p class=\"imagecachelist\">\n"
"<strong>"
"<span>Entry</span>"
"<span>Content Key</span>"
"<span>Redraw Count</span>"
"<span>Conversion Count</span>"
"<span>Last Redraw</span>"
"<span>Bitmap Age</span>"
"<span>Bitmap Size</span>"
"<span>Source</span>"
"</strong>\n");
do {
res = image_cache_snentryf(buffer + slen, sizeof buffer - slen,
cent_loop,
"<tr><td>%e</td>"
"<td>%k</td>"
"<td>%r</td>"
"<td>%c</td>"
"<td>%a</td>"
"<td>%g</td>"
"<td>%s</td>"
"<td><a href=\"%U\">%U</a></td>"
"</tr>\n");
"<a href=\"%U\">"
"<span>%e</span>"
"<span>%k</span>"
"<span>%r</span>"
"<span>%c</span>"
"<span>%a</span>"
"<span>%g</span>"
"<span>%s</span>"
"<span>%o</span>"
"</a>\n");
if (res <= 0)
break; /* last option */
@ -282,7 +283,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
} while (res > 0);
slen += snprintf(buffer + slen, sizeof buffer - slen,
"</table>\n</body>\n</html>\n");
"</p>\n</body>\n</html>\n");
msg.data.header_or_data.len = slen;
if (fetch_about_send_callback(&msg, ctx))

View File

@ -637,6 +637,7 @@ int image_cache_snentryf(char *string, size_t size, unsigned int entryn,
struct image_cache_entry_s *centry;
size_t slen = 0; /* current output string length */
int fmtc = 0; /* current index into format string */
lwc_string *origin; /* current entry's origin */
centry = image_cache__findn(entryn);
if (centry == NULL)
@ -681,6 +682,29 @@ int image_cache_snentryf(char *string, size_t size, unsigned int entryn,
slen += snprintf(string + slen, size - slen,
"%s", nsurl_access(llcache_handle_get_url(centry->content->llcache)));
break;
case 'o':
if (nsurl_has_component(llcache_handle_get_url(
centry->content->llcache),
NSURL_HOST)) {
origin = nsurl_get_component(
llcache_handle_get_url(
centry->content->
llcache),
NSURL_HOST);
slen += snprintf(string + slen,
size - slen, "%s",
lwc_string_data(
origin));
lwc_string_unref(origin);
} else {
slen += snprintf(string + slen,
size - slen, "%s",
"localhost");
}
break;
case 's':
if (centry->bitmap != NULL) {