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.ContentResolver; | 10 import android.content.ContentResolver; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 private PositionObserver.Listener mPositionListener; | 250 private PositionObserver.Listener mPositionListener; |
251 | 251 |
252 // Size of the viewport in physical pixels as set from onSizeChanged. | 252 // Size of the viewport in physical pixels as set from onSizeChanged. |
253 private int mViewportWidthPix; | 253 private int mViewportWidthPix; |
254 private int mViewportHeightPix; | 254 private int mViewportHeightPix; |
255 private int mPhysicalBackingWidthPix; | 255 private int mPhysicalBackingWidthPix; |
256 private int mPhysicalBackingHeightPix; | 256 private int mPhysicalBackingHeightPix; |
257 private int mOverdrawBottomHeightPix; | 257 private int mOverdrawBottomHeightPix; |
258 private int mViewportSizeOffsetWidthPix; | 258 private int mViewportSizeOffsetWidthPix; |
259 private int mViewportSizeOffsetHeightPix; | 259 private int mViewportSizeOffsetHeightPix; |
260 private int mLocationInWindowX; | |
261 private int mLocationInWindowY; | |
262 | 260 |
263 // Cached copy of all positions and scales as reported by the renderer. | 261 // Cached copy of all positions and scales as reported by the renderer. |
264 private final RenderCoordinates mRenderCoordinates; | 262 private final RenderCoordinates mRenderCoordinates; |
265 | 263 |
266 private final RenderCoordinates.NormalizedPoint mStartHandlePoint; | 264 private final RenderCoordinates.NormalizedPoint mStartHandlePoint; |
267 private final RenderCoordinates.NormalizedPoint mEndHandlePoint; | 265 private final RenderCoordinates.NormalizedPoint mEndHandlePoint; |
268 private final RenderCoordinates.NormalizedPoint mInsertionHandlePoint; | 266 private final RenderCoordinates.NormalizedPoint mInsertionHandlePoint; |
269 | 267 |
270 // Tracks whether a selection is currently active. When applied to selected
text, indicates | 268 // Tracks whether a selection is currently active. When applied to selected
text, indicates |
271 // whether the last selected text is still highlighted. | 269 // whether the last selected text is still highlighted. |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 mViewportWidthPix = wPix; | 1485 mViewportWidthPix = wPix; |
1488 mViewportHeightPix = hPix; | 1486 mViewportHeightPix = hPix; |
1489 if (mNativeContentViewCore != 0) { | 1487 if (mNativeContentViewCore != 0) { |
1490 nativeWasResized(mNativeContentViewCore); | 1488 nativeWasResized(mNativeContentViewCore); |
1491 } | 1489 } |
1492 | 1490 |
1493 updateAfterSizeChanged(); | 1491 updateAfterSizeChanged(); |
1494 } | 1492 } |
1495 | 1493 |
1496 /** | 1494 /** |
1497 * Called when the ContentView's position in the activity window changed. Th
is information is | |
1498 * used for cropping screenshots. | |
1499 */ | |
1500 public void onLocationInWindowChanged(int x, int y) { | |
1501 mLocationInWindowX = x; | |
1502 mLocationInWindowY = y; | |
1503 } | |
1504 | |
1505 /** | |
1506 * Called when the underlying surface the compositor draws to changes size. | 1495 * Called when the underlying surface the compositor draws to changes size. |
1507 * This may be larger than the viewport size. | 1496 * This may be larger than the viewport size. |
1508 */ | 1497 */ |
1509 public void onPhysicalBackingSizeChanged(int wPix, int hPix) { | 1498 public void onPhysicalBackingSizeChanged(int wPix, int hPix) { |
1510 if (mPhysicalBackingWidthPix == wPix && mPhysicalBackingHeightPix == hPi
x) return; | 1499 if (mPhysicalBackingWidthPix == wPix && mPhysicalBackingHeightPix == hPi
x) return; |
1511 | 1500 |
1512 mPhysicalBackingWidthPix = wPix; | 1501 mPhysicalBackingWidthPix = wPix; |
1513 mPhysicalBackingHeightPix = hPix; | 1502 mPhysicalBackingHeightPix = hPix; |
1514 | 1503 |
1515 if (mNativeContentViewCore != 0) { | 1504 if (mNativeContentViewCore != 0) { |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 } | 2994 } |
3006 | 2995 |
3007 /** | 2996 /** |
3008 * @return The cached copy of render positions and scales. | 2997 * @return The cached copy of render positions and scales. |
3009 */ | 2998 */ |
3010 public RenderCoordinates getRenderCoordinates() { | 2999 public RenderCoordinates getRenderCoordinates() { |
3011 return mRenderCoordinates; | 3000 return mRenderCoordinates; |
3012 } | 3001 } |
3013 | 3002 |
3014 @CalledByNative | 3003 @CalledByNative |
3015 private int getLocationInWindowX() { | |
3016 return mLocationInWindowX; | |
3017 } | |
3018 | |
3019 @CalledByNative | |
3020 private int getLocationInWindowY() { | |
3021 return mLocationInWindowY; | |
3022 } | |
3023 | |
3024 @CalledByNative | |
3025 private static Rect createRect(int x, int y, int right, int bottom) { | 3004 private static Rect createRect(int x, int y, int right, int bottom) { |
3026 return new Rect(x, y, right, bottom); | 3005 return new Rect(x, y, right, bottom); |
3027 } | 3006 } |
3028 | 3007 |
3029 public void extractSmartClipData(int x, int y, int width, int height) { | 3008 public void extractSmartClipData(int x, int y, int width, int height) { |
3030 if (mNativeContentViewCore != 0) { | 3009 if (mNativeContentViewCore != 0) { |
3031 nativeExtractSmartClipData(mNativeContentViewCore, x, y, width, heig
ht); | 3010 nativeExtractSmartClipData(mNativeContentViewCore, x, y, width, heig
ht); |
3032 } | 3011 } |
3033 } | 3012 } |
3034 | 3013 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 | 3234 |
3256 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); | 3235 private native void nativeShowImeIfNeeded(long nativeContentViewCoreImpl); |
3257 | 3236 |
3258 private native void nativeSetAccessibilityEnabled( | 3237 private native void nativeSetAccessibilityEnabled( |
3259 long nativeContentViewCoreImpl, boolean enabled); | 3238 long nativeContentViewCoreImpl, boolean enabled); |
3260 | 3239 |
3261 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, | 3240 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp
l, |
3262 int x, int y, int w, int h); | 3241 int x, int y, int w, int h); |
3263 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); | 3242 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl
, boolean opaque); |
3264 } | 3243 } |
OLD | NEW |