Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: cc/layers/layer.cc

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Fix Android/ChromeOS build problems with bit packed enum class Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 scroll_clip_layer_id_(INVALID_ID), 62 scroll_clip_layer_id_(INVALID_ID),
63 num_descendants_that_draw_content_(0), 63 num_descendants_that_draw_content_(0),
64 transform_tree_index_(-1), 64 transform_tree_index_(-1),
65 effect_tree_index_(-1), 65 effect_tree_index_(-1),
66 clip_tree_index_(-1), 66 clip_tree_index_(-1),
67 property_tree_sequence_number_(-1), 67 property_tree_sequence_number_(-1),
68 element_id_(0), 68 element_id_(0),
69 mutable_properties_(kMutablePropertyNone), 69 mutable_properties_(kMutablePropertyNone),
70 should_flatten_transform_from_property_tree_(false), 70 should_flatten_transform_from_property_tree_(false),
71 should_scroll_on_main_thread_(false), 71 should_scroll_on_main_thread_(false),
72 have_wheel_event_handlers_(false),
73 have_scroll_event_handlers_(false), 72 have_scroll_event_handlers_(false),
74 user_scrollable_horizontal_(true), 73 user_scrollable_horizontal_(true),
75 user_scrollable_vertical_(true), 74 user_scrollable_vertical_(true),
76 is_root_for_isolated_group_(false), 75 is_root_for_isolated_group_(false),
77 is_container_for_fixed_position_layers_(false), 76 is_container_for_fixed_position_layers_(false),
78 is_drawable_(false), 77 is_drawable_(false),
79 draws_content_(false), 78 draws_content_(false),
80 hide_layer_and_subtree_(false), 79 hide_layer_and_subtree_(false),
81 masks_to_bounds_(false), 80 masks_to_bounds_(false),
82 contents_opaque_(false), 81 contents_opaque_(false),
83 double_sided_(true), 82 double_sided_(true),
84 should_flatten_transform_(true), 83 should_flatten_transform_(true),
85 use_parent_backface_visibility_(false), 84 use_parent_backface_visibility_(false),
86 force_render_surface_(false), 85 force_render_surface_(false),
87 transform_is_invertible_(true), 86 transform_is_invertible_(true),
88 has_render_surface_(false), 87 has_render_surface_(false),
89 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), 88 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
89 touch_event_properties_(EventListenerProperties::NONE),
90 wheel_event_properties_(EventListenerProperties::NONE),
90 background_color_(0), 91 background_color_(0),
91 opacity_(1.f), 92 opacity_(1.f),
92 blend_mode_(SkXfermode::kSrcOver_Mode), 93 blend_mode_(SkXfermode::kSrcOver_Mode),
93 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 94 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
94 scroll_parent_(nullptr), 95 scroll_parent_(nullptr),
95 layer_or_descendant_is_drawn_tracker_(0), 96 layer_or_descendant_is_drawn_tracker_(0),
96 sorted_for_recursion_tracker_(0), 97 sorted_for_recursion_tracker_(0),
97 visited_tracker_(0), 98 visited_tracker_(0),
98 clip_parent_(nullptr), 99 clip_parent_(nullptr),
99 replica_layer_(nullptr), 100 replica_layer_(nullptr),
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 950 }
950 951
951 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { 952 void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
952 DCHECK(IsPropertyChangeAllowed()); 953 DCHECK(IsPropertyChangeAllowed());
953 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread) 954 if (should_scroll_on_main_thread_ == should_scroll_on_main_thread)
954 return; 955 return;
955 should_scroll_on_main_thread_ = should_scroll_on_main_thread; 956 should_scroll_on_main_thread_ = should_scroll_on_main_thread;
956 SetNeedsCommit(); 957 SetNeedsCommit();
957 } 958 }
958 959
959 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { 960 void Layer::SetTouchEventProperties(
961 EventListenerProperties touch_event_properties) {
960 DCHECK(IsPropertyChangeAllowed()); 962 DCHECK(IsPropertyChangeAllowed());
961 if (have_wheel_event_handlers_ == have_wheel_event_handlers) 963 if (touch_event_properties_ == touch_event_properties)
962 return; 964 return;
963 965
964 have_wheel_event_handlers_ = have_wheel_event_handlers; 966 touch_event_properties_ = touch_event_properties;
965 SetNeedsCommit(); 967 SetNeedsCommit();
966 } 968 }
967 969
970 void Layer::SetWheelEventProperties(
971 EventListenerProperties wheel_event_properties) {
972 DCHECK(IsPropertyChangeAllowed());
973 if (wheel_event_properties_ == wheel_event_properties)
974 return;
975
976 wheel_event_properties_ = wheel_event_properties;
977 SetNeedsCommit();
978 }
979
968 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) { 980 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
969 DCHECK(IsPropertyChangeAllowed()); 981 DCHECK(IsPropertyChangeAllowed());
970 if (have_scroll_event_handlers_ == have_scroll_event_handlers) 982 if (have_scroll_event_handlers_ == have_scroll_event_handlers)
971 return; 983 return;
972 have_scroll_event_handlers_ = have_scroll_event_handlers; 984 have_scroll_event_handlers_ = have_scroll_event_handlers;
973 SetNeedsCommit(); 985 SetNeedsCommit();
974 } 986 }
975 987
976 void Layer::SetNonFastScrollableRegion(const Region& region) { 988 void Layer::SetNonFastScrollableRegion(const Region& region) {
977 DCHECK(IsPropertyChangeAllowed()); 989 DCHECK(IsPropertyChangeAllowed());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 layer->SetDrawsContent(DrawsContent()); 1202 layer->SetDrawsContent(DrawsContent());
1191 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 1203 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
1192 layer->SetHasRenderSurface(has_render_surface_); 1204 layer->SetHasRenderSurface(has_render_surface_);
1193 layer->SetForceRenderSurface(force_render_surface_); 1205 layer->SetForceRenderSurface(force_render_surface_);
1194 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) 1206 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating())
1195 layer->SetFilters(filters_); 1207 layer->SetFilters(filters_);
1196 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); 1208 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly()));
1197 layer->SetBackgroundFilters(background_filters()); 1209 layer->SetBackgroundFilters(background_filters());
1198 layer->SetMasksToBounds(masks_to_bounds_); 1210 layer->SetMasksToBounds(masks_to_bounds_);
1199 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 1211 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
1200 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 1212 layer->SetTouchEventProperties(touch_event_properties_);
1213 layer->SetWheelEventProperties(wheel_event_properties_);
1201 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); 1214 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
1202 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 1215 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
1203 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 1216 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
1204 layer->SetScrollBlocksOn(scroll_blocks_on_); 1217 layer->SetScrollBlocksOn(scroll_blocks_on_);
1205 layer->SetContentsOpaque(contents_opaque_); 1218 layer->SetContentsOpaque(contents_opaque_);
1206 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) 1219 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
1207 layer->SetOpacity(opacity_); 1220 layer->SetOpacity(opacity_);
1208 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); 1221 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
1209 layer->SetBlendMode(blend_mode_); 1222 layer->SetBlendMode(blend_mode_);
1210 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); 1223 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 base->set_double_sided(double_sided_); 1472 base->set_double_sided(double_sided_);
1460 base->set_draws_content(draws_content_); 1473 base->set_draws_content(draws_content_);
1461 base->set_hide_layer_and_subtree(hide_layer_and_subtree_); 1474 base->set_hide_layer_and_subtree(hide_layer_and_subtree_);
1462 base->set_has_render_surface(has_render_surface_); 1475 base->set_has_render_surface(has_render_surface_);
1463 1476
1464 // TODO(nyquist): Add support for serializing FilterOperations for 1477 // TODO(nyquist): Add support for serializing FilterOperations for
1465 // |filters_| and |background_filters_|. See crbug.com/541321. 1478 // |filters_| and |background_filters_|. See crbug.com/541321.
1466 1479
1467 base->set_masks_to_bounds(masks_to_bounds_); 1480 base->set_masks_to_bounds(masks_to_bounds_);
1468 base->set_should_scroll_on_main_thread(should_scroll_on_main_thread_); 1481 base->set_should_scroll_on_main_thread(should_scroll_on_main_thread_);
1469 base->set_have_wheel_event_handlers(have_wheel_event_handlers_); 1482 base->set_touch_event_properties(
1483 static_cast<int32_t>(touch_event_properties_));
1484 base->set_wheel_event_properties(
1485 static_cast<int32_t>(wheel_event_properties_));
1470 base->set_have_scroll_event_handlers(have_scroll_event_handlers_); 1486 base->set_have_scroll_event_handlers(have_scroll_event_handlers_);
1471 RegionToProto(non_fast_scrollable_region_, 1487 RegionToProto(non_fast_scrollable_region_,
1472 base->mutable_non_fast_scrollable_region()); 1488 base->mutable_non_fast_scrollable_region());
1473 RegionToProto(touch_event_handler_region_, 1489 RegionToProto(touch_event_handler_region_,
1474 base->mutable_touch_event_handler_region()); 1490 base->mutable_touch_event_handler_region());
1475 base->set_scroll_blocks_on(scroll_blocks_on_); 1491 base->set_scroll_blocks_on(scroll_blocks_on_);
1476 base->set_contents_opaque(contents_opaque_); 1492 base->set_contents_opaque(contents_opaque_);
1477 base->set_opacity(opacity_); 1493 base->set_opacity(opacity_);
1478 base->set_blend_mode(SkXfermodeModeToProto(blend_mode_)); 1494 base->set_blend_mode(SkXfermodeModeToProto(blend_mode_));
1479 base->set_is_root_for_isolated_group(is_root_for_isolated_group_); 1495 base->set_is_root_for_isolated_group(is_root_for_isolated_group_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 effect_tree_index_ = base.effect_tree_index(); 1561 effect_tree_index_ = base.effect_tree_index();
1546 clip_tree_index_ = base.clip_tree_index(); 1562 clip_tree_index_ = base.clip_tree_index();
1547 offset_to_transform_parent_ = 1563 offset_to_transform_parent_ =
1548 ProtoToVector2dF(base.offset_to_transform_parent()); 1564 ProtoToVector2dF(base.offset_to_transform_parent());
1549 double_sided_ = base.double_sided(); 1565 double_sided_ = base.double_sided();
1550 draws_content_ = base.draws_content(); 1566 draws_content_ = base.draws_content();
1551 hide_layer_and_subtree_ = base.hide_layer_and_subtree(); 1567 hide_layer_and_subtree_ = base.hide_layer_and_subtree();
1552 has_render_surface_ = base.has_render_surface(); 1568 has_render_surface_ = base.has_render_surface();
1553 masks_to_bounds_ = base.masks_to_bounds(); 1569 masks_to_bounds_ = base.masks_to_bounds();
1554 should_scroll_on_main_thread_ = base.should_scroll_on_main_thread(); 1570 should_scroll_on_main_thread_ = base.should_scroll_on_main_thread();
1555 have_wheel_event_handlers_ = base.have_wheel_event_handlers(); 1571 touch_event_properties_ =
1572 (EventListenerProperties)base.touch_event_properties();
1573 wheel_event_properties_ =
1574 (EventListenerProperties)base.wheel_event_properties();
1556 have_scroll_event_handlers_ = base.have_scroll_event_handlers(); 1575 have_scroll_event_handlers_ = base.have_scroll_event_handlers();
1557 non_fast_scrollable_region_ = 1576 non_fast_scrollable_region_ =
1558 RegionFromProto(base.non_fast_scrollable_region()); 1577 RegionFromProto(base.non_fast_scrollable_region());
1559 touch_event_handler_region_ = 1578 touch_event_handler_region_ =
1560 RegionFromProto(base.touch_event_handler_region()); 1579 RegionFromProto(base.touch_event_handler_region());
1561 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on(); 1580 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on();
1562 contents_opaque_ = base.contents_opaque(); 1581 contents_opaque_ = base.contents_opaque();
1563 opacity_ = base.opacity(); 1582 opacity_ = base.opacity();
1564 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode()); 1583 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode());
1565 is_root_for_isolated_group_ = base.is_root_for_isolated_group(); 1584 is_root_for_isolated_group_ = base.is_root_for_isolated_group();
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 this, layer_tree_host_->property_trees()->transform_tree); 2036 this, layer_tree_host_->property_trees()->transform_tree);
2018 } 2037 }
2019 2038
2020 gfx::Transform Layer::screen_space_transform() const { 2039 gfx::Transform Layer::screen_space_transform() const {
2021 DCHECK_NE(transform_tree_index_, -1); 2040 DCHECK_NE(transform_tree_index_, -1);
2022 return ScreenSpaceTransformFromPropertyTrees( 2041 return ScreenSpaceTransformFromPropertyTrees(
2023 this, layer_tree_host_->property_trees()->transform_tree); 2042 this, layer_tree_host_->property_trees()->transform_tree);
2024 } 2043 }
2025 2044
2026 } // namespace cc 2045 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698