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

Side by Side Diff: ppapi/api/ppb_view.idl

Issue 8951014: Change the DidChangeView update to take a new ViewChanged resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More nacl fixes Created 8 years, 11 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
OLDNEW
(Empty)
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 /**
7 * Defines the <code>PPB_View</code> struct representing the state of the
8 * view of an instance.
9 */
10
11 label Chrome {
12 M18 = 1.0
13 };
14
15 /**
16 * <code>PPB_View</code> represents the state of the view of an instance.
17 * You can get a View object with the <code>PPB_Instance.GetView()</code>
darin (slow to review) 2012/01/31 21:56:47 nit: there is no GetView() method
18 * function. Additionally, all </code>PPB_ViewChanged</code> objects are also
darin (slow to review) 2012/01/31 21:56:47 nit: PPB_ViewChanged doesn't exist in this rev of
19 * <code>PPB_View</code> objects so you will receive new view information via
20 * <code>PPP_Instance.DidChangeView</code>.
21 */
22 [macro="PPB_VIEW_INTERFACE"]
23 interface PPB_View {
24 /**
25 * <code>IsView()</code> determines if the given resource is a valid
26 * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code>
27 * resources derive from <code>PPB_View</code> and will return true here
28 * as well.
29 *
30 * @return <code>PP_TRUE</code> if the given resource supports
31 * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid
32 * resource or is a resource of another type.
33 */
34 PP_Bool IsView([in] PP_Resource resource);
35
36 /**
37 * <code>GetRect()</code> retrieves the rectangle of the instance
38 * associated with the view changed notification relative to the upper left
39 * of the browser viewport. This position changes when the page is scrolled.
40 *
41 * The returned rectangle may not be inside the visible portion of the
42 * viewport if the instance is scrolled off the page. Therefore, the position
43 * may be negative or larger than the size of the page. The size will always
44 * reflect the size of the plugin were it to be scrolled entirely into view.
45 *
46 * In general, most plugins will not need to worry about the position of the
47 * instance in the viewport, and only need to use the size.
48 *
49 * @param rect Output argument receiving the rectangle on success.
50 *
51 * @return Returns <code>PP_TRUE</code> if the resource was valid and the
52 * viewport rect was filled in, <code>PP_FALSE</code> if not.
53 */
54 PP_Bool GetRect([in] PP_Resource resource,
55 [out] PP_Rect rect);
56
57 /**
58 * <code>IsFullscreen()</code> returns whether the instance is currently
59 * displaying in fullscreen mode.
60 *
61 * @return <code>PP_TRUE</code> if the instance is in full screen mode,
62 * or <code>PP_FALSE</code> if it's not or the resource is invalid.
63 */
64 PP_Bool IsFullscreen([in] PP_Resource resource);
65
66 /**
67 * <code>IsVisible()</code> returns whether the instance is plausibly
68 * visible to the user. You should use this flag to throttle or stop updates
69 * for invisible plugins.
70 *
71 * Thie measure incorporates both whether the instance is scrolled into
72 * view (whether the clip rect is nonempty) and whether the page is plausibly
73 * visible to the user (<code>IsPageVisible()</code>).
74 *
75 * @return <code>PP_TRUE</code> if the instance is plausibly visible to the
76 * user, <code>PP_FALSE</code> if it is definitely not visible.
77 */
78 PP_Bool IsVisible([in] PP_Resource resource);
79
80 /**
81 * <code>IsPageVisible()</code> determines if the page that contains the
82 * instance is visible. The most common cause of invisible pages is that
83 * the page is in a background tab in the browser.
84 *
85 * Most applications should use <code>IsVisible()</code> rather than
86 * this function since the instance could be scrolled off of a visible
87 * page, and this function will still return true. However, depending on
88 * how your plugin interacts with the page, there may be certain updates
89 * that you may want to perform when the page is visible even if your
90 * specific instance isn't.
91 *
92 * @return <code>PP_TRUE</code> if the instance is plausibly visible to the
93 * user, <code>PP_FALSE</code> if it is definitely not visible.
94 */
95 PP_Bool IsPageVisible([in] PP_Resource resource);
96
97 /**
98 * <code>GetClipRect()</code> returns the clip rectangle relative to the
99 * upper left corner of the instance. This rectangle indicates which parts of
100 * the instance are scrolled into view.
101 *
102 * If the instance is scrolled off the view, the return value will be
103 * (0, 0, 0, 0). this state. This clip rect does <i>not</i> take into account
104 * page visibility. This means if the instance is scrolled into view but the
105 * page itself is in an invisible tab, the return rect will contain the
106 * visible rect assuming the page was visible. See
107 * <code>IsPageVisible()</code> and <code>IsVisible()</code> if you want to
108 * handle this case.
109 *
110 * Most applications will not need to worry about the clip. The recommended
111 * behavior is to do full updates if the instance is visible as determined by
112 * <code>IsVisible()</code> and do no updates if not.
113 *
114 * However, if the cost for computing pixels is very high for your
115 * application or the pages you're targeting frequently have very large
116 * instances with small visible portions, you may wish to optimize further.
117 * In this case, the clip rect will tell you which parts of the plugin to
118 * update.
119 *
120 * Note that painting of the page and sending of view changed updates
121 * happens asynchronously. This means when the user scrolls, for example,
122 * it is likely that the previous backing store of the instance will be used
123 * for the first paint, and will be updated later when your application
124 * generates new content with the new clip. This may cause flickering at the
125 * boundaries when scrolling. If you do choose to do partial updates, you may
126 * want to think about what color the invisible portions of your backing
127 * store contain (be it transparent or some background color) or to paint
128 * a certain region outside the clip to reduce the visual distraction when
129 * this happens.
130 *
131 * @param clip Output argument receiving the clip rect on success.
132 *
133 * @return Returns <code>PP_TRUE</code> if the resource was valid and the
134 * clip rect was filled in, <code>PP_FALSE</code> if not.
135 */
136 PP_Bool GetClipRect([in] PP_Resource resource,
137 [out] PP_Rect clip);
138 };
139
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698