Bug 1529119 - Expose msaa-level, double_tap_zooming, autozoom. r=snorp
authorAgi Sferro <agi@sferro.dev>
Mon, 22 Apr 2019 18:50:08 +0000
changeset 470388 1362a0a6a7b27cd16c3e8caa0eb77ac198ddd5c2
parent 470387 55c286b28b78c3f6dc16f46550af9d05a389c927
child 470389 74eb8e5f7143ed073a993df7a3abdce04b58f830
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1529119
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529119 - Expose msaa-level, double_tap_zooming, autozoom. r=snorp FxR uses these prefs and they might be helpful to other embedders so we can just add them to GeckoRuntimeSettings. Differential Revision: https://phabricator.services.mozilla.com/D28232
mobile/android/geckoview/api.txt
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
--- a/mobile/android/geckoview/api.txt
+++ b/mobile/android/geckoview/api.txt
@@ -301,34 +301,40 @@ package org.mozilla.geckoview {
     method public boolean getAutomaticFontSizeAdjustment();
     method public int getAutoplayDefault();
     method @Nullable public String getConfigFilePath();
     method public boolean getConsoleOutputEnabled();
     method @NonNull public ContentBlocking.Settings getContentBlocking();
     method @Nullable public Class<?> getCrashHandler();
     method @Nullable public Float getDisplayDensityOverride();
     method @Nullable public Integer getDisplayDpiOverride();
+    method public boolean getDoubleTapZoomingEnabled();
     method @NonNull public Bundle getExtras();
     method public boolean getFontInflationEnabled();
     method public float getFontSizeFactor();
+    method public int getGlMsaaLevel();
+    method public boolean getInputAutoZoomEnabled();
     method public boolean getJavaScriptEnabled();
     method @Nullable public String[] getLocales();
     method public boolean getPauseForDebuggerEnabled();
     method public int getPreferredColorScheme();
     method public boolean getRemoteDebuggingEnabled();
     method @Nullable public GeckoRuntime getRuntime();
     method @Nullable public Rect getScreenSizeOverride();
     method public boolean getUseContentProcessHint();
     method public boolean getUseMaxScreenDepth();
     method public boolean getWebFontsEnabled();
     method @NonNull public GeckoRuntimeSettings setAutomaticFontSizeAdjustment(boolean);
     method @NonNull public GeckoRuntimeSettings setAutoplayDefault(int);
     method @NonNull public GeckoRuntimeSettings setConsoleOutputEnabled(boolean);
+    method @NonNull public GeckoRuntimeSettings setDoubleTapZoomingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setFontInflationEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setFontSizeFactor(float);
+    method @NonNull public GeckoRuntimeSettings setGlMsaaLevel(int);
+    method @NonNull public GeckoRuntimeSettings setInputAutoZoomEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setJavaScriptEnabled(boolean);
     method public void setLocales(@Nullable String[]);
     method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int);
     method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean);
     field public static final int AUTOPLAY_DEFAULT_ALLOWED = 0;
     field public static final int AUTOPLAY_DEFAULT_BLOCKED = 1;
     field public static final int COLOR_SCHEME_DARK = 1;
