Chromium Code Reviews| 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 "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 if (render_surface_layer->replica_layer()) { | 150 if (render_surface_layer->replica_layer()) { |
| 151 debug_rects_.push_back( | 151 debug_rects_.push_back( |
| 152 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE, | 152 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE, |
| 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(LayerImpl* layer) { | 160 void DebugRectHistory::SaveTouchEventHandlerRects(LayerImpl* layer) { |
|
ajuma
2016/04/01 13:38:14
Can this be changed to take a tree instead of a la
jaydasika
2016/04/01 17:01:24
Done.
| |
| 161 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { | 161 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 162 SaveTouchEventHandlerRectsCallback(layer); | 162 layer->layer_tree_impl(), |
| 163 }); | 163 [this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); }); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { | 166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { |
| 167 for (Region::Iterator iter(layer->touch_event_handler_region()); | 167 for (Region::Iterator iter(layer->touch_event_handler_region()); |
| 168 iter.has_rect(); | 168 iter.has_rect(); |
| 169 iter.next()) { | 169 iter.next()) { |
| 170 debug_rects_.push_back( | 170 debug_rects_.push_back( |
| 171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, | 171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, |
| 172 MathUtil::MapEnclosingClippedRect( | 172 MathUtil::MapEnclosingClippedRect( |
| 173 layer->ScreenSpaceTransform(), iter.rect()))); | 173 layer->ScreenSpaceTransform(), iter.rect()))); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 190 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); | 190 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); |
| 191 if (!inner_viewport) | 191 if (!inner_viewport) |
| 192 return; | 192 return; |
| 193 debug_rects_.push_back(DebugRect( | 193 debug_rects_.push_back(DebugRect( |
| 194 WHEEL_EVENT_HANDLER_RECT_TYPE, | 194 WHEEL_EVENT_HANDLER_RECT_TYPE, |
| 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), | 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), |
| 196 gfx::Rect(inner_viewport->bounds())))); | 196 gfx::Rect(inner_viewport->bounds())))); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerImpl* layer) { | 199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerImpl* layer) { |
| 200 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { | 200 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 201 SaveScrollEventHandlerRectsCallback(layer); | 201 layer->layer_tree_impl(), |
| 202 }); | 202 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); }); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { | 205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { |
| 206 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) | 206 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) |
| 207 return; | 207 return; |
| 208 | 208 |
| 209 debug_rects_.push_back( | 209 debug_rects_.push_back( |
| 210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, | 210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, |
| 211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), | 211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), |
| 212 gfx::Rect(layer->bounds())))); | 212 gfx::Rect(layer->bounds())))); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void DebugRectHistory::SaveNonFastScrollableRects(LayerImpl* layer) { | 215 void DebugRectHistory::SaveNonFastScrollableRects(LayerImpl* layer) { |
| 216 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { | 216 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 217 SaveNonFastScrollableRectsCallback(layer); | 217 layer->layer_tree_impl(), |
| 218 }); | 218 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); }); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { | 221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { |
| 222 for (Region::Iterator iter(layer->non_fast_scrollable_region()); | 222 for (Region::Iterator iter(layer->non_fast_scrollable_region()); |
| 223 iter.has_rect(); | 223 iter.has_rect(); |
| 224 iter.next()) { | 224 iter.next()) { |
| 225 debug_rects_.push_back( | 225 debug_rects_.push_back( |
| 226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, | 226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, |
| 227 MathUtil::MapEnclosingClippedRect( | 227 MathUtil::MapEnclosingClippedRect( |
| 228 layer->ScreenSpaceTransform(), iter.rect()))); | 228 layer->ScreenSpaceTransform(), iter.rect()))); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 246 debug_rects_.push_back( | 246 debug_rects_.push_back( |
| 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
| 249 inflated_bounds.y(), | 249 inflated_bounds.y(), |
| 250 inflated_bounds.width(), | 250 inflated_bounds.width(), |
| 251 inflated_bounds.height())))); | 251 inflated_bounds.height())))); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |