Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef7fa7bc authored by Grace Kloba's avatar Grace Kloba Committed by Android (Google) Code Review
Browse files

Merge "Add a WebSettings to control whether WebView will use some perf trick,...

Merge "Add a WebSettings to control whether WebView will use some perf trick, e.g. pause updating the picture, during panning and zooming transition."
parents ac68873b f9b731d3
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -200811,6 +200811,17 @@
 deprecated="not deprecated"
 visibility="public"
>
<method name="enableSmoothTransition"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getAllowFileAccess"
 return="boolean"
 abstract="false"
@@ -201426,6 +201437,19 @@
<parameter name="flag" type="boolean">
</parameter>
</method>
<method name="setEnableSmoothTransition"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="enable" type="boolean">
</parameter>
</method>
<method name="setFantasyFontFamily"
 return="void"
 abstract="false"
+20 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class WebSettings {
    private boolean         mBuiltInZoomControls = false;
    private boolean         mAllowFileAccess = true;
    private boolean         mLoadWithOverviewMode = false;
    private boolean         mEnableSmoothTransition = false;

    // private WebSettings, not accessible by the host activity
    static private int      mDoubleTapToastCount = 3;
@@ -522,6 +523,25 @@ public class WebSettings {
        return mLoadWithOverviewMode;
    }

    /**
     * Set whether the WebView will enable smooth transition while panning or
     * zooming. If it is true, WebView will choose a solution to maximize the
     * performance. e.g. the WebView's content may not be updated during the
     * transition. If it is false, WebView will keep its fidelity. The default
     * value is false.
     */
    public void setEnableSmoothTransition(boolean enable) {
        mEnableSmoothTransition = enable;
    }

    /**
     * Returns true if the WebView enables smooth transition while panning or
     * zooming.
     */
    public boolean enableSmoothTransition() {
        return mEnableSmoothTransition;
    }

    /**
     * Store whether the WebView is saving form data.
     */
+6 −0
Original line number Diff line number Diff line
@@ -1871,6 +1871,8 @@ final class WebViewCore {
        // called from UI thread while WEBKIT_DRAW is just pulled out of the
        // queue in WebCore thread to be executed. Then update won't be blocked.
        if (core != null) {
            if (!core.getSettings().enableSmoothTransition()) return;

            synchronized (core) {
                core.mDrawIsPaused = true;
                if (core.mDrawIsScheduled) {
@@ -1883,6 +1885,10 @@ final class WebViewCore {

    static void resumeUpdatePicture(WebViewCore core) {
        if (core != null) {
            // if mDrawIsPaused is true, ignore the setting, continue to resume
            if (!core.mDrawIsPaused
                    && !core.getSettings().enableSmoothTransition()) return;

            synchronized (core) {
                core.mDrawIsPaused = false;
                if (core.mDrawIsScheduled) {