@@ -343,19 +349,22 @@ package org.mozilla.geckoview {
     method @NonNull public GeckoRuntimeSettings.Builder automaticFontSizeAdjustment(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder autoplayDefault(int);
     method @NonNull public GeckoRuntimeSettings.Builder configFilePath(@Nullable String);
     method @NonNull public GeckoRuntimeSettings.Builder consoleOutput(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder contentBlocking(@NonNull ContentBlocking.Settings);
     method @NonNull public GeckoRuntimeSettings.Builder crashHandler(@Nullable Class<?>);
     method @NonNull public GeckoRuntimeSettings.Builder displayDensityOverride(float);
     method @NonNull public GeckoRuntimeSettings.Builder displayDpiOverride(int);
+    method @NonNull public GeckoRuntimeSettings.Builder doubleTapZoomingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder extras(@NonNull Bundle);
     method @NonNull public GeckoRuntimeSettings.Builder fontInflation(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder fontSizeFactor(float);
+    method @NonNull public GeckoRuntimeSettings.Builder glMsaaLevel(int);
+    method @NonNull public GeckoRuntimeSettings.Builder inputAutoZoomEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder javaScriptEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder locales(@Nullable String[]);
     method @NonNull public GeckoRuntimeSettings.Builder pauseForDebugger(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder preferredColorScheme(int);
     method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int);
     method @NonNull public GeckoRuntimeSettings.Builder useContentProcessHint(boolean);
     method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
@@ -332,16 +332,49 @@ public final class GeckoRuntimeSettings 
          * @param scheme The preferred color scheme. Must be one of the
          *               {@link GeckoRuntimeSettings#COLOR_SCHEME_LIGHT COLOR_SCHEME_*} constants.
          * @return This Builder instance.
          */
         public @NonNull Builder preferredColorScheme(final @ColorScheme int scheme) {
             getSettings().mPreferredColorScheme.set(scheme);
             return this;
         }
+
+        /**
+         * Set whether auto-zoom to editable fields should be enabled.
+         *
+         * @param flag True if auto-zoom should be enabled, false otherwise.
+         * @return This Builder instance.
+         */
+        public @NonNull Builder inputAutoZoomEnabled(final boolean flag) {
+            getSettings().mInputAutoZoom.set(flag);
+            return this;
+        }
+
+        /**
+         * Set whether double tap zooming should be enabled.
+         *
+         * @param flag True if double tap zooming should be enabled, false otherwise.
+         * @return This Builder instance.
+         */
+        public @NonNull Builder doubleTapZoomingEnabled(final boolean flag) {
+            getSettings().mDoubleTapZooming.set(flag);
+            return this;
+        }
+
+        /**
+         * Sets the WebGL MSAA level.
+         *
+         * @param level number of MSAA samples, 0 if MSAA should be disabled.
+         * @return This GeckoRuntimeSettings instance.
+         */
+        public @NonNull Builder glMsaaLevel(final int level) {
+            getSettings().mGlMsaaLevel.set(level);
+            return this;
+        }
     }
 
     private GeckoRuntime mRuntime;
     /* package */ boolean mUseContentProcess;
     /* package */ String[] mArgs;
     /* package */ Bundle mExtras;
     /* package */ String mConfigFilePath;
 
@@ -362,16 +395,22 @@ public final class GeckoRuntimeSettings 
     /* package */ final Pref<Integer> mAutoplayDefault = new Pref<Integer>(
         "media.autoplay.default", AUTOPLAY_DEFAULT_BLOCKED);
     /* package */ final Pref<Integer> mFontSizeFactor = new Pref<>(
         "font.size.systemFontScale", 100);
     /* package */ final Pref<Integer> mFontInflationMinTwips = new Pref<>(
         "font.size.inflation.minTwips", 0);
     /* package */ final Pref<Integer> mPreferredColorScheme = new Pref<>(
         "ui.systemUsesDarkTheme", -1);
+    /* package */ final Pref<Boolean> mInputAutoZoom = new Pref<>(
+            "formhelper.autozoom", true);
+    /* package */ final Pref<Boolean> mDoubleTapZooming = new Pref<>(
+            "apz.allow_double_tap_zooming", true);
+    /* package */ final Pref<Integer> mGlMsaaLevel = new Pref<>(
+            "gl.msaa-level", 0);
 
     /* package */ boolean mDebugPause;
     /* package */ boolean mUseMaxScreenDepth;
     /* package */ float mDisplayDensityOverride = -1.0f;
     /* package */ int mDisplayDpiOverride;
     /* package */ int mScreenWidthOverride;
     /* package */ int mScreenHeightOverride;
     /* package */ Class<? extends Service> mCrashHandler;
@@ -829,16 +868,76 @@ public final class GeckoRuntimeSettings 
      *               {@link GeckoRuntimeSettings#COLOR_SCHEME_LIGHT COLOR_SCHEME_*} constants.
      * @return This GeckoRuntimeSettings instance.
      */
     public @NonNull GeckoRuntimeSettings setPreferredColorScheme(final @ColorScheme int scheme) {
         mPreferredColorScheme.commit(scheme);
         return this;
     }
 
+    /**
+     * Gets whether auto-zoom to editable fields is enabled.
+     *
+     * @return True if auto-zoom is enabled, false otherwise.
+     */
+    public boolean getInputAutoZoomEnabled() {
+        return mInputAutoZoom.get();
+    }
+
+    /**
+     * Set whether auto-zoom to editable fields should be enabled.
+     *
+     * @param flag True if auto-zoom should be enabled, false otherwise.
+     * @return This GeckoRuntimeSettings instance.
+     */
+    public @NonNull GeckoRuntimeSettings setInputAutoZoomEnabled(final boolean flag) {
+        mInputAutoZoom.commit(flag);
+        return this;
+    }
+
+    /**
+     * Gets whether double-tap zooming is enabled.
+     *
+     * @return True if double-tap zooming is enabled, false otherwise.
+     */
+    public boolean getDoubleTapZoomingEnabled() {
+        return mDoubleTapZooming.get();
+    }
+
+    /**
+     * Sets whether double tap zooming is enabled.
+     *
+     * @param flag true if double tap zooming should be enabled, false otherwise.
+     * @return This GeckoRuntimeSettings instance.
+     */
+    public @NonNull GeckoRuntimeSettings setDoubleTapZoomingEnabled(final boolean flag) {
+        mDoubleTapZooming.commit(flag);
+        return this;
+    }
+
+    /**
+     * Gets the current WebGL MSAA level.
+     *
+     * @return number of MSAA samples, 0 if MSAA is disabled.
+     */
+    public int getGlMsaaLevel() {
+        return mGlMsaaLevel.get();
+    }
+
+    /**
+     * Sets the WebGL MSAA level.
+     *
+     * @param level number of MSAA samples, 0 if MSAA should be disabled.
+     * @return This GeckoRuntimeSettings instance.
+     */
+    public @NonNull GeckoRuntimeSettings setGlMsaaLevel(final int level) {
+        mGlMsaaLevel.commit(level);
+        return this;
+    }
+
     @Override // Parcelable
     public void writeToParcel(final Parcel out, final int flags) {
         super.writeToParcel(out, flags);
 
         ParcelableUtils.writeBoolean(out, mUseContentProcess);
         out.writeStringArray(mArgs);
         mExtras.writeToParcel(out, flags);
         ParcelableUtils.writeBoolean(out, mDebugPause);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md
@@ -85,16 +85,24 @@ exclude: true
 - Added messaging support for WebExtension. [`setMessageDelegate`][68.18]
   allows embedders to listen to messages coming from a WebExtension.
   [`Port`][68.19] allows bidirectional communication between the embedder and
   the WebExtension.
 
 [68.18]: ./WebExtension.html#setMessageDelegate-org.mozilla.geckoview.WebExtension.MessageDelegate-java.lang.String-
 [68.19]: ./WebExtension.Port.html
 
+- Expose the following prefs in [`GeckoRuntimeSettings`][67.3]:
+  [`setAutoZoomEnabled`][68.20], [`setDoubleTapZoomingEnabled`][68.21],
+  [`setGlMsaaLevel`][68.22].
+
+[68.20]: ./GeckoRuntimeSettings.html#setAutoZoomEnabled-boolean-
+[68.21]: ./GeckoRuntimeSettings.html#setDoubleTapZoomingEnabled-boolean-
+[68.22]: ./GeckoRuntimeSettings.html#setGlMsaaLevel-int-
+
 ## v67
 - Added [`setAutomaticFontSizeAdjustment`][67.2] to
   [`GeckoRuntimeSettings`][67.3] for automatically adjusting font size settings
   depending on the OS-level font size setting.
 
 [67.2]: ../GeckoRuntimeSettings.html#setAutomaticFontSizeAdjustment-boolean-
 [67.3]: ../GeckoRuntimeSettings.html
 
@@ -291,9 +299,9 @@ exclude: true
 [65.23]: ../GeckoSession.FinderResult.html
 
 - Update [`CrashReporter#sendCrashReport`][65.24] to return the crash ID as a
   [`GeckoResult<String>`][65.25].
 
 [65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
 [65.25]: ../GeckoResult.html
 
-[api-version]: 2186cb94bf0e2282ec4dca649f09ecdff0ecf05b
+[api-version]: 3b910c2e6b3df9bd9926cf4e54b37a5a08bdb64a