1 /* 2 * Copyright 2006, The Android Open Source Project 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef WebViewCore_h 27 #define WebViewCore_h 28 29 #include "CacheBuilder.h" 30 #include "CachedHistory.h" 31 #include "DeviceMotionAndOrientationManager.h" 32 #include "DOMSelection.h" 33 #include "FileChooser.h" 34 #include "PictureSet.h" 35 #include "PlatformGraphicsContext.h" 36 #include "SkColor.h" 37 #include "SkTDArray.h" 38 #include "SkRegion.h" 39 #include "Timer.h" 40 #include "WebCoreRefObject.h" 41 #include "WebCoreJni.h" 42 #include "WebRequestContext.h" 43 #include "android_npapi.h" 44 45 #include <jni.h> 46 #include <ui/KeycodeLabels.h> 47 #include <ui/PixelFormat.h> 48 49 namespace WebCore { 50 class Color; 51 class FrameView; 52 class HTMLAnchorElement; 53 class HTMLElement; 54 class HTMLImageElement; 55 class HTMLSelectElement; 56 class RenderPart; 57 class RenderText; 58 class Node; 59 class PlatformKeyboardEvent; 60 class QualifiedName; 61 class RenderTextControl; 62 class ScrollView; 63 class TimerBase; 64 class PageGroup; 65 } 66 67 #if USE(ACCELERATED_COMPOSITING) 68 namespace WebCore { 69 class GraphicsLayerAndroid; 70 } 71 #endif 72 73 namespace WebCore { 74 class BaseLayerAndroid; 75 } 76 77 struct PluginWidgetAndroid; 78 class SkPicture; 79 class SkIRect; 80 81 namespace android { 82 83 enum Direction { 84 DIRECTION_BACKWARD = 0, 85 DIRECTION_FORWARD = 1 86 }; 87 88 enum NavigationAxis { 89 AXIS_CHARACTER = 0, 90 AXIS_WORD = 1, 91 AXIS_SENTENCE = 2, 92 AXIS_HEADING = 3, 93 AXIS_SIBLING = 4, 94 AXIS_PARENT_FIRST_CHILD = 5, 95 AXIS_DOCUMENT = 6 96 }; 97 98 class CachedFrame; 99 class CachedNode; 100 class CachedRoot; 101 class ListBoxReply; 102 103 class WebCoreReply : public WebCoreRefObject { 104 public: 105 virtual ~WebCoreReply() {} 106 107 virtual void replyInt(int value) { 108 SkDEBUGF(("WebCoreReply::replyInt(%d) not handled\n", value)); 109 } 110 111 virtual void replyIntArray(const int* array, int count) { 112 SkDEBUGF(("WebCoreReply::replyIntArray() not handled\n")); 113 } 114 // add more replyFoo signatures as needed 115 }; 116 117 // one instance of WebViewCore per page for calling into Java's WebViewCore 118 class WebViewCore : public WebCoreRefObject { 119 public: 120 /** 121 * Initialize the native WebViewCore with a JNI environment, a Java 122 * WebViewCore object and the main frame. 123 */ 124 WebViewCore(JNIEnv* env, jobject javaView, WebCore::Frame* mainframe); 125 ~WebViewCore(); 126 127 // helper function 128 static WebViewCore* getWebViewCore(const WebCore::FrameView* view); 129 static WebViewCore* getWebViewCore(const WebCore::ScrollView* view); 130 131 // Followings are called from native WebCore to Java 132 133 /** 134 * Notification that a form was blurred. Pass a message to hide the 135 * keyboard if it was showing for that Node. 136 * @param Node The Node that blurred. 137 */ 138 void formDidBlur(const WebCore::Node*); 139 void focusNodeChanged(const WebCore::Node*); 140 141 /** 142 * Scroll to an absolute position. 143 * @param x The x coordinate. 144 * @param y The y coordinate. 145 * @param animate If it is true, animate to the new scroll position 146 * 147 * This method calls Java to trigger a gradual scroll event. 148 */ 149 void scrollTo(int x, int y, bool animate = false); 150 151 /** 152 * Record the invalid rectangle 153 */ 154 void contentInvalidate(const WebCore::IntRect &rect); 155 void contentInvalidateAll(); 156 157 /** 158 * Satisfy any outstanding invalidates, so that the current state 159 * of the DOM is drawn. 160 */ 161 void contentDraw(); 162 163 /** 164 * copy the layers to the UI side 165 */ 166 void layersDraw(); 167 168 #if USE(ACCELERATED_COMPOSITING) 169 GraphicsLayerAndroid* graphicsRootLayer() const; 170 #endif 171 172 /** Invalidate the view/screen, NOT the content/DOM, but expressed in 173 * content/DOM coordinates (i.e. they need to eventually be scaled, 174 * by webview into view.java coordinates 175 */ 176 void viewInvalidate(const WebCore::IntRect& rect); 177 178 /** 179 * Invalidate part of the content that may be offscreen at the moment 180 */ 181 void offInvalidate(const WebCore::IntRect &rect); 182 183 /** 184 * Called by webcore when the progress indicator is done 185 * used to rebuild and display any changes in focus 186 */ 187 void notifyProgressFinished(); 188 189 /** 190 * Notify the view that WebCore did its first layout. 191 */ 192 void didFirstLayout(); 193 194 /** 195 * Notify the view to update the viewport. 196 */ 197 void updateViewport(); 198 199 /** 200 * Notify the view to restore the screen width, which in turn restores 201 * the scale. Also restore the scale for the text wrap. 202 */ 203 void restoreScale(float scale, float textWrapScale); 204 205 /** 206 * Tell the java side to update the focused textfield 207 * @param pointer Pointer to the node for the input field. 208 * @param changeToPassword If true, we are changing the textfield to 209 * a password field, and ignore the String 210 * @param text If changeToPassword is false, this is the new text that 211 * should go into the textfield. 212 */ 213 void updateTextfield(WebCore::Node* pointer, 214 bool changeToPassword, const WTF::String& text); 215 216 /** 217 * Tell the java side to update the current selection in the focused 218 * textfield to the WebTextView. This function finds the currently 219 * focused textinput, and passes its selection to java. 220 * If there is no focus, or it is not a text input, this does nothing. 221 */ 222 void updateTextSelection(); 223 224 void clearTextEntry(); 225 // JavaScript support 226 void jsAlert(const WTF::String& url, const WTF::String& text); 227 bool jsConfirm(const WTF::String& url, const WTF::String& text); 228 bool jsPrompt(const WTF::String& url, const WTF::String& message, 229 const WTF::String& defaultValue, WTF::String& result); 230 bool jsUnload(const WTF::String& url, const WTF::String& message); 231 bool jsInterrupt(); 232 233 /** 234 * Posts a message to the UI thread to inform the Java side that the 235 * origin has exceeded its database quota. 236 * @param url The URL of the page that caused the quota overflow 237 * @param databaseIdentifier the id of the database that caused the 238 * quota overflow. 239 * @param currentQuota The current quota for the origin 240 * @param estimatedSize The estimated size of the database 241 * @return Whether the message was successfully sent. 242 */ 243 bool exceededDatabaseQuota(const WTF::String& url, 244 const WTF::String& databaseIdentifier, 245 const unsigned long long currentQuota, 246 const unsigned long long estimatedSize); 247 248 /** 249 * Posts a message to the UI thread to inform the Java side that the 250 * appcache has exceeded its max size. 251 * @param spaceNeeded is the amount of disk space that would be needed 252 * in order for the last appcache operation to succeed. 253 * @return Whether the message was successfully sent. 254 */ 255 bool reachedMaxAppCacheSize(const unsigned long long spaceNeeded); 256 257 /** 258 * Set up the PageGroup's idea of which links have been visited, 259 * with the browser history. 260 * @param group the object to deliver the links to. 261 */ 262 void populateVisitedLinks(WebCore::PageGroup*); 263 264 /** 265 * Instruct the browser to show a Geolocation permission prompt for the 266 * specified origin. 267 * @param origin The origin of the frame requesting Geolocation 268 * permissions. 269 */ 270 void geolocationPermissionsShowPrompt(const WTF::String& origin); 271 /** 272 * Instruct the browser to hide the Geolocation permission prompt. 273 */ 274 void geolocationPermissionsHidePrompt(); 275 276 jobject getDeviceMotionService(); 277 jobject getDeviceOrientationService(); 278 279 void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID, int msgLevel); 280 281 /** 282 * Tell the Java side of the scrollbar mode 283 */ 284 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode); 285 286 // 287 // Followings support calls from Java to native WebCore 288 // 289 290 WTF::String retrieveHref(int x, int y); 291 WTF::String retrieveAnchorText(int x, int y); 292 WTF::String retrieveImageSource(int x, int y); 293 WTF::String requestLabel(WebCore::Frame* , WebCore::Node* ); 294 295 // If the focus is a textfield (<input>), textarea, or contentEditable, 296 // scroll the selection on screen (if necessary). 297 void revealSelection(); 298 // Create a single picture to represent the drawn DOM (used by navcache) 299 void recordPicture(SkPicture* picture); 300 301 void moveFocus(WebCore::Frame* frame, WebCore::Node* node); 302 void moveMouse(WebCore::Frame* frame, int x, int y); 303 void moveMouseIfLatest(int moveGeneration, 304 WebCore::Frame* frame, int x, int y); 305 306 // set the scroll amount that webview.java is currently showing 307 void setScrollOffset(int moveGeneration, bool sendScrollEvent, int dx, int dy); 308 309 void setGlobalBounds(int x, int y, int h, int v); 310 311 void setSizeScreenWidthAndScale(int width, int height, int screenWidth, 312 float scale, int realScreenWidth, int screenHeight, int anchorX, 313 int anchorY, bool ignoreHeight); 314 315 /** 316 * Handle key events from Java. 317 * @return Whether keyCode was handled by this class. 318 */ 319 bool key(const WebCore::PlatformKeyboardEvent& event); 320 321 /** 322 * Handle (trackball) click event / dpad center press from Java. 323 * Also used when typing into an unfocused textfield, in which case 'fake' 324 * will be true. 325 */ 326 void click(WebCore::Frame* frame, WebCore::Node* node, bool fake); 327 328 /** 329 * Handle touch event 330 */ 331 bool handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint>& points, int actionIndex, int metaState); 332 333 /** 334 * Handle motionUp event from the UI thread (called touchUp in the 335 * WebCore thread). 336 * @param touchGeneration Generation number for touches so we can ignore 337 * touches when a newer one has been generated. 338 * @param frame Pointer to Frame containing the node that was touched. 339 * @param node Pointer to Node that was touched. 340 * @param x x-position of the touch. 341 * @param y y-position of the touch. 342 */ 343 void touchUp(int touchGeneration, WebCore::Frame* frame, 344 WebCore::Node* node, int x, int y); 345 346 /** 347 * Sets the index of the label from a popup 348 */ 349 void popupReply(int index); 350 void popupReply(const int* array, int count); 351 352 /** 353 * Delete text from start to end in the focused textfield. 354 * If start == end, set the selection, but perform no deletion. 355 * If there is no focus, silently fail. 356 * If start and end are out of order, swap them. 357 */ 358 void deleteSelection(int start, int end, int textGeneration); 359 360 /** 361 * Set the selection of the currently focused textfield to (start, end). 362 * If start and end are out of order, swap them. 363 */ 364 void setSelection(int start, int end); 365 366 /** 367 * Modifies the current selection. 368 * 369 * Note: Accessibility support. 370 * 371 * direction - The direction in which to alter the selection. 372 * granularity - The granularity of the selection modification. 373 * 374 * returns - The selected HTML as a string. This is not a well formed 375 * HTML, rather the selection annotated with the tags of all 376 * intermediary elements it crosses. 377 */ 378 String modifySelection(const int direction, const int granularity); 379 380 /** 381 * Moves the selection to the given node in a given frame i.e. selects that node. 382 * 383 * Note: Accessibility support. 384 * 385 * frame - The frame in which to select is the node to be selected. 386 * node - The node to be selected. 387 * 388 * returns - The selected HTML as a string. This is not a well formed 389 * HTML, rather the selection annotated with the tags of all 390 * intermediary elements it crosses. 391 */ 392 String moveSelection(WebCore::Frame* frame, WebCore::Node* node); 393 394 /** 395 * In the currently focused textfield, replace the characters from oldStart to oldEnd 396 * (if oldStart == oldEnd, this will be an insert at that position) with replace, 397 * and set the selection to (start, end). 398 */ 399 void replaceTextfieldText(int oldStart, 400 int oldEnd, const WTF::String& replace, int start, int end, 401 int textGeneration); 402 void passToJs(int generation, 403 const WTF::String& , const WebCore::PlatformKeyboardEvent& ); 404 /** 405 * Scroll the focused textfield to (x, y) in document space 406 */ 407 void scrollFocusedTextInput(float x, int y); 408 /** 409 * Set the FocusController's active and focused states, so that 410 * the caret will draw (true) or not. 411 */ 412 void setFocusControllerActive(bool active); 413 414 void saveDocumentState(WebCore::Frame* frame); 415 416 void addVisitedLink(const UChar*, int); 417 418 // TODO: I don't like this hack but I need to access the java object in 419 // order to send it as a parameter to java 420 AutoJObject getJavaObject(); 421 422 // Return the parent WebView Java object associated with this 423 // WebViewCore. 424 jobject getWebViewJavaObject(); 425 426 void setBackgroundColor(SkColor c); 427 void updateFrameCache(); 428 void updateCacheOnNodeChange(); 429 void dumpDomTree(bool); 430 void dumpRenderTree(bool); 431 void dumpNavTree(); 432 433 /* We maintain a list of active plugins. The list is edited by the 434 pluginview itself. The list is used to service invals to the plugin 435 pageflipping bitmap. 436 */ 437 void addPlugin(PluginWidgetAndroid*); 438 void removePlugin(PluginWidgetAndroid*); 439 // returns true if the pluginwidgit is in our active list 440 bool isPlugin(PluginWidgetAndroid*) const; 441 void invalPlugin(PluginWidgetAndroid*); 442 void drawPlugins(); 443 444 // send the current screen size/zoom to all of the plugins in our list 445 void sendPluginVisibleScreen(); 446 447 // notify plugin that a new drawing surface was created in the UI thread 448 void sendPluginSurfaceReady(); 449 450 // send onLoad event to plugins who are descendents of the given frame 451 void notifyPluginsOnFrameLoad(const Frame*); 452 453 // gets a rect representing the current on-screen portion of the document 454 void getVisibleScreen(ANPRectI&); 455 456 // send this event to all of the plugins in our list 457 void sendPluginEvent(const ANPEvent&); 458 459 // lookup the plugin widget struct given an NPP 460 PluginWidgetAndroid* getPluginWidget(NPP npp); 461 462 // return the cursorNode if it is a plugin 463 Node* cursorNodeIsPlugin(); 464 465 // Notify the Java side whether it needs to pass down the touch events 466 void needTouchEvents(bool); 467 468 void requestKeyboardWithSelection(const WebCore::Node*, int selStart, int selEnd); 469 // Notify the Java side that webkit is requesting a keyboard 470 void requestKeyboard(bool showKeyboard); 471 472 // Generates a class loader that contains classes from the plugin's apk 473 jclass getPluginClass(const WTF::String& libName, const char* className); 474 475 // Creates a full screen surface for a plugin 476 void showFullScreenPlugin(jobject webkitPlugin, int32_t orientation, NPP npp); 477 478 // Instructs the UI thread to discard the plugin's full-screen surface 479 void hideFullScreenPlugin(); 480 481 // Creates a childView for the plugin but does not attach to the view hierarchy 482 jobject createSurface(jobject view); 483 484 // Adds the plugin's view (aka surface) to the view hierarchy 485 jobject addSurface(jobject view, int x, int y, int width, int height); 486 487 // Updates a Surface coordinates and dimensions for a plugin 488 void updateSurface(jobject childView, int x, int y, int width, int height); 489 490 // Destroys a SurfaceView for a plugin 491 void destroySurface(jobject childView); 492 493 // Returns the context (android.content.Context) of the WebView 494 jobject getContext(); 495 496 // Manages requests to keep the screen on while the WebView is visible 497 void keepScreenOn(bool screenOn); 498 499 bool validNodeAndBounds(Frame* , Node* , const IntRect& ); 500 501 // Make the rect (left, top, width, height) visible. If it can be fully 502 // fit, center it on the screen. Otherwise make sure the point specified 503 // by (left + xPercentInDoc * width, top + yPercentInDoc * height) 504 // pinned at the screen position (xPercentInView, yPercentInView). 505 void showRect(int left, int top, int width, int height, int contentWidth, 506 int contentHeight, float xPercentInDoc, float xPercentInView, 507 float yPercentInDoc, float yPercentInView); 508 509 // Scale the rect (x, y, width, height) to make it just fit and centered 510 // in the current view. 511 void centerFitRect(int x, int y, int width, int height); 512 513 // return a list of rects matching the touch point (x, y) with the slop 514 Vector<IntRect> getTouchHighlightRects(int x, int y, int slop); 515 516 // Open a file chooser for selecting a file to upload 517 void openFileChooser(PassRefPtr<WebCore::FileChooser> ); 518 519 // reset the picture set to empty 520 void clearContent(); 521 522 bool focusBoundsChanged(); 523 524 // record the inval area, and the picture size 525 BaseLayerAndroid* recordContent(SkRegion* , SkIPoint* ); 526 527 // This creates a new BaseLayerAndroid by copying the current m_content 528 // and doing a copy of the layers. The layers' content may be updated 529 // as we are calling layersSync(). 530 BaseLayerAndroid* createBaseLayer(SkRegion*); 531 bool updateLayers(LayerAndroid*); 532 void notifyAnimationStarted(); 533 534 int textWrapWidth() const { return m_textWrapWidth; } 535 float scale() const { return m_scale; } 536 float textWrapScale() const { return m_screenWidth * m_scale / m_textWrapWidth; } 537 WebCore::Frame* mainFrame() const { return m_mainFrame; } 538 void updateCursorBounds(const CachedRoot* root, 539 const CachedFrame* cachedFrame, const CachedNode* cachedNode); 540 void updateFrameCacheIfLoading(); 541 542 // utility to split slow parts of the picture set 543 void splitContent(PictureSet*); 544 545 void notifyWebAppCanBeInstalled(); 546 547 #if ENABLE(VIDEO) 548 void enterFullscreenForVideoLayer(int layerId, const WTF::String& url); 549 #endif 550 551 void setWebTextViewAutoFillable(int queryId, const string16& previewSummary); 552 553 DeviceMotionAndOrientationManager* deviceMotionAndOrientationManager() { return &m_deviceMotionAndOrientationManager; } 554 555 void listBoxRequest(WebCoreReply* reply, const uint16_t** labels, 556 size_t count, const int enabled[], size_t enabledCount, 557 bool multiple, const int selected[], size_t selectedCountOrSelection); 558 bool shouldPaintCaret() { return m_shouldPaintCaret; } 559 void setShouldPaintCaret(bool should) { m_shouldPaintCaret = should; } 560 bool isPaused() const { return m_isPaused; } 561 void setIsPaused(bool isPaused) { m_isPaused = isPaused; } 562 bool drawIsPaused() const; 563 // The actual content (without title bar) size in doc coordinate 564 int screenWidth() const { return m_screenWidth; } 565 int screenHeight() const { return m_screenHeight; } 566 #if USE(CHROME_NETWORK_STACK) 567 void setWebRequestContextUserAgent(); 568 void setWebRequestContextCacheMode(int mode); 569 WebRequestContext* webRequestContext(); 570 #endif 571 // Attempts to scroll the layer to the x,y coordinates of rect. The 572 // layer is the id of the LayerAndroid. 573 void scrollRenderLayer(int layer, const SkRect& rect); 574 // call only from webkit thread (like add/remove), return true if inst 575 // is still alive 576 static bool isInstance(WebViewCore*); 577 // if there exists at least one WebViewCore instance then we return the 578 // application context, otherwise NULL is returned. 579 static jobject getApplicationContext(); 580 // Check whether a media mimeType is supported in Android media framework. 581 static bool isSupportedMediaMimeType(const WTF::String& mimeType); 582 583 // these members are shared with webview.cpp 584 static Mutex gFrameCacheMutex; 585 CachedRoot* m_frameCacheKit; // nav data being built by webcore 586 SkPicture* m_navPictureKit; 587 int m_moveGeneration; // copy of state in WebViewNative triggered by move 588 int m_touchGeneration; // copy of state in WebViewNative triggered by touch 589 int m_lastGeneration; // last action using up to date cache 590 bool m_updatedFrameCache; 591 bool m_findIsUp; 592 bool m_hasCursorBounds; 593 WebCore::IntRect m_cursorBounds; 594 WebCore::IntRect m_cursorHitBounds; 595 void* m_cursorFrame; 596 IntPoint m_cursorLocation; 597 void* m_cursorNode; 598 static Mutex gCursorBoundsMutex; 599 // end of shared members 600 601 // internal functions 602 private: 603 CacheBuilder& cacheBuilder(); 604 WebCore::Node* currentFocus(); 605 // Create a set of pictures to represent the drawn DOM, driven by 606 // the invalidated region and the time required to draw (used to draw) 607 void recordPictureSet(PictureSet* master); 608 609 void doMaxScroll(CacheBuilder::Direction dir); 610 SkPicture* rebuildPicture(const SkIRect& inval); 611 void rebuildPictureSet(PictureSet* ); 612 void sendNotifyProgressFinished(); 613 /* 614 * Handle a mouse click, either from a touch or trackball press. 615 * @param frame Pointer to the Frame containing the node that was clicked on. 616 * @param node Pointer to the Node that was clicked on. 617 * @param fake This is a fake mouse click, used to put a textfield into focus. Do not 618 * open the IME. 619 */ 620 bool handleMouseClick(WebCore::Frame*, WebCore::Node*, bool fake); 621 WebCore::HTMLAnchorElement* retrieveAnchorElement(int x, int y); 622 WebCore::HTMLElement* retrieveElement(int x, int y, 623 const WebCore::QualifiedName& ); 624 WebCore::HTMLImageElement* retrieveImageElement(int x, int y); 625 // below are members responsible for accessibility support 626 String modifySelectionTextNavigationAxis(DOMSelection* selection, int direction, int granularity); 627 String modifySelectionDomNavigationAxis(DOMSelection* selection, int direction, int granularity); 628 Text* traverseNextContentTextNode(Node* fromNode, Node* toNode ,int direction); 629 bool isVisible(Node* node); 630 bool isHeading(Node* node); 631 String formatMarkup(DOMSelection* selection); 632 void selectAt(int x, int y); 633 634 void scrollNodeIntoView(Frame* frame, Node* node); 635 bool isContentTextNode(Node* node); 636 Node* getIntermediaryInputElement(Node* fromNode, Node* toNode, int direction); 637 bool isContentInputElement(Node* node); 638 bool isDescendantOf(Node* parent, Node* node); 639 void advanceAnchorNode(DOMSelection* selection, int direction, String& markup, bool ignoreFirstNode, ExceptionCode& ec); 640 Node* getNextAnchorNode(Node* anchorNode, bool skipFirstHack, int direction); 641 Node* getImplicitBoundaryNode(Node* node, unsigned offset, int direction); 642 643 // called from constructor, to add this to a global list 644 static void addInstance(WebViewCore*); 645 // called from destructor, to remove this from a global list 646 static void removeInstance(WebViewCore*); 647 648 friend class ListBoxReply; 649 struct JavaGlue; 650 struct JavaGlue* m_javaGlue; 651 WebCore::Frame* m_mainFrame; 652 WebCoreReply* m_popupReply; 653 WebCore::Node* m_lastFocused; 654 WebCore::IntRect m_lastFocusedBounds; 655 int m_blurringNodePointer; 656 int m_lastFocusedSelStart; 657 int m_lastFocusedSelEnd; 658 PictureSet m_content; // the set of pictures to draw 659 SkRegion m_addInval; // the accumulated inval region (not yet drawn) 660 SkRegion m_rebuildInval; // the accumulated region for rebuilt pictures 661 // Used in passToJS to avoid updating the UI text field until after the 662 // key event has been processed. 663 bool m_blockTextfieldUpdates; 664 bool m_focusBoundsChanged; 665 bool m_skipContentDraw; 666 // Passed in with key events to know when they were generated. Store it 667 // with the cache so that we can ignore stale text changes. 668 int m_textGeneration; 669 CachedRoot* m_temp; 670 SkPicture* m_tempPict; 671 int m_maxXScroll; 672 int m_maxYScroll; 673 int m_scrollOffsetX; // webview.java's current scroll in X 674 int m_scrollOffsetY; // webview.java's current scroll in Y 675 WebCore::IntPoint m_mousePos; 676 bool m_frameCacheOutOfDate; 677 bool m_progressDone; 678 CachedHistory m_history; 679 int m_screenWidth; // width of the visible rect in document coordinates 680 int m_screenHeight;// height of the visible rect in document coordinates 681 int m_textWrapWidth; 682 float m_scale; 683 unsigned m_domtree_version; 684 bool m_check_domtree_version; 685 PageGroup* m_groupForVisitedLinks; 686 bool m_isPaused; 687 int m_cacheMode; 688 bool m_shouldPaintCaret; 689 690 SkTDArray<PluginWidgetAndroid*> m_plugins; 691 WebCore::Timer<WebViewCore> m_pluginInvalTimer; 692 void pluginInvalTimerFired(WebCore::Timer<WebViewCore>*) { 693 this->drawPlugins(); 694 } 695 696 int m_screenOnCounter; 697 Node* m_currentNodeDomNavigationAxis; 698 DeviceMotionAndOrientationManager m_deviceMotionAndOrientationManager; 699 700 #if ENABLE(TOUCH_EVENTS) 701 bool m_forwardingTouchEvents; 702 #endif 703 704 #if USE(CHROME_NETWORK_STACK) 705 scoped_refptr<WebRequestContext> m_webRequestContext; 706 #endif 707 708 }; 709 710 } // namespace android 711 712 #endif // WebViewCore_h 713