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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 device_scale_factor_(1.f), | 70 device_scale_factor_(1.f), |
71 painted_device_scale_factor_(1.f), | 71 painted_device_scale_factor_(1.f), |
72 elastic_overscroll_(elastic_overscroll), | 72 elastic_overscroll_(elastic_overscroll), |
73 viewport_size_invalid_(false), | 73 viewport_size_invalid_(false), |
74 needs_update_draw_properties_(true), | 74 needs_update_draw_properties_(true), |
75 needs_full_tree_sync_(true), | 75 needs_full_tree_sync_(true), |
76 next_activation_forces_redraw_(false), | 76 next_activation_forces_redraw_(false), |
77 has_ever_been_drawn_(false), | 77 has_ever_been_drawn_(false), |
78 render_surface_layer_list_id_(0), | 78 render_surface_layer_list_id_(0), |
79 have_scroll_event_handlers_(false), | 79 have_scroll_event_handlers_(false), |
80 have_wheel_event_handlers_(false), | 80 event_listener_properties_(), |
81 top_controls_shrink_blink_size_(false), | 81 top_controls_shrink_blink_size_(false), |
82 top_controls_height_(0), | 82 top_controls_height_(0), |
83 top_controls_shown_ratio_(top_controls_shown_ratio) {} | 83 top_controls_shown_ratio_(top_controls_shown_ratio) {} |
84 | 84 |
85 LayerTreeImpl::~LayerTreeImpl() { | 85 LayerTreeImpl::~LayerTreeImpl() { |
86 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS | 86 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS |
87 : SwapPromise::ACTIVATION_FAILS); | 87 : SwapPromise::ACTIVATION_FAILS); |
88 | 88 |
89 // Need to explicitly clear the tree prior to destroying this so that | 89 // Need to explicitly clear the tree prior to destroying this so that |
90 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 90 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_); | 341 inner_viewport_scroll_layer_id_, outer_viewport_scroll_layer_id_); |
342 | 342 |
343 target_tree->RegisterSelection(selection_); | 343 target_tree->RegisterSelection(selection_); |
344 | 344 |
345 // This should match the property synchronization in | 345 // This should match the property synchronization in |
346 // LayerTreeHost::finishCommitOnImplThread(). | 346 // LayerTreeHost::finishCommitOnImplThread(). |
347 target_tree->set_source_frame_number(source_frame_number()); | 347 target_tree->set_source_frame_number(source_frame_number()); |
348 target_tree->set_background_color(background_color()); | 348 target_tree->set_background_color(background_color()); |
349 target_tree->set_has_transparent_background(has_transparent_background()); | 349 target_tree->set_has_transparent_background(has_transparent_background()); |
350 target_tree->set_have_scroll_event_handlers(have_scroll_event_handlers()); | 350 target_tree->set_have_scroll_event_handlers(have_scroll_event_handlers()); |
351 target_tree->set_have_wheel_event_handlers(have_wheel_event_handlers()); | 351 target_tree->set_event_listener_properties( |
| 352 EventListenerClass::kTouch, |
| 353 event_listener_properties(EventListenerClass::kTouch)); |
| 354 target_tree->set_event_listener_properties( |
| 355 EventListenerClass::kMouseWheel, |
| 356 event_listener_properties(EventListenerClass::kMouseWheel)); |
352 | 357 |
353 if (ViewportSizeInvalid()) | 358 if (ViewportSizeInvalid()) |
354 target_tree->SetViewportSizeInvalid(); | 359 target_tree->SetViewportSizeInvalid(); |
355 else | 360 else |
356 target_tree->ResetViewportSizeInvalid(); | 361 target_tree->ResetViewportSizeInvalid(); |
357 | 362 |
358 if (hud_layer()) | 363 if (hud_layer()) |
359 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( | 364 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( |
360 LayerTreeHostCommon::FindLayerInSubtree( | 365 LayerTreeHostCommon::FindLayerInSubtree( |
361 target_tree->root_layer(), hud_layer()->id()))); | 366 target_tree->root_layer(), hud_layer()->id()))); |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1683 property_trees_.transform_tree, property_trees_.clip_tree, | 1688 property_trees_.transform_tree, property_trees_.clip_tree, |
1684 use_property_trees, &data_for_recursion); | 1689 use_property_trees, &data_for_recursion); |
1685 return data_for_recursion.closest_match; | 1690 return data_for_recursion.closest_match; |
1686 } | 1691 } |
1687 | 1692 |
1688 struct HitTestVisibleScrollableOrTouchableFunctor { | 1693 struct HitTestVisibleScrollableOrTouchableFunctor { |
1689 bool operator()(LayerImpl* layer) const { | 1694 bool operator()(LayerImpl* layer) const { |
1690 return layer->IsDrawnRenderSurfaceLayerListMember() || | 1695 return layer->IsDrawnRenderSurfaceLayerListMember() || |
1691 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || | 1696 ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) || |
1692 !layer->touch_event_handler_region().IsEmpty() || | 1697 !layer->touch_event_handler_region().IsEmpty() || |
1693 layer->layer_tree_impl()->have_wheel_event_handlers(); | 1698 layer->layer_tree_impl()->event_listener_properties( |
| 1699 EventListenerClass::kMouseWheel) != |
| 1700 EventListenerProperties::kNone; |
1694 } | 1701 } |
1695 }; | 1702 }; |
1696 | 1703 |
1697 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( | 1704 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( |
1698 const gfx::PointF& screen_space_point) { | 1705 const gfx::PointF& screen_space_point) { |
1699 if (!root_layer()) | 1706 if (!root_layer()) |
1700 return NULL; | 1707 return NULL; |
1701 bool update_lcd_text = false; | 1708 bool update_lcd_text = false; |
1702 if (!UpdateDrawProperties(update_lcd_text)) | 1709 if (!UpdateDrawProperties(update_lcd_text)) |
1703 return NULL; | 1710 return NULL; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 const gfx::BoxF& box, | 2050 const gfx::BoxF& box, |
2044 gfx::BoxF* bounds) const { | 2051 gfx::BoxF* bounds) const { |
2045 *bounds = gfx::BoxF(); | 2052 *bounds = gfx::BoxF(); |
2046 return layer_tree_host_impl_->animation_host() | 2053 return layer_tree_host_impl_->animation_host() |
2047 ? layer_tree_host_impl_->animation_host() | 2054 ? layer_tree_host_impl_->animation_host() |
2048 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) | 2055 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) |
2049 : true; | 2056 : true; |
2050 } | 2057 } |
2051 | 2058 |
2052 } // namespace cc | 2059 } // namespace cc |
OLD | NEW |