Add a WebSettings to control whether WebView will

use some perf trick, e.g. pause updating the picture,
during panning and zooming transition.

Fix http://b/issue?id=2784020
This commit is contained in:
Grace Kloba
2010-06-21 19:23:57 -07:00
parent 05dd626a95
commit f9b731d383
3 changed files with 50 additions and 0 deletions

View File

@@ -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"

View File

@@ -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.
*/

View File

@@ -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) {