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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 26575006: [Android] Hide handles when the containing view moves (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 380 private PositionObserver mPositionObserver;
381 private PositionObserver.Listener mPositionListener;
381 382
382 // Size of the viewport in physical pixels as set from onSizeChanged. 383 // Size of the viewport in physical pixels as set from onSizeChanged.
383 private int mViewportWidthPix; 384 private int mViewportWidthPix;
384 private int mViewportHeightPix; 385 private int mViewportHeightPix;
385 private int mPhysicalBackingWidthPix; 386 private int mPhysicalBackingWidthPix;
386 private int mPhysicalBackingHeightPix; 387 private int mPhysicalBackingHeightPix;
387 private int mOverdrawBottomHeightPix; 388 private int mOverdrawBottomHeightPix;
388 private int mViewportSizeOffsetWidthPix; 389 private int mViewportSizeOffsetWidthPix;
389 private int mViewportSizeOffsetHeightPix; 390 private int mViewportSizeOffsetHeightPix;
390 391
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // up to the Android framework. 714 // up to the Android framework.
714 // 715 //
715 // TODO(husky): Once the native code has been updated so that the 716 // TODO(husky): Once the native code has been updated so that the
716 // HW acceleration flag can be set dynamically (Grace is doing this), 717 // HW acceleration flag can be set dynamically (Grace is doing this),
717 // move this check into onAttachedToWindow(), where we can test for 718 // move this check into onAttachedToWindow(), where we can test for
718 // HW support directly. 719 // HW support directly.
719 mHardwareAccelerated = hasHardwareAcceleration(mContext); 720 mHardwareAccelerated = hasHardwareAcceleration(mContext);
720 721
721 mContainerView = containerView; 722 mContainerView = containerView;
722 mPositionObserver = new ViewPositionObserver(mContainerView); 723 mPositionObserver = new ViewPositionObserver(mContainerView);
724 mPositionListener = new PositionObserver.Listener() {
725 @Override
726 public void onPositionChanged(int x, int y) {
727 if (isSelectionHandleShowing() || isInsertionHandleShowing()) {
728 temporarilyHideTextHandles();
729 }
730 }
731 };
723 732
724 int windowNativePointer = windowAndroid != null ? windowAndroid.getNativ ePointer() : 0; 733 int windowNativePointer = windowAndroid != null ? windowAndroid.getNativ ePointer() : 0;
725 734
726 int viewAndroidNativePointer = 0; 735 int viewAndroidNativePointer = 0;
727 if (windowNativePointer != 0) { 736 if (windowNativePointer != 0) {
728 mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate ()); 737 mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate ());
729 viewAndroidNativePointer = mViewAndroid.getNativePointer(); 738 viewAndroidNativePointer = mViewAndroid.getNativePointer();
730 } 739 }
731 740
732 mNativeContentViewCore = nativeInit(mHardwareAccelerated, 741 mNativeContentViewCore = nativeInit(mHardwareAccelerated,
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 } 2099 }
2091 } 2100 }
2092 2101
2093 private void hideHandles() { 2102 private void hideHandles() {
2094 if (mSelectionHandleController != null) { 2103 if (mSelectionHandleController != null) {
2095 mSelectionHandleController.hideAndDisallowAutomaticShowing(); 2104 mSelectionHandleController.hideAndDisallowAutomaticShowing();
2096 } 2105 }
2097 if (mInsertionHandleController != null) { 2106 if (mInsertionHandleController != null) {
2098 mInsertionHandleController.hideAndDisallowAutomaticShowing(); 2107 mInsertionHandleController.hideAndDisallowAutomaticShowing();
2099 } 2108 }
2109 mPositionObserver.removeListener(mPositionListener);
2100 } 2110 }
2101 2111
2102 private void showSelectActionBar() { 2112 private void showSelectActionBar() {
2103 if (mActionMode != null) { 2113 if (mActionMode != null) {
2104 mActionMode.invalidate(); 2114 mActionMode.invalidate();
2105 return; 2115 return;
2106 } 2116 }
2107 2117
2108 // Start a new action mode with a SelectActionModeCallback. 2118 // Start a new action mode with a SelectActionModeCallback.
2109 SelectActionModeCallback.ActionHandler actionHandler = 2119 SelectActionModeCallback.ActionHandler actionHandler =
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 // Deselection 2530 // Deselection
2521 if (mSelectionHandleController != null) { 2531 if (mSelectionHandleController != null) {
2522 mSelectionHandleController.hideAndDisallowAutomaticShowing() ; 2532 mSelectionHandleController.hideAndDisallowAutomaticShowing() ;
2523 } 2533 }
2524 if (mInsertionHandleController != null) { 2534 if (mInsertionHandleController != null) {
2525 mInsertionHandleController.hideAndDisallowAutomaticShowing() ; 2535 mInsertionHandleController.hideAndDisallowAutomaticShowing() ;
2526 } 2536 }
2527 } 2537 }
2528 mHasSelection = false; 2538 mHasSelection = false;
2529 } 2539 }
2540 if (isSelectionHandleShowing() || isInsertionHandleShowing()) {
2541 mPositionObserver.addListener(mPositionListener);
2542 }
2530 } 2543 }
2531 2544
2532 @SuppressWarnings("unused") 2545 @SuppressWarnings("unused")
2533 @CalledByNative 2546 @CalledByNative
2534 private static void onEvaluateJavaScriptResult( 2547 private static void onEvaluateJavaScriptResult(
2535 String jsonResult, JavaScriptCallback callback) { 2548 String jsonResult, JavaScriptCallback callback) {
2536 callback.handleJavaScriptResult(jsonResult); 2549 callback.handleJavaScriptResult(jsonResult);
2537 } 2550 }
2538 2551
2539 @SuppressWarnings("unused") 2552 @SuppressWarnings("unused")
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 3279
3267 private native void nativeAttachExternalVideoSurface( 3280 private native void nativeAttachExternalVideoSurface(
3268 int nativeContentViewCoreImpl, int playerId, Surface surface); 3281 int nativeContentViewCoreImpl, int playerId, Surface surface);
3269 3282
3270 private native void nativeDetachExternalVideoSurface( 3283 private native void nativeDetachExternalVideoSurface(
3271 int nativeContentViewCoreImpl, int playerId); 3284 int nativeContentViewCoreImpl, int playerId);
3272 3285
3273 private native void nativeSetAccessibilityEnabled( 3286 private native void nativeSetAccessibilityEnabled(
3274 int nativeContentViewCoreImpl, boolean enabled); 3287 int nativeContentViewCoreImpl, boolean enabled);
3275 } 3288 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698