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

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

Issue 1642093002: Purge the ScrollBlocksOn code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build failures 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
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 mask_layer_id_(-1), 55 mask_layer_id_(-1),
56 replica_layer_id_(-1), 56 replica_layer_id_(-1),
57 layer_id_(id), 57 layer_id_(id),
58 layer_tree_impl_(tree_impl), 58 layer_tree_impl_(tree_impl),
59 scroll_offset_(scroll_offset), 59 scroll_offset_(scroll_offset),
60 scroll_clip_layer_id_(Layer::INVALID_ID), 60 scroll_clip_layer_id_(Layer::INVALID_ID),
61 main_thread_scrolling_reasons_( 61 main_thread_scrolling_reasons_(
62 MainThreadScrollingReason::kNotScrollingOnMain), 62 MainThreadScrollingReason::kNotScrollingOnMain),
63 have_wheel_event_handlers_(false), 63 have_wheel_event_handlers_(false),
64 have_scroll_event_handlers_(false), 64 have_scroll_event_handlers_(false),
65 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
66 user_scrollable_horizontal_(true), 65 user_scrollable_horizontal_(true),
67 user_scrollable_vertical_(true), 66 user_scrollable_vertical_(true),
68 stacking_order_changed_(false), 67 stacking_order_changed_(false),
69 double_sided_(true), 68 double_sided_(true),
70 should_flatten_transform_(true), 69 should_flatten_transform_(true),
71 should_flatten_transform_from_property_tree_(false), 70 should_flatten_transform_from_property_tree_(false),
72 layer_property_changed_(false), 71 layer_property_changed_(false),
73 masks_to_bounds_(false), 72 masks_to_bounds_(false),
74 contents_opaque_(false), 73 contents_opaque_(false),
75 is_root_for_isolated_group_(false), 74 is_root_for_isolated_group_(false),
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 : user_scrollable_vertical_; 504 : user_scrollable_vertical_;
506 } 505 }
507 506
508 void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() { 507 void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() {
509 DCHECK(layer_tree_impl()->IsActiveTree()); 508 DCHECK(layer_tree_impl()->IsActiveTree());
510 scroll_offset_->AbortCommit(); 509 scroll_offset_->AbortCommit();
511 } 510 }
512 511
513 InputHandler::ScrollStatus LayerImpl::TryScroll( 512 InputHandler::ScrollStatus LayerImpl::TryScroll(
514 const gfx::PointF& screen_space_point, 513 const gfx::PointF& screen_space_point,
515 InputHandler::ScrollInputType type, 514 InputHandler::ScrollInputType type) const {
516 ScrollBlocksOn effective_block_mode) const {
517 InputHandler::ScrollStatus scroll_status; 515 InputHandler::ScrollStatus scroll_status;
518 scroll_status.main_thread_scrolling_reasons = 516 scroll_status.main_thread_scrolling_reasons =
519 MainThreadScrollingReason::kNotScrollingOnMain; 517 MainThreadScrollingReason::kNotScrollingOnMain;
520 if (should_scroll_on_main_thread()) { 518 if (should_scroll_on_main_thread()) {
521 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread"); 519 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread");
522 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; 520 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD;
523 scroll_status.main_thread_scrolling_reasons = 521 scroll_status.main_thread_scrolling_reasons =
524 main_thread_scrolling_reasons_; 522 main_thread_scrolling_reasons_;
525 return scroll_status; 523 return scroll_status;
526 } 524 }
(...skipping 24 matching lines...) Expand all
551 gfx::ToRoundedPoint(hit_test_point_in_layer_space))) { 549 gfx::ToRoundedPoint(hit_test_point_in_layer_space))) {
552 TRACE_EVENT0("cc", 550 TRACE_EVENT0("cc",
553 "LayerImpl::tryScroll: Failed NonFastScrollableRegion"); 551 "LayerImpl::tryScroll: Failed NonFastScrollableRegion");
554 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; 552 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD;
555 scroll_status.main_thread_scrolling_reasons = 553 scroll_status.main_thread_scrolling_reasons =
556 MainThreadScrollingReason::kNonFastScrollableRegion; 554 MainThreadScrollingReason::kNonFastScrollableRegion;
557 return scroll_status; 555 return scroll_status;
558 } 556 }
559 } 557 }
560 558
561 if (have_scroll_event_handlers() &&
562 effective_block_mode & SCROLL_BLOCKS_ON_SCROLL_EVENT) {
563 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers");
564 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD;
565 scroll_status.main_thread_scrolling_reasons =
566 MainThreadScrollingReason::kEventHandlers;
567 return scroll_status;
568 }
569
570 if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) && 559 if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) &&
571 have_wheel_event_handlers() && 560 have_wheel_event_handlers()) {
572 effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) {
573 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers"); 561 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
574 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; 562 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD;
575 scroll_status.main_thread_scrolling_reasons = 563 scroll_status.main_thread_scrolling_reasons =
576 MainThreadScrollingReason::kEventHandlers; 564 MainThreadScrollingReason::kEventHandlers;
577 return scroll_status; 565 return scroll_status;
578 } 566 }
579 567
580 if (!scrollable()) { 568 if (!scrollable()) {
581 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); 569 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable");
582 scroll_status.thread = InputHandler::SCROLL_IGNORED; 570 scroll_status.thread = InputHandler::SCROLL_IGNORED;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 if (layer->has_render_surface() != has_render_surface()) 610 if (layer->has_render_surface() != has_render_surface())
623 layer->layer_tree_impl()->set_needs_update_draw_properties(); 611 layer->layer_tree_impl()->set_needs_update_draw_properties();
624 layer->SetHasRenderSurface(!!render_surface()); 612 layer->SetHasRenderSurface(!!render_surface());
625 layer->SetForceRenderSurface(force_render_surface_); 613 layer->SetForceRenderSurface(force_render_surface_);
626 layer->SetFilters(filters()); 614 layer->SetFilters(filters());
627 layer->SetBackgroundFilters(background_filters()); 615 layer->SetBackgroundFilters(background_filters());
628 layer->SetMasksToBounds(masks_to_bounds_); 616 layer->SetMasksToBounds(masks_to_bounds_);
629 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); 617 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
630 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 618 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
631 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); 619 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
632 layer->SetScrollBlocksOn(scroll_blocks_on_);
633 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 620 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
634 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 621 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
635 layer->SetContentsOpaque(contents_opaque_); 622 layer->SetContentsOpaque(contents_opaque_);
636 layer->SetOpacity(opacity_); 623 layer->SetOpacity(opacity_);
637 layer->SetBlendMode(blend_mode_); 624 layer->SetBlendMode(blend_mode_);
638 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); 625 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
639 layer->SetPosition(position_); 626 layer->SetPosition(position_);
640 layer->SetIsContainerForFixedPositionLayers( 627 layer->SetIsContainerForFixedPositionLayers(
641 is_container_for_fixed_position_layers_); 628 is_container_for_fixed_position_layers_);
642 layer->SetPositionConstraint(position_constraint_); 629 layer->SetPositionConstraint(position_constraint_);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 767
781 if (have_wheel_event_handlers_) 768 if (have_wheel_event_handlers_)
782 result->SetBoolean("WheelHandler", have_wheel_event_handlers_); 769 result->SetBoolean("WheelHandler", have_wheel_event_handlers_);
783 if (have_scroll_event_handlers_) 770 if (have_scroll_event_handlers_)
784 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); 771 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_);
785 if (!touch_event_handler_region_.IsEmpty()) { 772 if (!touch_event_handler_region_.IsEmpty()) {
786 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); 773 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue();
787 result->Set("TouchRegion", region.release()); 774 result->Set("TouchRegion", region.release());
788 } 775 }
789 776
790 if (scroll_blocks_on_) {
791 list = new base::ListValue;
792 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_START_TOUCH)
793 list->AppendString("StartTouch");
794 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_WHEEL_EVENT)
795 list->AppendString("WheelEvent");
796 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_SCROLL_EVENT)
797 list->AppendString("ScrollEvent");
798 result->Set("ScrollBlocksOn", list);
799 }
800
801 list = new base::ListValue; 777 list = new base::ListValue;
802 for (size_t i = 0; i < children_.size(); ++i) 778 for (size_t i = 0; i < children_.size(); ++i)
803 list->Append(children_[i]->LayerTreeAsJson()); 779 list->Append(children_[i]->LayerTreeAsJson());
804 result->Set("Children", list); 780 result->Set("Children", list);
805 781
806 return result; 782 return result;
807 } 783 }
808 784
809 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) { 785 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) {
810 if (stacking_order_changed) { 786 if (stacking_order_changed) {
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 Region scroll_region(scroll_rect); 1742 Region scroll_region(scroll_rect);
1767 state->BeginArray("scroll_event_handler_region"); 1743 state->BeginArray("scroll_event_handler_region");
1768 scroll_region.AsValueInto(state); 1744 scroll_region.AsValueInto(state);
1769 state->EndArray(); 1745 state->EndArray();
1770 } 1746 }
1771 if (!non_fast_scrollable_region_.IsEmpty()) { 1747 if (!non_fast_scrollable_region_.IsEmpty()) {
1772 state->BeginArray("non_fast_scrollable_region"); 1748 state->BeginArray("non_fast_scrollable_region");
1773 non_fast_scrollable_region_.AsValueInto(state); 1749 non_fast_scrollable_region_.AsValueInto(state);
1774 state->EndArray(); 1750 state->EndArray();
1775 } 1751 }
1776 if (scroll_blocks_on_) {
1777 state->SetInteger("scroll_blocks_on", scroll_blocks_on_);
1778 }
1779
1780 state->BeginArray("children"); 1752 state->BeginArray("children");
1781 for (size_t i = 0; i < children_.size(); ++i) { 1753 for (size_t i = 0; i < children_.size(); ++i) {
1782 state->BeginDictionary(); 1754 state->BeginDictionary();
1783 children_[i]->AsValueInto(state); 1755 children_[i]->AsValueInto(state);
1784 state->EndDictionary(); 1756 state->EndDictionary();
1785 } 1757 }
1786 state->EndArray(); 1758 state->EndArray();
1787 if (mask_layer_) { 1759 if (mask_layer_) {
1788 state->BeginDictionary("mask_layer"); 1760 state->BeginDictionary("mask_layer");
1789 mask_layer_->AsValueInto(state); 1761 mask_layer_->AsValueInto(state);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 .layer_transforms_should_scale_layer_contents) { 1929 .layer_transforms_should_scale_layer_contents) {
1958 return default_scale; 1930 return default_scale;
1959 } 1931 }
1960 1932
1961 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1933 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1962 DrawTransform(), default_scale); 1934 DrawTransform(), default_scale);
1963 return std::max(transform_scales.x(), transform_scales.y()); 1935 return std::max(transform_scales.x(), transform_scales.y());
1964 } 1936 }
1965 1937
1966 } // namespace cc 1938 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698