OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 scroll_parent_(nullptr), | 53 scroll_parent_(nullptr), |
54 clip_parent_(nullptr), | 54 clip_parent_(nullptr), |
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), | |
64 have_scroll_event_handlers_(false), | 63 have_scroll_event_handlers_(false), |
65 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), | 64 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), |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if (have_scroll_event_handlers() && | 555 if (have_scroll_event_handlers() && |
557 effective_block_mode & SCROLL_BLOCKS_ON_SCROLL_EVENT) { | 556 effective_block_mode & SCROLL_BLOCKS_ON_SCROLL_EVENT) { |
558 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers"); | 557 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers"); |
559 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; | 558 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; |
560 scroll_status.main_thread_scrolling_reasons = | 559 scroll_status.main_thread_scrolling_reasons = |
561 MainThreadScrollingReason::kEventHandlers; | 560 MainThreadScrollingReason::kEventHandlers; |
562 return scroll_status; | 561 return scroll_status; |
563 } | 562 } |
564 | 563 |
565 if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) && | 564 if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) && |
566 have_wheel_event_handlers() && | 565 layer_tree_impl_->have_wheel_event_handlers() && |
567 effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) { | 566 effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) { |
568 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers"); | 567 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers"); |
569 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; | 568 scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD; |
570 scroll_status.main_thread_scrolling_reasons = | 569 scroll_status.main_thread_scrolling_reasons = |
571 MainThreadScrollingReason::kEventHandlers; | 570 MainThreadScrollingReason::kEventHandlers; |
572 return scroll_status; | 571 return scroll_status; |
573 } | 572 } |
574 | 573 |
575 if (!scrollable()) { | 574 if (!scrollable()) { |
576 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); | 575 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // TODO(weiliangc): Should be safely removed after impl side is able to | 614 // TODO(weiliangc): Should be safely removed after impl side is able to |
616 // update render surfaces without rebuilding property trees. | 615 // update render surfaces without rebuilding property trees. |
617 if (layer->has_render_surface() != has_render_surface()) | 616 if (layer->has_render_surface() != has_render_surface()) |
618 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 617 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
619 layer->SetHasRenderSurface(!!render_surface()); | 618 layer->SetHasRenderSurface(!!render_surface()); |
620 layer->SetForceRenderSurface(force_render_surface_); | 619 layer->SetForceRenderSurface(force_render_surface_); |
621 layer->SetFilters(filters()); | 620 layer->SetFilters(filters()); |
622 layer->SetBackgroundFilters(background_filters()); | 621 layer->SetBackgroundFilters(background_filters()); |
623 layer->SetMasksToBounds(masks_to_bounds_); | 622 layer->SetMasksToBounds(masks_to_bounds_); |
624 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); | 623 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); |
625 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | |
626 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); | 624 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); |
627 layer->SetScrollBlocksOn(scroll_blocks_on_); | 625 layer->SetScrollBlocksOn(scroll_blocks_on_); |
628 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 626 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
629 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 627 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
630 layer->SetContentsOpaque(contents_opaque_); | 628 layer->SetContentsOpaque(contents_opaque_); |
631 layer->SetOpacity(opacity_); | 629 layer->SetOpacity(opacity_); |
632 layer->SetBlendMode(blend_mode_); | 630 layer->SetBlendMode(blend_mode_); |
633 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 631 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
634 layer->SetPosition(position_); | 632 layer->SetPosition(position_); |
635 layer->SetIsContainerForFixedPositionLayers( | 633 layer->SetIsContainerForFixedPositionLayers( |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 result->Set("DrawTransform", list); | 764 result->Set("DrawTransform", list); |
767 | 765 |
768 result->SetBoolean("DrawsContent", draws_content_); | 766 result->SetBoolean("DrawsContent", draws_content_); |
769 result->SetBoolean("Is3dSorted", Is3dSorted()); | 767 result->SetBoolean("Is3dSorted", Is3dSorted()); |
770 result->SetDouble("OPACITY", opacity()); | 768 result->SetDouble("OPACITY", opacity()); |
771 result->SetBoolean("ContentsOpaque", contents_opaque_); | 769 result->SetBoolean("ContentsOpaque", contents_opaque_); |
772 | 770 |
773 if (scrollable()) | 771 if (scrollable()) |
774 result->SetBoolean("Scrollable", true); | 772 result->SetBoolean("Scrollable", true); |
775 | 773 |
776 if (have_wheel_event_handlers_) | |
777 result->SetBoolean("WheelHandler", have_wheel_event_handlers_); | |
778 if (have_scroll_event_handlers_) | 774 if (have_scroll_event_handlers_) |
779 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); | 775 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); |
780 if (!touch_event_handler_region_.IsEmpty()) { | 776 if (!touch_event_handler_region_.IsEmpty()) { |
781 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); | 777 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); |
782 result->Set("TouchRegion", region.release()); | 778 result->Set("TouchRegion", region.release()); |
783 } | 779 } |
784 | 780 |
785 if (scroll_blocks_on_) { | 781 if (scroll_blocks_on_) { |
786 list = new base::ListValue; | 782 list = new base::ListValue; |
787 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_START_TOUCH) | 783 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_START_TOUCH) |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 bool clipped; | 1731 bool clipped; |
1736 gfx::QuadF layer_quad = | 1732 gfx::QuadF layer_quad = |
1737 MathUtil::MapQuad(ScreenSpaceTransform(), | 1733 MathUtil::MapQuad(ScreenSpaceTransform(), |
1738 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); | 1734 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); |
1739 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); | 1735 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); |
1740 if (!touch_event_handler_region_.IsEmpty()) { | 1736 if (!touch_event_handler_region_.IsEmpty()) { |
1741 state->BeginArray("touch_event_handler_region"); | 1737 state->BeginArray("touch_event_handler_region"); |
1742 touch_event_handler_region_.AsValueInto(state); | 1738 touch_event_handler_region_.AsValueInto(state); |
1743 state->EndArray(); | 1739 state->EndArray(); |
1744 } | 1740 } |
1745 if (have_wheel_event_handlers_) { | |
1746 gfx::Rect wheel_rect(bounds()); | |
1747 Region wheel_region(wheel_rect); | |
1748 state->BeginArray("wheel_event_handler_region"); | |
1749 wheel_region.AsValueInto(state); | |
1750 state->EndArray(); | |
1751 } | |
1752 if (have_scroll_event_handlers_) { | 1741 if (have_scroll_event_handlers_) { |
1753 gfx::Rect scroll_rect(bounds()); | 1742 gfx::Rect scroll_rect(bounds()); |
1754 Region scroll_region(scroll_rect); | 1743 Region scroll_region(scroll_rect); |
1755 state->BeginArray("scroll_event_handler_region"); | 1744 state->BeginArray("scroll_event_handler_region"); |
1756 scroll_region.AsValueInto(state); | 1745 scroll_region.AsValueInto(state); |
1757 state->EndArray(); | 1746 state->EndArray(); |
1758 } | 1747 } |
1759 if (!non_fast_scrollable_region_.IsEmpty()) { | 1748 if (!non_fast_scrollable_region_.IsEmpty()) { |
1760 state->BeginArray("non_fast_scrollable_region"); | 1749 state->BeginArray("non_fast_scrollable_region"); |
1761 non_fast_scrollable_region_.AsValueInto(state); | 1750 non_fast_scrollable_region_.AsValueInto(state); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 .layer_transforms_should_scale_layer_contents) { | 1932 .layer_transforms_should_scale_layer_contents) { |
1944 return default_scale; | 1933 return default_scale; |
1945 } | 1934 } |
1946 | 1935 |
1947 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1936 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1948 DrawTransform(), default_scale); | 1937 DrawTransform(), default_scale); |
1949 return std::max(transform_scales.x(), transform_scales.y()); | 1938 return std::max(transform_scales.x(), transform_scales.y()); |
1950 } | 1939 } |
1951 | 1940 |
1952 } // namespace cc | 1941 } // namespace cc |
OLD | NEW |