OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.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> |
11 | 11 |
12 #include "base/atomic_sequence_num.h" | 12 #include "base/atomic_sequence_num.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "cc/animation/animation.h" | 18 #include "cc/animation/animation.h" |
19 #include "cc/animation/animation_registrar.h" | 19 #include "cc/animation/animation_registrar.h" |
20 #include "cc/animation/keyframed_animation_curve.h" | 20 #include "cc/animation/keyframed_animation_curve.h" |
21 #include "cc/animation/layer_animation_controller.h" | 21 #include "cc/animation/layer_animation_controller.h" |
22 #include "cc/animation/mutable_properties.h" | 22 #include "cc/animation/mutable_properties.h" |
23 #include "cc/base/simple_enclosed_region.h" | 23 #include "cc/base/simple_enclosed_region.h" |
24 #include "cc/debug/frame_viewer_instrumentation.h" | 24 #include "cc/debug/frame_viewer_instrumentation.h" |
| 25 #include "cc/input/main_thread_scrolling_reason.h" |
25 #include "cc/layers/layer_client.h" | 26 #include "cc/layers/layer_client.h" |
26 #include "cc/layers/layer_impl.h" | 27 #include "cc/layers/layer_impl.h" |
27 #include "cc/layers/layer_proto_converter.h" | 28 #include "cc/layers/layer_proto_converter.h" |
28 #include "cc/layers/layer_settings.h" | 29 #include "cc/layers/layer_settings.h" |
29 #include "cc/layers/scrollbar_layer_interface.h" | 30 #include "cc/layers/scrollbar_layer_interface.h" |
30 #include "cc/output/copy_output_request.h" | 31 #include "cc/output/copy_output_request.h" |
31 #include "cc/output/copy_output_result.h" | 32 #include "cc/output/copy_output_result.h" |
32 #include "cc/proto/cc_conversions.h" | 33 #include "cc/proto/cc_conversions.h" |
33 #include "cc/proto/gfx_conversions.h" | 34 #include "cc/proto/gfx_conversions.h" |
34 #include "cc/proto/layer.pb.h" | 35 #include "cc/proto/layer.pb.h" |
(...skipping 24 matching lines...) Expand all Loading... |
59 parent_(nullptr), | 60 parent_(nullptr), |
60 layer_tree_host_(nullptr), | 61 layer_tree_host_(nullptr), |
61 scroll_clip_layer_id_(INVALID_ID), | 62 scroll_clip_layer_id_(INVALID_ID), |
62 num_descendants_that_draw_content_(0), | 63 num_descendants_that_draw_content_(0), |
63 transform_tree_index_(-1), | 64 transform_tree_index_(-1), |
64 effect_tree_index_(-1), | 65 effect_tree_index_(-1), |
65 clip_tree_index_(-1), | 66 clip_tree_index_(-1), |
66 property_tree_sequence_number_(-1), | 67 property_tree_sequence_number_(-1), |
67 element_id_(0), | 68 element_id_(0), |
68 mutable_properties_(kMutablePropertyNone), | 69 mutable_properties_(kMutablePropertyNone), |
69 main_thread_scrolling_reasons_(InputHandler::NOT_SCROLLING_ON_MAIN), | 70 main_thread_scrolling_reasons_( |
| 71 MainThreadScrollingReason::kNotScrollingOnMain), |
70 should_flatten_transform_from_property_tree_(false), | 72 should_flatten_transform_from_property_tree_(false), |
71 have_wheel_event_handlers_(false), | 73 have_wheel_event_handlers_(false), |
72 have_scroll_event_handlers_(false), | 74 have_scroll_event_handlers_(false), |
73 user_scrollable_horizontal_(true), | 75 user_scrollable_horizontal_(true), |
74 user_scrollable_vertical_(true), | 76 user_scrollable_vertical_(true), |
75 is_root_for_isolated_group_(false), | 77 is_root_for_isolated_group_(false), |
76 is_container_for_fixed_position_layers_(false), | 78 is_container_for_fixed_position_layers_(false), |
77 is_drawable_(false), | 79 is_drawable_(false), |
78 draws_content_(false), | 80 draws_content_(false), |
79 hide_layer_and_subtree_(false), | 81 hide_layer_and_subtree_(false), |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 DCHECK(IsPropertyChangeAllowed()); | 943 DCHECK(IsPropertyChangeAllowed()); |
942 if (user_scrollable_horizontal_ == horizontal && | 944 if (user_scrollable_horizontal_ == horizontal && |
943 user_scrollable_vertical_ == vertical) | 945 user_scrollable_vertical_ == vertical) |
944 return; | 946 return; |
945 user_scrollable_horizontal_ = horizontal; | 947 user_scrollable_horizontal_ = horizontal; |
946 user_scrollable_vertical_ = vertical; | 948 user_scrollable_vertical_ = vertical; |
947 SetNeedsCommit(); | 949 SetNeedsCommit(); |
948 } | 950 } |
949 | 951 |
950 void Layer::AddMainThreadScrollingReasons( | 952 void Layer::AddMainThreadScrollingReasons( |
951 InputHandler::MainThreadScrollingReason main_thread_scrolling_reasons) { | 953 uint32_t main_thread_scrolling_reasons) { |
952 DCHECK(IsPropertyChangeAllowed()); | 954 DCHECK(IsPropertyChangeAllowed()); |
953 DCHECK(main_thread_scrolling_reasons); | 955 DCHECK(main_thread_scrolling_reasons); |
954 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) | 956 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) |
955 return; | 957 return; |
956 main_thread_scrolling_reasons_ |= main_thread_scrolling_reasons; | 958 main_thread_scrolling_reasons_ |= main_thread_scrolling_reasons; |
957 SetNeedsCommit(); | 959 SetNeedsCommit(); |
958 } | 960 } |
959 | 961 |
960 void Layer::ClearMainThreadScrollingReasons() { | 962 void Layer::ClearMainThreadScrollingReasons() { |
961 DCHECK(IsPropertyChangeAllowed()); | 963 DCHECK(IsPropertyChangeAllowed()); |
962 if (!main_thread_scrolling_reasons_) | 964 if (!main_thread_scrolling_reasons_) |
963 return; | 965 return; |
964 main_thread_scrolling_reasons_ = InputHandler::NOT_SCROLLING_ON_MAIN; | 966 main_thread_scrolling_reasons_ = |
| 967 MainThreadScrollingReason::kNotScrollingOnMain; |
965 SetNeedsCommit(); | 968 SetNeedsCommit(); |
966 } | 969 } |
967 | 970 |
968 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { | 971 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { |
969 DCHECK(IsPropertyChangeAllowed()); | 972 DCHECK(IsPropertyChangeAllowed()); |
970 if (have_wheel_event_handlers_ == have_wheel_event_handlers) | 973 if (have_wheel_event_handlers_ == have_wheel_event_handlers) |
971 return; | 974 return; |
972 | 975 |
973 have_wheel_event_handlers_ = have_wheel_event_handlers; | 976 have_wheel_event_handlers_ = have_wheel_event_handlers; |
974 SetNeedsCommit(); | 977 SetNeedsCommit(); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 transform_tree_index_ = base.transform_free_index(); | 1559 transform_tree_index_ = base.transform_free_index(); |
1557 effect_tree_index_ = base.effect_tree_index(); | 1560 effect_tree_index_ = base.effect_tree_index(); |
1558 clip_tree_index_ = base.clip_tree_index(); | 1561 clip_tree_index_ = base.clip_tree_index(); |
1559 offset_to_transform_parent_ = | 1562 offset_to_transform_parent_ = |
1560 ProtoToVector2dF(base.offset_to_transform_parent()); | 1563 ProtoToVector2dF(base.offset_to_transform_parent()); |
1561 double_sided_ = base.double_sided(); | 1564 double_sided_ = base.double_sided(); |
1562 draws_content_ = base.draws_content(); | 1565 draws_content_ = base.draws_content(); |
1563 hide_layer_and_subtree_ = base.hide_layer_and_subtree(); | 1566 hide_layer_and_subtree_ = base.hide_layer_and_subtree(); |
1564 has_render_surface_ = base.has_render_surface(); | 1567 has_render_surface_ = base.has_render_surface(); |
1565 masks_to_bounds_ = base.masks_to_bounds(); | 1568 masks_to_bounds_ = base.masks_to_bounds(); |
1566 main_thread_scrolling_reasons_ = | 1569 main_thread_scrolling_reasons_ = base.main_thread_scrolling_reasons(); |
1567 static_cast<InputHandler::MainThreadScrollingReason>( | |
1568 base.main_thread_scrolling_reasons()); | |
1569 have_wheel_event_handlers_ = base.have_wheel_event_handlers(); | 1570 have_wheel_event_handlers_ = base.have_wheel_event_handlers(); |
1570 have_scroll_event_handlers_ = base.have_scroll_event_handlers(); | 1571 have_scroll_event_handlers_ = base.have_scroll_event_handlers(); |
1571 non_fast_scrollable_region_ = | 1572 non_fast_scrollable_region_ = |
1572 RegionFromProto(base.non_fast_scrollable_region()); | 1573 RegionFromProto(base.non_fast_scrollable_region()); |
1573 touch_event_handler_region_ = | 1574 touch_event_handler_region_ = |
1574 RegionFromProto(base.touch_event_handler_region()); | 1575 RegionFromProto(base.touch_event_handler_region()); |
1575 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on(); | 1576 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on(); |
1576 contents_opaque_ = base.contents_opaque(); | 1577 contents_opaque_ = base.contents_opaque(); |
1577 opacity_ = base.opacity(); | 1578 opacity_ = base.opacity(); |
1578 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode()); | 1579 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode()); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 this, layer_tree_host_->property_trees()->transform_tree); | 2032 this, layer_tree_host_->property_trees()->transform_tree); |
2032 } | 2033 } |
2033 | 2034 |
2034 gfx::Transform Layer::screen_space_transform() const { | 2035 gfx::Transform Layer::screen_space_transform() const { |
2035 DCHECK_NE(transform_tree_index_, -1); | 2036 DCHECK_NE(transform_tree_index_, -1); |
2036 return ScreenSpaceTransformFromPropertyTrees( | 2037 return ScreenSpaceTransformFromPropertyTrees( |
2037 this, layer_tree_host_->property_trees()->transform_tree); | 2038 this, layer_tree_host_->property_trees()->transform_tree); |
2038 } | 2039 } |
2039 | 2040 |
2040 } // namespace cc | 2041 } // namespace cc |
OLD | NEW |