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

Side by Side Diff: ppapi/c/ppb_view.h

Issue 9401012: Updated grammar, added resource argument to all functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
« ppapi/api/ppb_view.idl ('K') | « ppapi/api/ppb_view.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* From ppb_view.idl modified Mon Feb 6 14:05:16 2012. */ 6 /* From ppb_view.idl modified Thu Feb 16 13:43:49 2012. */
7 7
8 #ifndef PPAPI_C_PPB_VIEW_H_ 8 #ifndef PPAPI_C_PPB_VIEW_H_
9 #define PPAPI_C_PPB_VIEW_H_ 9 #define PPAPI_C_PPB_VIEW_H_
10 10
11 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h" 12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_point.h" 13 #include "ppapi/c/pp_point.h"
14 #include "ppapi/c/pp_rect.h" 14 #include "ppapi/c/pp_rect.h"
15 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_size.h" 16 #include "ppapi/c/pp_size.h"
17 #include "ppapi/c/pp_stdint.h" 17 #include "ppapi/c/pp_stdint.h"
18 18
19 #define PPB_VIEW_INTERFACE_1_0 "PPB_View;1.0" 19 #define PPB_VIEW_INTERFACE_1_0 "PPB_View;1.0"
20 #define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_0 20 #define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_0
21 21
22 /** 22 /**
23 * @file 23 * @file
24 * Defines the <code>PPB_View</code> struct representing the state of the 24 * This file defines the <code>PPB_View</code> struct representing the state
25 * view of an instance. 25 * of the view of an instance.
26 */ 26 */
27 27
28 28
29 /** 29 /**
30 * @addtogroup Interfaces 30 * @addtogroup Interfaces
31 * @{ 31 * @{
32 */ 32 */
33 /** 33 /**
34 * <code>PPB_View</code> represents the state of the view of an instance. 34 * <code>PPB_View</code> represents the state of the view of an instance.
35 * You will receive new view information via 35 * You will receive new view information using
36 * <code>PPP_Instance.DidChangeView</code>. 36 * <code>PPP_Instance.DidChangeView</code>.
37 */ 37 */
38 struct PPB_View_1_0 { 38 struct PPB_View_1_0 {
39 /** 39 /**
40 * <code>IsView()</code> determines if the given resource is a valid 40 * IsView() determines if the given resource is a valid
41 * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code> 41 * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code>
42 * resources derive from <code>PPB_View</code> and will return true here 42 * resources derive from <code>PPB_View</code> and will return true here
43 * as well. 43 * as well.
44 * 44 *
45 * @param resource A <code>PP_Resource</code> corresponding to a
46 * <code>PPB_View</code> resource.
47 *
45 * @return <code>PP_TRUE</code> if the given resource supports 48 * @return <code>PP_TRUE</code> if the given resource supports
46 * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid 49 * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid
47 * resource or is a resource of another type. 50 * resource or is a resource of another type.
48 */ 51 */
49 PP_Bool (*IsView)(PP_Resource resource); 52 PP_Bool (*IsView)(PP_Resource resource);
50 /** 53 /**
51 * <code>GetRect()</code> retrieves the rectangle of the instance 54 * GetRect() retrieves the rectangle of the module instance associated
52 * associated with the view changed notification relative to the upper left 55 * with a view changed notification relative to the upper-left of the browser
53 * of the browser viewport. This position changes when the page is scrolled. 56 * viewport. This position changes when the page is scrolled.
54 * 57 *
55 * The returned rectangle may not be inside the visible portion of the 58 * The returned rectangle may not be inside the visible portion of the
56 * viewport if the instance is scrolled off the page. Therefore, the position 59 * viewport if the module instance is scrolled off the page. Therefore, the
57 * may be negative or larger than the size of the page. The size will always 60 * position may be negative or larger than the size of the page. The size will
58 * reflect the size of the plugin were it to be scrolled entirely into view. 61 * always reflect the size of the module were it to be scrolled entirely into
62 * view.
59 * 63 *
60 * In general, most plugins will not need to worry about the position of the 64 * In general, most modules will not need to worry about the position of the
61 * instance in the viewport, and only need to use the size. 65 * module instance in the viewport, and only need to use the size.
62 * 66 *
63 * @param rect Output argument receiving the rectangle on success. 67 * @param resource A <code>PP_Resource</code> corresponding to a
68 * <code>PPB_View</code> resource.
69 *
70 * @param rect A <code>PP_Rect</code> receiving the rectangle on success.
64 * 71 *
65 * @return Returns <code>PP_TRUE</code> if the resource was valid and the 72 * @return Returns <code>PP_TRUE</code> if the resource was valid and the
66 * viewport rect was filled in, <code>PP_FALSE</code> if not. 73 * viewport rectangle was filled in, <code>PP_FALSE</code> if not.
67 */ 74 */
68 PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); 75 PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect);
69 /** 76 /**
70 * <code>IsFullscreen()</code> returns whether the instance is currently 77 * IsFullscreen() returns whether the instance is currently
71 * displaying in fullscreen mode. 78 * displaying in fullscreen mode.
72 * 79 *
80 * @param resource A <code>PP_Resource</code> corresponding to a
81 * <code>PPB_View</code> resource.
82 *
73 * @return <code>PP_TRUE</code> if the instance is in full screen mode, 83 * @return <code>PP_TRUE</code> if the instance is in full screen mode,
74 * or <code>PP_FALSE</code> if it's not or the resource is invalid. 84 * or <code>PP_FALSE</code> if it's not or the resource is invalid.
75 */ 85 */
76 PP_Bool (*IsFullscreen)(PP_Resource resource); 86 PP_Bool (*IsFullscreen)(PP_Resource resource);
77 /** 87 /**
78 * <code>IsVisible()</code> returns whether the instance is plausibly 88 * IsVisible() determines whether the module instance might be visible to
79 * visible to the user. You should use this flag to throttle or stop updates 89 * the user. For example,
80 * for invisible plugins. 90 the Chrome window could be minimized or another window
91 * could be over it. In both of these cases, the module instance would not be
92 * visible to the user, but IsVisible() will return true.
81 * 93 *
82 * Thie measure incorporates both whether the instance is scrolled into 94 * Use the result to speed up or stop updates for invisible module
83 * view (whether the clip rect is nonempty) and whether the page is plausibly 95 * instances.
84 * visible to the user (<code>IsPageVisible()</code>).
85 * 96 *
86 * @return <code>PP_TRUE</code> if the instance is plausibly visible to the 97 * This function performs the duties of GetRect() (determining whether the
98 * module instance is scrolled into view and the clip rectangle is nonempty)
99 * and IsPageVisible() (whether the page is visible to the user).
100 *
101 * @param resource A <code>PP_Resource</code> corresponding to a
102 * <code>PPB_View</code> resource.
103 *
104 * @return <code>PP_TRUE</code> if the instance might be visible to the
87 * user, <code>PP_FALSE</code> if it is definitely not visible. 105 * user, <code>PP_FALSE</code> if it is definitely not visible.
88 */ 106 */
89 PP_Bool (*IsVisible)(PP_Resource resource); 107 PP_Bool (*IsVisible)(PP_Resource resource);
90 /** 108 /**
91 * <code>IsPageVisible()</code> determines if the page that contains the 109 * IsPageVisible() determines if the page that contains the module instance
92 * instance is visible. The most common cause of invisible pages is that 110 * is visible. The most common cause of invisible pages is that
93 * the page is in a background tab in the browser. 111 * the page is in a background tab in the browser.
94 * 112 *
95 * Most applications should use <code>IsVisible()</code> rather than 113 * Most applications should use IsVisible() instead of this function since
96 * this function since the instance could be scrolled off of a visible 114 * the module instance could be scrolled off of a visible page, and this
97 * page, and this function will still return true. However, depending on 115 * function will still return true. However, depending on how your module
98 * how your plugin interacts with the page, there may be certain updates 116 * interacts with the page, there may be certain updates that you may want to
99 * that you may want to perform when the page is visible even if your 117 * perform when the page is visible even if your specific module instance is
100 * specific instance isn't. 118 * not visible.
119 *
120 * @param resource A <code>PP_Resource</code> corresponding to a
121 * <code>PPB_View</code> resource.
101 * 122 *
102 * @return <code>PP_TRUE</code> if the instance is plausibly visible to the 123 * @return <code>PP_TRUE</code> if the instance is plausibly visible to the
103 * user, <code>PP_FALSE</code> if it is definitely not visible. 124 * user, <code>PP_FALSE</code> if it is definitely not visible.
104 */ 125 */
105 PP_Bool (*IsPageVisible)(PP_Resource resource); 126 PP_Bool (*IsPageVisible)(PP_Resource resource);
106 /** 127 /**
107 * <code>GetClipRect()</code> returns the clip rectangle relative to the 128 * GetClipRect() returns the clip rectangle relative to the upper-left corner
108 * upper left corner of the instance. This rectangle indicates which parts of 129 * of the module instance. This rectangle indicates the portions of the module
109 * the instance are scrolled into view. 130 * instance that are scrolled into view.
110 * 131 *
111 * If the instance is scrolled off the view, the return value will be 132 * If the module instance is scrolled off the view, the return value will be
112 * (0, 0, 0, 0). This clip rect does <i>not</i> take into account page 133 * (0, 0, 0, 0). This clip rectangle does <i>not</i> take into account page
113 * visibility. This means if the instance is scrolled into view but the page 134 * visibility. Therefore, if the module instance is scrolled into view, but
114 * itself is in an invisible tab, the return rect will contain the visible 135 * the page itself is on a tab that is not visible, the return rectangle will
115 * rect assuming the page was visible. See <code>IsPageVisible()</code> and 136 * contain the visible rectangle as though the page were visible. Refer to
116 * <code>IsVisible()</code> if you want to handle this case. 137 * IsPageVisible() and IsVisible() if you want to account for page
138 * visibility.
117 * 139 *
118 * Most applications will not need to worry about the clip. The recommended 140 * Most applications will not need to worry about the clip rectangle. The
119 * behavior is to do full updates if the instance is visible as determined by 141 * recommended behavior is to do full updates if the module instance is
120 * <code>IsVisible()</code> and do no updates if not. 142 * visible, as determined by IsVisible(), and do no updates if it is not
143 * visible.
121 * 144 *
122 * However, if the cost for computing pixels is very high for your 145 * However, if the cost for computing pixels is very high for your
123 * application or the pages you're targeting frequently have very large 146 * application, or the pages you're targeting frequently have very large
124 * instances with small visible portions, you may wish to optimize further. 147 * module instances with small visible portions, you may wish to optimize
125 * In this case, the clip rect will tell you which parts of the plugin to 148 * further. In this case, the clip rectangle will tell you which parts of
126 * update. 149 * the module to update.
127 * 150 *
128 * Note that painting of the page and sending of view changed updates 151 * Note that painting of the page and sending of view changed updates
129 * happens asynchronously. This means when the user scrolls, for example, 152 * happens asynchronously. This means when the user scrolls, for example,
130 * it is likely that the previous backing store of the instance will be used 153 * it is likely that the previous backing store of the module instance will
131 * for the first paint, and will be updated later when your application 154 * be used for the first paint, and will be updated later when your
132 * generates new content with the new clip. This may cause flickering at the 155 * application generates new content with the new clip. This may cause
133 * boundaries when scrolling. If you do choose to do partial updates, you may 156 * flickering at the boundaries when scrolling. If you do choose to do
134 * want to think about what color the invisible portions of your backing 157 * partial updates, you may want to think about what color the invisible
135 * store contain (be it transparent or some background color) or to paint 158 * portions of your backing store contain (be it transparent or some
136 * a certain region outside the clip to reduce the visual distraction when 159 * background color) or to paint a certain region outside the clip to reduce
137 * this happens. 160 * the visual distraction when this happens.
161 *
162 * @param resource A <code>PP_Resource</code> corresponding to a
163 * <code>PPB_View</code> resource.
138 * 164 *
139 * @param clip Output argument receiving the clip rect on success. 165 * @param clip Output argument receiving the clip rect on success.
140 * 166 *
141 * @return Returns <code>PP_TRUE</code> if the resource was valid and the 167 * @return Returns <code>PP_TRUE</code> if the resource was valid and the
142 * clip rect was filled in, <code>PP_FALSE</code> if not. 168 * clip rect was filled in, <code>PP_FALSE</code> if not.
143 */ 169 */
144 PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); 170 PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip);
145 }; 171 };
146 172
147 typedef struct PPB_View_1_0 PPB_View; 173 typedef struct PPB_View_1_0 PPB_View;
148 /** 174 /**
149 * @} 175 * @}
150 */ 176 */
151 177
152 #endif /* PPAPI_C_PPB_VIEW_H_ */ 178 #endif /* PPAPI_C_PPB_VIEW_H_ */
153 179
OLDNEW
« ppapi/api/ppb_view.idl ('K') | « ppapi/api/ppb_view.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698