| 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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 mask_layer_id_(-1), | 47 mask_layer_id_(-1), |
| 48 replica_layer_id_(-1), | 48 replica_layer_id_(-1), |
| 49 layer_id_(id), | 49 layer_id_(id), |
| 50 layer_tree_impl_(tree_impl), | 50 layer_tree_impl_(tree_impl), |
| 51 scroll_offset_(scroll_offset), | 51 scroll_offset_(scroll_offset), |
| 52 scroll_offset_delegate_(nullptr), | 52 scroll_offset_delegate_(nullptr), |
| 53 scroll_clip_layer_(nullptr), | 53 scroll_clip_layer_(nullptr), |
| 54 should_scroll_on_main_thread_(false), | 54 should_scroll_on_main_thread_(false), |
| 55 have_wheel_event_handlers_(false), | 55 have_wheel_event_handlers_(false), |
| 56 have_scroll_event_handlers_(false), | 56 have_scroll_event_handlers_(false), |
| 57 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), | 57 scroll_blocks_on_(ScrollBlocksOnNone), |
| 58 user_scrollable_horizontal_(true), | 58 user_scrollable_horizontal_(true), |
| 59 user_scrollable_vertical_(true), | 59 user_scrollable_vertical_(true), |
| 60 stacking_order_changed_(false), | 60 stacking_order_changed_(false), |
| 61 double_sided_(true), | 61 double_sided_(true), |
| 62 should_flatten_transform_(true), | 62 should_flatten_transform_(true), |
| 63 layer_property_changed_(false), | 63 layer_property_changed_(false), |
| 64 masks_to_bounds_(false), | 64 masks_to_bounds_(false), |
| 65 contents_opaque_(false), | 65 contents_opaque_(false), |
| 66 is_root_for_isolated_group_(false), | 66 is_root_for_isolated_group_(false), |
| 67 use_parent_backface_visibility_(false), | 67 use_parent_backface_visibility_(false), |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 DCHECK(layer_tree_impl()->IsActiveTree()); | 418 DCHECK(layer_tree_impl()->IsActiveTree()); |
| 419 scroll_offset_->AbortCommit(); | 419 scroll_offset_->AbortCommit(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 InputHandler::ScrollStatus LayerImpl::TryScroll( | 422 InputHandler::ScrollStatus LayerImpl::TryScroll( |
| 423 const gfx::PointF& screen_space_point, | 423 const gfx::PointF& screen_space_point, |
| 424 InputHandler::ScrollInputType type, | 424 InputHandler::ScrollInputType type, |
| 425 ScrollBlocksOn effective_block_mode) const { | 425 ScrollBlocksOn effective_block_mode) const { |
| 426 if (should_scroll_on_main_thread()) { | 426 if (should_scroll_on_main_thread()) { |
| 427 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread"); | 427 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Failed ShouldScrollOnMainThread"); |
| 428 return InputHandler::SCROLL_ON_MAIN_THREAD; | 428 return InputHandler::ScrollOnMainThread; |
| 429 } | 429 } |
| 430 | 430 |
| 431 if (!screen_space_transform().IsInvertible()) { | 431 if (!screen_space_transform().IsInvertible()) { |
| 432 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Ignored NonInvertibleTransform"); | 432 TRACE_EVENT0("cc", "LayerImpl::TryScroll: Ignored NonInvertibleTransform"); |
| 433 return InputHandler::SCROLL_IGNORED; | 433 return InputHandler::ScrollIgnored; |
| 434 } | 434 } |
| 435 | 435 |
| 436 if (!non_fast_scrollable_region().IsEmpty()) { | 436 if (!non_fast_scrollable_region().IsEmpty()) { |
| 437 bool clipped = false; | 437 bool clipped = false; |
| 438 gfx::Transform inverse_screen_space_transform( | 438 gfx::Transform inverse_screen_space_transform( |
| 439 gfx::Transform::kSkipInitialization); | 439 gfx::Transform::kSkipInitialization); |
| 440 if (!screen_space_transform().GetInverse(&inverse_screen_space_transform)) { | 440 if (!screen_space_transform().GetInverse(&inverse_screen_space_transform)) { |
| 441 // TODO(shawnsingh): We shouldn't be applying a projection if screen space | 441 // TODO(shawnsingh): We shouldn't be applying a projection if screen space |
| 442 // transform is uninvertible here. Perhaps we should be returning | 442 // transform is uninvertible here. Perhaps we should be returning |
| 443 // SCROLL_ON_MAIN_THREAD in this case? | 443 // ScrollOnMainThread in this case? |
| 444 } | 444 } |
| 445 | 445 |
| 446 gfx::PointF hit_test_point_in_content_space = | 446 gfx::PointF hit_test_point_in_content_space = |
| 447 MathUtil::ProjectPoint(inverse_screen_space_transform, | 447 MathUtil::ProjectPoint(inverse_screen_space_transform, |
| 448 screen_space_point, | 448 screen_space_point, |
| 449 &clipped); | 449 &clipped); |
| 450 gfx::PointF hit_test_point_in_layer_space = | 450 gfx::PointF hit_test_point_in_layer_space = |
| 451 gfx::ScalePoint(hit_test_point_in_content_space, | 451 gfx::ScalePoint(hit_test_point_in_content_space, |
| 452 1.f / contents_scale_x(), | 452 1.f / contents_scale_x(), |
| 453 1.f / contents_scale_y()); | 453 1.f / contents_scale_y()); |
| 454 if (!clipped && | 454 if (!clipped && |
| 455 non_fast_scrollable_region().Contains( | 455 non_fast_scrollable_region().Contains( |
| 456 gfx::ToRoundedPoint(hit_test_point_in_layer_space))) { | 456 gfx::ToRoundedPoint(hit_test_point_in_layer_space))) { |
| 457 TRACE_EVENT0("cc", | 457 TRACE_EVENT0("cc", |
| 458 "LayerImpl::tryScroll: Failed NonFastScrollableRegion"); | 458 "LayerImpl::tryScroll: Failed NonFastScrollableRegion"); |
| 459 return InputHandler::SCROLL_ON_MAIN_THREAD; | 459 return InputHandler::ScrollOnMainThread; |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 if (have_scroll_event_handlers() && | 463 if (have_scroll_event_handlers() && |
| 464 effective_block_mode & SCROLL_BLOCKS_ON_SCROLL_EVENT) { | 464 effective_block_mode & ScrollBlocksOnScrollEvent) { |
| 465 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers"); | 465 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed ScrollEventHandlers"); |
| 466 return InputHandler::SCROLL_ON_MAIN_THREAD; | 466 return InputHandler::ScrollOnMainThread; |
| 467 } | 467 } |
| 468 | 468 |
| 469 if (type == InputHandler::WHEEL && have_wheel_event_handlers() && | 469 if (type == InputHandler::Wheel && have_wheel_event_handlers() && |
| 470 effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) { | 470 effective_block_mode & ScrollBlocksOnWheelEvent) { |
| 471 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers"); | 471 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers"); |
| 472 return InputHandler::SCROLL_ON_MAIN_THREAD; | 472 return InputHandler::ScrollOnMainThread; |
| 473 } | 473 } |
| 474 | 474 |
| 475 if (!scrollable()) { | 475 if (!scrollable()) { |
| 476 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); | 476 TRACE_EVENT0("cc", "LayerImpl::tryScroll: Ignored not scrollable"); |
| 477 return InputHandler::SCROLL_IGNORED; | 477 return InputHandler::ScrollIgnored; |
| 478 } | 478 } |
| 479 | 479 |
| 480 gfx::ScrollOffset max_scroll_offset = MaxScrollOffset(); | 480 gfx::ScrollOffset max_scroll_offset = MaxScrollOffset(); |
| 481 if (max_scroll_offset.x() <= 0 && max_scroll_offset.y() <= 0) { | 481 if (max_scroll_offset.x() <= 0 && max_scroll_offset.y() <= 0) { |
| 482 TRACE_EVENT0("cc", | 482 TRACE_EVENT0("cc", |
| 483 "LayerImpl::tryScroll: Ignored. Technically scrollable," | 483 "LayerImpl::tryScroll: Ignored. Technically scrollable," |
| 484 " but has no affordance in either direction."); | 484 " but has no affordance in either direction."); |
| 485 return InputHandler::SCROLL_IGNORED; | 485 return InputHandler::ScrollIgnored; |
| 486 } | 486 } |
| 487 | 487 |
| 488 return InputHandler::SCROLL_STARTED; | 488 return InputHandler::ScrollStarted; |
| 489 } | 489 } |
| 490 | 490 |
| 491 gfx::Rect LayerImpl::LayerRectToContentRect( | 491 gfx::Rect LayerImpl::LayerRectToContentRect( |
| 492 const gfx::RectF& layer_rect) const { | 492 const gfx::RectF& layer_rect) const { |
| 493 gfx::RectF content_rect = | 493 gfx::RectF content_rect = |
| 494 gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y()); | 494 gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y()); |
| 495 // Intersect with content rect to avoid the extra pixel because for some | 495 // Intersect with content rect to avoid the extra pixel because for some |
| 496 // values x and y, ceil((x / y) * y) may be x + 1. | 496 // values x and y, ceil((x / y) * y) may be x + 1. |
| 497 content_rect.Intersect(gfx::Rect(content_bounds())); | 497 content_rect.Intersect(gfx::Rect(content_bounds())); |
| 498 return gfx::ToEnclosingRect(content_rect); | 498 return gfx::ToEnclosingRect(content_rect); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 510 layer->SetTransformOrigin(transform_origin_); | 510 layer->SetTransformOrigin(transform_origin_); |
| 511 layer->SetBackgroundColor(background_color_); | 511 layer->SetBackgroundColor(background_color_); |
| 512 layer->SetBounds(bounds_); | 512 layer->SetBounds(bounds_); |
| 513 layer->SetContentBounds(content_bounds()); | 513 layer->SetContentBounds(content_bounds()); |
| 514 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 514 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
| 515 layer->SetDoubleSided(double_sided_); | 515 layer->SetDoubleSided(double_sided_); |
| 516 layer->SetDrawCheckerboardForMissingTiles( | 516 layer->SetDrawCheckerboardForMissingTiles( |
| 517 draw_checkerboard_for_missing_tiles_); | 517 draw_checkerboard_for_missing_tiles_); |
| 518 layer->SetDrawsContent(DrawsContent()); | 518 layer->SetDrawsContent(DrawsContent()); |
| 519 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 519 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 520 layer->SetHasRenderSurface(!!render_surface() || layer->HasCopyRequest()); | 520 layer->SetHasRenderSurface(!!render_surface()); |
| 521 layer->SetFilters(filters()); | 521 layer->SetFilters(filters()); |
| 522 layer->SetBackgroundFilters(background_filters()); | 522 layer->SetBackgroundFilters(background_filters()); |
| 523 layer->SetMasksToBounds(masks_to_bounds_); | 523 layer->SetMasksToBounds(masks_to_bounds_); |
| 524 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 524 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
| 525 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 525 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
| 526 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); | 526 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); |
| 527 layer->SetScrollBlocksOn(scroll_blocks_on_); | 527 layer->SetScrollBlocksOn(scroll_blocks_on_); |
| 528 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 528 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
| 529 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 529 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
| 530 layer->SetContentsOpaque(contents_opaque_); | 530 layer->SetContentsOpaque(contents_opaque_); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 const gfx::Transform& gfx_transform = draw_properties_.target_space_transform; | 665 const gfx::Transform& gfx_transform = draw_properties_.target_space_transform; |
| 666 double transform[16]; | 666 double transform[16]; |
| 667 gfx_transform.matrix().asColMajord(transform); | 667 gfx_transform.matrix().asColMajord(transform); |
| 668 list = new base::ListValue; | 668 list = new base::ListValue; |
| 669 for (int i = 0; i < 16; ++i) | 669 for (int i = 0; i < 16; ++i) |
| 670 list->AppendDouble(transform[i]); | 670 list->AppendDouble(transform[i]); |
| 671 result->Set("DrawTransform", list); | 671 result->Set("DrawTransform", list); |
| 672 | 672 |
| 673 result->SetBoolean("DrawsContent", draws_content_); | 673 result->SetBoolean("DrawsContent", draws_content_); |
| 674 result->SetBoolean("Is3dSorted", Is3dSorted()); | 674 result->SetBoolean("Is3dSorted", Is3dSorted()); |
| 675 result->SetDouble("OPACITY", opacity()); | 675 result->SetDouble("Opacity", opacity()); |
| 676 result->SetBoolean("ContentsOpaque", contents_opaque_); | 676 result->SetBoolean("ContentsOpaque", contents_opaque_); |
| 677 | 677 |
| 678 if (scrollable()) | 678 if (scrollable()) |
| 679 result->SetBoolean("Scrollable", true); | 679 result->SetBoolean("Scrollable", true); |
| 680 | 680 |
| 681 if (have_wheel_event_handlers_) | 681 if (have_wheel_event_handlers_) |
| 682 result->SetBoolean("WheelHandler", have_wheel_event_handlers_); | 682 result->SetBoolean("WheelHandler", have_wheel_event_handlers_); |
| 683 if (have_scroll_event_handlers_) | 683 if (have_scroll_event_handlers_) |
| 684 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); | 684 result->SetBoolean("ScrollHandler", have_scroll_event_handlers_); |
| 685 if (!touch_event_handler_region_.IsEmpty()) { | 685 if (!touch_event_handler_region_.IsEmpty()) { |
| 686 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); | 686 scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue(); |
| 687 result->Set("TouchRegion", region.release()); | 687 result->Set("TouchRegion", region.release()); |
| 688 } | 688 } |
| 689 | 689 |
| 690 if (scroll_blocks_on_) { | 690 if (scroll_blocks_on_) { |
| 691 list = new base::ListValue; | 691 list = new base::ListValue; |
| 692 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_START_TOUCH) | 692 if (scroll_blocks_on_ & ScrollBlocksOnStartTouch) |
| 693 list->AppendString("StartTouch"); | 693 list->AppendString("StartTouch"); |
| 694 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_WHEEL_EVENT) | 694 if (scroll_blocks_on_ & ScrollBlocksOnWheelEvent) |
| 695 list->AppendString("WheelEvent"); | 695 list->AppendString("WheelEvent"); |
| 696 if (scroll_blocks_on_ & SCROLL_BLOCKS_ON_SCROLL_EVENT) | 696 if (scroll_blocks_on_ & ScrollBlocksOnScrollEvent) |
| 697 list->AppendString("ScrollEvent"); | 697 list->AppendString("ScrollEvent"); |
| 698 result->Set("ScrollBlocksOn", list); | 698 result->Set("ScrollBlocksOn", list); |
| 699 } | 699 } |
| 700 | 700 |
| 701 list = new base::ListValue; | 701 list = new base::ListValue; |
| 702 for (size_t i = 0; i < children_.size(); ++i) | 702 for (size_t i = 0; i < children_.size(); ++i) |
| 703 list->Append(children_[i]->LayerTreeAsJson()); | 703 list->Append(children_[i]->LayerTreeAsJson()); |
| 704 result->Set("Children", list); | 704 result->Set("Children", list); |
| 705 | 705 |
| 706 return result; | 706 return result; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 | 939 |
| 940 void LayerImpl::SetFilters(const FilterOperations& filters) { | 940 void LayerImpl::SetFilters(const FilterOperations& filters) { |
| 941 if (filters_ == filters) | 941 if (filters_ == filters) |
| 942 return; | 942 return; |
| 943 | 943 |
| 944 filters_ = filters; | 944 filters_ = filters; |
| 945 NoteLayerPropertyChangedForSubtree(); | 945 NoteLayerPropertyChangedForSubtree(); |
| 946 } | 946 } |
| 947 | 947 |
| 948 bool LayerImpl::FilterIsAnimating() const { | 948 bool LayerImpl::FilterIsAnimating() const { |
| 949 return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER); | 949 return layer_animation_controller_->IsAnimatingProperty(Animation::Filter); |
| 950 } | 950 } |
| 951 | 951 |
| 952 bool LayerImpl::FilterIsAnimatingOnImplOnly() const { | 952 bool LayerImpl::FilterIsAnimatingOnImplOnly() const { |
| 953 Animation* filter_animation = | 953 Animation* filter_animation = |
| 954 layer_animation_controller_->GetAnimation(Animation::FILTER); | 954 layer_animation_controller_->GetAnimation(Animation::Filter); |
| 955 return filter_animation && filter_animation->is_impl_only(); | 955 return filter_animation && filter_animation->is_impl_only(); |
| 956 } | 956 } |
| 957 | 957 |
| 958 void LayerImpl::SetBackgroundFilters( | 958 void LayerImpl::SetBackgroundFilters( |
| 959 const FilterOperations& filters) { | 959 const FilterOperations& filters) { |
| 960 if (background_filters_ == filters) | 960 if (background_filters_ == filters) |
| 961 return; | 961 return; |
| 962 | 962 |
| 963 background_filters_ = filters; | 963 background_filters_ = filters; |
| 964 NoteLayerPropertyChanged(); | 964 NoteLayerPropertyChanged(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 982 | 982 |
| 983 void LayerImpl::SetOpacity(float opacity) { | 983 void LayerImpl::SetOpacity(float opacity) { |
| 984 if (opacity_ == opacity) | 984 if (opacity_ == opacity) |
| 985 return; | 985 return; |
| 986 | 986 |
| 987 opacity_ = opacity; | 987 opacity_ = opacity; |
| 988 NoteLayerPropertyChangedForSubtree(); | 988 NoteLayerPropertyChangedForSubtree(); |
| 989 } | 989 } |
| 990 | 990 |
| 991 bool LayerImpl::OpacityIsAnimating() const { | 991 bool LayerImpl::OpacityIsAnimating() const { |
| 992 return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY); | 992 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); |
| 993 } | 993 } |
| 994 | 994 |
| 995 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { | 995 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { |
| 996 Animation* opacity_animation = | 996 Animation* opacity_animation = |
| 997 layer_animation_controller_->GetAnimation(Animation::OPACITY); | 997 layer_animation_controller_->GetAnimation(Animation::Opacity); |
| 998 return opacity_animation && opacity_animation->is_impl_only(); | 998 return opacity_animation && opacity_animation->is_impl_only(); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) { | 1001 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) { |
| 1002 if (blend_mode_ == blend_mode) | 1002 if (blend_mode_ == blend_mode) |
| 1003 return; | 1003 return; |
| 1004 | 1004 |
| 1005 blend_mode_ = blend_mode; | 1005 blend_mode_ = blend_mode; |
| 1006 NoteLayerPropertyChangedForSubtree(); | 1006 NoteLayerPropertyChangedForSubtree(); |
| 1007 } | 1007 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 DCHECK(transform_is_invertible_ == transform_is_invertible) | 1059 DCHECK(transform_is_invertible_ == transform_is_invertible) |
| 1060 << "Can't change invertibility if transform is unchanged"; | 1060 << "Can't change invertibility if transform is unchanged"; |
| 1061 return; | 1061 return; |
| 1062 } | 1062 } |
| 1063 transform_ = transform; | 1063 transform_ = transform; |
| 1064 transform_is_invertible_ = transform_is_invertible; | 1064 transform_is_invertible_ = transform_is_invertible; |
| 1065 NoteLayerPropertyChangedForSubtree(); | 1065 NoteLayerPropertyChangedForSubtree(); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 bool LayerImpl::TransformIsAnimating() const { | 1068 bool LayerImpl::TransformIsAnimating() const { |
| 1069 return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM); | 1069 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { | 1072 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { |
| 1073 Animation* transform_animation = | 1073 Animation* transform_animation = |
| 1074 layer_animation_controller_->GetAnimation(Animation::TRANSFORM); | 1074 layer_animation_controller_->GetAnimation(Animation::Transform); |
| 1075 return transform_animation && transform_animation->is_impl_only(); | 1075 return transform_animation && transform_animation->is_impl_only(); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { | 1078 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { |
| 1079 update_rect_ = update_rect; | 1079 update_rect_ = update_rect; |
| 1080 SetNeedsPushProperties(); | 1080 SetNeedsPushProperties(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { | 1083 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { |
| 1084 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); | 1084 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 if (scrollbar_animation_controller_) { | 1325 if (scrollbar_animation_controller_) { |
| 1326 // Non-overlay scrollbars shouldn't trigger animations. | 1326 // Non-overlay scrollbars shouldn't trigger animations. |
| 1327 if (scrollbar_layer->is_overlay_scrollbar()) | 1327 if (scrollbar_layer->is_overlay_scrollbar()) |
| 1328 scrollbar_animation_controller_->DidScrollUpdate(on_resize); | 1328 scrollbar_animation_controller_->DidScrollUpdate(on_resize); |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 void LayerImpl::DidBecomeActive() { | 1333 void LayerImpl::DidBecomeActive() { |
| 1334 if (layer_tree_impl_->settings().scrollbar_animator == | 1334 if (layer_tree_impl_->settings().scrollbar_animator == |
| 1335 LayerTreeSettings::NO_ANIMATOR) { | 1335 LayerTreeSettings::NoAnimator) { |
| 1336 return; | 1336 return; |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 bool need_scrollbar_animation_controller = scrollable() && scrollbars_; | 1339 bool need_scrollbar_animation_controller = scrollable() && scrollbars_; |
| 1340 if (!need_scrollbar_animation_controller) { | 1340 if (!need_scrollbar_animation_controller) { |
| 1341 scrollbar_animation_controller_ = nullptr; | 1341 scrollbar_animation_controller_ = nullptr; |
| 1342 return; | 1342 return; |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 if (scrollbar_animation_controller_) | 1345 if (scrollbar_animation_controller_) |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 } | 1566 } |
| 1567 | 1567 |
| 1568 int LayerImpl::NumDescendantsThatDrawContent() const { | 1568 int LayerImpl::NumDescendantsThatDrawContent() const { |
| 1569 return num_descendants_that_draw_content_; | 1569 return num_descendants_that_draw_content_; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void LayerImpl::NotifyAnimationFinished( | 1572 void LayerImpl::NotifyAnimationFinished( |
| 1573 base::TimeTicks monotonic_time, | 1573 base::TimeTicks monotonic_time, |
| 1574 Animation::TargetProperty target_property, | 1574 Animation::TargetProperty target_property, |
| 1575 int group) { | 1575 int group) { |
| 1576 if (target_property == Animation::SCROLL_OFFSET) | 1576 if (target_property == Animation::ScrollOffset) |
| 1577 layer_tree_impl_->InputScrollAnimationFinished(); | 1577 layer_tree_impl_->InputScrollAnimationFinished(); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) { | 1580 void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) { |
| 1581 if (!!render_surface() == should_have_render_surface) | 1581 if (!!render_surface() == should_have_render_surface) |
| 1582 return; | 1582 return; |
| 1583 | 1583 |
| 1584 SetNeedsPushProperties(); | 1584 SetNeedsPushProperties(); |
| 1585 layer_tree_impl()->set_needs_update_draw_properties(); | 1585 layer_tree_impl()->set_needs_update_draw_properties(); |
| 1586 if (should_have_render_surface) { | 1586 if (should_have_render_surface) { |
| 1587 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1587 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
| 1588 return; | 1588 return; |
| 1589 } | 1589 } |
| 1590 render_surface_.reset(); | 1590 render_surface_.reset(); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 } // namespace cc | 1593 } // namespace cc |
| OLD | NEW |