Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78537227 authored by Grace Kloba's avatar Grace Kloba Committed by Android Git Automerger
Browse files

am 49a791a0: am 4350e145: Move the full screen\'s matching embedded view to be...

am 49a791a0: am 4350e145: Move the full screen\'s matching embedded view to be fully visible so that the touch will always work.

Merge commit '49a791a0'

* commit '49a791a0':
  Move the full screen's matching embedded view to be
parents a8181d53 49a791a0
Loading
Loading
Loading
Loading
+38 −1
Original line number Diff line number Diff line
@@ -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: