summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-03-09 17:38:49 -0500
committerDerek Sollenberger <djsollen@google.com>2010-03-15 08:36:19 -0400
commitc28ff44b1e48c7232065b0a81f64a7accb9d2ebf (patch)
tree332e9f30ad3628ebf68acb50073ec5b4d50d6ed7 /core/java/android/webkit/WebView.java
parent24217d8e4dad2a99d7db6f51e89945421a6e7da8 (diff)
Allow plugin's surface to handle touch when in full-screen.
There is a matching commit in external/webkit Change-Id: I88d8c533eb821c564c453dfd7293616669b3bf37
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java85
1 files changed, 13 insertions, 72 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index c5a4e9eebe6d..3b01b60d4293 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -6508,80 +6508,21 @@ public class WebView extends AbsoluteLayout
break;
case SHOW_FULLSCREEN: {
- WebViewCore.PluginFullScreenData data
- = (WebViewCore.PluginFullScreenData) msg.obj;
- if (data.mNpp != 0 && data.mView != null) {
- if (inFullScreenMode()) {
- Log.w(LOGTAG,
- "Should not have another full screen.");
- mFullScreenHolder.dismiss();
- }
- mFullScreenHolder = new PluginFullScreenHolder(
- WebView.this, data.mNpp);
- // as we are sharing the View between full screen and
- // embedded mode, we have to remove the
- // AbsoluteLayout.LayoutParams set by embedded mode to
- // ViewGroup.LayoutParams before adding it to the dialog
- data.mView.setLayoutParams(new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.FILL_PARENT));
- mFullScreenHolder.setContentView(data.mView);
- mFullScreenHolder.setCancelable(false);
- mFullScreenHolder.setCanceledOnTouchOutside(false);
- mFullScreenHolder.show();
- } else if (!inFullScreenMode()) {
- // this may happen if user dismisses the fullscreen and
- // then the WebCore re-position message finally reached
- // the UI thread.
- break;
- }
- // move the matching embedded view fully into the view so
- // that touch will be valid instead of rejected due to out
- // of the visible bounds
- // TODO: do we need to preserve the original position and
- // scale so that we can revert it when leaving the full
- // screen mode?
- int x = contentToViewX(data.mDocX);
- int y = contentToViewY(data.mDocY);
- int width = contentToViewDimension(data.mDocWidth);
- int height = contentToViewDimension(data.mDocHeight);
- int viewWidth = getViewWidth();
- int viewHeight = getViewHeight();
- int newX = mScrollX;
- int newY = mScrollY;
- if (x < mScrollX) {
- newX = x + (width > viewWidth
- ? (width - viewWidth) / 2 : 0);
- } else if (x + width > mScrollX + viewWidth) {
- newX = x + width - viewWidth - (width > viewWidth
- ? (width - viewWidth) / 2 : 0);
- }
- if (y < mScrollY) {
- newY = y + (height > viewHeight
- ? (height - viewHeight) / 2 : 0);
- } else if (y + height > mScrollY + viewHeight) {
- newY = y + height - viewHeight - (height > viewHeight
- ? (height - viewHeight) / 2 : 0);
- }
- scrollTo(newX, newY);
- if (width > viewWidth || height > viewHeight) {
- mZoomCenterX = viewWidth * .5f;
- mZoomCenterY = viewHeight * .5f;
- // do not change text wrap scale so that there is no
- // reflow
- setNewZoomScale(mActualScale
- / Math.max((float) width / viewWidth,
- (float) height / viewHeight), false,
- false);
- }
- // Now update the bound
- mFullScreenHolder.updateBound(contentToViewX(data.mDocX)
- - mScrollX, contentToViewY(data.mDocY) - mScrollY,
- contentToViewDimension(data.mDocWidth),
- contentToViewDimension(data.mDocHeight));
+ View view = (View) msg.obj;
+ int npp = msg.arg1;
+
+ if (mFullScreenHolder != null) {
+ Log.w(LOGTAG, "Should not have another full screen.");
+ mFullScreenHolder.dismiss();
}
- break;
+ mFullScreenHolder = new PluginFullScreenHolder(WebView.this, npp);
+ mFullScreenHolder.setContentView(view);
+ mFullScreenHolder.setCancelable(false);
+ mFullScreenHolder.setCanceledOnTouchOutside(false);
+ mFullScreenHolder.show();
+ break;
+ }
case HIDE_FULLSCREEN:
if (inFullScreenMode()) {
mFullScreenHolder.dismiss();