Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: public/webview/WebWidget.h

Issue 16623002: mv public/webview to public/webpage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/webview/WebViewClient.h ('k') | public/webview/WebWidgetClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef WebWidget_h
32 #define WebWidget_h
33
34 #include "../platform/WebCanvas.h"
35 #include "../platform/WebCommon.h"
36 #include "../platform/WebRect.h"
37 #include "../platform/WebSize.h"
38 #include "WebCompositionUnderline.h"
39 #include "WebTextDirection.h"
40 #include "WebTextInputInfo.h"
41
42 namespace WebKit {
43
44 class WebInputEvent;
45 class WebLayerTreeView;
46 class WebMouseEvent;
47 class WebString;
48 struct WebPoint;
49 struct WebRenderingStats;
50 template <typename T> class WebVector;
51
52 class WebWidget {
53 public:
54 // This method closes and deletes the WebWidget.
55 virtual void close() { }
56
57 // Returns the current size of the WebWidget.
58 virtual WebSize size() { return WebSize(); }
59
60 // Used to group a series of resize events. For example, if the user
61 // drags a resizer then willStartLiveResize will be called, followed by a
62 // sequence of resize events, ending with willEndLiveResize when the user
63 // lets go of the resizer.
64 virtual void willStartLiveResize() { }
65
66 // Called to resize the WebWidget.
67 virtual void resize(const WebSize&) { }
68
69 // Ends a group of resize events that was started with a call to
70 // willStartLiveResize.
71 virtual void willEndLiveResize() { }
72
73 // Called to notify the WebWidget of entering/exiting fullscreen mode. The
74 // resize method may be called between will{Enter,Exit}FullScreen and
75 // did{Enter,Exit}FullScreen.
76 virtual void willEnterFullScreen() { }
77 virtual void didEnterFullScreen() { }
78 virtual void willExitFullScreen() { }
79 virtual void didExitFullScreen() { }
80
81 // Called to update imperative animation state. This should be called before
82 // paint, although the client can rate-limit these calls.
83 virtual void animate(double monotonicFrameBeginTime) { }
84
85 // Called to layout the WebWidget. This MUST be called before Paint,
86 // and it may result in calls to WebWidgetClient::didInvalidateRect.
87 virtual void layout() { }
88
89 // Called to toggle the WebWidget in or out of force compositing mode. This
90 // should be called before paint.
91 virtual void enterForceCompositingMode(bool enter) { }
92
93 // Called to notify the WebWidget that the widget has exited compositing
94 // mode and cannot reenter.
95 virtual void didExitCompositingMode() { }
96
97 enum PaintOptions {
98 // Attempt to fulfill the painting request by reading back from the
99 // compositor, assuming we're using a compositor to render.
100 ReadbackFromCompositorIfAvailable,
101
102 // Force the widget to rerender onto the canvas using software. This
103 // mode ignores 3d transforms and ignores GPU-resident content, such
104 // as video, canvas, and WebGL.
105 //
106 // Note: This option exists on OS(ANDROID) and will hopefully be
107 // removed once the link disambiguation feature renders using
108 // the compositor.
109 ForceSoftwareRenderingAndIgnoreGPUResidentContent,
110 };
111
112 // Called to paint the rectangular region within the WebWidget
113 // onto the specified canvas at (viewPort.x,viewPort.y). You MUST call
114 // Layout before calling this method. It is okay to call paint
115 // multiple times once layout has been called, assuming no other
116 // changes are made to the WebWidget (e.g., once events are
117 // processed, it should be assumed that another call to layout is
118 // warranted before painting again).
119 virtual void paint(WebCanvas*, const WebRect& viewPort, PaintOptions = Readb ackFromCompositorIfAvailable) { }
120
121 // Returns true if we've started tracking repaint rectangles.
122 virtual bool isTrackingRepaints() const { return false; }
123
124 // Indicates that the compositing surface associated with this WebWidget is
125 // ready to use.
126 virtual void setCompositorSurfaceReady() { }
127
128 // Temporary method for the embedder to notify the WebWidget that the widget
129 // has taken damage, e.g. due to a window expose. This method will be
130 // removed when the WebWidget inversion patch lands --- http://crbug.com/112 837
131 virtual void setNeedsRedraw() { }
132
133 // Called to inform the WebWidget of a change in theme.
134 // Implementors that cache rendered copies of widgets need to re-render
135 // on receiving this message
136 virtual void themeChanged() { }
137
138 // Called to inform the WebWidget of an input event. Returns true if
139 // the event has been processed, false otherwise.
140 virtual bool handleInputEvent(const WebInputEvent&) { return false; }
141
142 // Called to inform the WebWidget of the mouse cursor's visibility.
143 virtual void setCursorVisibilityState(bool isVisible) { }
144
145 // Check whether the given point hits any registered touch event handlers.
146 virtual bool hasTouchEventHandlersAt(const WebPoint&) { return true; }
147
148 // Applies a scroll delta to the root layer, which is bundled with a page
149 // scale factor that may apply a CSS transform on the whole document (used
150 // for mobile-device pinch zooming). This is triggered by events sent to the
151 // compositor thread.
152 virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFact or) { }
153
154 // Called to inform the WebWidget that mouse capture was lost.
155 virtual void mouseCaptureLost() { }
156
157 // Called to inform the WebWidget that it has gained or lost keyboard focus.
158 virtual void setFocus(bool) { }
159
160 // Called to inform the WebWidget of a new composition text.
161 // If selectionStart and selectionEnd has the same value, then it indicates
162 // the input caret position. If the text is empty, then the existing
163 // composition text will be cancelled.
164 // Returns true if the composition text was set successfully.
165 virtual bool setComposition(
166 const WebString& text,
167 const WebVector<WebCompositionUnderline>& underlines,
168 int selectionStart,
169 int selectionEnd) { return false; }
170
171 // Called to inform the WebWidget to confirm an ongoing composition.
172 // This method is same as confirmComposition(WebString());
173 // Returns true if there is an ongoing composition.
174 virtual bool confirmComposition() { return false; }
175
176 // Called to inform the WebWidget to confirm an ongoing composition with a
177 // new composition text. If the text is empty then the current composition
178 // text is confirmed. If there is no ongoing composition, then deletes the
179 // current selection and inserts the text. This method has no effect if
180 // there is no ongoing composition and the text is empty.
181 // Returns true if there is an ongoing composition or the text is inserted.
182 virtual bool confirmComposition(const WebString& text) { return false; }
183
184 // Fetches the character range of the current composition, also called the
185 // "marked range." Returns true and fills the out-paramters on success;
186 // returns false on failure.
187 virtual bool compositionRange(size_t* location, size_t* length) { return fal se; }
188
189 // Returns information about the current text input of this WebWidget.
190 virtual WebTextInputInfo textInputInfo() { return WebTextInputInfo(); }
191
192 // Returns the current text input type of this WebWidget.
193 // FIXME: Remove this method. It's redundant with textInputInfo().
194 virtual WebTextInputType textInputType() { return WebTextInputTypeNone; }
195
196 // Returns the anchor and focus bounds of the current selection.
197 // If the selection range is empty, it returns the caret bounds.
198 virtual bool selectionBounds(WebRect& anchor, WebRect& focus) const { return false; }
199
200 // Returns the text direction at the start and end bounds of the current sel ection.
201 // If the selection range is empty, it returns false.
202 virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirectio n& end) const { return false; }
203
204 // Returns true if the selection range is nonempty and its anchor is first
205 // (i.e its anchor is its start).
206 virtual bool isSelectionAnchorFirst() const { return false; }
207
208 // Fetch the current selection range of this WebWidget. If there is no
209 // selection, it will output a 0-length range with the location at the
210 // caret. Returns true and fills the out-paramters on success; returns false
211 // on failure.
212 virtual bool caretOrSelectionRange(size_t* location, size_t* length) { retur n false; }
213
214 // Changes the text direction of the selected input node.
215 virtual void setTextDirection(WebTextDirection) { }
216
217 // Returns true if the WebWidget uses GPU accelerated compositing
218 // to render its contents.
219 virtual bool isAcceleratedCompositingActive() const { return false; }
220
221 // The WebLayerTreeView initialized on this WebWidgetClient will be going aw ay and
222 // is no longer safe to access.
223 virtual void willCloseLayerTreeView() { }
224
225 // Calling WebWidgetClient::requestPointerLock() will result in one
226 // return call to didAcquirePointerLock() or didNotAcquirePointerLock().
227 virtual void didAcquirePointerLock() { }
228 virtual void didNotAcquirePointerLock() { }
229
230 // Pointer lock was held, but has been lost. This may be due to a
231 // request via WebWidgetClient::requestPointerUnlock(), or for other
232 // reasons such as the user exiting lock, window focus changing, etc.
233 virtual void didLosePointerLock() { }
234
235 // Informs the WebWidget that the resizer rect changed. Happens for example
236 // on mac, when a widget appears below the WebWidget without changing the
237 // WebWidget's size (WebWidget::resize() automatically checks the resizer
238 // rect.)
239 virtual void didChangeWindowResizerRect() { }
240
241 // The page background color. Can be used for filling in areas without
242 // content.
243 virtual WebColor backgroundColor() const { return 0xFFFFFFFF; /* SK_ColorWHI TE */ }
244
245 protected:
246 ~WebWidget() { }
247 };
248
249 } // namespace WebKit
250
251 #endif
OLDNEW
« no previous file with comments | « public/webview/WebViewClient.h ('k') | public/webview/WebWidgetClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698