From 605234c3d23279419df72b0e553509ca95490769 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 19 May 2020 21:02:03 +0100 Subject: Page info: Only show certificate if scheme is https. --- desktop/page-info.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'desktop/page-info.c') diff --git a/desktop/page-info.c b/desktop/page-info.c index 79701d2f7..6467b60d4 100644 --- a/desktop/page-info.c +++ b/desktop/page-info.c @@ -462,11 +462,18 @@ static nserror page_info__layout( { int cur_y = 0; int max_x = 0; + enum nsurl_scheme_type scheme; + + scheme = nsurl_get_scheme_type(browser_window_access_url(pi->bw)); cur_y += pi->window_padding; for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) { struct page_info_entry *entry = pi->entries + i; + if (i == PI_ENTRY_CERT && scheme != NSURL_SCHEME_HTTPS) { + continue; + } + switch (entry->type) { case PAGE_INFO_ENTRY_TYPE_TEXT: cur_y += entry->u.text.height; @@ -576,6 +583,7 @@ nserror page_info_redraw( const struct redraw_context *ctx) { struct redraw_context new_ctx = *ctx; + enum nsurl_scheme_type scheme; struct rect r = { .x0 = clip->x0 + x, .y0 = clip->y0 + y, @@ -585,6 +593,8 @@ nserror page_info_redraw( int cur_y = 0; nserror err; + scheme = nsurl_get_scheme_type(browser_window_access_url(pi->bw)); + /* Start knockout rendering if it's available for this plotter. */ if (ctx->plot->option_knockout) { bool res = knockout_plot_start(ctx, &new_ctx); @@ -602,6 +612,10 @@ nserror page_info_redraw( const struct page_info_entry *entry = pi->entries + i; int cur_x = pi->window_padding; + if (i == PI_ENTRY_CERT && scheme != NSURL_SCHEME_HTTPS) { + continue; + } + switch (entry->type) { case PAGE_INFO_ENTRY_TYPE_TEXT: err = page_info__redraw_text_entry( @@ -704,15 +718,22 @@ nserror page_info_mouse_action( int y, bool *did_something) { + enum nsurl_scheme_type scheme; int cur_y = 0; nserror err; + scheme = nsurl_get_scheme_type(browser_window_access_url(pi->bw)); + cur_y += pi->window_padding; for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) { struct page_info_entry *entry = pi->entries + i; bool hovering = false; int height; + if (i == PI_ENTRY_CERT && scheme != NSURL_SCHEME_HTTPS) { + continue; + } + switch (entry->type) { case PAGE_INFO_ENTRY_TYPE_TEXT: cur_y += entry->u.text.height; -- cgit v1.2.3