Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1940)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java

Issue 1237913002: [Contextual Search] Adds basic support for narrow Search Panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync & rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java
index 231c50c3c21187dbd02b4e678ba562ec7e7b4b7b..b3aa1ce208f93f02e8810a044f72ad4fc6245557 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/eventfilter/ContextualSearchEventFilter.java
@@ -181,7 +181,8 @@ public class ContextualSearchEventFilter extends GestureEventFilter {
if (!mIsDeterminingEventTarget && action == MotionEvent.ACTION_DOWN) {
mInitialEventY = e.getY();
- if (mSearchPanel.isYCoordinateInsideSearchContentView(mInitialEventY * mPxToDp)) {
+ if (mSearchPanel.isCoordinateInsideSearchContentView(
+ e.getX() * mPxToDp, mInitialEventY * mPxToDp)) {
// If the DOWN event happened inside the Search Content View, we'll need
// to wait until the user has moved the finger beyond a certain threshold,
// so we can determine the gesture's orientation and consequently be able
@@ -357,10 +358,11 @@ public class ContextualSearchEventFilter extends GestureEventFilter {
isSyntheticEvent = true;
}
- float searchContentViewOffsetYPx = mSearchPanel.getSearchContentViewOffsetY() / mPxToDp;
+ final float contentViewOffsetXPx = mSearchPanel.getSearchContentViewOffsetX() / mPxToDp;
+ final float contentViewOffsetYPx = mSearchPanel.getSearchContentViewOffsetY() / mPxToDp;
// Adjust the offset to be relative to the Search Contents View.
- event.offsetLocation(0.f, -searchContentViewOffsetYPx);
+ event.offsetLocation(-contentViewOffsetXPx, -contentViewOffsetYPx);
boolean wasEventCanceled = false;
if (mWasActionDownEventSynthetic && action == MotionEvent.ACTION_UP) {
@@ -404,7 +406,8 @@ public class ContextualSearchEventFilter extends GestureEventFilter {
* @return Whether the event has been consumed.
*/
private boolean handleSingleTapUp(MotionEvent e) {
- setEventTarget(mSearchPanel.isYCoordinateInsideSearchContentView(e.getY() * mPxToDp)
+ setEventTarget(mSearchPanel.isCoordinateInsideSearchContentView(
+ e.getX() * mPxToDp, e.getY() * mPxToDp)
? EventTarget.SEARCH_CONTENT_VIEW : EventTarget.SEARCH_PANEL);
return false;

Powered by Google App Engine
This is Rietveld 408576698