OLD | NEW |
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 #include "ppapi/shared_impl/ppb_view_shared.h" | 5 #include "ppapi/shared_impl/ppb_view_shared.h" |
6 | 6 |
7 namespace { | 7 namespace { |
8 | 8 |
9 bool IsRectNonempty(const PP_Rect& rect) { | 9 bool IsRectNonempty(const PP_Rect& rect) { |
10 return rect.size.width > 0 && rect.size.height > 0; | 10 return rect.size.width > 0 && rect.size.height > 0; |
(...skipping 17 matching lines...) Expand all Loading... |
28 return rect.point.x == other.rect.point.x && | 28 return rect.point.x == other.rect.point.x && |
29 rect.point.y == other.rect.point.y && | 29 rect.point.y == other.rect.point.y && |
30 rect.size.width == other.rect.size.width && | 30 rect.size.width == other.rect.size.width && |
31 rect.size.height == other.rect.size.height && | 31 rect.size.height == other.rect.size.height && |
32 is_fullscreen == other.is_fullscreen && | 32 is_fullscreen == other.is_fullscreen && |
33 is_page_visible == other.is_page_visible && | 33 is_page_visible == other.is_page_visible && |
34 clip_rect.point.x == other.clip_rect.point.x && | 34 clip_rect.point.x == other.clip_rect.point.x && |
35 clip_rect.point.y == other.clip_rect.point.y && | 35 clip_rect.point.y == other.clip_rect.point.y && |
36 clip_rect.size.width == other.clip_rect.size.width && | 36 clip_rect.size.width == other.clip_rect.size.width && |
37 clip_rect.size.height == other.clip_rect.size.height && | 37 clip_rect.size.height == other.clip_rect.size.height && |
38 device_scale == other.device_scale && css_scale == other.css_scale; | 38 device_scale == other.device_scale && css_scale == other.css_scale && |
| 39 scroll_offset.x == other.scroll_offset.x && |
| 40 scroll_offset.y == other.scroll_offset.y; |
39 } | 41 } |
40 | 42 |
41 PPB_View_Shared::PPB_View_Shared(ResourceObjectType type, | 43 PPB_View_Shared::PPB_View_Shared(ResourceObjectType type, |
42 PP_Instance instance, | 44 PP_Instance instance, |
43 const ViewData& data) | 45 const ViewData& data) |
44 : Resource(type, instance), data_(data) {} | 46 : Resource(type, instance), data_(data) {} |
45 | 47 |
46 PPB_View_Shared::~PPB_View_Shared() {} | 48 PPB_View_Shared::~PPB_View_Shared() {} |
47 | 49 |
48 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { return this; } | 50 thunk::PPB_View_API* PPB_View_Shared::AsPPB_View_API() { return this; } |
(...skipping 23 matching lines...) Expand all Loading... |
72 if (!clip) | 74 if (!clip) |
73 return PP_FALSE; | 75 return PP_FALSE; |
74 *clip = data_.clip_rect; | 76 *clip = data_.clip_rect; |
75 return PP_TRUE; | 77 return PP_TRUE; |
76 } | 78 } |
77 | 79 |
78 float PPB_View_Shared::GetDeviceScale() const { return data_.device_scale; } | 80 float PPB_View_Shared::GetDeviceScale() const { return data_.device_scale; } |
79 | 81 |
80 float PPB_View_Shared::GetCSSScale() const { return data_.css_scale; } | 82 float PPB_View_Shared::GetCSSScale() const { return data_.css_scale; } |
81 | 83 |
| 84 PP_Bool PPB_View_Shared::GetScrollOffset(PP_Point* scroll_offset) const { |
| 85 if (!scroll_offset) |
| 86 return PP_FALSE; |
| 87 *scroll_offset = data_.scroll_offset; |
| 88 return PP_TRUE; |
| 89 } |
| 90 |
82 } // namespace ppapi | 91 } // namespace ppapi |
OLD | NEW |