diff options
| author | Grace Kloba <klobag@google.com> | 2009-12-21 16:35:04 -0800 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2009-12-21 18:05:04 -0800 |
| commit | 4350e1451c9f884fabcabfda915b58a26c6ebf5f (patch) | |
| tree | ff3a9d73e9e4fd65c76cfd3de553ebab3c0830b7 | |
| parent | d4a4729c0cac582a2dcec7c8cfb316b81885a0f0 (diff) | |
| download | frameworks_base-4350e1451c9f884fabcabfda915b58a26c6ebf5f.zip frameworks_base-4350e1451c9f884fabcabfda915b58a26c6ebf5f.tar.gz frameworks_base-4350e1451c9f884fabcabfda915b58a26c6ebf5f.tar.bz2 | |
Move the full screen's matching embedded view to be
fully visible so that the touch will always work.
| -rw-r--r-- | core/java/android/webkit/WebView.java | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index bfe5b41..fb8148b 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -5684,12 +5684,49 @@ public class WebView extends AbsoluteLayout mFullScreenHolder.setContentView(data.mView); mFullScreenHolder.setCancelable(false); mFullScreenHolder.setCanceledOnTouchOutside(false); + mFullScreenHolder.show(); } + // 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; + setNewZoomScale(mActualScale + / Math.max((float) width / viewWidth, + (float) height / viewHeight), false); + } + // Now update the bound mFullScreenHolder.updateBound(contentToViewX(data.mDocX) - mScrollX, contentToViewY(data.mDocY) - mScrollY, contentToViewDimension(data.mDocWidth), contentToViewDimension(data.mDocHeight)); - mFullScreenHolder.show(); break; case HIDE_FULLSCREEN: |
