Gitweb links:

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

The branch, master has been updated
       via  d082717ea653b61c36ebf067a12d468abedc8e5f (commit)
       via  64d90e014b3d95fe3fa37cdad09c37bee3e384d9 (commit)
      from  8b7bbb415828c72ba1719d7ed210772ff7cc4dc8 (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=d082717ea653b61c36ebf067a12d468abedc8e5f
commit d082717ea653b61c36ebf067a12d468abedc8e5f
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    HTML: CSS media spec: Pass in dark mode preference.

diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index c6a2872..2b6b1a8 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -458,6 +458,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
        dom_hubbub_error error;
        dom_exception err;
        void *old_node_data;
+       const char *prefer_color_mode = (nsoption_bool(prefer_dark_mode)) ?
+                       "dark" : "light";
 
        c->parser = NULL;
        c->parse_completed = false;
@@ -505,6 +507,13 @@ html_create_html_data(html_content *c, const 
http_parameter *params)
                return NSERROR_NOMEM;
        }
 
+       if (lwc_intern_string(prefer_color_mode, strlen(prefer_color_mode),
+                       &c->media.prefers_color_scheme) != lwc_error_ok) {
+               lwc_string_unref(c->universal);
+               c->universal = NULL;
+               return NSERROR_NOMEM;
+       }
+
        c->sel = selection_create((struct content *)c);
 
        nerror = http_parameter_list_find_item(params, corestring_lwc_charset, 
&charset);
@@ -516,6 +525,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
                if (c->encoding == NULL) {
                        lwc_string_unref(c->universal);
                        c->universal = NULL;
+                       lwc_string_unref(c->media.prefers_color_scheme);
+                       c->media.prefers_color_scheme = NULL;
                        return NSERROR_NOMEM;
 
                }
@@ -552,6 +563,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
 
                lwc_string_unref(c->universal);
                c->universal = NULL;
+               lwc_string_unref(c->media.prefers_color_scheme);
+               c->media.prefers_color_scheme = NULL;
 
                return libdom_hubbub_error_to_nserror(error);
        }
@@ -568,6 +581,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
 
                lwc_string_unref(c->universal);
                c->universal = NULL;
+               lwc_string_unref(c->media.prefers_color_scheme);
+               c->media.prefers_color_scheme = NULL;
 
                NSLOG(netsurf, INFO, "Unable to set user data.");
                return NSERROR_DOM;
@@ -1274,6 +1289,11 @@ static void html_destroy(struct content *c)
                html->universal = NULL;
        }
 
+       if (html->media.prefers_color_scheme != NULL) {
+               lwc_string_unref(html->media.prefers_color_scheme);
+               html->media.prefers_color_scheme = NULL;
+       }
+
        /* Free stylesheets */
        html_css_free_stylesheets(html);
 


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

    Core: Options: Add user preference for dark mode colours

diff --git a/desktop/options.h b/desktop/options.h
index 539ff21..a12275e 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -255,6 +255,9 @@ NSOPTION_BOOL(enable_PDF_compression, true)
 /** setting a password and encoding PDF documents */
 NSOPTION_BOOL(enable_PDF_password, false)
 
+/** whether to prefer dark mode (light on dark) */
+NSOPTION_BOOL(prefer_dark_mode, false)
+
 /******** System colours ********/
 NSOPTION_COLOUR(sys_colour_ActiveBorder, 0x00d3d3d3)
 NSOPTION_COLOUR(sys_colour_ActiveCaption, 0x00f1f1f1)


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

Summary of changes:
 content/handlers/html/html.c |   20 ++++++++++++++++++++
 desktop/options.h            |    3 +++
 2 files changed, 23 insertions(+)

diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index c6a2872..2b6b1a8 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -458,6 +458,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
        dom_hubbub_error error;
        dom_exception err;
        void *old_node_data;
+       const char *prefer_color_mode = (nsoption_bool(prefer_dark_mode)) ?
+                       "dark" : "light";
 
        c->parser = NULL;
        c->parse_completed = false;
@@ -505,6 +507,13 @@ html_create_html_data(html_content *c, const 
http_parameter *params)
                return NSERROR_NOMEM;
        }
 
+       if (lwc_intern_string(prefer_color_mode, strlen(prefer_color_mode),
+                       &c->media.prefers_color_scheme) != lwc_error_ok) {
+               lwc_string_unref(c->universal);
+               c->universal = NULL;
+               return NSERROR_NOMEM;
+       }
+
        c->sel = selection_create((struct content *)c);
 
        nerror = http_parameter_list_find_item(params, corestring_lwc_charset, 
&charset);
@@ -516,6 +525,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
                if (c->encoding == NULL) {
                        lwc_string_unref(c->universal);
                        c->universal = NULL;
+                       lwc_string_unref(c->media.prefers_color_scheme);
+                       c->media.prefers_color_scheme = NULL;
                        return NSERROR_NOMEM;
 
                }
@@ -552,6 +563,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
 
                lwc_string_unref(c->universal);
                c->universal = NULL;
+               lwc_string_unref(c->media.prefers_color_scheme);
+               c->media.prefers_color_scheme = NULL;
 
                return libdom_hubbub_error_to_nserror(error);
        }
@@ -568,6 +581,8 @@ html_create_html_data(html_content *c, const http_parameter 
*params)
 
                lwc_string_unref(c->universal);
                c->universal = NULL;
+               lwc_string_unref(c->media.prefers_color_scheme);
+               c->media.prefers_color_scheme = NULL;
 
                NSLOG(netsurf, INFO, "Unable to set user data.");
                return NSERROR_DOM;
@@ -1274,6 +1289,11 @@ static void html_destroy(struct content *c)
                html->universal = NULL;
        }
 
+       if (html->media.prefers_color_scheme != NULL) {
+               lwc_string_unref(html->media.prefers_color_scheme);
+               html->media.prefers_color_scheme = NULL;
+       }
+
        /* Free stylesheets */
        html_css_free_stylesheets(html);
 
diff --git a/desktop/options.h b/desktop/options.h
index 539ff21..a12275e 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -255,6 +255,9 @@ NSOPTION_BOOL(enable_PDF_compression, true)
 /** setting a password and encoding PDF documents */
 NSOPTION_BOOL(enable_PDF_password, false)
 
+/** whether to prefer dark mode (light on dark) */
+NSOPTION_BOOL(prefer_dark_mode, false)
+
 /******** System colours ********/
 NSOPTION_COLOUR(sys_colour_ActiveBorder, 0x00d3d3d3)
 NSOPTION_COLOUR(sys_colour_ActiveCaption, 0x00f1f1f1)


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

Reply via email to