Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/9ef852cdabe860ae51ad4731c56f93267fe84975
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/9ef852cdabe860ae51ad4731c56f93267fe84975
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/9ef852cdabe860ae51ad4731c56f93267fe84975

The branch, master has been updated
       via  9ef852cdabe860ae51ad4731c56f93267fe84975 (commit)
       via  b2f4f278be7200281c7ffc24187f10c678ffcdef (commit)
      from  6fe2f7de473246177eb21ee5cff7cfe2ae4bbe48 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=9ef852cdabe860ae51ad4731c56f93267fe84975
commit 9ef852cdabe860ae51ad4731c56f93267fe84975
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Page info: Don't show cookies if it's not an http(s) scheme.

diff --git a/desktop/page-info.c b/desktop/page-info.c
index 30afbbd..49b11a1 100644
--- a/desktop/page-info.c
+++ b/desktop/page-info.c
@@ -454,6 +454,36 @@ static nserror page_info__create_from_bw(
 }
 
 /**
+ * Check whether an entry is relevant.
+ *
+ * \param[in] entry   The page info entry to consider.
+ * \param[in] scheme  URL scheme that the page info is for.
+ * \return true if the entry should be hidden, otherwise false.
+ */
+static inline bool page_info__hide_entry(
+               enum pi_entry entry,
+               enum nsurl_scheme_type scheme)
+{
+       switch (entry) {
+       case PI_ENTRY_CERT:
+               if (scheme != NSURL_SCHEME_HTTPS) {
+                       return true;
+               }
+               break;
+       case PI_ENTRY_COOKIES:
+               if (scheme != NSURL_SCHEME_HTTP &&
+                   scheme != NSURL_SCHEME_HTTPS) {
+                       return true;
+               }
+               break;
+       default:
+               break;
+       }
+
+       return false;
+}
+
+/**
  * Lay out the page info window.
  *
  * \param[in] pi  The page info window handle.
@@ -469,7 +499,7 @@ static nserror page_info__layout(
        for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
                struct page_info_entry *entry = pi->entries + i;
 
-               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 
@@ -608,7 +638,7 @@ nserror page_info_redraw(
                const struct page_info_entry *entry = pi->entries + i;
                int cur_x = pi->window_padding;
 
-               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 
@@ -723,7 +753,7 @@ nserror page_info_mouse_action(
                bool hovering = false;
                int height;
 
-               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=b2f4f278be7200281c7ffc24187f10c678ffcdef
commit b2f4f278be7200281c7ffc24187f10c678ffcdef
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Page info: Get URL scheme on creation.

diff --git a/desktop/page-info.c b/desktop/page-info.c
index 6467b60..30afbbd 100644
--- a/desktop/page-info.c
+++ b/desktop/page-info.c
@@ -241,6 +241,7 @@ struct page_info {
 
        struct browser_window *bw;
        lwc_string *domain;
+       enum nsurl_scheme_type scheme;
 
        browser_window_page_info_state state;
        unsigned cookies;
@@ -447,6 +448,7 @@ static nserror page_info__create_from_bw(
        pi->state = browser_window_get_page_info_state(bw);
        pi->cookies = browser_window_get_cookie_count(bw);
        pi->domain = nsurl_get_component(url, NSURL_HOST);
+       pi->scheme = nsurl_get_scheme_type(url);
 
        return page_info__set_text(pi);
 }
@@ -462,15 +464,12 @@ 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) {
+               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
                        continue;
                }
 
@@ -583,7 +582,6 @@ 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,
@@ -593,8 +591,6 @@ 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);
@@ -612,7 +608,7 @@ 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) {
+               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
                        continue;
                }
 
@@ -718,19 +714,16 @@ 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) {
+               if (i == PI_ENTRY_CERT && pi->scheme != NSURL_SCHEME_HTTPS) {
                        continue;
                }
 


-----------------------------------------------------------------------

Summary of changes:
 desktop/page-info.c |   47 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/desktop/page-info.c b/desktop/page-info.c
index 6467b60..49b11a1 100644
--- a/desktop/page-info.c
+++ b/desktop/page-info.c
@@ -241,6 +241,7 @@ struct page_info {
 
        struct browser_window *bw;
        lwc_string *domain;
+       enum nsurl_scheme_type scheme;
 
        browser_window_page_info_state state;
        unsigned cookies;
@@ -447,11 +448,42 @@ static nserror page_info__create_from_bw(
        pi->state = browser_window_get_page_info_state(bw);
        pi->cookies = browser_window_get_cookie_count(bw);
        pi->domain = nsurl_get_component(url, NSURL_HOST);
+       pi->scheme = nsurl_get_scheme_type(url);
 
        return page_info__set_text(pi);
 }
 
 /**
+ * Check whether an entry is relevant.
+ *
+ * \param[in] entry   The page info entry to consider.
+ * \param[in] scheme  URL scheme that the page info is for.
+ * \return true if the entry should be hidden, otherwise false.
+ */
+static inline bool page_info__hide_entry(
+               enum pi_entry entry,
+               enum nsurl_scheme_type scheme)
+{
+       switch (entry) {
+       case PI_ENTRY_CERT:
+               if (scheme != NSURL_SCHEME_HTTPS) {
+                       return true;
+               }
+               break;
+       case PI_ENTRY_COOKIES:
+               if (scheme != NSURL_SCHEME_HTTP &&
+                   scheme != NSURL_SCHEME_HTTPS) {
+                       return true;
+               }
+               break;
+       default:
+               break;
+       }
+
+       return false;
+}
+
+/**
  * Lay out the page info window.
  *
  * \param[in] pi  The page info window handle.
@@ -462,15 +494,12 @@ 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) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 
@@ -583,7 +612,6 @@ 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,
@@ -593,8 +621,6 @@ 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);
@@ -612,7 +638,7 @@ 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) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 
@@ -718,19 +744,16 @@ 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) {
+               if (page_info__hide_entry(i, pi->scheme)) {
                        continue;
                }
 


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to