OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/debug/debug_rect_history.h" | 5 #include "cc/debug/debug_rect_history.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 MathUtil::MapEnclosingClippedRect( | 153 MathUtil::MapEnclosingClippedRect( |
154 render_surface->replica_screen_space_transform(), | 154 render_surface->replica_screen_space_transform(), |
155 render_surface->content_rect()))); | 155 render_surface->content_rect()))); |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 void DebugRectHistory::SaveTouchEventHandlerRects(LayerTreeImpl* tree_impl) { | 160 void DebugRectHistory::SaveTouchEventHandlerRects(LayerTreeImpl* tree_impl) { |
161 LayerTreeHostCommon::CallFunctionForEveryLayer( | 161 LayerTreeHostCommon::CallFunctionForEveryLayer( |
162 tree_impl, | 162 tree_impl, |
163 [this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); }, | 163 [this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); }); |
164 CallFunctionLayerType::ALL_LAYERS); | |
165 } | 164 } |
166 | 165 |
167 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { | 166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { |
168 for (Region::Iterator iter(layer->touch_event_handler_region()); | 167 for (Region::Iterator iter(layer->touch_event_handler_region()); |
169 iter.has_rect(); | 168 iter.has_rect(); |
170 iter.next()) { | 169 iter.next()) { |
171 debug_rects_.push_back( | 170 debug_rects_.push_back( |
172 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, | 171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, |
173 MathUtil::MapEnclosingClippedRect( | 172 MathUtil::MapEnclosingClippedRect( |
174 layer->ScreenSpaceTransform(), iter.rect()))); | 173 layer->ScreenSpaceTransform(), iter.rect()))); |
(...skipping 18 matching lines...) Expand all Loading... |
193 return; | 192 return; |
194 debug_rects_.push_back(DebugRect( | 193 debug_rects_.push_back(DebugRect( |
195 WHEEL_EVENT_HANDLER_RECT_TYPE, | 194 WHEEL_EVENT_HANDLER_RECT_TYPE, |
196 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), | 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), |
197 gfx::Rect(inner_viewport->bounds())))); | 196 gfx::Rect(inner_viewport->bounds())))); |
198 } | 197 } |
199 | 198 |
200 void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) { | 199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) { |
201 LayerTreeHostCommon::CallFunctionForEveryLayer( | 200 LayerTreeHostCommon::CallFunctionForEveryLayer( |
202 tree_impl, | 201 tree_impl, |
203 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); }, | 202 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); }); |
204 CallFunctionLayerType::ALL_LAYERS); | |
205 } | 203 } |
206 | 204 |
207 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { | 205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { |
208 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) | 206 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) |
209 return; | 207 return; |
210 | 208 |
211 debug_rects_.push_back( | 209 debug_rects_.push_back( |
212 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, | 210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, |
213 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), | 211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), |
214 gfx::Rect(layer->bounds())))); | 212 gfx::Rect(layer->bounds())))); |
215 } | 213 } |
216 | 214 |
217 void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) { | 215 void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) { |
218 LayerTreeHostCommon::CallFunctionForEveryLayer( | 216 LayerTreeHostCommon::CallFunctionForEveryLayer( |
219 tree_impl, | 217 tree_impl, |
220 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); }, | 218 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); }); |
221 CallFunctionLayerType::ALL_LAYERS); | |
222 } | 219 } |
223 | 220 |
224 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { | 221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { |
225 for (Region::Iterator iter(layer->non_fast_scrollable_region()); | 222 for (Region::Iterator iter(layer->non_fast_scrollable_region()); |
226 iter.has_rect(); | 223 iter.has_rect(); |
227 iter.next()) { | 224 iter.next()) { |
228 debug_rects_.push_back( | 225 debug_rects_.push_back( |
229 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, | 226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, |
230 MathUtil::MapEnclosingClippedRect( | 227 MathUtil::MapEnclosingClippedRect( |
231 layer->ScreenSpaceTransform(), iter.rect()))); | 228 layer->ScreenSpaceTransform(), iter.rect()))); |
(...skipping 17 matching lines...) Expand all Loading... |
249 debug_rects_.push_back( | 246 debug_rects_.push_back( |
250 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
251 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
252 inflated_bounds.y(), | 249 inflated_bounds.y(), |
253 inflated_bounds.width(), | 250 inflated_bounds.width(), |
254 inflated_bounds.height())))); | 251 inflated_bounds.height())))); |
255 } | 252 } |
256 } | 253 } |
257 | 254 |
258 } // namespace cc | 255 } // namespace cc |
OLD | NEW |