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

Commit eec79618 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android Git Automerger
Browse files

am eaea38b2: am 6d00c724: Merge "Reload page when A11y is on and the...

am eaea38b2: am 6d00c724: Merge "Reload page when A11y is on and the JavaScript state changes." into jb-mr1-dev

* commit 'eaea38b2':
  Reload page when A11y is on and the JavaScript state changes.
parents 30a4e23a eaea38b2
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ class AccessibilityInjector {
        }

        if (!shouldInjectJavaScript(url)) {
            mAccessibilityScriptInjected = false;
            toggleFallbackAccessibilityInjector(true);
            return;
        }
@@ -291,6 +292,23 @@ class AccessibilityInjector {
        mAccessibilityScriptInjected = true;
    }

    /**
     * Adjusts the accessibility injection state to reflect changes in the
     * JavaScript enabled state.
     *
     * @param enabled Whether JavaScript is enabled.
     */
    public void updateJavaScriptEnabled(boolean enabled) {
        if (enabled) {
            addAccessibilityApisIfNecessary();
        } else {
            removeAccessibilityApisIfNecessary();
        }

        // We have to reload the page after adding or removing APIs.
        mWebView.reload();
    }

    /**
     * Toggles the non-JavaScript method for handling accessibility.
     *
+1 −0
Original line number Diff line number Diff line
@@ -1103,6 +1103,7 @@ public class WebSettingsClassic extends WebSettings {
        if (mJavaScriptEnabled != flag) {
            mJavaScriptEnabled = flag;
            postSync();
            mWebView.updateJavaScriptEnabled(flag);
        }
    }

+6 −0
Original line number Diff line number Diff line
@@ -1626,6 +1626,12 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        mZoomManager.updateMultiTouchSupport(context);
    }

    void updateJavaScriptEnabled(boolean enabled) {
        if (isAccessibilityEnabled()) {
            getAccessibilityInjector().updateJavaScriptEnabled(enabled);
        }
    }

    private void init() {
        OnTrimMemoryListener.init(mContext);
        mWebView.setWillNotDraw(false);