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

Commit 0d03b914 authored by Grace Kloba's avatar Grace Kloba
Browse files

Before we send VIEW_SIZE_CHANGED after first layout,

we should remove VIEW_SIZE_CHANGED in the queue if
there is any as we are going to send the message in
the front of the queue.

Fix http://b/issue?id=2133222
parent fee73ee2
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -1980,6 +1980,13 @@ final class WebViewCore {
            data.mTextWrapWidth = data.mWidth;
            data.mTextWrapWidth = data.mWidth;
            data.mScale = -1.0f;
            data.mScale = -1.0f;
            data.mIgnoreHeight = false;
            data.mIgnoreHeight = false;
            // send VIEW_SIZE_CHANGED to the front of the queue so that we can
            // avoid pushing the wrong picture to the WebView side. If there is
            // a VIEW_SIZE_CHANGED in the queue, probably from WebView side,
            // ignore it as we have a new size. If we leave VIEW_SIZE_CHANGED
            // in the queue, as mLastHeightSent has been updated here, we may
            // miss the requestLayout in WebView side after the new picture.
            mEventHub.removeMessages(EventHub.VIEW_SIZE_CHANGED);
            mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
            mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
                    EventHub.VIEW_SIZE_CHANGED, data));
                    EventHub.VIEW_SIZE_CHANGED, data));
        } else if (mSettings.getUseWideViewPort()) {
        } else if (mSettings.getUseWideViewPort()) {
@@ -2001,6 +2008,9 @@ final class WebViewCore {
                data.mTextWrapWidth = Math.round(webViewWidth
                data.mTextWrapWidth = Math.round(webViewWidth
                        / mRestoreState.mTextWrapScale);
                        / mRestoreState.mTextWrapScale);
                data.mIgnoreHeight = false;
                data.mIgnoreHeight = false;
                // send VIEW_SIZE_CHANGED to the front of the queue so that we
                // can avoid pushing the wrong picture to the WebView side.
                mEventHub.removeMessages(EventHub.VIEW_SIZE_CHANGED);
                mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
                mEventHub.sendMessageAtFrontOfQueue(Message.obtain(null,
                        EventHub.VIEW_SIZE_CHANGED, data));
                        EventHub.VIEW_SIZE_CHANGED, data));
            }
            }