OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 device_scale_factor_(1.f), | 79 device_scale_factor_(1.f), |
80 painted_device_scale_factor_(1.f), | 80 painted_device_scale_factor_(1.f), |
81 elastic_overscroll_(elastic_overscroll), | 81 elastic_overscroll_(elastic_overscroll), |
82 viewport_size_invalid_(false), | 82 viewport_size_invalid_(false), |
83 needs_update_draw_properties_(true), | 83 needs_update_draw_properties_(true), |
84 needs_full_tree_sync_(true), | 84 needs_full_tree_sync_(true), |
85 next_activation_forces_redraw_(false), | 85 next_activation_forces_redraw_(false), |
86 has_ever_been_drawn_(false), | 86 has_ever_been_drawn_(false), |
87 render_surface_layer_list_id_(0), | 87 render_surface_layer_list_id_(0), |
88 have_scroll_event_handlers_(false), | 88 have_scroll_event_handlers_(false), |
89 have_wheel_event_handlers_(false), | 89 event_listener_properties_(), |
90 top_controls_shrink_blink_size_(false), | 90 top_controls_shrink_blink_size_(false), |
91 top_controls_height_(0), | 91 top_controls_height_(0), |
92 top_controls_shown_ratio_(top_controls_shown_ratio) {} | 92 top_controls_shown_ratio_(top_controls_shown_ratio) {} |
93 | 93 |
94 LayerTreeImpl::~LayerTreeImpl() { | 94 LayerTreeImpl::~LayerTreeImpl() { |
95 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS | 95 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS |
96 : SwapPromise::ACTIVATION_FAILS); | 96 : SwapPromise::ACTIVATION_FAILS); |
97 | 97 |
98 // Need to explicitly clear the tree prior to destroying this so that | 98 // Need to explicitly clear the tree prior to destroying this so that |
99 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 99 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_); | 350 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_); |
351 | 351 |
352 target_tree->RegisterSelection(selection_); | 352 target_tree->RegisterSelection(selection_); |
353 | 353 |
354 // This should match the property synchronization in | 354 // This should match the property synchronization in |
355 // LayerTreeHost::finishCommitOnImplThread(). | 355 // LayerTreeHost::finishCommitOnImplThread(). |
356 target_tree->set_source_frame_number(source_frame_number()); | 356 target_tree->set_source_frame_number(source_frame_number()); |
357 target_tree->set_background_color(background_color()); | 357 target_tree->set_background_color(background_color()); |
358 target_tree->set_has_transparent_background(has_transparent_background()); | 358 target_tree->set_has_transparent_background(has_transparent_background()); |
359 target_tree->set_have_scroll_event_handlers(have_scroll_event_handlers()); | 359 target_tree->set_have_scroll_event_handlers(have_scroll_event_handlers()); |
360 target_tree->set_have_wheel_event_handlers(have_wheel_event_handlers()); | 360 target_tree->set_event_listener_properties( |
| 361 EventListenerClass::kTouch, |
| 362 event_listener_properties(EventListenerClass::kTouch)); |
| 363 target_tree->set_event_listener_properties( |
| 364 EventListenerClass::kMouseWheel, |
| 365 event_listener_properties(EventListenerClass::kMouseWheel)); |
361 | 366 |
362 if (ViewportSizeInvalid()) | 367 if (ViewportSizeInvalid()) |
363 target_tree->SetViewportSizeInvalid(); | 368 target_tree->SetViewportSizeInvalid(); |
364 else | 369 else |
365 target_tree->ResetViewportSizeInvalid(); | 370 target_tree->ResetViewportSizeInvalid(); |
366 | 371 |
367 if (hud_layer()) | 372 if (hud_layer()) |
368 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( | 373 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( |
369 LayerTreeHostCommon::FindLayerInSubtree( | 374 LayerTreeHostCommon::FindLayerInSubtree( |
370 target_tree->root_layer(), hud_layer()->id()))); | 375 target_tree->root_layer(), hud_layer()->id()))); |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 property_trees_.transform_tree, property_trees_.clip_tree, | 1701 property_trees_.transform_tree, property_trees_.clip_tree, |
1697 use_property_trees, &data_for_recursion); | 1702 use_property_trees, &data_for_recursion); |
1698 return data_for_recursion.closest_match; | 1703 return data_for_recursion.closest_match; |
1699 } | 1704 } |
1700 | 1705 |
1701 struct HitTestVisibleScrollableOrTouchableFunctor { | 1706 struct HitTestVisibleScrollableOrTouchableFunctor { |
1702 bool operator()(LayerImpl* layer) const { | 1707 bool operator()(LayerImpl* layer) const { |
1703 return layer->IsDrawnRenderSurfaceLayerListMember() || | 1708 return layer->IsDrawnRenderSurfaceLayerListMember() || |
1704 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || | 1709 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || |
1705 !layer->touch_event_handler_region().IsEmpty() || | 1710 !layer->touch_event_handler_region().IsEmpty() || |
1706 layer->layer_tree_impl()->have_wheel_event_handlers(); | 1711 layer->layer_tree_impl()->event_listener_properties( |
| 1712 EventListenerClass::kMouseWheel) != |
| 1713 EventListenerProperties::kNone; |
1707 } | 1714 } |
1708 }; | 1715 }; |
1709 | 1716 |
1710 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( | 1717 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( |
1711 const gfx::PointF& screen_space_point) { | 1718 const gfx::PointF& screen_space_point) { |
1712 if (!root_layer()) | 1719 if (!root_layer()) |
1713 return NULL; | 1720 return NULL; |
1714 bool update_lcd_text = false; | 1721 bool update_lcd_text = false; |
1715 if (!UpdateDrawProperties(update_lcd_text)) | 1722 if (!UpdateDrawProperties(update_lcd_text)) |
1716 return NULL; | 1723 return NULL; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 const gfx::BoxF& box, | 2063 const gfx::BoxF& box, |
2057 gfx::BoxF* bounds) const { | 2064 gfx::BoxF* bounds) const { |
2058 *bounds = gfx::BoxF(); | 2065 *bounds = gfx::BoxF(); |
2059 return layer_tree_host_impl_->animation_host() | 2066 return layer_tree_host_impl_->animation_host() |
2060 ? layer_tree_host_impl_->animation_host() | 2067 ? layer_tree_host_impl_->animation_host() |
2061 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 2068 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
2062 : true; | 2069 : true; |
2063 } | 2070 } |
2064 | 2071 |
2065 } // namespace cc | 2072 } // namespace cc |
OLD | NEW |