diff options
author | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-29 01:11:58 +0000 |
---|---|---|
committer | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-29 01:11:58 +0000 |
commit | 65319e205a77622ef623346a22cd50a1ad837044 (patch) | |
tree | 3cdffabd4950d0658145eaa9bcf1cdc9cb54f469 /cc/debug/debug_rect_history.cc | |
parent | 09185be19c2517df1d33fcfc486c230f7168ac80 (diff) | |
download | chromium_src-65319e205a77622ef623346a22cd50a1ad837044.zip chromium_src-65319e205a77622ef623346a22cd50a1ad837044.tar.gz chromium_src-65319e205a77622ef623346a22cd50a1ad837044.tar.bz2 |
cc: Add debug rects for touch and wheel event handler regions and slow scrolling areas
This change adds new debug rect types to show regions with touch or
wheel event handlers as well as areas that scroll slowly. Each rect type
also displays a label in the top left corner to make them easier to
identify.
BUG=253552
Review URL: https://chromiumcodereview.appspot.com/17599002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug/debug_rect_history.cc')
-rw-r--r-- | cc/debug/debug_rect_history.cc | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc index 7eaf6ab..24ba86e 100644 --- a/cc/debug/debug_rect_history.cc +++ b/cc/debug/debug_rect_history.cc @@ -9,6 +9,7 @@ #include "cc/layers/render_surface_impl.h" #include "cc/trees/damage_tracker.h" #include "cc/trees/layer_tree_host.h" +#include "cc/trees/layer_tree_host_common.h" namespace cc { @@ -31,6 +32,15 @@ void DebugRectHistory::SaveDebugRectsForCurrentFrame( // store all debug rects for a history of many frames. debug_rects_.clear(); + if (debug_state.show_touch_event_handler_rects) + SaveTouchEventHandlerRects(root_layer); + + if (debug_state.show_wheel_event_handler_rects) + SaveWheelEventHandlerRects(root_layer); + + if (debug_state.show_non_fast_scrollable_rects) + SaveNonFastScrollableRects(root_layer); + if (debug_state.show_paint_rects) SavePaintRects(root_layer); @@ -162,4 +172,65 @@ void DebugRectHistory::SaveNonOccludingRects( } } +void DebugRectHistory::SaveTouchEventHandlerRects(LayerImpl* layer) { + LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>( + layer, + base::Bind(&DebugRectHistory::SaveTouchEventHandlerRectsCallback, + base::Unretained(this))); +} + +void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { + for (Region::Iterator iter(layer->touch_event_handler_region()); + iter.has_rect(); + iter.next()) { + gfx::RectF touch_rect = gfx::ScaleRect(iter.rect(), + layer->contents_scale_x(), + layer->contents_scale_y()); + debug_rects_.push_back(DebugRect(TOUCH_EVENT_HANDLER_RECT_TYPE, + MathUtil::MapClippedRect( + layer->screen_space_transform(), + touch_rect))); + } +} + +void DebugRectHistory::SaveWheelEventHandlerRects(LayerImpl* layer) { + LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>( + layer, + base::Bind(&DebugRectHistory::SaveWheelEventHandlerRectsCallback, + base::Unretained(this))); +} + +void DebugRectHistory::SaveWheelEventHandlerRectsCallback(LayerImpl* layer) { + if (!layer->have_wheel_event_handlers()) + return; + + gfx::RectF wheel_rect = gfx::RectF(layer->content_bounds()); + wheel_rect.Scale(layer->contents_scale_x(), layer->contents_scale_y()); + debug_rects_.push_back(DebugRect(WHEEL_EVENT_HANDLER_RECT_TYPE, + MathUtil::MapClippedRect( + layer->screen_space_transform(), + wheel_rect))); +} + +void DebugRectHistory::SaveNonFastScrollableRects(LayerImpl* layer) { + LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>( + layer, + base::Bind(&DebugRectHistory::SaveNonFastScrollableRectsCallback, + base::Unretained(this))); +} + +void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { + for (Region::Iterator iter(layer->non_fast_scrollable_region()); + iter.has_rect(); + iter.next()) { + gfx::RectF scroll_rect = gfx::ScaleRect(iter.rect(), + layer->contents_scale_x(), + layer->contents_scale_y()); + debug_rects_.push_back(DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, + MathUtil::MapClippedRect( + layer->screen_space_transform(), + scroll_rect))); + } +} + } // namespace cc |