diff options
author | alanv <alanv@google.com> | 2012-08-09 17:47:09 -0700 |
---|---|---|
committer | alanv <alanv@google.com> | 2012-08-09 17:47:09 -0700 |
commit | 92a5be96d8af6a47e31b8db9467123292ea73fb0 (patch) | |
tree | 33617b88fa03db784cc2bc3b13e2a51247d0f34b | |
parent | 336b31c28ab282595fbf649eaf053f0811034dd9 (diff) | |
download | frameworks_base-92a5be96d8af6a47e31b8db9467123292ea73fb0.zip frameworks_base-92a5be96d8af6a47e31b8db9467123292ea73fb0.tar.gz frameworks_base-92a5be96d8af6a47e31b8db9467123292ea73fb0.tar.bz2 |
Reload page when A11y is on and the JavaScript state changes.
Bug: 6910403
Change-Id: I0965d76e76282736d053947eb96be0af32fd6001
-rw-r--r-- | core/java/android/webkit/AccessibilityInjector.java | 18 | ||||
-rw-r--r-- | core/java/android/webkit/WebSettingsClassic.java | 1 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewClassic.java | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/core/java/android/webkit/AccessibilityInjector.java b/core/java/android/webkit/AccessibilityInjector.java index 7dfb5bb..fd73fda 100644 --- a/core/java/android/webkit/AccessibilityInjector.java +++ b/core/java/android/webkit/AccessibilityInjector.java @@ -279,6 +279,7 @@ class AccessibilityInjector { } if (!shouldInjectJavaScript(url)) { + mAccessibilityScriptInjected = false; toggleFallbackAccessibilityInjector(true); return; } @@ -292,6 +293,23 @@ class AccessibilityInjector { } /** + * 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. * * @param enabled {@code true} to enable the non-JavaScript method, or diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java index 66651f7..1be917e 100644 --- a/core/java/android/webkit/WebSettingsClassic.java +++ b/core/java/android/webkit/WebSettingsClassic.java @@ -1135,6 +1135,7 @@ public class WebSettingsClassic extends WebSettings { if (mJavaScriptEnabled != flag) { mJavaScriptEnabled = flag; postSync(); + mWebView.updateJavaScriptEnabled(flag); } } diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 5b8764b..fa22031 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -1630,6 +1630,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); |