diff --git a/android/KMEA/app/src/main/assets/keyboard.html b/android/KMEA/app/src/main/assets/keyboard.html
index b11a21124e..34d8e5c4c2 100644
--- a/android/KMEA/app/src/main/assets/keyboard.html
+++ b/android/KMEA/app/src/main/assets/keyboard.html
@@ -15,6 +15,7 @@
polyfill.
-->
+
diff --git a/android/KMEA/app/src/main/assets/other-polyfills.js b/android/KMEA/app/src/main/assets/other-polyfills.js
new file mode 100644
index 0000000000..1bd1960e58
--- /dev/null
+++ b/android/KMEA/app/src/main/assets/other-polyfills.js
@@ -0,0 +1,17 @@
+// Needed by the KMW's gesture engine until Chrome 61.
+var DOMRect = DOMRect || function (x, y, width, height) {
+ this.x = this.left = x;
+ this.y = this.top = y;
+ this.width = width;
+ this.height = height;
+ this.bottom = y + height;
+ this.right = x + width;
+};
+
+// https://stackoverflow.com/questions/53308396/how-to-polyfill-array-prototype-includes-for-ie8
+if(!Array.prototype.includes){
+ //or use Object.defineProperty
+ Array.prototype.includes = function(search){
+ return !!~this.indexOf(search);
+ }
+}
diff --git a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
index cbcb28053a..eee43592f3 100644
--- a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
+++ b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
@@ -281,6 +281,7 @@ public final class KMManager {
protected static final String KMFilename_KmwGlobeHintCss = "globe-hint.css";
protected static final String KMFilename_Osk_Ttf_Font = "keymanweb-osk.ttf";
protected static final String KMFilename_JSPolyfill = "es6-shim.min.js";
+ protected static final String KMFilename_JSPolyfill2 = "other-polyfills.js";
// Deprecated by KeyboardController.KMFilename_Installed_KeyboardsList
public static final String KMFilename_KeyboardsList = "keyboards_list.dat";
@@ -812,6 +813,7 @@ public final class KMManager {
// Copy default keyboard font
copyAsset(context, KMDefault_KeyboardFont, "", true);
copyAsset(context, KMFilename_JSPolyfill, "", true);
+ copyAsset(context, KMFilename_JSPolyfill2, "", true);
// Keyboard packages directory
File packagesDir = new File(getPackagesDir());
diff --git a/common/web/gesture-recognizer/src/engine/configuration/paddedZoneSource.ts b/common/web/gesture-recognizer/src/engine/configuration/paddedZoneSource.ts
index fa9cfd37e1..794c74665d 100644
--- a/common/web/gesture-recognizer/src/engine/configuration/paddedZoneSource.ts
+++ b/common/web/gesture-recognizer/src/engine/configuration/paddedZoneSource.ts
@@ -125,11 +125,11 @@ export class PaddedZoneSource implements RecognitionZoneSource {
getBoundingClientRect(): DOMRect {
const rootZone = this.root.getBoundingClientRect();
- return DOMRect.fromRect({
- x: rootZone.x + this.edgePadding.x,
- y: rootZone.y + this.edgePadding.y,
- width: rootZone.width - this.edgePadding.w,
- height: rootZone.height - this.edgePadding.h
- });
+ return new DOMRect(
+ /*x:*/ rootZone.x + this.edgePadding.x,
+ /*y:*/ rootZone.y + this.edgePadding.y,
+ /*width:*/ rootZone.width - this.edgePadding.w,
+ /*height:*/ rootZone.height - this.edgePadding.h
+ );
}
}
\ No newline at end of file
diff --git a/common/web/gesture-recognizer/src/engine/configuration/viewportZoneSource.ts b/common/web/gesture-recognizer/src/engine/configuration/viewportZoneSource.ts
index c558a2aaf7..57f277d42a 100644
--- a/common/web/gesture-recognizer/src/engine/configuration/viewportZoneSource.ts
+++ b/common/web/gesture-recognizer/src/engine/configuration/viewportZoneSource.ts
@@ -5,11 +5,11 @@ export class ViewportZoneSource implements RecognitionZoneSource {
getBoundingClientRect(): DOMRect {
// Viewport dimension detection is based on https://stackoverflow.com/a/8876069.
- return DOMRect.fromRect({
- y: 0,
- x: 0,
- width: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
- height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
- });
+ return new DOMRect(
+ /*x:*/ 0,
+ /*y:*/ 0,
+ /*width:*/ Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
+ /*height:*/ Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
+ );
}
}
\ No newline at end of file
diff --git a/common/web/lm-worker/build-bundler.js b/common/web/lm-worker/build-bundler.js
index 1c4045d5e2..0066c05c29 100644
--- a/common/web/lm-worker/build-bundler.js
+++ b/common/web/lm-worker/build-bundler.js
@@ -51,6 +51,9 @@ await esbuild.build(embeddedWorkerBuildOptions);
const minifiedProfilingOptions = {
...embeddedWorkerBuildOptions,
minify: true,
+ // Do NOT enable - will break under Android 5.0 / Chrome 35 environments, likely through Chrome 42.
+ // https://caniuse.com/mdn-javascript_builtins_function_name_configurable_true
+ keepNames: false,
metafile: true,
write: false // don't actually write the file.
}
diff --git a/common/web/lm-worker/build-wrap-and-minify.js b/common/web/lm-worker/build-wrap-and-minify.js
index 1572238b7a..07032e539b 100644
--- a/common/web/lm-worker/build-wrap-and-minify.js
+++ b/common/web/lm-worker/build-wrap-and-minify.js
@@ -34,7 +34,9 @@ if(MINIFY) {
sourcemap: 'external',
sourcesContent: DEBUG,
minify: true,
- keepNames: true,
+ // Do NOT enable - will break under Android 5.0 / Chrome 35 environments, likely through Chrome 42.
+ // https://caniuse.com/mdn-javascript_builtins_function_name_configurable_true
+ keepNames: false,
target: 'es5',
outfile: `build/lib/worker-main.polyfilled.min.js`
});