OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.SearchManager; | 8 import android.app.SearchManager; |
9 import android.content.ContentResolver; | 9 import android.content.ContentResolver; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 // Only valid when focused on a text / password field. | 370 // Only valid when focused on a text / password field. |
371 private ImeAdapter mImeAdapter; | 371 private ImeAdapter mImeAdapter; |
372 private ImeAdapter.AdapterInputConnectionFactory mAdapterInputConnectionFact ory; | 372 private ImeAdapter.AdapterInputConnectionFactory mAdapterInputConnectionFact ory; |
373 private AdapterInputConnection mInputConnection; | 373 private AdapterInputConnection mInputConnection; |
374 | 374 |
375 private SelectionHandleController mSelectionHandleController; | 375 private SelectionHandleController mSelectionHandleController; |
376 private InsertionHandleController mInsertionHandleController; | 376 private InsertionHandleController mInsertionHandleController; |
377 | 377 |
378 private Runnable mDeferredHandleFadeInRunnable; | 378 private Runnable mDeferredHandleFadeInRunnable; |
379 | 379 |
380 private PositionObserver mPositionObserver; | |
381 | |
380 // Size of the viewport in physical pixels as set from onSizeChanged. | 382 // Size of the viewport in physical pixels as set from onSizeChanged. |
381 private int mViewportWidthPix; | 383 private int mViewportWidthPix; |
382 private int mViewportHeightPix; | 384 private int mViewportHeightPix; |
383 private int mPhysicalBackingWidthPix; | 385 private int mPhysicalBackingWidthPix; |
384 private int mPhysicalBackingHeightPix; | 386 private int mPhysicalBackingHeightPix; |
385 private int mOverdrawBottomHeightPix; | 387 private int mOverdrawBottomHeightPix; |
386 private int mViewportSizeOffsetWidthPix; | 388 private int mViewportSizeOffsetWidthPix; |
387 private int mViewportSizeOffsetHeightPix; | 389 private int mViewportSizeOffsetHeightPix; |
388 | 390 |
389 // Cached copy of all positions and scales as reported by the renderer. | 391 // Cached copy of all positions and scales as reported by the renderer. |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 // necessarily mean we're going to *get* hardware acceleration -- that's | 712 // necessarily mean we're going to *get* hardware acceleration -- that's |
711 // up to the Android framework. | 713 // up to the Android framework. |
712 // | 714 // |
713 // TODO(husky): Once the native code has been updated so that the | 715 // TODO(husky): Once the native code has been updated so that the |
714 // HW acceleration flag can be set dynamically (Grace is doing this), | 716 // HW acceleration flag can be set dynamically (Grace is doing this), |
715 // move this check into onAttachedToWindow(), where we can test for | 717 // move this check into onAttachedToWindow(), where we can test for |
716 // HW support directly. | 718 // HW support directly. |
717 mHardwareAccelerated = hasHardwareAcceleration(mContext); | 719 mHardwareAccelerated = hasHardwareAcceleration(mContext); |
718 | 720 |
719 mContainerView = containerView; | 721 mContainerView = containerView; |
722 mPositionObserver = new ViewPositionObserver(mContainerView); | |
720 | 723 |
721 int windowNativePointer = windowAndroid != null ? windowAndroid.getNativ ePointer() : 0; | 724 int windowNativePointer = windowAndroid != null ? windowAndroid.getNativ ePointer() : 0; |
722 | 725 |
723 int viewAndroidNativePointer = 0; | 726 int viewAndroidNativePointer = 0; |
724 if (windowNativePointer != 0) { | 727 if (windowNativePointer != 0) { |
725 mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate ()); | 728 mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate ()); |
726 viewAndroidNativePointer = mViewAndroid.getNativePointer(); | 729 viewAndroidNativePointer = mViewAndroid.getNativePointer(); |
727 } | 730 } |
728 | 731 |
729 mNativeContentViewCore = nativeInit(mHardwareAccelerated, | 732 mNativeContentViewCore = nativeInit(mHardwareAccelerated, |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1992 mDownloadDelegate = delegate; | 1995 mDownloadDelegate = delegate; |
1993 } | 1996 } |
1994 | 1997 |
1995 // Called by DownloadController. | 1998 // Called by DownloadController. |
1996 ContentViewDownloadDelegate getDownloadDelegate() { | 1999 ContentViewDownloadDelegate getDownloadDelegate() { |
1997 return mDownloadDelegate; | 2000 return mDownloadDelegate; |
1998 } | 2001 } |
1999 | 2002 |
2000 private SelectionHandleController getSelectionHandleController() { | 2003 private SelectionHandleController getSelectionHandleController() { |
2001 if (mSelectionHandleController == null) { | 2004 if (mSelectionHandleController == null) { |
2002 mSelectionHandleController = new SelectionHandleController(getContai nerView()) { | 2005 mSelectionHandleController = new SelectionHandleController( |
2006 getContainerView(), | |
2007 mPositionObserver) { | |
Ted C
2013/10/14 23:46:44
these params now fit on the same line
| |
2003 @Override | 2008 @Override |
2004 public void selectBetweenCoordinates(int x1, int y1, int x2, int y2) { | 2009 public void selectBetweenCoordinates(int x1, int y1, int x2, int y2) { |
2005 if (mNativeContentViewCore != 0 && !(x1 == x2 && y1 == y2)) { | 2010 if (mNativeContentViewCore != 0 && !(x1 == x2 && y1 == y2)) { |
2006 nativeSelectBetweenCoordinates(mNativeContentViewCore, | 2011 nativeSelectBetweenCoordinates(mNativeContentViewCore, |
2007 x1, y1 - mRenderCoordinates.getContentOffsetYPix (), | 2012 x1, y1 - mRenderCoordinates.getContentOffsetYPix (), |
2008 x2, y2 - mRenderCoordinates.getContentOffsetYPix ()); | 2013 x2, y2 - mRenderCoordinates.getContentOffsetYPix ()); |
2009 } | 2014 } |
2010 } | 2015 } |
2011 | 2016 |
2012 @Override | 2017 @Override |
2013 public void showHandles(int startDir, int endDir) { | 2018 public void showHandles(int startDir, int endDir) { |
2014 super.showHandles(startDir, endDir); | 2019 super.showHandles(startDir, endDir); |
2015 showSelectActionBar(); | 2020 showSelectActionBar(); |
2016 } | 2021 } |
2017 | 2022 |
2018 }; | 2023 }; |
2019 | 2024 |
2020 mSelectionHandleController.hideAndDisallowAutomaticShowing(); | 2025 mSelectionHandleController.hideAndDisallowAutomaticShowing(); |
2021 } | 2026 } |
2022 | 2027 |
2023 return mSelectionHandleController; | 2028 return mSelectionHandleController; |
2024 } | 2029 } |
2025 | 2030 |
2026 private InsertionHandleController getInsertionHandleController() { | 2031 private InsertionHandleController getInsertionHandleController() { |
2027 if (mInsertionHandleController == null) { | 2032 if (mInsertionHandleController == null) { |
2028 mInsertionHandleController = new InsertionHandleController(getContai nerView()) { | 2033 mInsertionHandleController = new InsertionHandleController( |
2034 getContainerView(), mPositionObserver) { | |
2029 private static final int AVERAGE_LINE_HEIGHT = 14; | 2035 private static final int AVERAGE_LINE_HEIGHT = 14; |
2030 | 2036 |
2031 @Override | 2037 @Override |
2032 public void setCursorPosition(int x, int y) { | 2038 public void setCursorPosition(int x, int y) { |
2033 if (mNativeContentViewCore != 0) { | 2039 if (mNativeContentViewCore != 0) { |
2034 nativeMoveCaret(mNativeContentViewCore, | 2040 nativeMoveCaret(mNativeContentViewCore, |
2035 x, y - mRenderCoordinates.getContentOffsetYPix() ); | 2041 x, y - mRenderCoordinates.getContentOffsetYPix() ); |
2036 } | 2042 } |
2037 } | 2043 } |
2038 | 2044 |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3269 | 3275 |
3270 private native void nativeAttachExternalVideoSurface( | 3276 private native void nativeAttachExternalVideoSurface( |
3271 int nativeContentViewCoreImpl, int playerId, Surface surface); | 3277 int nativeContentViewCoreImpl, int playerId, Surface surface); |
3272 | 3278 |
3273 private native void nativeDetachExternalVideoSurface( | 3279 private native void nativeDetachExternalVideoSurface( |
3274 int nativeContentViewCoreImpl, int playerId); | 3280 int nativeContentViewCoreImpl, int playerId); |
3275 | 3281 |
3276 private native void nativeSetAccessibilityEnabled( | 3282 private native void nativeSetAccessibilityEnabled( |
3277 int nativeContentViewCoreImpl, boolean enabled); | 3283 int nativeContentViewCoreImpl, boolean enabled); |
3278 } | 3284 } |
OLD | NEW |