Chromium Code Reviews| Index: ppapi/shared_impl/ppb_view_shared.cc |
| diff --git a/ppapi/shared_impl/ppb_view_shared.cc b/ppapi/shared_impl/ppb_view_shared.cc |
| index 9e1565581ba9c41dd5986b2cc007e064be5a4259..6fa328ae10520a65c16a100110afa3b94fee4b27 100644 |
| --- a/ppapi/shared_impl/ppb_view_shared.cc |
| +++ b/ppapi/shared_impl/ppb_view_shared.cc |
| @@ -4,6 +4,12 @@ |
| #include "ppapi/shared_impl/ppb_view_shared.h" |
| +namespace { |
| +bool IsRectVisible(const PP_Rect& rect) { |
|
brettw
2013/02/12 18:48:02
Maybe IsRectNonempty would be a better name?
teravest
2013/02/12 19:01:41
Done.
|
| + return rect.size.width > 0 && rect.size.height > 0; |
| +} |
| +} |
|
brettw
2013/02/12 18:48:02
Style nit: needs " // namespace" and I'd put spac
teravest
2013/02/12 19:01:41
Done.
|
| + |
| namespace ppapi { |
| ViewData::ViewData() { |
| @@ -50,4 +56,38 @@ const ViewData& PPB_View_Shared::GetData() const { |
| return data_; |
| } |
| +PP_Bool PPB_View_Shared::GetRect(PP_Rect* viewport) const { |
| + if (!viewport) |
| + return PP_FALSE; |
| + *viewport = data_.rect; |
| + return PP_TRUE; |
| +} |
| + |
| +PP_Bool PPB_View_Shared::IsFullscreen() const { |
| + return PP_FromBool(data_.is_fullscreen); |
| +} |
| + |
| +PP_Bool PPB_View_Shared::IsVisible() const { |
| + return PP_FromBool(data_.is_page_visible && IsRectVisible(data_.clip_rect)); |
| +} |
| + |
| +PP_Bool PPB_View_Shared::IsPageVisible() const { |
| + return PP_FromBool(data_.is_page_visible); |
| +} |
| + |
| +PP_Bool PPB_View_Shared::GetClipRect(PP_Rect* clip) const { |
| + if (!clip) |
| + return PP_FALSE; |
| + *clip = data_.clip_rect; |
| + return PP_TRUE; |
| +} |
| + |
| +float PPB_View_Shared::GetDeviceScale() const { |
| + return data_.device_scale; |
| +} |
| + |
| +float PPB_View_Shared::GetCSSScale() const { |
| + return data_.css_scale; |
| +} |
| + |
| } // namespace ppapi |