| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()))); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void DebugRectHistory::SaveWheelEventHandlerRects(LayerImpl* root_layer) { | 177 void DebugRectHistory::SaveWheelEventHandlerRects(LayerImpl* layer) { |
| 178 LayerTreeHostCommon::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { |
| 179 SaveWheelEventHandlerRectsCallback(layer); |
| 180 }); |
| 181 } |
| 182 |
| 183 void DebugRectHistory::SaveWheelEventHandlerRectsCallback(LayerImpl* layer) { |
| 178 EventListenerProperties event_properties = | 184 EventListenerProperties event_properties = |
| 179 root_layer->layer_tree_impl()->event_listener_properties( | 185 layer->layer_tree_impl()->event_listener_properties( |
| 180 EventListenerClass::kMouseWheel); | 186 EventListenerClass::kMouseWheel); |
| 181 if (event_properties == EventListenerProperties::kNone || | 187 if (event_properties == EventListenerProperties::kNone || |
| 182 (root_layer->layer_tree_impl()->settings().use_mouse_wheel_gestures && | 188 (layer->layer_tree_impl()->settings().use_mouse_wheel_gestures && |
| 183 event_properties == EventListenerProperties::kPassive)) { | 189 event_properties == EventListenerProperties::kPassive)) { |
| 184 return; | 190 return; |
| 185 } | 191 } |
| 186 | 192 |
| 187 // Since the wheel event handlers property is on the entire layer tree just | 193 debug_rects_.push_back( |
| 188 // mark inner viewport if have listeners. | 194 DebugRect(WHEEL_EVENT_HANDLER_RECT_TYPE, |
| 189 LayerImpl* inner_viewport = | 195 MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), |
| 190 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); | 196 gfx::Rect(layer->bounds())))); |
| 191 if (!inner_viewport) | |
| 192 return; | |
| 193 debug_rects_.push_back(DebugRect( | |
| 194 WHEEL_EVENT_HANDLER_RECT_TYPE, | |
| 195 MathUtil::MapEnclosingClippedRect(inner_viewport->ScreenSpaceTransform(), | |
| 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::CallFunctionForSubtree(layer, [this](LayerImpl* layer) { |
| 201 SaveScrollEventHandlerRectsCallback(layer); | 201 SaveScrollEventHandlerRectsCallback(layer); |
| 202 }); | 202 }); |
| 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()) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |