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

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

Issue 1639363002: Move have_wheel_event_handlers to WebLayerTreeView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 10 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_(MutableProperty::kNone), 69 mutable_properties_(MutableProperty::kNone),
70 main_thread_scrolling_reasons_( 70 main_thread_scrolling_reasons_(
71 MainThreadScrollingReason::kNotScrollingOnMain), 71 MainThreadScrollingReason::kNotScrollingOnMain),
72 should_flatten_transform_from_property_tree_(false), 72 should_flatten_transform_from_property_tree_(false),
73 have_wheel_event_handlers_(false),
74 have_scroll_event_handlers_(false), 73 have_scroll_event_handlers_(false),
75 user_scrollable_horizontal_(true), 74 user_scrollable_horizontal_(true),
76 user_scrollable_vertical_(true), 75 user_scrollable_vertical_(true),
77 is_root_for_isolated_group_(false), 76 is_root_for_isolated_group_(false),
78 is_container_for_fixed_position_layers_(false), 77 is_container_for_fixed_position_layers_(false),
79 is_drawable_(false), 78 is_drawable_(false),
80 draws_content_(false), 79 draws_content_(false),
81 hide_layer_and_subtree_(false), 80 hide_layer_and_subtree_(false),
82 masks_to_bounds_(false), 81 masks_to_bounds_(false),
83 contents_opaque_(false), 82 contents_opaque_(false),
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 960
962 void Layer::ClearMainThreadScrollingReasons() { 961 void Layer::ClearMainThreadScrollingReasons() {
963 DCHECK(IsPropertyChangeAllowed()); 962 DCHECK(IsPropertyChangeAllowed());
964 if (!main_thread_scrolling_reasons_) 963 if (!main_thread_scrolling_reasons_)
965 return; 964 return;
966 main_thread_scrolling_reasons_ = 965 main_thread_scrolling_reasons_ =
967 MainThreadScrollingReason::kNotScrollingOnMain; 966 MainThreadScrollingReason::kNotScrollingOnMain;
968 SetNeedsCommit(); 967 SetNeedsCommit();
969 } 968 }
970 969
971 void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
972 DCHECK(IsPropertyChangeAllowed());
973 if (have_wheel_event_handlers_ == have_wheel_event_handlers)
974 return;
975
976 have_wheel_event_handlers_ = have_wheel_event_handlers;
977 SetNeedsCommit();
978 }
979
980 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) { 970 void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
981 DCHECK(IsPropertyChangeAllowed()); 971 DCHECK(IsPropertyChangeAllowed());
982 if (have_scroll_event_handlers_ == have_scroll_event_handlers) 972 if (have_scroll_event_handlers_ == have_scroll_event_handlers)
983 return; 973 return;
984 have_scroll_event_handlers_ = have_scroll_event_handlers; 974 have_scroll_event_handlers_ = have_scroll_event_handlers;
985 SetNeedsCommit(); 975 SetNeedsCommit();
986 } 976 }
987 977
988 void Layer::SetNonFastScrollableRegion(const Region& region) { 978 void Layer::SetNonFastScrollableRegion(const Region& region) {
989 DCHECK(IsPropertyChangeAllowed()); 979 DCHECK(IsPropertyChangeAllowed());
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 layer->SetDrawsContent(DrawsContent()); 1193 layer->SetDrawsContent(DrawsContent());
1204 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 1194 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
1205 layer->SetHasRenderSurface(has_render_surface_); 1195 layer->SetHasRenderSurface(has_render_surface_);
1206 layer->SetForceRenderSurface(force_render_surface_); 1196 layer->SetForceRenderSurface(force_render_surface_);
1207 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) 1197 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating())
1208 layer->SetFilters(filters_); 1198 layer->SetFilters(filters_);
1209 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); 1199 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly()));
1210 layer->SetBackgroundFilters(background_filters()); 1200 layer->SetBackgroundFilters(background_filters());
1211 layer->SetMasksToBounds(masks_to_bounds_); 1201 layer->SetMasksToBounds(masks_to_bounds_);
1212 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); 1202 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
1213 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
1214 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); 1203 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
1215 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 1204 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
1216 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 1205 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
1217 layer->SetScrollBlocksOn(scroll_blocks_on_); 1206 layer->SetScrollBlocksOn(scroll_blocks_on_);
1218 layer->SetContentsOpaque(contents_opaque_); 1207 layer->SetContentsOpaque(contents_opaque_);
1219 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) 1208 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
1220 layer->SetOpacity(opacity_); 1209 layer->SetOpacity(opacity_);
1221 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); 1210 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
1222 layer->SetBlendMode(blend_mode_); 1211 layer->SetBlendMode(blend_mode_);
1223 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); 1212 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 base->set_double_sided(double_sided_); 1463 base->set_double_sided(double_sided_);
1475 base->set_draws_content(draws_content_); 1464 base->set_draws_content(draws_content_);
1476 base->set_hide_layer_and_subtree(hide_layer_and_subtree_); 1465 base->set_hide_layer_and_subtree(hide_layer_and_subtree_);
1477 base->set_has_render_surface(has_render_surface_); 1466 base->set_has_render_surface(has_render_surface_);
1478 1467
1479 // TODO(nyquist): Add support for serializing FilterOperations for 1468 // TODO(nyquist): Add support for serializing FilterOperations for
1480 // |filters_| and |background_filters_|. See crbug.com/541321. 1469 // |filters_| and |background_filters_|. See crbug.com/541321.
1481 1470
1482 base->set_masks_to_bounds(masks_to_bounds_); 1471 base->set_masks_to_bounds(masks_to_bounds_);
1483 base->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); 1472 base->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
1484 base->set_have_wheel_event_handlers(have_wheel_event_handlers_);
1485 base->set_have_scroll_event_handlers(have_scroll_event_handlers_); 1473 base->set_have_scroll_event_handlers(have_scroll_event_handlers_);
1486 RegionToProto(non_fast_scrollable_region_, 1474 RegionToProto(non_fast_scrollable_region_,
1487 base->mutable_non_fast_scrollable_region()); 1475 base->mutable_non_fast_scrollable_region());
1488 RegionToProto(touch_event_handler_region_, 1476 RegionToProto(touch_event_handler_region_,
1489 base->mutable_touch_event_handler_region()); 1477 base->mutable_touch_event_handler_region());
1490 base->set_scroll_blocks_on(scroll_blocks_on_); 1478 base->set_scroll_blocks_on(scroll_blocks_on_);
1491 base->set_contents_opaque(contents_opaque_); 1479 base->set_contents_opaque(contents_opaque_);
1492 base->set_opacity(opacity_); 1480 base->set_opacity(opacity_);
1493 base->set_blend_mode(SkXfermodeModeToProto(blend_mode_)); 1481 base->set_blend_mode(SkXfermodeModeToProto(blend_mode_));
1494 base->set_is_root_for_isolated_group(is_root_for_isolated_group_); 1482 base->set_is_root_for_isolated_group(is_root_for_isolated_group_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 effect_tree_index_ = base.effect_tree_index(); 1548 effect_tree_index_ = base.effect_tree_index();
1561 clip_tree_index_ = base.clip_tree_index(); 1549 clip_tree_index_ = base.clip_tree_index();
1562 offset_to_transform_parent_ = 1550 offset_to_transform_parent_ =
1563 ProtoToVector2dF(base.offset_to_transform_parent()); 1551 ProtoToVector2dF(base.offset_to_transform_parent());
1564 double_sided_ = base.double_sided(); 1552 double_sided_ = base.double_sided();
1565 draws_content_ = base.draws_content(); 1553 draws_content_ = base.draws_content();
1566 hide_layer_and_subtree_ = base.hide_layer_and_subtree(); 1554 hide_layer_and_subtree_ = base.hide_layer_and_subtree();
1567 has_render_surface_ = base.has_render_surface(); 1555 has_render_surface_ = base.has_render_surface();
1568 masks_to_bounds_ = base.masks_to_bounds(); 1556 masks_to_bounds_ = base.masks_to_bounds();
1569 main_thread_scrolling_reasons_ = base.main_thread_scrolling_reasons(); 1557 main_thread_scrolling_reasons_ = base.main_thread_scrolling_reasons();
1570 have_wheel_event_handlers_ = base.have_wheel_event_handlers();
1571 have_scroll_event_handlers_ = base.have_scroll_event_handlers(); 1558 have_scroll_event_handlers_ = base.have_scroll_event_handlers();
1572 non_fast_scrollable_region_ = 1559 non_fast_scrollable_region_ =
1573 RegionFromProto(base.non_fast_scrollable_region()); 1560 RegionFromProto(base.non_fast_scrollable_region());
1574 touch_event_handler_region_ = 1561 touch_event_handler_region_ =
1575 RegionFromProto(base.touch_event_handler_region()); 1562 RegionFromProto(base.touch_event_handler_region());
1576 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on(); 1563 scroll_blocks_on_ = (ScrollBlocksOn)base.scroll_blocks_on();
1577 contents_opaque_ = base.contents_opaque(); 1564 contents_opaque_ = base.contents_opaque();
1578 opacity_ = base.opacity(); 1565 opacity_ = base.opacity();
1579 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode()); 1566 blend_mode_ = SkXfermodeModeFromProto(base.blend_mode());
1580 is_root_for_isolated_group_ = base.is_root_for_isolated_group(); 1567 is_root_for_isolated_group_ = base.is_root_for_isolated_group();
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 this, layer_tree_host_->property_trees()->transform_tree); 2019 this, layer_tree_host_->property_trees()->transform_tree);
2033 } 2020 }
2034 2021
2035 gfx::Transform Layer::screen_space_transform() const { 2022 gfx::Transform Layer::screen_space_transform() const {
2036 DCHECK_NE(transform_tree_index_, -1); 2023 DCHECK_NE(transform_tree_index_, -1);
2037 return ScreenSpaceTransformFromPropertyTrees( 2024 return ScreenSpaceTransformFromPropertyTrees(
2038 this, layer_tree_host_->property_trees()->transform_tree); 2025 this, layer_tree_host_->property_trees()->transform_tree);
2039 } 2026 }
2040 2027
2041 } // namespace cc 2028 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698