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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.SearchManager; | 9 import android.app.SearchManager; |
10 import android.content.ClipboardManager; | 10 import android.content.ClipboardManager; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 public View acquireAnchorView() { | 434 public View acquireAnchorView() { |
435 View anchorView = new View(mContext); | 435 View anchorView = new View(mContext); |
436 mContainerViewAtCreation.addView(anchorView); | 436 mContainerViewAtCreation.addView(anchorView); |
437 return anchorView; | 437 return anchorView; |
438 } | 438 } |
439 | 439 |
440 @Override | 440 @Override |
441 @SuppressWarnings("deprecation") // AbsoluteLayout | 441 @SuppressWarnings("deprecation") // AbsoluteLayout |
442 public void setAnchorViewPosition( | 442 public void setAnchorViewPosition( |
443 View view, float x, float y, float width, float height) { | 443 View view, float x, float y, float width, float height) { |
| 444 if (view.getParent() == null) { |
| 445 // Ignore. setAnchorViewPosition has been called after the a
nchor view has |
| 446 // already been released. |
| 447 return; |
| 448 } |
444 assert view.getParent() == mContainerViewAtCreation; | 449 assert view.getParent() == mContainerViewAtCreation; |
445 | 450 |
446 float scale = (float) DeviceDisplayInfo.create(mContext).getDIPS
cale(); | 451 float scale = (float) DeviceDisplayInfo.create(mContext).getDIPS
cale(); |
447 | 452 |
448 // The anchor view should not go outside the bounds of the Conta
inerView. | 453 // The anchor view should not go outside the bounds of the Conta
inerView. |
449 int leftMargin = Math.round(x * scale); | 454 int leftMargin = Math.round(x * scale); |
450 int topMargin = Math.round(mRenderCoordinates.getContentOffsetYP
ix() + y * scale); | 455 int topMargin = Math.round(mRenderCoordinates.getContentOffsetYP
ix() + y * scale); |
451 int scaledWidth = Math.round(width * scale); | 456 int scaledWidth = Math.round(width * scale); |
452 // ContentViewCore currently only supports these two container v
iew types. | 457 // ContentViewCore currently only supports these two container v
iew types. |
453 if (mContainerViewAtCreation instanceof FrameLayout) { | 458 if (mContainerViewAtCreation instanceof FrameLayout) { |
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3207 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3212 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3208 | 3213 |
3209 private native void nativeSetAccessibilityEnabled( | 3214 private native void nativeSetAccessibilityEnabled( |
3210 long nativeContentViewCoreImpl, boolean enabled); | 3215 long nativeContentViewCoreImpl, boolean enabled); |
3211 | 3216 |
3212 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3217 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3213 int x, int y, int w, int h); | 3218 int x, int y, int w, int h); |
3214 | 3219 |
3215 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3220 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3216 } | 3221 } |
OLD | NEW |