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_scroll_event_handlers_(false), | |
64 user_scrollable_horizontal_(true), | 63 user_scrollable_horizontal_(true), |
65 user_scrollable_vertical_(true), | 64 user_scrollable_vertical_(true), |
66 stacking_order_changed_(false), | 65 stacking_order_changed_(false), |
67 double_sided_(true), | 66 double_sided_(true), |
68 should_flatten_transform_(true), | 67 should_flatten_transform_(true), |
69 should_flatten_transform_from_property_tree_(false), | 68 should_flatten_transform_from_property_tree_(false), |
70 layer_property_changed_(false), | 69 layer_property_changed_(false), |
71 masks_to_bounds_(false), | 70 masks_to_bounds_(false), |
72 contents_opaque_(false), | 71 contents_opaque_(false), |
73 is_root_for_isolated_group_(false), | 72 is_root_for_isolated_group_(false), |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 // TODO(weiliangc): Should be safely removed after impl side is able to | 606 // TODO(weiliangc): Should be safely removed after impl side is able to |
608 // update render surfaces without rebuilding property trees. | 607 // update render surfaces without rebuilding property trees. |
609 if (layer->has_render_surface() != has_render_surface()) | 608 if (layer->has_render_surface() != has_render_surface()) |
610 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 609 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
611 layer->SetHasRenderSurface(!!render_surface()); | 610 layer->SetHasRenderSurface(!!render_surface()); |
612 layer->SetForceRenderSurface(force_render_surface_); | 611 layer->SetForceRenderSurface(force_render_surface_); |
613 layer->SetFilters(filters()); | 612 layer->SetFilters(filters()); |
614 layer->SetBackgroundFilters(background_filters()); | 613 layer->SetBackgroundFilters(background_filters()); |
615 layer->SetMasksToBounds(masks_to_bounds_); | 614 layer->SetMasksToBounds(masks_to_bounds_); |
616 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); | 615 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); |
617 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); | |
618 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 616 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
619 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 617 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
620 layer->SetContentsOpaque(contents_opaque_); | 618 layer->SetContentsOpaque(contents_opaque_); |
621 layer->SetOpacity(opacity_); | 619 layer->SetOpacity(opacity_); |
622 layer->SetBlendMode(blend_mode_); | 620 layer->SetBlendMode(blend_mode_); |
623 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 621 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
624 layer->SetPosition(position_); | 622 layer->SetPosition(position_); |
625 layer->SetIsContainerForFixedPositionLayers( | 623 layer->SetIsContainerForFixedPositionLayers( |
626 is_container_for_fixed_position_layers_); | 624 is_container_for_fixed_position_layers_); |
627 layer->SetPositionConstraint(position_constraint_); | 625 layer->SetPositionConstraint(position_constraint_); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 result->Set("DrawTransform", list); | 754 result->Set("DrawTransform", list); |
757 | 755 |
758 result->SetBoolean("DrawsContent", draws_content_); | 756 result->SetBoolean("DrawsContent", draws_content_); |
759 result->SetBoolean("Is3dSorted", Is3dSorted()); | 757 result->SetBoolean("Is3dSorted", Is3dSorted()); |
760 result->SetDouble("OPACITY", opacity()); | 758 result->SetDouble("OPACITY", opacity()); |
761 result->SetBoolean("ContentsOpaque", contents_opaque_); | 759 result->SetBoolean("ContentsOpaque", contents_opaque_); |
762 | 760 |
763 if (scrollable()) | 761 if (scrollable()) |
764 result->SetBoolean("Scrollable", true); | 762 result->SetBoolean("Scrollable", true); |
765 | 763 |
766 if (have_scroll_event_handlers_) | |
767 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); | |
768 if (!touch_event_handler_region_.IsEmpty()) { | 764 if (!touch_event_handler_region_.IsEmpty()) { |
769 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); | 765 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); |
770 result->Set("TouchRegion", region.release()); | 766 result->Set("TouchRegion", region.release()); |
771 } | 767 } |
772 | 768 |
773 list = new base::ListValue; | 769 list = new base::ListValue; |
774 for (size_t i = 0; i < children_.size(); ++i) | 770 for (size_t i = 0; i < children_.size(); ++i) |
775 list->Append(children_[i]->LayerTreeAsJson()); | 771 list->Append(children_[i]->LayerTreeAsJson()); |
776 result->Set("Children", list); | 772 result->Set("Children", list); |
777 | 773 |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 bool clipped; | 1715 bool clipped; |
1720 gfx::QuadF layer_quad = | 1716 gfx::QuadF layer_quad = |
1721 MathUtil::MapQuad(ScreenSpaceTransform(), | 1717 MathUtil::MapQuad(ScreenSpaceTransform(), |
1722 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); | 1718 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); |
1723 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); | 1719 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); |
1724 if (!touch_event_handler_region_.IsEmpty()) { | 1720 if (!touch_event_handler_region_.IsEmpty()) { |
1725 state->BeginArray("touch_event_handler_region"); | 1721 state->BeginArray("touch_event_handler_region"); |
1726 touch_event_handler_region_.AsValueInto(state); | 1722 touch_event_handler_region_.AsValueInto(state); |
1727 state->EndArray(); | 1723 state->EndArray(); |
1728 } | 1724 } |
1729 if (have_scroll_event_handlers_) { | |
1730 gfx::Rect scroll_rect(bounds()); | |
1731 Region scroll_region(scroll_rect); | |
1732 state->BeginArray("scroll_event_handler_region"); | |
1733 scroll_region.AsValueInto(state); | |
1734 state->EndArray(); | |
1735 } | |
1736 if (!non_fast_scrollable_region_.IsEmpty()) { | 1725 if (!non_fast_scrollable_region_.IsEmpty()) { |
1737 state->BeginArray("non_fast_scrollable_region"); | 1726 state->BeginArray("non_fast_scrollable_region"); |
1738 non_fast_scrollable_region_.AsValueInto(state); | 1727 non_fast_scrollable_region_.AsValueInto(state); |
1739 state->EndArray(); | 1728 state->EndArray(); |
1740 } | 1729 } |
1741 state->BeginArray("children"); | 1730 state->BeginArray("children"); |
1742 for (size_t i = 0; i < children_.size(); ++i) { | 1731 for (size_t i = 0; i < children_.size(); ++i) { |
1743 state->BeginDictionary(); | 1732 state->BeginDictionary(); |
1744 children_[i]->AsValueInto(state); | 1733 children_[i]->AsValueInto(state); |
1745 state->EndDictionary(); | 1734 state->EndDictionary(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 .layer_transforms_should_scale_layer_contents) { | 1907 .layer_transforms_should_scale_layer_contents) { |
1919 return default_scale; | 1908 return default_scale; |
1920 } | 1909 } |
1921 | 1910 |
1922 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1911 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1923 DrawTransform(), default_scale); | 1912 DrawTransform(), default_scale); |
1924 return std::max(transform_scales.x(), transform_scales.y()); | 1913 return std::max(transform_scales.x(), transform_scales.y()); |
1925 } | 1914 } |
1926 | 1915 |
1927 } // namespace cc | 1916 } // namespace cc |
OLD | NEW |