| 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 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); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { | 167 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { |
| 167 for (Region::Iterator iter(layer->touch_event_handler_region()); | 168 for (Region::Iterator iter(layer->touch_event_handler_region()); |
| 168 iter.has_rect(); | 169 iter.has_rect(); |
| 169 iter.next()) { | 170 iter.next()) { |
| 170 debug_rects_.push_back( | 171 debug_rects_.push_back( |
| 171 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, | 172 DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, |
| 172 MathUtil::MapEnclosingClippedRect( | 173 MathUtil::MapEnclosingClippedRect( |
| 173 layer->ScreenSpaceTransform(), iter.rect()))); | 174 layer->ScreenSpaceTransform(), iter.rect()))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 192 return; | 193 return; |
| 193 debug_rects_.push_back(DebugRect( | 194 debug_rects_.push_back(DebugRect( |
| 194 WHEEL_EVENT_HANDLER_RECT_TYPE, | 195 WHEEL_EVENT_HANDLER_RECT_TYPE, |
| 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), | 196 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), |
| 196 gfx::Rect(inner_viewport->bounds())))); | 197 gfx::Rect(inner_viewport->bounds())))); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) { | 200 void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) { |
| 200 LayerTreeHostCommon::CallFunctionForEveryLayer( | 201 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 201 tree_impl, | 202 tree_impl, |
| 202 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); }); | 203 [this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); }, |
| 204 CallFunctionLayerType::ALL_LAYERS); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { | 207 void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) { |
| 206 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) | 208 if (!layer->layer_tree_impl()->have_scroll_event_handlers()) |
| 207 return; | 209 return; |
| 208 | 210 |
| 209 debug_rects_.push_back( | 211 debug_rects_.push_back( |
| 210 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, | 212 DebugRect(SCROLL_EVENT_HANDLER_RECT_TYPE, |
| 211 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), | 213 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), |
| 212 gfx::Rect(layer->bounds())))); | 214 gfx::Rect(layer->bounds())))); |
| 213 } | 215 } |
| 214 | 216 |
| 215 void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) { | 217 void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) { |
| 216 LayerTreeHostCommon::CallFunctionForEveryLayer( | 218 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 217 tree_impl, | 219 tree_impl, |
| 218 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); }); | 220 [this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); }, |
| 221 CallFunctionLayerType::ALL_LAYERS); |
| 219 } | 222 } |
| 220 | 223 |
| 221 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { | 224 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { |
| 222 for (Region::Iterator iter(layer->non_fast_scrollable_region()); | 225 for (Region::Iterator iter(layer->non_fast_scrollable_region()); |
| 223 iter.has_rect(); | 226 iter.has_rect(); |
| 224 iter.next()) { | 227 iter.next()) { |
| 225 debug_rects_.push_back( | 228 debug_rects_.push_back( |
| 226 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, | 229 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, |
| 227 MathUtil::MapEnclosingClippedRect( | 230 MathUtil::MapEnclosingClippedRect( |
| 228 layer->ScreenSpaceTransform(), iter.rect()))); | 231 layer->ScreenSpaceTransform(), iter.rect()))); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 246 debug_rects_.push_back( | 249 debug_rects_.push_back( |
| 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 250 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 251 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
| 249 inflated_bounds.y(), | 252 inflated_bounds.y(), |
| 250 inflated_bounds.width(), | 253 inflated_bounds.width(), |
| 251 inflated_bounds.height())))); | 254 inflated_bounds.height())))); |
| 252 } | 255 } |
| 253 } | 256 } |
| 254 | 257 |
| 255 } // namespace cc | 258 } // namespace cc |
| OLD | NEW |