|
|
Chromium Code Reviews
DescriptionAvoid clearing of Find In Page during BACK key press
This change takes care of avoiding the removal of Find In
Page toolbar when pressing BACK key in the presence of IME.
IME will be cleared first. Second BACK Key will clear the
Find In Page toolbar.
BUG=564368
Committed: https://crrev.com/b67b82af1eecc41bb80f51cdaddc0a129540c8b9
Cr-Commit-Position: refs/heads/master@{#401377}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Added test and fixed review comments. #
Total comments: 4
Patch Set 3 : Fixed review comments and enhanced test coverage. #
Total comments: 5
Patch Set 4 : Refined tests and fixed review comments. #
Messages
Total messages: 26 (7 generated)
ajith.v@chromium.org changed reviewers: + yfriedman@chromium.org
PTAL!
yfriedman@chromium.org changed reviewers: + changwan@chromium.org
I think changwan is a better reviewer for this but he OOO for the rest of the week so this'll have to wait a bit
could you also add a new test to FindTest.java? https://codereview.chromium.org/1947603002/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java (right): https://codereview.chromium.org/1947603002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java:723: if (mFindQuery.hasWindowFocus() && UiUtils.isKeyboardShowing(getContext(), mFindQuery)) { Please avoid using UiUtils#isKeyboardShowing() at all cost. It is a hacky method at best, and may not work in some corner cases. onKeyPreIme() was added 5 years ago, but I don't see the point of overriding it for this class. (The same applies to UrlBar, AppMenu, BookmarkSearchView.) Could you try removing the current onKeyPreIme() implementation and adding onKeyUp() to handle KEYCODE_BACK event to dismiss deactivate FindToolbar? See AppMenu#onKey() for reference. That way, we can give on-screen keyboard a chance to handle KEYCODE_BACK event before us, and dismiss FindToolbar only when OSK is already hidden. In case of physical (bluetooth) keyboard, it should dismiss FindToolbar right away.
changwan@chromium.org changed reviewers: + johnme@chromium.org
johnme@, could you explain why we had to override onKeyPreIme() instead of overriding onKeyUp() (and possibly onKeyDown())? Is the reason still valid?
On 2016/05/09 10:06:23, Changwan Ryu wrote: > johnme@, could you explain why we had to override onKeyPreIme() instead of > overriding onKeyUp() (and possibly onKeyDown())? Is the reason still valid? I can't remember, possibly because KEYCODE_BACK never got delivered to those events because it was handled by something else? But if it's possible to listen for it in onKeyUp, and that only receives the event if the keyboard has already been dismissed, that would be ideal. Would need to make sure we properly handle the keyboard hiding; clearly hideKeyboardAndStartFinding supports the case where we hide the keyboard ourselves, but I don't know offhand how well the FiP UI handles the keyboard hiding by itself (for example do the match rects in the scrollbar get adjusted for the increased window size?)
On 2016/05/10 16:28:49, johnme wrote: > On 2016/05/09 10:06:23, Changwan Ryu wrote: > > johnme@, could you explain why we had to override onKeyPreIme() instead of > > overriding onKeyUp() (and possibly onKeyDown())? Is the reason still valid? > > I can't remember, possibly because KEYCODE_BACK never got delivered to those > events because it was handled by something else? But if it's possible to listen > for it in onKeyUp, and that only receives the event if the keyboard has already > been dismissed, that would be ideal. > > Would need to make sure we properly handle the keyboard hiding; clearly > hideKeyboardAndStartFinding supports the case where we hide the keyboard > ourselves, but I don't know offhand how well the FiP UI handles the keyboard > hiding by itself (for example do the match rects in the scrollbar get adjusted > for the increased window size?) Thanks for the answer, johnme@. AKV, could you try my suggestions in #5 and see if there is any anomaly, e.g. match rects get lost or not drawn properly?
On 2016/05/11 02:24:59, Changwan Ryu wrote: > On 2016/05/10 16:28:49, johnme wrote: > > On 2016/05/09 10:06:23, Changwan Ryu wrote: > > > johnme@, could you explain why we had to override onKeyPreIme() instead of > > > overriding onKeyUp() (and possibly onKeyDown())? Is the reason still valid? > > > > I can't remember, possibly because KEYCODE_BACK never got delivered to those > > events because it was handled by something else? But if it's possible to > listen > > for it in onKeyUp, and that only receives the event if the keyboard has > already > > been dismissed, that would be ideal. > > > > Would need to make sure we properly handle the keyboard hiding; clearly > > hideKeyboardAndStartFinding supports the case where we hide the keyboard > > ourselves, but I don't know offhand how well the FiP UI handles the keyboard > > hiding by itself (for example do the match rects in the scrollbar get adjusted > > for the increased window size?) > > Thanks for the answer, johnme@. > AKV, could you try my suggestions in #5 and see if there is any anomaly, e.g. > match rects get lost or not drawn properly? Thank you Changwan. Currently I am OOO for few days. I will check this as soon as I reach office.
PTAL! https://codereview.chromium.org/1947603002/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java (right): https://codereview.chromium.org/1947603002/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java:723: if (mFindQuery.hasWindowFocus() && UiUtils.isKeyboardShowing(getContext(), mFindQuery)) { On 2016/05/09 09:43:01, Changwan Ryu wrote: > Please avoid using UiUtils#isKeyboardShowing() at all cost. It is a hacky method > at best, and may not work in some corner cases. > > onKeyPreIme() was added 5 years ago, but I don't see the point of overriding it > for this class. (The same applies to UrlBar, AppMenu, BookmarkSearchView.) > > Could you try removing the current onKeyPreIme() implementation and adding > onKeyUp() to handle KEYCODE_BACK event to dismiss deactivate FindToolbar? See > AppMenu#onKey() for reference. > > That way, we can give on-screen keyboard a chance to handle KEYCODE_BACK event > before us, and dismiss FindToolbar only when OSK is already hidden. In case of > physical (bluetooth) keyboard, it should dismiss FindToolbar right away. Done.
https://codereview.chromium.org/1947603002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java (right): https://codereview.chromium.org/1947603002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java:107: if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { I think you still need key dispatcher state to track ACTION_DOWN correctly. Otherwise, there is a chance that the container or framework may end up handling this in a half-baked fashion. https://codereview.chromium.org/1947603002/diff/20001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java (right): https://codereview.chromium.org/1947603002/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:348: public void testFindNotDismissedWithBackKey() throws InterruptedException { could you rename this to testBackKeyDoesNotDismissFindWhenImeIsPresent and add testBackKeyDismissesFind? We need to test both cases.
PTAL! https://codereview.chromium.org/1947603002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java (right): https://codereview.chromium.org/1947603002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java:107: if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { On 2016/06/13 01:32:02, Changwan Ryu wrote: > I think you still need key dispatcher state to track ACTION_DOWN correctly. > Otherwise, there is a chance that the container or framework may end up handling > this in a half-baked fashion. Ok I think theoretically/practically that's correct. I will change it. Thank you :) https://codereview.chromium.org/1947603002/diff/20001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java (right): https://codereview.chromium.org/1947603002/diff/20001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:348: public void testFindNotDismissedWithBackKey() throws InterruptedException { On 2016/06/13 01:32:02, Changwan Ryu wrote: > could you rename this to testBackKeyDoesNotDismissFindWhenImeIsPresent > and add testBackKeyDismissesFind? We need to test both cases. Ok. I will add other test as well.
changwan@chromium.org changed reviewers: + tedchoc@chromium.org
lgtm Adding tedchoc@ for approval
will defer to changwan@ about whether this is necessary...just looks a bit "fishy" to me https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java (right): https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:353: // IME is present at this moment, so IME will consume BACK key. should we wait for UiUtils.isKeyboardShowing here before proceeding? in general any time we are waiting for IME state changes, should we be doing that?
There were two chromium accounts requesting fix of this, so I think this is a necessary change. https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java (right): https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:353: // IME is present at this moment, so IME will consume BACK key. On 2016/06/13 23:55:19, Ted C wrote: > should we wait for UiUtils.isKeyboardShowing here before proceeding? in general > any time we are waiting for IME state changes, should we be doing that? +1 https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:370: KeyUtils.singleKeyEventView(getInstrumentation(), findQueryText, KeyEvent.KEYCODE_A); here, too
PTAL! https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... File chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java (right): https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:353: // IME is present at this moment, so IME will consume BACK key. On 2016/06/14 00:22:19, Changwan Ryu wrote: > On 2016/06/13 23:55:19, Ted C wrote: > > should we wait for UiUtils.isKeyboardShowing here before proceeding? in > general > > any time we are waiting for IME state changes, should we be doing that? > > +1 Done. https://codereview.chromium.org/1947603002/diff/40001/chrome/android/javatest... chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java:370: KeyUtils.singleKeyEventView(getInstrumentation(), findQueryText, KeyEvent.KEYCODE_A); On 2016/06/14 00:22:19, Changwan Ryu wrote: > here, too Done.
friendly ping! PTAL!
lgtm
The CQ bit was checked by ajith.v@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from changwan@chromium.org Link to the patchset: https://codereview.chromium.org/1947603002/#ps60001 (title: "Refined tests and fixed review comments.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1947603002/60001
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Avoid clearing of Find In Page during BACK key press This change takes care of avoiding the removal of Find In Page toolbar when pressing BACK key in the presence of IME. IME will be cleared first. Second BACK Key will clear the Find In Page toolbar. BUG=564368 ========== to ========== Avoid clearing of Find In Page during BACK key press This change takes care of avoiding the removal of Find In Page toolbar when pressing BACK key in the presence of IME. IME will be cleared first. Second BACK Key will clear the Find In Page toolbar. BUG=564368 Committed: https://crrev.com/b67b82af1eecc41bb80f51cdaddc0a129540c8b9 Cr-Commit-Position: refs/heads/master@{#401377} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/b67b82af1eecc41bb80f51cdaddc0a129540c8b9 Cr-Commit-Position: refs/heads/master@{#401377} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
