Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| index d0bcd486ece4adf008e0e52c3139b536ddb9d1e6..6a15a623391b223e6f4244d15a590f0b6d64197a 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| @@ -40,6 +40,7 @@ import android.view.inputmethod.EditorInfo; |
| import android.view.inputmethod.InputConnection; |
| import android.view.inputmethod.InputMethodManager; |
| +import org.chromium.base.CommandLine; |
| import org.chromium.base.ObserverList; |
| import org.chromium.base.ObserverList.RewindableIterator; |
| import org.chromium.base.TraceEvent; |
| @@ -59,6 +60,7 @@ import org.chromium.content.browser.input.SelectPopup; |
| import org.chromium.content.browser.input.SelectPopupDialog; |
| import org.chromium.content.browser.input.SelectPopupDropdown; |
| import org.chromium.content.browser.input.SelectPopupItem; |
| +import org.chromium.content.common.ContentSwitches; |
| import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
| import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
| import org.chromium.content_public.browser.ActionModeCallbackHelper; |
| @@ -353,6 +355,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
| private float mCurrentTouchOffsetX; |
| private float mCurrentTouchOffsetY; |
| + // True if we want to disable Android native event batching and use compositor event queue. |
| + private boolean mShouldRequestUnbufferedDispatch; |
| + |
| // Whether the ContentViewCore requires the WebContents to be fullscreen in order to lock the |
| // screen orientation. |
| private boolean mFullscreenRequiredForOrientationLock = true; |
| @@ -584,6 +589,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
| mSelectionPopupController.setContainerView(getContainerView()); |
| mWebContentsObserver = new ContentViewWebContentsObserver(this); |
| + |
| + mShouldRequestUnbufferedDispatch = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP |
| + && CommandLine.getInstance().hasSwitch(ContentSwitches.DISABLE_EVENT_BATCHING); |
| } |
| /** |
| @@ -990,12 +998,16 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa |
| return sendTouchEvent(event, isTouchHandleEvent); |
| } |
| + @SuppressLint("NewApi") |
|
chongz
2017/02/22 21:36:15
I'm not sure what's the proper way of accessing ne
aelias_OOO_until_Jul13
2017/02/22 22:40:51
It's @TargetApi. I suggest placing it in a small
chongz
2017/02/22 23:08:58
Done.
|
| private boolean sendTouchEvent(MotionEvent event, boolean isTouchHandleEvent) { |
| TraceEvent.begin("sendTouchEvent"); |
| try { |
| int eventAction = event.getActionMasked(); |
| if (eventAction == MotionEvent.ACTION_DOWN) { |
| + if (mShouldRequestUnbufferedDispatch) { |
| + mContainerView.requestUnbufferedDispatch(event); |
| + } |
| cancelRequestToScrollFocusedEditableNodeIntoView(); |
| } |