+ return 'A';
+ }
+}
+
+void
+seturiparameters(Client *c, const char *uri, ParamName *params)
+{
+ Parameter *config, *uriconfig = NULL;
+ int i, p;
+
+ for (i = 0; i < LENGTH(uriparams); ++i) {
+ if (uriparams[i].uri &&
+ !regexec(&(uriparams[i].re), uri, 0, NULL, 0)) {
+ uriconfig = uriparams[i].config;
+ break;
+ }
+ }
+
+ curconfig = uriconfig ? uriconfig : defconfig;
+
+ for (i = 0; (p = params[i]) != ParameterLast; ++i) {
+ switch(p) {
+ default: /* FALLTHROUGH */
+ if (!(defconfig[p].prio < curconfig[p].prio ||
+ defconfig[p].prio < modparams[p]))
+ continue;
+ case Certificate:
+ case CookiePolicies:
+ case Style:
+ setparameter(c, 0, p, &curconfig[p].val);
+ }
+ }
+}
+
+void
+setparameter(Client *c, int refresh, ParamName p, const Arg *a)
+{
+ GdkRGBA bgcolor = { 0 };
+ WebKitSettings *s = webkit_web_view_get_settings(c->view);
+
+ modparams[p] = curconfig[p].prio;
+
+ switch (p) {
+ case AcceleratedCanvas:
+ webkit_settings_set_enable_accelerated_2d_canvas(s, a->i);
+ break;
+ case AccessMicrophone:
+ return; /* do nothing */
+ case AccessWebcam:
+ return; /* do nothing */
+ case CaretBrowsing:
+ webkit_settings_set_enable_caret_browsing(s, a->i);
+ refresh = 0;
+ break;
+ case Certificate:
+ if (a->i)
+ setcert(c, geturi(c));
+ return; /* do not update */
+ case CookiePolicies:
+ webkit_cookie_manager_set_accept_policy(
+ webkit_web_context_get_cookie_manager(
+ webkit_web_view_get_context(c->view)),
+ cookiepolicy_get());
+ refresh = 0;
+ break;
+ case DiskCache:
+ webkit_web_context_set_cache_model(
+ webkit_web_view_get_context(c->view), a->i ?
+ WEBKIT_CACHE_MODEL_WEB_BROWSER :
+ WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
+ return; /* do not update */
+ case DefaultCharset:
+ webkit_settings_set_default_charset(s, a->v);
+ return; /* do not update */
+ case DNSPrefetch:
+ webkit_settings_set_enable_dns_prefetching(s, a->i);
+ return; /* do not update */
+ case FileURLsCrossAccess:
+ webkit_settings_set_allow_file_access_from_file_urls(s, a->i);
+ webkit_settings_set_allow_universal_access_from_file_urls(s, a->i);
+ return; /* do not update */
+ case FontSize:
+ webkit_settings_set_default_font_size(s, a->i);
+ return; /* do not update */
+ case FrameFlattening:
+ webkit_settings_set_enable_frame_flattening(s, a->i);
+ break;
+ case Geolocation:
+ refresh = 0;
+ break;
+ case HideBackground:
+ if (a->i)
+ webkit_web_view_set_background_color(c->view, &bgcolor);
+ return; /* do not update */
+ case Inspector:
+ webkit_settings_set_enable_developer_extras(s, a->i);
+ return; /* do not update */
+ case Java:
+ webkit_settings_set_enable_java(s, a->i);
+ return; /* do not update */
+ case JavaScript:
+ webkit_settings_set_enable_javascript(s, a->i);
+ break;
+ case KioskMode:
+ return; /* do nothing */
+ case LoadImages:
+ webkit_settings_set_auto_load_images(s, a->i);
+ break;
+ case MediaManualPlay:
+ webkit_settings_set_media_playback_requires_user_gesture(s, a->i);
+ break;
+ case Plugins:
+ webkit_settings_set_enable_plugins(s, a->i);
+ break;
+ case PreferredLanguages:
+ return; /* do nothing */
+ case RunInFullscreen:
+ return; /* do nothing */
+ case ScrollBars:
+ /* Disabled until we write some WebKitWebExtension for
+ * manipulating the DOM directly.
+ enablescrollbars = !enablescrollbars;
+ evalscript(c, "document.documentElement.style.overflow = '%s'",
+ enablescrollbars ? "auto" : "hidden");
+ */
+ return; /* do not update */
+ case ShowIndicators:
+ break;
+ case SmoothScrolling:
+ webkit_settings_set_enable_smooth_scrolling(s, a->i);
+ return; /* do not update */
+ case SiteQuirks:
+ webkit_settings_set_enable_site_specific_quirks(s, a->i);
+ break;
+ case SpellChecking:
+ webkit_web_context_set_spell_checking_enabled(
+ webkit_web_view_get_context(c->view), a->i);
+ return; /* do not update */
+ case SpellLanguages:
+ return; /* do nothing */
+ case StrictTLS:
+ webkit_web_context_set_tls_errors_policy(
+ webkit_web_view_get_context(c->view), a->i ?
+ WEBKIT_TLS_ERRORS_POLICY_FAIL :
+ WEBKIT_TLS_ERRORS_POLICY_IGNORE);
+ break;
+ case Style:
+ webkit_user_content_manager_remove_all_style_sheets(
+ webkit_web_view_get_user_content_manager(c->view));
+ if (a->i)
+ setstyle(c, getstyle(geturi(c)));
+ refresh = 0;
+ break;
+ case WebGL:
+ webkit_settings_set_enable_webgl(s, a->i);