15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/* 25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2009 Google Inc. All rights reserved. 35267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 45267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * modification, are permitted provided that the following conditions are 65267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * met: 75267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 85267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Redistributions of source code must retain the above copyright 95267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * notice, this list of conditions and the following disclaimer. 105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Redistributions in binary form must reproduce the above 115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * in the documentation and/or other materials provided with the 135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * distribution. 145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * contributors may be used to endorse or promote products derived from 165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * this software without specific prior written permission. 175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * 185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) */ 305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#ifndef WebWidget_h 325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebWidget_h 335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebCanvas.h" 355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebCommon.h" 367242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#include "../platform/WebPoint.h" 375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebRect.h" 385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebSize.h" 39c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)#include "WebBeginFrameArgs.h" 405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebCompositionUnderline.h" 415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebTextDirection.h" 425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebTextInputInfo.h" 435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 4451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink { 455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 46f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liuclass WebCompositeAndReadbackAsyncCallback; 475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebInputEvent; 485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebLayerTreeView; 495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebMouseEvent; 507242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciclass WebPagePopup; 515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebString; 527242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciclass WebWidgetClient; 535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPoint; 545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebRenderingStats; 555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)template <typename T> class WebVector; 565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebWidget { 585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)public: 595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // This method closes and deletes the WebWidget. 605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void close() { } 615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the current size of the WebWidget. 635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual WebSize size() { return WebSize(); } 645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Used to group a series of resize events. For example, if the user 665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // drags a resizer then willStartLiveResize will be called, followed by a 675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // sequence of resize events, ending with willEndLiveResize when the user 685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // lets go of the resizer. 695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void willStartLiveResize() { } 705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to resize the WebWidget. 725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void resize(const WebSize&) { } 735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 7410f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch // Resizes the unscaled pinch viewport. Normally the unscaled pinch 7510f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch // viewport is the same size as the main frame. The passed size becomes the 7610f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch // size of the viewport when unscaled (i.e. scale = 1). This is used to 7710f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch // shrink the visible viewport to allow things like the ChromeOS virtual 7810f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch // keyboard to overlay over content but allow scrolling it into view. 7910f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch virtual void resizePinchViewport(const WebSize&) { } 8010f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch 815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Ends a group of resize events that was started with a call to 825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // willStartLiveResize. 835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void willEndLiveResize() { } 845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to notify the WebWidget of entering/exiting fullscreen mode. The 865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // resize method may be called between will{Enter,Exit}FullScreen and 875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // did{Enter,Exit}FullScreen. 885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void willEnterFullScreen() { } 895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didEnterFullScreen() { } 905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void willExitFullScreen() { } 915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didExitFullScreen() { } 925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to update imperative animation state. This should be called before 945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // paint, although the client can rate-limit these calls. 95c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) // FIXME: Remove this function once Chrome side patch lands. 96c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) void animate(double monotonicFrameBeginTime) 97c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) { 98c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) beginFrame(WebBeginFrameArgs(monotonicFrameBeginTime)); 99c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) } 100c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) virtual void beginFrame(const WebBeginFrameArgs& frameTime) { } 1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1027242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // Called to notify that a previously begun frame was finished and 1037242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // committed to the compositor. This is used to schedule lower priority 1047242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // work after tasks such as input processing and painting. 1057242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual void didCommitFrameToCompositor() { } 1067242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 1075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to layout the WebWidget. This MUST be called before Paint, 1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // and it may result in calls to WebWidgetClient::didInvalidateRect. 1095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void layout() { } 1105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to paint the rectangular region within the WebWidget 1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // onto the specified canvas at (viewPort.x,viewPort.y). You MUST call 1135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Layout before calling this method. It is okay to call paint 1145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // multiple times once layout has been called, assuming no other 1155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // changes are made to the WebWidget (e.g., once events are 1165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // processed, it should be assumed that another call to layout is 1175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // warranted before painting again). 118d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) virtual void paint(WebCanvas*, const WebRect& viewPort) { } 1195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 120323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) virtual void paintCompositedDeprecated(WebCanvas*, const WebRect&) { } 121323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) 122f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu // The caller is responsible for keeping the WebCompositeAndReadbackAsyncCallback 123323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) // object alive until it is called. This should only be called when 124323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) // isAcceleratedCompositingActive() is true. 125323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles) virtual void compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback*) { } 126f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu 1275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if we've started tracking repaint rectangles. 1285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool isTrackingRepaints() const { return false; } 1295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Indicates that the compositing surface associated with this WebWidget is 1315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // ready to use. 1325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setCompositorSurfaceReady() { } 1335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget of a change in theme. 1355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Implementors that cache rendered copies of widgets need to re-render 1365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // on receiving this message 1375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void themeChanged() { } 1385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget of an input event. Returns true if 1405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // the event has been processed, false otherwise. 1415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool handleInputEvent(const WebInputEvent&) { return false; } 1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget of the mouse cursor's visibility. 1445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setCursorVisibilityState(bool isVisible) { } 1455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Check whether the given point hits any registered touch event handlers. 1475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool hasTouchEventHandlersAt(const WebPoint&) { return true; } 1485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1497242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // Applies viewport related properties during a commit from the compositor 1507242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // thread. 1517242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual void applyViewportDeltas( 1527242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci const WebSize& scrollDelta, 1537242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci float scaleFactor, 1547242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci float topControlsDelta) { } 1557242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 1567242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // Applies viewport related properties during a commit from the compositor 1577242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // thread. 1587242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual void applyViewportDeltas( 1597242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci const WebSize& pinchViewportDelta, 1607242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci const WebSize& mainFrameDelta, 1617242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci float scaleFactor, 1627242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci float topControlsDelta) { } 1635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget that mouse capture was lost. 1655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void mouseCaptureLost() { } 1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget that it has gained or lost keyboard focus. 1685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setFocus(bool) { } 1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget of a new composition text. 1715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // If selectionStart and selectionEnd has the same value, then it indicates 1725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // the input caret position. If the text is empty, then the existing 1735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // composition text will be cancelled. 1745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if the composition text was set successfully. 1755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool setComposition( 1765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) const WebString& text, 1775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) const WebVector<WebCompositionUnderline>& underlines, 1785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) int selectionStart, 1795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) int selectionEnd) { return false; } 1805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 181591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch enum ConfirmCompositionBehavior { 182591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch DoNotKeepSelection, 183591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch KeepSelection, 184591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch }; 185591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 1865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget to confirm an ongoing composition. 1875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // This method is same as confirmComposition(WebString()); 1885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if there is an ongoing composition. 189591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch virtual bool confirmComposition() { return false; } // Deprecated 190591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior) { return false; } 1915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 1925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Called to inform the WebWidget to confirm an ongoing composition with a 1935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // new composition text. If the text is empty then the current composition 1945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // text is confirmed. If there is no ongoing composition, then deletes the 1955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // current selection and inserts the text. This method has no effect if 1965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // there is no ongoing composition and the text is empty. 1975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if there is an ongoing composition or the text is inserted. 1985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool confirmComposition(const WebString& text) { return false; } 1995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Fetches the character range of the current composition, also called the 2015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // "marked range." Returns true and fills the out-paramters on success; 2025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // returns false on failure. 2035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool compositionRange(size_t* location, size_t* length) { return false; } 2045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns information about the current text input of this WebWidget. 2065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual WebTextInputInfo textInputInfo() { return WebTextInputInfo(); } 2075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the anchor and focus bounds of the current selection. 2095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // If the selection range is empty, it returns the caret bounds. 2105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool selectionBounds(WebRect& anchor, WebRect& focus) const { return false; } 2115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 21219cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) // Called to notify that IME candidate window has changed its visibility or 21319cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) // its appearance. These calls correspond to trigger 21419cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) // candidatewindow{show,update,hide} events defined in W3C IME API. 21519cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) virtual void didShowCandidateWindow() { } 21619cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) virtual void didUpdateCandidateWindow() { } 21719cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) virtual void didHideCandidateWindow() { } 21819cde67944066db31e633d9e386f2aa9bf9fadb3Torne (Richard Coles) 2195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns the text direction at the start and end bounds of the current selection. 2205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // If the selection range is empty, it returns false. 2215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const { return false; } 2225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if the selection range is nonempty and its anchor is first 2245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // (i.e its anchor is its start). 2255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool isSelectionAnchorFirst() const { return false; } 2265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Fetch the current selection range of this WebWidget. If there is no 2285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // selection, it will output a 0-length range with the location at the 2295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // caret. Returns true and fills the out-paramters on success; returns false 2305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // on failure. 2315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool caretOrSelectionRange(size_t* location, size_t* length) { return false; } 2325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Changes the text direction of the selected input node. 2345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void setTextDirection(WebTextDirection) { } 2355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Returns true if the WebWidget uses GPU accelerated compositing 2375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // to render its contents. 2385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual bool isAcceleratedCompositingActive() const { return false; } 2395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2401e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) // Returns true if the WebWidget created is of type WebPagePopup. 2411e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) virtual bool isPagePopup() const { return false; } 2421e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) // Returns true if the WebWidget created is of type WebPopupMenu. 2431e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) virtual bool isPopupMenu() const { return false; } 2441e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 2455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // The WebLayerTreeView initialized on this WebWidgetClient will be going away and 2465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // is no longer safe to access. 2475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void willCloseLayerTreeView() { } 2485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Calling WebWidgetClient::requestPointerLock() will result in one 2505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // return call to didAcquirePointerLock() or didNotAcquirePointerLock(). 2515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didAcquirePointerLock() { } 2525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didNotAcquirePointerLock() { } 2535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Pointer lock was held, but has been lost. This may be due to a 2555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // request via WebWidgetClient::requestPointerUnlock(), or for other 2565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // reasons such as the user exiting lock, window focus changing, etc. 2575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didLosePointerLock() { } 2585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // Informs the WebWidget that the resizer rect changed. Happens for example 2605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // on mac, when a widget appears below the WebWidget without changing the 2615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // WebWidget's size (WebWidget::resize() automatically checks the resizer 2625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // rect.) 2635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void didChangeWindowResizerRect() { } 2645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // The page background color. Can be used for filling in areas without 2665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) // content. 2675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual WebColor backgroundColor() const { return 0xFFFFFFFF; /* SK_ColorWHITE */ } 2685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2697242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // The currently open page popup, which are calendar and datalist pickers 2707242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // but not the select popup. 2717242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual WebPagePopup* pagePopup() const { return 0; } 2727242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 2737242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // Sets the height subtracted from the Widget to accomodate the top controls. 2747242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual void setTopControlsLayoutHeight(float) { } 2757242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 2765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)protected: 2775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) ~WebWidget() { } 2785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)}; 2795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 28051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink 2815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) 2825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif 283