diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-08-15 18:30:03 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-15 18:30:57 -0700 |
commit | 6d00c724330702c6bfd2bba2b7b2501fa3ab62ff (patch) | |
tree | f29a2ce14a4a17c16cd014f275fd528a694a1272 | |
parent | 41bfb75f7c76588239ed5d2d4e38aeb1762ff348 (diff) | |
parent | 92a5be96d8af6a47e31b8db9467123292ea73fb0 (diff) | |
download | frameworks_base-6d00c724330702c6bfd2bba2b7b2501fa3ab62ff.zip frameworks_base-6d00c724330702c6bfd2bba2b7b2501fa3ab62ff.tar.gz frameworks_base-6d00c724330702c6bfd2bba2b7b2501fa3ab62ff.tar.bz2 |
Merge "Reload page when A11y is on and the JavaScript state changes." into jb-mr1-dev
-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 8d79492..a9efd7b 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -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); |