Merge "Update DeviceOrientationManager to be specific to a WebViewCore"
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package android.webkit;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* This class is simply a container for the methods used to configure WebKit's
|
||||
* mock DeviceOrientationClient for use in LayoutTests.
|
||||
@@ -27,23 +25,28 @@ import android.util.Log;
|
||||
* @hide
|
||||
*/
|
||||
public final class DeviceOrientationManager {
|
||||
/**
|
||||
* Sets whether the Page for the specified WebViewCore should use a mock DeviceOrientation
|
||||
* client.
|
||||
*/
|
||||
public static void useMock(WebViewCore webViewCore) {
|
||||
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
|
||||
nativeUseMock(webViewCore);
|
||||
private WebViewCore mWebViewCore;
|
||||
|
||||
public DeviceOrientationManager(WebViewCore webViewCore) {
|
||||
mWebViewCore = webViewCore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position for the mock DeviceOrientation service for the supplied WebViewCore.
|
||||
* Sets whether the Page for this WebViewCore should use a mock DeviceOrientation
|
||||
* client.
|
||||
*/
|
||||
public static void setMockOrientation(WebViewCore webViewCore, boolean canProvideAlpha,
|
||||
double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma,
|
||||
double gamma) {
|
||||
public void useMock() {
|
||||
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
|
||||
nativeSetMockOrientation(webViewCore, canProvideAlpha, alpha, canProvideBeta, beta,
|
||||
nativeUseMock(mWebViewCore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position for the mock DeviceOrientation service for this WebViewCore.
|
||||
*/
|
||||
public void setMockOrientation(boolean canProvideAlpha, double alpha, boolean canProvideBeta,
|
||||
double beta, boolean canProvideGamma, double gamma) {
|
||||
assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName());
|
||||
nativeSetMockOrientation(mWebViewCore, canProvideAlpha, alpha, canProvideBeta, beta,
|
||||
canProvideGamma, gamma);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.DeviceOrientationManager;
|
||||
import android.webkit.WebTextView.AutoCompleteAdapter;
|
||||
import android.webkit.WebViewCore.EventHub;
|
||||
import android.webkit.WebViewCore.TouchEventData;
|
||||
@@ -3763,8 +3762,8 @@ public class WebView extends AbsoluteLayout
|
||||
*/
|
||||
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
|
||||
boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
|
||||
DeviceOrientationManager.setMockOrientation(mWebViewCore, canProvideAlpha, alpha,
|
||||
canProvideBeta, beta, canProvideGamma, gamma);
|
||||
mWebViewCore.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta,
|
||||
canProvideGamma, gamma);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,6 +117,8 @@ final class WebViewCore {
|
||||
private int mWebkitScrollX = 0;
|
||||
private int mWebkitScrollY = 0;
|
||||
|
||||
private DeviceOrientationManager mDeviceOrientationManager = new DeviceOrientationManager(this);
|
||||
|
||||
// The thread name used to identify the WebCore thread and for use in
|
||||
// debugging other classes that require operation within the WebCore thread.
|
||||
/* package */ static final String THREAD_NAME = "WebViewCoreThread";
|
||||
@@ -2489,7 +2491,13 @@ final class WebViewCore {
|
||||
}
|
||||
|
||||
private void useMockDeviceOrientation() {
|
||||
DeviceOrientationManager.useMock(this);
|
||||
mDeviceOrientationManager.useMock();
|
||||
}
|
||||
|
||||
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
|
||||
boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
|
||||
mDeviceOrientationManager.setMockOrientation(canProvideAlpha, alpha, canProvideBeta, beta,
|
||||
canProvideGamma, gamma);
|
||||
}
|
||||
|
||||
private native void nativePause();
|
||||
|
||||
Reference in New Issue
Block a user