summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Grace Kloba <klobag@google.com> 2010-06-22 10:39:18 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-06-22 10:39:18 -0700
commitef7fa7bc66e3b5cab0519a06ed89c52bfe60d27c (patch)
tree297f838f4c6e4ce8df7eaab60c03175f9b137759
parentac68873bf5703673a7d2bf0a88edce5cb81a5f1b (diff)
parentf9b731d383790e0dfd407525efcd72bba4ee4895 (diff)
Merge "Add a WebSettings to control whether WebView will use some perf trick, e.g. pause updating the picture, during panning and zooming transition."
-rw-r--r--api/current.xml24
-rw-r--r--core/java/android/webkit/WebSettings.java20
-rw-r--r--core/java/android/webkit/WebViewCore.java6
3 files changed, 50 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml
index b9c9fe984144..8fdebce802a2 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -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"
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 64f43bbe4265..751f246212bf 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -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;
@@ -523,6 +524,25 @@ public class WebSettings {
}
/**
+ * 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.
*/
public void setSaveFormData(boolean save) {
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 5139ae80df0b..badb391a4545 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -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) {