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

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/ViewRoot.java

Issue 2688113002: Make ViewRoot the top of the ViewAndroid tree (Closed)
Patch Set: - Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.ui.base; 5 package org.chromium.ui.base;
6 6
7 import android.view.MotionEvent; 7 import android.view.MotionEvent;
8 8
9 import org.chromium.base.annotations.JNINamespace; 9 import org.chromium.base.annotations.JNINamespace;
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 pointerCount > 1 ? event.getTouchMinor(1) : 0}; 45 pointerCount > 1 ? event.getTouchMinor(1) : 0};
46 46
47 for (int i = 0; i < 2; i++) { 47 for (int i = 0; i < 2; i++) {
48 if (touchMajor[i] < touchMinor[i]) { 48 if (touchMajor[i] < touchMinor[i]) {
49 float tmp = touchMajor[i]; 49 float tmp = touchMajor[i];
50 touchMajor[i] = touchMinor[i]; 50 touchMajor[i] = touchMinor[i];
51 touchMinor[i] = tmp; 51 touchMinor[i] = tmp;
52 } 52 }
53 } 53 }
54 54
55 return nativeOnTouchEvent(getNativePtr(), event, 55 return nativeOnTouchEvent(getNativePointer(), event, event.getEventTime( ),
56 event.getEventTime(), event.getActionMasked(), 56 event.getActionMasked(), pointerCount, event.getHistorySize(),
57 pointerCount, event.getHistorySize(), event.getActionIndex(), 57 event.getActionIndex(), event.getX(), event.getY(),
58 event.getX(), event.getY(), 58 pointerCount > 1 ? event.getX(1) : 0, pointerCount > 1 ? event.g etY(1) : 0,
59 pointerCount > 1 ? event.getX(1) : 0, 59 event.getPointerId(0), pointerCount > 1 ? event.getPointerId(1) : -1, touchMajor[0],
60 pointerCount > 1 ? event.getY(1) : 0, 60 touchMajor[1], touchMinor[0], touchMinor[1], event.getOrientatio n(),
61 event.getPointerId(0), pointerCount > 1 ? event.getPointerId(1) : -1, 61 pointerCount > 1 ? event.getOrientation(1) : 0,
62 touchMajor[0], touchMajor[1],
63 touchMinor[0], touchMinor[1],
64 event.getOrientation(), pointerCount > 1 ? event.getOrientation( 1) : 0,
65 event.getAxisValue(MotionEvent.AXIS_TILT), 62 event.getAxisValue(MotionEvent.AXIS_TILT),
66 pointerCount > 1 ? event.getAxisValue(MotionEvent.AXIS_TILT, 1) : 0, 63 pointerCount > 1 ? event.getAxisValue(MotionEvent.AXIS_TILT, 1) : 0,
67 event.getRawX(), event.getRawY(), 64 event.getRawX(), event.getRawY(), event.getToolType(0),
68 event.getToolType(0),
69 pointerCount > 1 ? event.getToolType(1) : MotionEvent.TOOL_TYPE_ UNKNOWN, 65 pointerCount > 1 ? event.getToolType(1) : MotionEvent.TOOL_TYPE_ UNKNOWN,
70 event.getButtonState(), 66 event.getButtonState(), event.getMetaState(), isTouchHandleEvent );
71 event.getMetaState(),
72 isTouchHandleEvent);
73 } 67 }
74 68
75 public long getNativePtr() { 69 public long getNativePointer() {
76 if (mNativeView == 0) mNativeView = nativeInit(mWindowAndroid.getNativeP ointer()); 70 if (mNativeView == 0) mNativeView = nativeInit(mWindowAndroid.getNativeP ointer());
77 return mNativeView; 71 return mNativeView;
78 } 72 }
79 73
80 public void destroy() { 74 public void destroy() {
81 if (mNativeView != 0) { 75 if (mNativeView != 0) {
82 nativeDestroy(mNativeView); 76 nativeDestroy(mNativeView);
83 mNativeView = 0; 77 mNativeView = 0;
84 } 78 }
85 } 79 }
86 80
87 private native long nativeInit(long windowNativePointer); 81 private native long nativeInit(long windowNativePointer);
88 private native void nativeDestroy(long nativeViewRoot); 82 private native void nativeDestroy(long nativeViewRoot);
89 83
90 // All touch events (including flings, scrolls etc) accept coordinates in ph ysical pixels. 84 // All touch events (including flings, scrolls etc) accept coordinates in ph ysical pixels.
91 private native boolean nativeOnTouchEvent( 85 private native boolean nativeOnTouchEvent(
92 long nativeViewRoot, MotionEvent event, 86 long nativeViewRoot, MotionEvent event,
93 long timeMs, int action, int pointerCount, int historySize, int acti onIndex, 87 long timeMs, int action, int pointerCount, int historySize, int acti onIndex,
94 float x0, float y0, float x1, float y1, 88 float x0, float y0, float x1, float y1,
95 int pointerId0, int pointerId1, 89 int pointerId0, int pointerId1,
96 float touchMajor0, float touchMajor1, 90 float touchMajor0, float touchMajor1,
97 float touchMinor0, float touchMinor1, 91 float touchMinor0, float touchMinor1,
98 float orientation0, float orientation1, 92 float orientation0, float orientation1,
99 float tilt0, float tilt1, 93 float tilt0, float tilt1,
100 float rawX, float rawY, 94 float rawX, float rawY,
101 int androidToolType0, int androidToolType1, 95 int androidToolType0, int androidToolType1,
102 int androidButtonState, int androidMetaState, 96 int androidButtonState, int androidMetaState,
103 boolean isTouchHandleEvent); 97 boolean isTouchHandleEvent);
104 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698