diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 7339cd422..3a779f480 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -179,7 +179,8 @@ class WebEngineCaret(browsertab.AbstractCaret): @pyqtSlot(usertypes.KeyMode) def _on_mode_entered(self, mode): - pass + js_code = javascript.assemble('caret', 'setInitialCursor') + self._tab.run_js_async(js_code) @pyqtSlot(usertypes.KeyMode) def _on_mode_left(self): @@ -547,6 +548,8 @@ class WebEngineTab(browsertab.AbstractTab): 'window._qutebrowser = {};', utils.read_file('javascript/scroll.js'), utils.read_file('javascript/webelem.js'), + utils.read_file('javascript/webengine_caret.js'), + utils.read_file('javascript/axs_testing.js'), ]) script = QWebEngineScript() script.setInjectionPoint(QWebEngineScript.DocumentCreation) diff --git a/qutebrowser/javascript/axs_testing.js b/qutebrowser/javascript/axs_testing.js new file mode 100644 index 000000000..e6b1a3755 --- /dev/null +++ b/qutebrowser/javascript/axs_testing.js @@ -0,0 +1,2643 @@ +/* + * Copyright 2016 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/tree/7d778f7da58af341a47b3a6f6457c2842b24d4d8 + * + * See project README for build steps. + */ + +// AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. + +var fn = (function() { + var COMPILED = !0, goog = goog || {}; +goog.global = this; +goog.isDef = function(a) { + return void 0 !== a; +}; +goog.exportPath_ = function(a, b, c) { + a = a.split("."); + c = c || goog.global; + a[0] in c || !c.execScript || c.execScript("var " + a[0]); + for (var d;a.length && (d = a.shift());) { + !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; + } +}; +goog.define = function(a, b) { + var c = b; + COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a])); + goog.exportPath_(a, c); +}; +goog.DEBUG = !0; +goog.LOCALE = "en"; +goog.TRUSTED_SITE = !0; +goog.STRICT_MODE_COMPATIBLE = !1; +goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG; +goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1; +goog.provide = function(a) { + if (goog.isInModuleLoader_()) { + throw Error("goog.provide can not be used within a goog.module."); + } + if (!COMPILED && goog.isProvided_(a)) { + throw Error('Namespace "' + a + '" already declared.'); + } + goog.constructNamespace_(a); +}; +goog.constructNamespace_ = function(a, b) { + if (!COMPILED) { + delete goog.implicitNamespaces_[a]; + for (var c = a;(c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);) { + goog.implicitNamespaces_[c] = !0; + } + } + goog.exportPath_(a, b); +}; +goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/; +goog.module = function(a) { + if (!goog.isString(a) || !a || -1 == a.search(goog.VALID_MODULE_RE_)) { + throw Error("Invalid module identifier"); + } + if (!goog.isInModuleLoader_()) { + throw Error("Module " + a + " has been loaded incorrectly."); + } + if (goog.moduleLoaderState_.moduleName) { + throw Error("goog.module may only be called once per module."); + } + goog.moduleLoaderState_.moduleName = a; + if (!COMPILED) { + if (goog.isProvided_(a)) { + throw Error('Namespace "' + a + '" already declared.'); + } + delete goog.implicitNamespaces_[a]; + } +}; +goog.module.get = function(a) { + return goog.module.getInternal_(a); +}; +goog.module.getInternal_ = function(a) { + if (!COMPILED) { + return goog.isProvided_(a) ? a in goog.loadedModules_ ? goog.loadedModules_[a] : goog.getObjectByName(a) : null; + } +}; +goog.moduleLoaderState_ = null; +goog.isInModuleLoader_ = function() { + return null != goog.moduleLoaderState_; +}; +goog.module.declareLegacyNamespace = function() { + if (!COMPILED && !goog.isInModuleLoader_()) { + throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module"); + } + if (!COMPILED && !goog.moduleLoaderState_.moduleName) { + throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace."); + } + goog.moduleLoaderState_.declareLegacyNamespace = !0; +}; +goog.setTestOnly = function(a) { + if (goog.DISALLOW_TEST_ONLY_CODE) { + throw a = a || "", Error("Importing test-only code into non-debug environment" + (a ? ": " + a : ".")); + } +}; +goog.forwardDeclare = function(a) { +}; +COMPILED || (goog.isProvided_ = function(a) { + return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); +}, goog.implicitNamespaces_ = {"goog.module":!0}); +goog.getObjectByName = function(a, b) { + for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { + if (goog.isDefAndNotNull(d[e])) { + d = d[e]; + } else { + return null; + } + } + return d; +}; +goog.globalize = function(a, b) { + var c = b || goog.global, d; + for (d in a) { + c[d] = a[d]; + } +}; +goog.addDependency = function(a, b, c, d) { + if (goog.DEPENDENCIES_ENABLED) { + var e; + a = a.replace(/\\/g, "/"); + var f = goog.dependencies_; + d && "boolean" !== typeof d || (d = d ? {module:"goog"} : {}); + for (var g = 0;e = b[g];g++) { + f.nameToPath[e] = a, f.loadFlags[a] = d; + } + for (d = 0;b = c[d];d++) { + a in f.requires || (f.requires[a] = {}), f.requires[a][b] = !0; + } + } +}; +goog.ENABLE_DEBUG_LOADER = !0; +goog.logToConsole_ = function(a) { + goog.global.console && goog.global.console.error(a); +}; +goog.require = function(a) { + if (!COMPILED) { + goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_ && goog.maybeProcessDeferredDep_(a); + if (goog.isProvided_(a)) { + return goog.isInModuleLoader_() ? goog.module.getInternal_(a) : null; + } + if (goog.ENABLE_DEBUG_LOADER) { + var b = goog.getPathFromDeps_(a); + if (b) { + return goog.writeScripts_(b), null; + } + } + a = "goog.require could not find: " + a; + goog.logToConsole_(a); + throw Error(a); + } +}; +goog.basePath = ""; +goog.nullFunction = function() { +}; +goog.abstractMethod = function() { + throw Error("unimplemented abstract method"); +}; +goog.addSingletonGetter = function(a) { + a.getInstance = function() { + if (a.instance_) { + return a.instance_; + } + goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a); + return a.instance_ = new a; + }; +}; +goog.instantiatedSingletons_ = []; +goog.LOAD_MODULE_USING_EVAL = !0; +goog.SEAL_MODULE_EXPORTS = goog.DEBUG; +goog.loadedModules_ = {}; +goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; +goog.ALWAYS_TRANSPILE = !1; +goog.NEVER_TRANSPILE = !1; +goog.DEPENDENCIES_ENABLED && (goog.dependencies_ = {loadFlags:{}, nameToPath:{}, requires:{}, visited:{}, written:{}, deferred:{}}, goog.inHtmlDocument_ = function() { + var a = goog.global.document; + return null != a && "write" in a; +}, goog.findBasePath_ = function() { + if (goog.isDef(goog.global.CLOSURE_BASE_PATH)) { + goog.basePath = goog.global.CLOSURE_BASE_PATH; + } else { + if (goog.inHtmlDocument_()) { + for (var a = goog.global.document.getElementsByTagName("SCRIPT"), b = a.length - 1;0 <= b;--b) { + var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; + if ("base.js" == c.substr(d - 7, 7)) { + goog.basePath = c.substr(0, d - 7); + break; + } + } + } + } +}, goog.importScript_ = function(a, b) { + (goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_)(a, b) && (goog.dependencies_.written[a] = !0); +}, goog.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all), goog.importProcessedScript_ = function(a, b, c) { + goog.importScript_("", 'goog.retrieveAndExec_("' + a + '", ' + b + ", " + c + ");"); +}, goog.queuedModules_ = [], goog.wrapModule_ = function(a, b) { + return goog.LOAD_MODULE_USING_EVAL && goog.isDef(goog.global.JSON) ? "goog.loadModule(" + goog.global.JSON.stringify(b + "\n//# sourceURL=" + a + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + b + "\n;return exports});\n//# sourceURL=" + a + "\n"; +}, goog.loadQueuedModules_ = function() { + var a = goog.queuedModules_.length; + if (0 < a) { + var b = goog.queuedModules_; + goog.queuedModules_ = []; + for (var c = 0;c < a;c++) { + goog.maybeProcessDeferredPath_(b[c]); + } + } +}, goog.maybeProcessDeferredDep_ = function(a) { + goog.isDeferredModule_(a) && goog.allDepsAreAvailable_(a) && (a = goog.getPathFromDeps_(a), goog.maybeProcessDeferredPath_(goog.basePath + a)); +}, goog.isDeferredModule_ = function(a) { + var b = (a = goog.getPathFromDeps_(a)) && goog.dependencies_.loadFlags[a] || {}; + return a && ("goog" == b.module || goog.needsTranspile_(b.lang)) ? goog.basePath + a in goog.dependencies_.deferred : !1; +}, goog.allDepsAreAvailable_ = function(a) { + if ((a = goog.getPathFromDeps_(a)) && a in goog.dependencies_.requires) { + for (var b in goog.dependencies_.requires[a]) { + if (!goog.isProvided_(b) && !goog.isDeferredModule_(b)) { + return !1; + } + } + } + return !0; +}, goog.maybeProcessDeferredPath_ = function(a) { + if (a in goog.dependencies_.deferred) { + var b = goog.dependencies_.deferred[a]; + delete goog.dependencies_.deferred[a]; + goog.globalEval(b); + } +}, goog.loadModuleFromUrl = function(a) { + goog.retrieveAndExec_(a, !0, !1); +}, goog.loadModule = function(a) { + var b = goog.moduleLoaderState_; + try { + goog.moduleLoaderState_ = {moduleName:void 0, declareLegacyNamespace:!1}; + var c; + if (goog.isFunction(a)) { + c = a.call(goog.global, {}); + } else { + if (goog.isString(a)) { + c = goog.loadModuleFromSource_.call(goog.global, a); + } else { + throw Error("Invalid module definition"); + } + } + var d = goog.moduleLoaderState_.moduleName; + if (!goog.isString(d) || !d) { + throw Error('Invalid module name "' + d + '"'); + } + goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && Object.seal(c); + goog.loadedModules_[d] = c; + } finally { + goog.moduleLoaderState_ = b; + } +}, goog.loadModuleFromSource_ = function(a) { + eval(a); + return {}; +}, goog.writeScriptSrcNode_ = function(a) { + goog.global.document.write('