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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2019-04-22 18:50:08 +00:00
Родитель 9caa256abd
Коммит d9c6b51564
3 изменённых файлов: 117 добавлений и 1 удалений

Просмотреть файл

@ -306,9 +306,12 @@ package org.mozilla.geckoview {
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();
@ -322,8 +325,11 @@ package org.mozilla.geckoview {
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);
@ -348,9 +354,12 @@ package org.mozilla.geckoview {
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);

Просмотреть файл

@ -337,6 +337,39 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
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;
@ -367,6 +400,12 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
"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;
@ -834,6 +873,66 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
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);

Просмотреть файл

@ -90,6 +90,14 @@ exclude: true
[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
@ -296,4 +304,4 @@ exclude: true
[65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: ../GeckoResult.html
[api-version]: 2186cb94bf0e2282ec4dca649f09ecdff0ecf05b
[api-version]: 3b910c2e6b3df9bd9926cf4e54b37a5a08bdb64a