15267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)/*
25267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) * Copyright (C) 2009, 2010, 2011, 2012 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 WebView_h
325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#define WebView_h
335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3402772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch#include "../platform/WebColor.h"
355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebString.h"
365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "../platform/WebVector.h"
375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebDragOperation.h"
38aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch#include "WebHistoryCommitType.h"
39aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch#include "WebHistoryItem.h"
405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebPageVisibilityState.h"
415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#include "WebWidget.h"
425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink {
445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
458abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)class WebAXObject;
465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebAutofillClient;
479e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)class WebCredentialManagerClient;
485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDevToolsAgent;
495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDevToolsAgentClient;
505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebDragData;
515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFrame;
525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebFrameClient;
535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebGraphicsContext3D;
545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebHitTestResult;
555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebNode;
565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebPageOverlay;
575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebPrerendererClient;
585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebRange;
595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSettings;
605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebSpellCheckClient;
615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebString;
625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebViewClient;
635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebActiveWheelFlingParameters;
645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebMediaPlayerAction;
655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPluginAction;
665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)struct WebPoint;
6710f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdochstruct WebFloatPoint;
6802772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdochstruct WebWindowFeatures;
695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)class WebView : public WebWidget {
715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)public:
7206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static const double textSizeMultiplierRatio;
7306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static const double minTextSizeMultiplier;
7406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static const double maxTextSizeMultiplier;
7506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static const float minPageScaleFactor;
7606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static const float maxPageScaleFactor;
775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
781e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    enum StyleInjectionTarget {
791e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        InjectStyleInAllFrames,
801e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)        InjectStyleInTopFrameOnly
815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    };
825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Initialization ------------------------------------------------------
855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
861e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // Creates a WebView that is NOT yet initialized. You will need to
871e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // call setMainFrame to finish the initialization. It is valid
881e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // to pass a null client pointer.
8906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static WebView* create(WebViewClient*);
905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // After creating a WebView, you should immediately call this method.
925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // You can optionally modify the settings before calling this method.
931e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // This WebFrame will receive events for the main frame and must not
941e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // be null.
951e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void setMainFrame(WebFrame*) = 0;
965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Initializes the various client interfaces.
985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setAutofillClient(WebAutofillClient*) = 0;
999e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    virtual void setCredentialManagerClient(WebCredentialManagerClient*) = 0;
1005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setDevToolsAgentClient(WebDevToolsAgentClient*) = 0;
1015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setPrerendererClient(WebPrerendererClient*) = 0;
1025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setSpellCheckClient(WebSpellCheckClient*) = 0;
1035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Options -------------------------------------------------------------
1055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The returned pointer is valid for the lifetime of the WebView.
1075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSettings* settings() = 0;
1085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Corresponds to the encoding of the main frame.  Setting the page
1105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // encoding may cause the main frame to reload.
1115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebString pageEncoding() const = 0;
1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setPageEncoding(const WebString&) = 0;
1135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Makes the WebView transparent.  This is useful if you want to have
1155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // some custom background rendered behind it.
1165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isTransparent() const = 0;
1175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setIsTransparent(bool) = 0;
1185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
11902772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // Sets the base color used for this WebView's background. This is in effect
12002772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // the default background color used for pages with no background-color
12102772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // style in effect, or used as the alpha-blended basis for any pages with
12202772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // translucent background-color style. (For pages with opaque
12302772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // background-color style, this property is effectively ignored).
12402772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // Setting this takes effect for the currently loaded page, if any, and
12502772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // persists across subsequent navigations. Defaults to white prior to the
12602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // first call to this method.
12702772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    virtual void setBaseBackgroundColor(WebColor) = 0;
12802772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch
1295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Controls whether pressing Tab key advances focus to links.
1305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool tabsToLinks() const = 0;
1315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setTabsToLinks(bool) = 0;
1325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Method that controls whether pressing Tab key cycles through page
1345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // elements or inserts a '\t' char in the focused text area.
1355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool tabKeyCyclesThroughElements() const = 0;
1365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setTabKeyCyclesThroughElements(bool) = 0;
1375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Controls the WebView's active state, which may affect the rendering
1395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // of elements on the page (i.e., tinting of input elements).
1405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual bool isActive() const = 0;
1415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setIsActive(bool) = 0;
1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Allows disabling domain relaxation.
1445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) = 0;
1455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
14602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // Allows setting the state of the various bars exposed via BarProp
14702772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // properties on the window object. The size related fields of
14802772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    // WebWindowFeatures are ignored.
14902772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch    virtual void setWindowFeatures(const WebWindowFeatures&) = 0;
15002772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch
151a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    // Marks the WebView as being opened by a DOM call. This is relevant
152a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    // for whether window.close() may be called.
153a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch    virtual void setOpenedByDOM() = 0;
154a9984bf9ddc3cf73fdae3f29134a2bab379e7029Ben Murdoch
1555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Frames --------------------------------------------------------------
1575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebFrame* mainFrame() = 0;
1595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the frame identified by the given name.  This method
1615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // supports pseudo-names like _self, _top, and _blank.  It traverses
1625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the entire frame tree containing this tree looking for a frame that
1635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // matches the given name.  If the optional relativeToFrame parameter
1645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // is specified, then the search begins with the given frame and its
1655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // children.
1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebFrame* findFrameByName(
1675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebString& name, WebFrame* relativeToFrame = 0) = 0;
1685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Focus ---------------------------------------------------------------
1715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebFrame* focusedFrame() = 0;
1735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setFocusedFrame(WebFrame*) = 0;
1745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Focus the first (last if reverse is true) focusable node.
1765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setInitialFocus(bool reverse) = 0;
1775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
178d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // Clears the focused element (and selection if a text field is focused)
1795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to ensure that a text field on the page is not eating keystrokes we
1805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // send it.
181d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    virtual void clearFocusedElement() = 0;
1825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Scrolls the node currently in focus into |rect|, where |rect| is in
1845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // window space.
1855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void scrollFocusedNodeIntoRect(const WebRect&) { }
1865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Advance the focus of the WebView forward to the next element or to the
1885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // previous element in the tab sequence (if reverse is true).
1895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void advanceFocus(bool reverse) { }
1905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
1915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Animate a scale into the specified find-in-page rect.
1925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void zoomToFindInPageRect(const WebRect&) = 0;
1935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
194f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    // Animate a scale into the specified rect where multiple targets were
195f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    // found from previous tap gesture.
196f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    // Returns false if it doesn't do any zooming.
197f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)    virtual bool zoomToMultipleTargetsRect(const WebRect&) = 0;
198f5e4ad553afbc08dd2e729bb77e937a9a94d5827Torne (Richard Coles)
1995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Zoom ----------------------------------------------------------------
2015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the current zoom level.  0 is "original size", and each increment
2035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // above or below represents zooming 20% larger or smaller to default limits
2045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // of 300% and 50% of original size, respectively.  Only plugins use
2055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // non whole-numbers, since they might choose to have specific zoom level so
2065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // that fixed-width content is fit-to-page-width, for example.
2075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual double zoomLevel() = 0;
2085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Changes the zoom level to the specified level, clamping at the limits
2105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // noted above, and returns the current zoom level after applying the
2115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // change.
2128abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    virtual double setZoomLevel(double) = 0;
2138abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)
2145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Updates the zoom limits for this view.
2155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void zoomLimitsChanged(double minimumZoomLevel,
2165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                   double maximumZoomLevel) = 0;
2175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Helper functions to convert between zoom level and zoom factor.  zoom
2195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // factor is zoom percent / 100, so 300% = 3.0.
22006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static double zoomLevelToZoomFactor(double zoomLevel);
22106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static double zoomFactorToZoomLevel(double factor);
2225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2238abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    // Returns the current text zoom factor, where 1.0 is the normal size, > 1.0
2248abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    // is scaled up and < 1.0 is scaled down.
2258abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    virtual float textZoomFactor() = 0;
2268abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)
2278abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    // Scales the text in the page by a factor of textZoomFactor.
2288abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    // Note: this has no effect on plugins.
2298abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    virtual float setTextZoomFactor(float) = 0;
2308abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)
2315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the initial page scale to the given factor. This scale setting overrides
2325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // page scale set in the page's viewport meta tag.
2335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setInitialPageScaleOverride(float) = 0;
2345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Gets the scale factor of the page, where 1.0 is the normal size, > 1.0
2365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // is scaled up, < 1.0 is scaled down.
2375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float pageScaleFactor() const = 0;
2385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
23910f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // TODO: Obsolete, the origin parameter is ambiguous with two viewports. Remove
24010f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // once Chromium side users are removed.
2415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Scales a page by a factor of scaleFactor and then sets a scroll position to (x, y).
2425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // setPageScaleFactor() magnifies and shrinks a page without affecting layout.
2435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // On the other hand, zooming affects layout of the page.
2445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) = 0;
2455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
24610f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // TODO: Reevaluate if this is needed once all users are converted to using the
24710f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // virtual viewport pinch model.
24810f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // Temporary to keep old style pinch viewport working while we gradually bring up
24910f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // virtual viewport pinch.
25010f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual void setMainFrameScrollOffset(const WebPoint& origin) = 0;
25110f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch
25210f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // Scales the page without affecting layout by using the pinch-to-zoom viewport.
25310f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual void setPageScaleFactor(float) = 0;
25410f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch
25510f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // Sets the offset of the pinch-to-zoom viewport within the main frame, in
25610f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // partial CSS pixels. The offset will be clamped so the pinch viewport
25710f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // stays within the frame's bounds.
25810f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual void setPinchViewportOffset(const WebFloatPoint&) = 0;
25910f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch
26010f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // Gets the pinch viewport's current offset within the page's main frame,
26110f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    // in partial CSS pixels.
26210f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch    virtual WebFloatPoint pinchViewportOffset() const = 0;
26310f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch
2645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // PageScaleFactor will be force-clamped between minPageScale and maxPageScale
2655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // (and these values will persist until setPageScaleFactorLimits is called
2665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // again).
2675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale) = 0;
2685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float minimumPageScaleFactor() const = 0;
2705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float maximumPageScaleFactor() const = 0;
2715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Reset any saved values for the scroll and scale state.
2735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void resetScrollAndScaleState() = 0;
2745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Prevent the web page from setting min/max scale via the viewport meta
2765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // tag. This is an accessibility feature that lets folks zoom in to web
2775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // pages even if the web page tries to block scaling.
2785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setIgnoreViewportTagScaleLimits(bool) = 0;
2795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the "preferred" contents size, defined as the preferred minimum width of the main document's contents
2815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // and the minimum height required to display the main document without scrollbars.
2825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The returned size has the page zoom factor applied.
2835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebSize contentsPreferredMinimumSize() = 0;
2845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The ratio of the current device's screen DPI to the target device's screen DPI.
2865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual float deviceScaleFactor() const = 0;
2875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the ratio as computed by computePageScaleConstraints.
2895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setDeviceScaleFactor(float) = 0;
2905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2917242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // Set and reset the device color profile.
2927242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual void setDeviceColorProfile(const WebVector<char>&) = 0;
2937242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    virtual void resetDeviceColorProfile() = 0;
2945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Auto-Resize -----------------------------------------------------------
2965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
2975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // In auto-resize mode, the view is automatically adjusted to fit the html
2985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // content within the given bounds.
2995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void enableAutoResizeMode(
3005267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebSize& minSize,
3015267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebSize& maxSize) = 0;
3025267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3035267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Turn off auto-resize.
3045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void disableAutoResizeMode() = 0;
3055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Media ---------------------------------------------------------------
3075267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Performs the specified media player action on the node at the given location.
3095267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void performMediaPlayerAction(
3105267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebMediaPlayerAction&, const WebPoint& location) = 0;
3115267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Performs the specified plugin action on the node at the given location.
3135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void performPluginAction(
3145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebPluginAction&, const WebPoint& location) = 0;
3155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Data exchange -------------------------------------------------------
3185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Do a hit test at given point and return the HitTestResult.
3205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebHitTestResult hitTestResultAt(const WebPoint&) = 0;
3215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Copy to the clipboard the image located at a particular point in the
3235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // WebView (if there is such an image)
3245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void copyImageAt(const WebPoint&) = 0;
3255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
326323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    // Save as the image located at a particular point in the
327323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    // WebView (if there is such an image)
328323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)    virtual void saveImageAt(const WebPoint&) = 0;
329323480423219ecd77329f8326dc5e0e3b50926d4Torne (Richard Coles)
3305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notifies the WebView that a drag has terminated.
3315267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dragSourceEndedAt(
3325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebPoint& clientPoint, const WebPoint& screenPoint,
3335267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebDragOperation operation) = 0;
3345267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Notfies the WebView that the system drag and drop operation has ended.
3365267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dragSourceSystemDragEnded() = 0;
3375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Callback methods when a drag-and-drop operation is trying to drop
3395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // something on the WebView.
3405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDragOperation dragTargetDragEnter(
3415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebDragData&,
3425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebPoint& clientPoint, const WebPoint& screenPoint,
3435267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebDragOperationsMask operationsAllowed,
3445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int keyModifiers) = 0;
3455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDragOperation dragTargetDragOver(
3465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebPoint& clientPoint, const WebPoint& screenPoint,
3475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        WebDragOperationsMask operationsAllowed,
3485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int keyModifiers) = 0;
3495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dragTargetDragLeave() = 0;
3505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void dragTargetDrop(
3515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        const WebPoint& clientPoint, const WebPoint& screenPoint,
3525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        int keyModifiers) = 0;
3535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Retrieves a list of spelling markers.
3555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void spellingMarkers(WebVector<uint32_t>* markers) = 0;
3569e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& words) = 0;
3575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3585267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Support for resource loading initiated by plugins -------------------
3595267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3605267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns next unused request identifier which is unique within the
3615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // parent Page.
3625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual unsigned long createUniqueIdentifierForRequest() = 0;
3635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Developer tools -----------------------------------------------------
3665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Inspect a particular point in the WebView.  (x = -1 || y = -1) is a
3685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // special case, meaning inspect the current page and not a specific
3695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // point.
3705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void inspectElementAt(const WebPoint&) = 0;
3715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3721e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // Set an override of device scale factor passed from WebView to
3731e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // compositor. Pass zero to cancel override. This is used to implement
3741e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // device metrics emulation.
3751e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    virtual void setCompositorDeviceScaleFactorOverride(float) = 0;
3761e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)
37751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // Set offset and scale on the root composited layer. This is used
3781e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // to implement device metrics emulation.
37951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    virtual void setRootLayerTransform(const WebSize& offset, float scale) = 0;
3801e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)
3815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // The embedder may optionally engage a WebDevToolsAgent.  This may only
3825267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // be set once per WebView.
3835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual WebDevToolsAgent* devToolsAgent() = 0;
3845267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3855267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Accessibility -------------------------------------------------------
3875267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Returns the accessibility object for this view.
3898abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles)    virtual WebAXObject accessibilityObject() = 0;
3905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Context menu --------------------------------------------------------
3935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void performCustomContextMenuAction(unsigned action) = 0;
3955267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Shows a context menu for the currently focused element.
3975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void showContextMenu() = 0;
3985267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
3995267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
40009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // SmartClip support ---------------------------------------------------
401197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void extractSmartClipData(WebRect initRect, WebString& text, WebString& html, WebRect& resultRect) = 0;
40209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
40309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
4045267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Popup menu ----------------------------------------------------------
4055267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4065267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets whether select popup menus should be rendered by the browser.
40706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static void setUseExternalPopupMenus(bool);
4085267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
40909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Hides any popup (suggestions, selects...) that might be showing.
41009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void hidePopups() = 0;
41109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
4125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Visited link state --------------------------------------------------
4145267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4155267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Tells all WebView instances to update the visited link state for the
4165267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // specified hash.
41706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static void updateVisitedLinkState(unsigned long long hash);
4185267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4195267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Tells all WebView instances to update the visited state for all
4205267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // their links.
42106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static void resetVisitedLinkState();
4225267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4235267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Custom colors -------------------------------------------------------
4255267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4265267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setSelectionColors(unsigned activeBackgroundColor,
4275267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    unsigned activeForegroundColor,
4285267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    unsigned inactiveBackgroundColor,
4295267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    unsigned inactiveForegroundColor) = 0;
4305267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4311e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // Injected style ------------------------------------------------------
4321e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)
4331e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // Treats |sourceCode| as a CSS author style sheet and injects it into all Documents whose URLs match |patterns|,
4341e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    // in the frames specified by the last argument.
4351e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    BLINK_EXPORT static void injectStyleSheet(const WebString& sourceCode, const WebVector<WebString>& patterns, StyleInjectionTarget);
4361e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)    BLINK_EXPORT static void removeInjectedStyleSheets();
4375267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4385267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Modal dialog support ------------------------------------------------
4395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4405267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Call these methods before and after running a nested, modal event loop
4415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // to suspend script callbacks and resource loads.
44206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static void willEnterModalLoop();
44306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)    BLINK_EXPORT static void didExitModalLoop();
4445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4455267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Called to inform the WebView that a wheel fling animation was started externally (for instance
4465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // by the compositor) but must be completed by the WebView.
4475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&) = 0;
4485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
44951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    // Cancels an active fling, returning true if a fling was active.
45051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)    virtual bool endActiveFlingAnimation() = 0;
45151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)
4525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setShowPaintRects(bool) = 0;
4535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setShowFPSCounter(bool) = 0;
4545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setContinuousPaintingEnabled(bool) = 0;
455591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch    virtual void setShowScrollBottleneckRects(bool) = 0;
4565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
457d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // Compute the bounds of the root element of the current selection and fills
458d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // the out-parameter on success. |bounds| coordinates will be relative to
459d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    // the contents window and will take into account the current scale level.
460d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    virtual void getSelectionRootBounds(WebRect& bounds) const = 0;
461d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
4625267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Visibility -----------------------------------------------------------
4635267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4645267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Sets the visibility of the WebView.
4655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void setVisibilityState(WebPageVisibilityState visibilityState,
4665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)                                    bool isInitialState) { }
4675267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // PageOverlay ----------------------------------------------------------
4695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Adds/removes page overlay to this WebView. These functions change the
4715267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // graphical appearance of the WebView. WebPageOverlay paints the
4725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // contents of the page overlay. It also provides an z-order number for
4735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the page overlay. The z-order number defines the paint order the page
4745267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // overlays. Page overlays with larger z-order number will be painted after
4755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // page overlays with smaller z-order number. That is, they appear above
4765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the page overlays with smaller z-order number. If two page overlays have
4775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // the same z-order number, the later added one will be on top.
4785267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void addPageOverlay(WebPageOverlay*, int /*z-order*/) = 0;
4795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void removePageOverlay(WebPageOverlay*) = 0;
4805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
481aafa69cb17c9d6606c07663ade5f81388a2c5986Ben Murdoch
482d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // i18n -----------------------------------------------------------------
483d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
484d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // Inform the WebView that the accept languages have changed.
485d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // If the WebView wants to get the accept languages value, it will have
486d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    // to call the WebViewClient::acceptLanguages().
487d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    virtual void acceptLanguagesChanged() = 0;
488d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
4895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    // Testing functionality for TestRunner ---------------------------------
4905267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4915267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)protected:
4925267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    ~WebView() {}
4935267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)};
4945267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
49551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink
4965267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
4975267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)#endif
498