ContentView.java revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.content.browser; 6 7import android.app.Activity; 8import android.content.Context; 9import android.content.res.Configuration; 10import android.graphics.Bitmap; 11import android.graphics.Canvas; 12import android.graphics.Rect; 13import android.os.Build; 14import android.util.AttributeSet; 15import android.view.KeyEvent; 16import android.view.MotionEvent; 17import android.view.View; 18import android.view.accessibility.AccessibilityEvent; 19import android.view.accessibility.AccessibilityNodeInfo; 20import android.view.inputmethod.EditorInfo; 21import android.view.inputmethod.InputConnection; 22import android.widget.FrameLayout; 23 24import com.google.common.annotations.VisibleForTesting; 25 26import org.chromium.content.common.TraceEvent; 27import org.chromium.ui.WindowAndroid; 28 29/** 30 * The containing view for {@link ContentViewCore} that exists in the Android UI hierarchy and 31 * exposes the various {@link View} functionality to it. 32 * 33 * TODO(joth): Remove any methods overrides from this class that were added for WebView 34 * compatibility. 35 */ 36public class ContentView extends FrameLayout 37 implements ContentViewCore.InternalAccessDelegate, PageInfo { 38 39 private final ContentViewCore mContentViewCore; 40 41 private float mCurrentTouchOffsetX; 42 private float mCurrentTouchOffsetY; 43 44 /** 45 * Creates an instance of a ContentView. 46 * @param context The Context the view is running in, through which it can 47 * access the current theme, resources, etc. 48 * @param nativeWebContents A pointer to the native web contents. 49 * @param windowAndroid An instance of the WindowAndroid. 50 * @return A ContentView instance. 51 */ 52 public static ContentView newInstance(Context context, int nativeWebContents, 53 WindowAndroid windowAndroid) { 54 return newInstance(context, nativeWebContents, windowAndroid, null, 55 android.R.attr.webViewStyle); 56 } 57 58 /** 59 * Creates an instance of a ContentView. 60 * @param context The Context the view is running in, through which it can 61 * access the current theme, resources, etc. 62 * @param nativeWebContents A pointer to the native web contents. 63 * @param windowAndroid An instance of the WindowAndroid. 64 * @param attrs The attributes of the XML tag that is inflating the view. 65 * @return A ContentView instance. 66 */ 67 public static ContentView newInstance(Context context, int nativeWebContents, 68 WindowAndroid windowAndroid, AttributeSet attrs) { 69 // TODO(klobag): use the WebViewStyle as the default style for now. It enables scrollbar. 70 // When ContentView is moved to framework, we can define its own style in the res. 71 return newInstance(context, nativeWebContents, windowAndroid, attrs, 72 android.R.attr.webViewStyle); 73 } 74 75 /** 76 * Creates an instance of a ContentView. 77 * @param context The Context the view is running in, through which it can 78 * access the current theme, resources, etc. 79 * @param nativeWebContents A pointer to the native web contents. 80 * @param windowAndroid An instance of the WindowAndroid. 81 * @param attrs The attributes of the XML tag that is inflating the view. 82 * @param defStyle The default style to apply to this view. 83 * @return A ContentView instance. 84 */ 85 public static ContentView newInstance(Context context, int nativeWebContents, 86 WindowAndroid windowAndroid, AttributeSet attrs, int defStyle) { 87 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 88 return new ContentView(context, nativeWebContents, windowAndroid, attrs, defStyle); 89 } else { 90 return new JellyBeanContentView(context, nativeWebContents, windowAndroid, attrs, 91 defStyle); 92 } 93 } 94 95 protected ContentView(Context context, int nativeWebContents, WindowAndroid windowAndroid, 96 AttributeSet attrs, int defStyle) { 97 super(context, attrs, defStyle); 98 99 mContentViewCore = new ContentViewCore(context); 100 mContentViewCore.initialize(this, this, nativeWebContents, windowAndroid, 101 Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN ? 102 ContentViewCore.INPUT_EVENTS_DELIVERED_AT_VSYNC : 103 ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY); 104 } 105 106 // PageInfo implementation. 107 108 @Override 109 public String getUrl() { 110 return mContentViewCore.getUrl(); 111 } 112 113 @Override 114 public String getTitle() { 115 return mContentViewCore.getTitle(); 116 } 117 118 @Override 119 public boolean isReadyForSnapshot() { 120 return !isCrashed() && isReady(); 121 } 122 123 @Override 124 public Bitmap getBitmap() { 125 return getBitmap(getWidth(), getHeight()); 126 } 127 128 @Override 129 public Bitmap getBitmap(int width, int height) { 130 return mContentViewCore.getBitmap(width, height); 131 } 132 133 @Override 134 public int getBackgroundColor() { 135 return mContentViewCore.getBackgroundColor(); 136 } 137 138 @Override 139 public View getView() { 140 return this; 141 } 142 143 /** 144 * @return The core component of the ContentView that handles JNI communication. Should only be 145 * used for passing to native. 146 */ 147 public ContentViewCore getContentViewCore() { 148 return mContentViewCore; 149 } 150 151 /** 152 * @return The cache of scales and positions used to convert coordinates from/to CSS. 153 */ 154 public RenderCoordinates getRenderCoordinates() { 155 return mContentViewCore.getRenderCoordinates(); 156 } 157 158 /** 159 * Returns true if the given Activity has hardware acceleration enabled 160 * in its manifest, or in its foreground window. 161 * 162 * TODO(husky): Remove when ContentViewCore.initialize() is refactored (see TODO there) 163 * TODO(dtrainor) This is still used by other classes. Make sure to pull some version of this 164 * out before removing it. 165 */ 166 public static boolean hasHardwareAcceleration(Activity activity) { 167 return ContentViewCore.hasHardwareAcceleration(activity); 168 } 169 170 /** 171 * Destroy the internal state of the WebView. This method may only be called 172 * after the WebView has been removed from the view system. No other methods 173 * may be called on this WebView after this method has been called. 174 */ 175 public void destroy() { 176 mContentViewCore.destroy(); 177 } 178 179 /** 180 * Returns true initially, false after destroy() has been called. 181 * It is illegal to call any other public method after destroy(). 182 */ 183 public boolean isAlive() { 184 return mContentViewCore.isAlive(); 185 } 186 187 /** 188 * For internal use. Throws IllegalStateException if mNativeContentView is 0. 189 * Use this to ensure we get a useful Java stack trace, rather than a native 190 * crash dump, from use-after-destroy bugs in Java code. 191 */ 192 void checkIsAlive() throws IllegalStateException { 193 mContentViewCore.checkIsAlive(); 194 } 195 196 public void setContentViewClient(ContentViewClient client) { 197 mContentViewCore.setContentViewClient(client); 198 } 199 200 @VisibleForTesting 201 public ContentViewClient getContentViewClient() { 202 return mContentViewCore.getContentViewClient(); 203 } 204 205 /** 206 * Load url without fixing up the url string. Consumers of ContentView are responsible for 207 * ensuring the URL passed in is properly formatted (i.e. the scheme has been added if left 208 * off during user input). 209 * 210 * @param params Parameters for this load. 211 */ 212 public void loadUrl(LoadUrlParams params) { 213 mContentViewCore.loadUrl(params); 214 } 215 216 /** 217 * Stops loading the current web contents. 218 */ 219 public void stopLoading() { 220 mContentViewCore.stopLoading(); 221 } 222 223 /** 224 * @return Whether the current WebContents has a previous navigation entry. 225 */ 226 public boolean canGoBack() { 227 return mContentViewCore.canGoBack(); 228 } 229 230 /** 231 * @return Whether the current WebContents has a navigation entry after the current one. 232 */ 233 public boolean canGoForward() { 234 return mContentViewCore.canGoForward(); 235 } 236 237 /** 238 * @param offset The offset into the navigation history. 239 * @return Whether we can move in history by given offset 240 */ 241 public boolean canGoToOffset(int offset) { 242 return mContentViewCore.canGoToOffset(offset); 243 } 244 245 /** 246 * Navigates to the specified offset from the "current entry". Does nothing if the offset is out 247 * of bounds. 248 * @param offset The offset into the navigation history. 249 */ 250 public void goToOffset(int offset) { 251 mContentViewCore.goToOffset(offset); 252 } 253 254 /** 255 * Goes to the navigation entry before the current one. 256 */ 257 public void goBack() { 258 mContentViewCore.goBack(); 259 } 260 261 /** 262 * Goes to the navigation entry following the current one. 263 */ 264 public void goForward() { 265 mContentViewCore.goForward(); 266 } 267 268 /** 269 * Reload the current page. 270 */ 271 public void reload() { 272 mContentViewCore.reload(); 273 } 274 275 /** 276 * Clears the WebView's page history in both the backwards and forwards 277 * directions. 278 */ 279 public void clearHistory() { 280 mContentViewCore.clearHistory(); 281 } 282 283 String getSelectedText() { 284 return mContentViewCore.getSelectedText(); 285 } 286 287 /** 288 * Start profiling the update speed. You must call {@link #stopFpsProfiling} 289 * to stop profiling. 290 */ 291 @VisibleForTesting 292 public void startFpsProfiling() { 293 // TODO(nileshagrawal): Implement this. 294 } 295 296 /** 297 * Stop profiling the update speed. 298 */ 299 @VisibleForTesting 300 public float stopFpsProfiling() { 301 // TODO(nileshagrawal): Implement this. 302 return 0.0f; 303 } 304 305 /** 306 * Fling the ContentView from the current position. 307 * @param x Fling touch starting position 308 * @param y Fling touch starting position 309 * @param velocityX Initial velocity of the fling (X) measured in pixels per second. 310 * @param velocityY Initial velocity of the fling (Y) measured in pixels per second. 311 */ 312 @VisibleForTesting 313 public void fling(long timeMs, int x, int y, int velocityX, int velocityY) { 314 mContentViewCore.getContentViewGestureHandler().fling(timeMs, x, y, velocityX, velocityY); 315 } 316 317 void endFling(long timeMs) { 318 mContentViewCore.getContentViewGestureHandler().endFling(timeMs); 319 } 320 321 /** 322 * Start pinch zoom. You must call {@link #pinchEnd} to stop. 323 */ 324 @VisibleForTesting 325 public void pinchBegin(long timeMs, int x, int y) { 326 mContentViewCore.getContentViewGestureHandler().pinchBegin(timeMs, x, y); 327 } 328 329 /** 330 * Stop pinch zoom. 331 */ 332 @VisibleForTesting 333 public void pinchEnd(long timeMs) { 334 mContentViewCore.getContentViewGestureHandler().pinchEnd(timeMs); 335 } 336 337 void setIgnoreSingleTap(boolean value) { 338 mContentViewCore.getContentViewGestureHandler().setIgnoreSingleTap(value); 339 } 340 341 /** 342 * Modify the ContentView magnification level. The effect of calling this 343 * method is exactly as after "pinch zoom". 344 * 345 * @param timeMs The event time in milliseconds. 346 * @param delta The ratio of the new magnification level over the current 347 * magnification level. 348 * @param anchorX The magnification anchor (X) in the current view 349 * coordinate. 350 * @param anchorY The magnification anchor (Y) in the current view 351 * coordinate. 352 */ 353 @VisibleForTesting 354 public void pinchBy(long timeMs, int anchorX, int anchorY, float delta) { 355 mContentViewCore.getContentViewGestureHandler().pinchBy(timeMs, anchorX, anchorY, delta); 356 } 357 358 /** 359 * Injects the passed JavaScript code in the current page and evaluates it. 360 * 361 * @throws IllegalStateException If the ContentView has been destroyed. 362 */ 363 public void evaluateJavaScript(String script) throws IllegalStateException { 364 mContentViewCore.evaluateJavaScript(script, null); 365 } 366 367 /** 368 * This method should be called when the containing activity is paused. 369 **/ 370 public void onActivityPause() { 371 mContentViewCore.onActivityPause(); 372 } 373 374 /** 375 * This method should be called when the containing activity is resumed. 376 **/ 377 public void onActivityResume() { 378 mContentViewCore.onActivityResume(); 379 } 380 381 /** 382 * To be called when the ContentView is shown. 383 **/ 384 public void onShow() { 385 mContentViewCore.onShow(); 386 } 387 388 /** 389 * To be called when the ContentView is hidden. 390 **/ 391 public void onHide() { 392 mContentViewCore.onHide(); 393 } 394 395 /** 396 * Return the ContentSettings object used to retrieve the settings for this 397 * ContentView. 398 * @return A ContentSettings object that can be used to retrieve this ContentView's 399 * settings. 400 */ 401 public ContentSettings getContentSettings() { 402 return mContentViewCore.getContentSettings(); 403 } 404 405 /** 406 * Hides the select action bar. 407 */ 408 public void hideSelectActionBar() { 409 mContentViewCore.hideSelectActionBar(); 410 } 411 412 // FrameLayout overrides. 413 414 // Needed by ContentViewCore.InternalAccessDelegate 415 @Override 416 public boolean drawChild(Canvas canvas, View child, long drawingTime) { 417 return super.drawChild(canvas, child, drawingTime); 418 } 419 420 @Override 421 protected void onSizeChanged(int w, int h, int ow, int oh) { 422 TraceEvent.begin(); 423 super.onSizeChanged(w, h, ow, oh); 424 mContentViewCore.onSizeChanged(w, h, ow, oh); 425 TraceEvent.end(); 426 } 427 428 @Override 429 public InputConnection onCreateInputConnection(EditorInfo outAttrs) { 430 return mContentViewCore.onCreateInputConnection(outAttrs); 431 } 432 433 @Override 434 public boolean onCheckIsTextEditor() { 435 return mContentViewCore.onCheckIsTextEditor(); 436 } 437 438 @Override 439 protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { 440 TraceEvent.begin(); 441 super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); 442 mContentViewCore.onFocusChanged(gainFocus); 443 TraceEvent.end(); 444 } 445 446 @Override 447 public boolean onKeyUp(int keyCode, KeyEvent event) { 448 return mContentViewCore.onKeyUp(keyCode, event); 449 } 450 451 @Override 452 public boolean dispatchKeyEventPreIme(KeyEvent event) { 453 return mContentViewCore.dispatchKeyEventPreIme(event); 454 } 455 456 @Override 457 public boolean dispatchKeyEvent(KeyEvent event) { 458 if (isFocused()) { 459 return mContentViewCore.dispatchKeyEvent(event); 460 } else { 461 return super.dispatchKeyEvent(event); 462 } 463 } 464 465 @Override 466 public boolean onTouchEvent(MotionEvent event) { 467 MotionEvent offset = createOffsetMotionEvent(event); 468 boolean consumed = mContentViewCore.onTouchEvent(offset); 469 offset.recycle(); 470 return consumed; 471 } 472 473 /** 474 * Mouse move events are sent on hover enter, hover move and hover exit. 475 * They are sent on hover exit because sometimes it acts as both a hover 476 * move and hover exit. 477 */ 478 @Override 479 public boolean onHoverEvent(MotionEvent event) { 480 MotionEvent offset = createOffsetMotionEvent(event); 481 boolean consumed = mContentViewCore.onHoverEvent(offset); 482 offset.recycle(); 483 return consumed; 484 } 485 486 @Override 487 public boolean onGenericMotionEvent(MotionEvent event) { 488 return mContentViewCore.onGenericMotionEvent(event); 489 } 490 491 /** 492 * Sets the current amount to offset incoming touch events by. This is used to handle content 493 * moving and not lining up properly with the android input system. 494 * @param dx The X offset in pixels to shift touch events. 495 * @param dy The Y offset in pixels to shift touch events. 496 */ 497 public void setCurrentMotionEventOffsets(float dx, float dy) { 498 mCurrentTouchOffsetX = dx; 499 mCurrentTouchOffsetY = dy; 500 } 501 502 private MotionEvent createOffsetMotionEvent(MotionEvent src) { 503 MotionEvent dst = MotionEvent.obtain(src); 504 dst.offsetLocation(mCurrentTouchOffsetX, mCurrentTouchOffsetY); 505 return dst; 506 } 507 508 @Override 509 protected void onConfigurationChanged(Configuration newConfig) { 510 mContentViewCore.onConfigurationChanged(newConfig); 511 } 512 513 /** 514 * Currently the ContentView scrolling happens in the native side. In 515 * the Java view system, it is always pinned at (0, 0). scrollBy() and scrollTo() 516 * are overridden, so that View's mScrollX and mScrollY will be unchanged at 517 * (0, 0). This is critical for drawing ContentView correctly. 518 */ 519 @Override 520 public void scrollBy(int x, int y) { 521 mContentViewCore.scrollBy(x, y); 522 } 523 524 @Override 525 public void scrollTo(int x, int y) { 526 mContentViewCore.scrollTo(x, y); 527 } 528 529 @Override 530 protected int computeHorizontalScrollExtent() { 531 // TODO (dtrainor): Need to expose scroll events properly to public. Either make getScroll* 532 // work or expose computeHorizontalScrollOffset()/computeVerticalScrollOffset as public. 533 return mContentViewCore.computeHorizontalScrollExtent(); 534 } 535 536 @Override 537 protected int computeHorizontalScrollOffset() { 538 return mContentViewCore.computeHorizontalScrollOffset(); 539 } 540 541 @Override 542 protected int computeHorizontalScrollRange() { 543 return mContentViewCore.computeHorizontalScrollRange(); 544 } 545 546 @Override 547 protected int computeVerticalScrollExtent() { 548 return mContentViewCore.computeVerticalScrollExtent(); 549 } 550 551 @Override 552 protected int computeVerticalScrollOffset() { 553 return mContentViewCore.computeVerticalScrollOffset(); 554 } 555 556 @Override 557 protected int computeVerticalScrollRange() { 558 return mContentViewCore.computeVerticalScrollRange(); 559 } 560 561 // End FrameLayout overrides. 562 563 @Override 564 public boolean awakenScrollBars(int startDelay, boolean invalidate) { 565 return mContentViewCore.awakenScrollBars(startDelay, invalidate); 566 } 567 568 @Override 569 public boolean awakenScrollBars() { 570 return super.awakenScrollBars(); 571 } 572 573 public int getSingleTapX() { 574 return mContentViewCore.getContentViewGestureHandler().getSingleTapX(); 575 } 576 577 public int getSingleTapY() { 578 return mContentViewCore.getContentViewGestureHandler().getSingleTapY(); 579 } 580 581 @Override 582 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { 583 super.onInitializeAccessibilityNodeInfo(info); 584 mContentViewCore.onInitializeAccessibilityNodeInfo(info); 585 } 586 587 /** 588 * Fills in scrolling values for AccessibilityEvents. 589 * @param event Event being fired. 590 */ 591 @Override 592 public void onInitializeAccessibilityEvent(AccessibilityEvent event) { 593 super.onInitializeAccessibilityEvent(event); 594 mContentViewCore.onInitializeAccessibilityEvent(event); 595 } 596 597 @Override 598 protected void onAttachedToWindow() { 599 super.onAttachedToWindow(); 600 mContentViewCore.onAttachedToWindow(); 601 } 602 603 @Override 604 protected void onDetachedFromWindow() { 605 super.onDetachedFromWindow(); 606 mContentViewCore.onDetachedFromWindow(); 607 } 608 609 @Override 610 protected void onVisibilityChanged(View changedView, int visibility) { 611 super.onVisibilityChanged(changedView, visibility); 612 mContentViewCore.onVisibilityChanged(changedView, visibility); 613 } 614 615 /** 616 * Register the delegate to be used when content can not be handled by 617 * the rendering engine, and should be downloaded instead. This will replace 618 * the current delegate. 619 * @param delegate An implementation of ContentViewDownloadDelegate. 620 */ 621 public void setDownloadDelegate(ContentViewDownloadDelegate delegate) { 622 mContentViewCore.setDownloadDelegate(delegate); 623 } 624 625 // Called by DownloadController. 626 ContentViewDownloadDelegate getDownloadDelegate() { 627 return mContentViewCore.getDownloadDelegate(); 628 } 629 630 public boolean getUseDesktopUserAgent() { 631 return mContentViewCore.getUseDesktopUserAgent(); 632 } 633 634 /** 635 * Set whether or not we're using a desktop user agent for the currently loaded page. 636 * @param override If true, use a desktop user agent. Use a mobile one otherwise. 637 * @param reloadOnChange Reload the page if the UA has changed. 638 */ 639 public void setUseDesktopUserAgent(boolean override, boolean reloadOnChange) { 640 mContentViewCore.setUseDesktopUserAgent(override, reloadOnChange); 641 } 642 643 /** 644 * @return Whether the native ContentView has crashed. 645 */ 646 public boolean isCrashed() { 647 return mContentViewCore.isCrashed(); 648 } 649 650 /** 651 * @return Whether a reload happens when this ContentView is activated. 652 */ 653 public boolean needsReload() { 654 return mContentViewCore.needsReload(); 655 } 656 657 /** 658 * Checks whether the WebView can be zoomed in. 659 * 660 * @return True if the WebView can be zoomed in. 661 */ 662 // This method uses the term 'zoom' for legacy reasons, but relates 663 // to what chrome calls the 'page scale factor'. 664 public boolean canZoomIn() { 665 return mContentViewCore.canZoomIn(); 666 } 667 668 /** 669 * Checks whether the WebView can be zoomed out. 670 * 671 * @return True if the WebView can be zoomed out. 672 */ 673 // This method uses the term 'zoom' for legacy reasons, but relates 674 // to what chrome calls the 'page scale factor'. 675 public boolean canZoomOut() { 676 return mContentViewCore.canZoomOut(); 677 } 678 679 /** 680 * Zooms in the WebView by 25% (or less if that would result in zooming in 681 * more than possible). 682 * 683 * @return True if there was a zoom change, false otherwise. 684 */ 685 // This method uses the term 'zoom' for legacy reasons, but relates 686 // to what chrome calls the 'page scale factor'. 687 public boolean zoomIn() { 688 return mContentViewCore.zoomIn(); 689 } 690 691 /** 692 * Zooms out the WebView by 20% (or less if that would result in zooming out 693 * more than possible). 694 * 695 * @return True if there was a zoom change, false otherwise. 696 */ 697 // This method uses the term 'zoom' for legacy reasons, but relates 698 // to what chrome calls the 'page scale factor'. 699 public boolean zoomOut() { 700 return mContentViewCore.zoomOut(); 701 } 702 703 /** 704 * Resets the zoom factor of the WebView. 705 * 706 * @return True if there was a zoom change, false otherwise. 707 */ 708 // This method uses the term 'zoom' for legacy reasons, but relates 709 // to what chrome calls the 'page scale factor'. 710 public boolean zoomReset() { 711 return mContentViewCore.zoomReset(); 712 } 713 714 /** 715 * Return the current scale of the WebView 716 * @return The current scale. 717 */ 718 public float getScale() { 719 return mContentViewCore.getScale(); 720 } 721 722 /** 723 * If the view is ready to draw contents to the screen. In hardware mode, 724 * the initialization of the surface texture may not occur until after the 725 * view has been added to the layout. This method will return {@code true} 726 * once the texture is actually ready. 727 */ 728 public boolean isReady() { 729 return mContentViewCore.isReady(); 730 } 731 732 /** 733 * Returns whether or not accessibility injection is being used. 734 */ 735 public boolean isInjectingAccessibilityScript() { 736 return mContentViewCore.isInjectingAccessibilityScript(); 737 } 738 739 /** 740 * Enable or disable accessibility features. 741 */ 742 public void setAccessibilityState(boolean state) { 743 mContentViewCore.setAccessibilityState(state); 744 } 745 746 /** 747 * Stop any TTS notifications that are currently going on. 748 */ 749 public void stopCurrentAccessibilityNotifications() { 750 mContentViewCore.stopCurrentAccessibilityNotifications(); 751 } 752 753 /** 754 * Inform WebKit that Fullscreen mode has been exited by the user. 755 */ 756 public void exitFullscreen() { 757 mContentViewCore.exitFullscreen(); 758 } 759 760 /** 761 * Return content scroll y. 762 * 763 * @return The vertical scroll position in pixels. 764 */ 765 public int getContentScrollY() { 766 return mContentViewCore.computeVerticalScrollOffset(); 767 } 768 769 /** 770 * Return content height. 771 * 772 * @return The height of the content in pixels. 773 */ 774 public int getContentHeight() { 775 return mContentViewCore.computeVerticalScrollRange(); 776 } 777 778 /////////////////////////////////////////////////////////////////////////////////////////////// 779 // Start Implementation of ContentViewCore.InternalAccessDelegate // 780 /////////////////////////////////////////////////////////////////////////////////////////////// 781 782 @Override 783 public boolean super_onKeyUp(int keyCode, KeyEvent event) { 784 return super.onKeyUp(keyCode, event); 785 } 786 787 @Override 788 public boolean super_dispatchKeyEventPreIme(KeyEvent event) { 789 return super.dispatchKeyEventPreIme(event); 790 } 791 792 @Override 793 public boolean super_dispatchKeyEvent(KeyEvent event) { 794 return super.dispatchKeyEvent(event); 795 } 796 797 @Override 798 public boolean super_onGenericMotionEvent(MotionEvent event) { 799 return super.onGenericMotionEvent(event); 800 } 801 802 @Override 803 public void super_onConfigurationChanged(Configuration newConfig) { 804 super.onConfigurationChanged(newConfig); 805 } 806 807 @Override 808 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { 809 return super.awakenScrollBars(startDelay, invalidate); 810 } 811 812 /////////////////////////////////////////////////////////////////////////////////////////////// 813 // End Implementation of ContentViewCore.InternalAccessDelegate // 814 /////////////////////////////////////////////////////////////////////////////////////////////// 815} 816