OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 hide_layer_and_subtree_(false), | 64 hide_layer_and_subtree_(false), |
65 masks_to_bounds_(false), | 65 masks_to_bounds_(false), |
66 contents_opaque_(false), | 66 contents_opaque_(false), |
67 double_sided_(true), | 67 double_sided_(true), |
68 should_flatten_transform_(true), | 68 should_flatten_transform_(true), |
69 use_parent_backface_visibility_(false), | 69 use_parent_backface_visibility_(false), |
70 draw_checkerboard_for_missing_tiles_(false), | 70 draw_checkerboard_for_missing_tiles_(false), |
71 force_render_surface_(false), | 71 force_render_surface_(false), |
72 transform_is_invertible_(true), | 72 transform_is_invertible_(true), |
73 has_render_surface_(false), | 73 has_render_surface_(false), |
74 scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE), | 74 scroll_blocks_on_(ScrollBlocksOnNone), |
75 background_color_(0), | 75 background_color_(0), |
76 opacity_(1.f), | 76 opacity_(1.f), |
77 blend_mode_(SkXfermode::kSrcOver_Mode), | 77 blend_mode_(SkXfermode::kSrcOver_Mode), |
78 scroll_parent_(nullptr), | 78 scroll_parent_(nullptr), |
79 clip_parent_(nullptr), | 79 clip_parent_(nullptr), |
80 replica_layer_(nullptr), | 80 replica_layer_(nullptr), |
81 raster_scale_(0.f), | 81 raster_scale_(0.f), |
82 client_(nullptr), | 82 client_(nullptr), |
83 frame_timing_requests_dirty_(false) { | 83 frame_timing_requests_dirty_(false) { |
84 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 84 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 void Layer::SetFilters(const FilterOperations& filters) { | 465 void Layer::SetFilters(const FilterOperations& filters) { |
466 DCHECK(IsPropertyChangeAllowed()); | 466 DCHECK(IsPropertyChangeAllowed()); |
467 if (filters_ == filters) | 467 if (filters_ == filters) |
468 return; | 468 return; |
469 filters_ = filters; | 469 filters_ = filters; |
470 SetNeedsCommit(); | 470 SetNeedsCommit(); |
471 } | 471 } |
472 | 472 |
473 bool Layer::FilterIsAnimating() const { | 473 bool Layer::FilterIsAnimating() const { |
474 return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER); | 474 return layer_animation_controller_->IsAnimatingProperty(Animation::Filter); |
475 } | 475 } |
476 | 476 |
477 void Layer::SetBackgroundFilters(const FilterOperations& filters) { | 477 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
478 DCHECK(IsPropertyChangeAllowed()); | 478 DCHECK(IsPropertyChangeAllowed()); |
479 if (background_filters_ == filters) | 479 if (background_filters_ == filters) |
480 return; | 480 return; |
481 background_filters_ = filters; | 481 background_filters_ = filters; |
482 SetNeedsCommit(); | 482 SetNeedsCommit(); |
483 } | 483 } |
484 | 484 |
485 void Layer::SetOpacity(float opacity) { | 485 void Layer::SetOpacity(float opacity) { |
486 DCHECK(IsPropertyChangeAllowed()); | 486 DCHECK(IsPropertyChangeAllowed()); |
487 if (opacity_ == opacity) | 487 if (opacity_ == opacity) |
488 return; | 488 return; |
489 opacity_ = opacity; | 489 opacity_ = opacity; |
490 SetNeedsCommit(); | 490 SetNeedsCommit(); |
491 } | 491 } |
492 | 492 |
493 bool Layer::OpacityIsAnimating() const { | 493 bool Layer::OpacityIsAnimating() const { |
494 return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY); | 494 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); |
495 } | 495 } |
496 | 496 |
497 bool Layer::OpacityCanAnimateOnImplThread() const { | 497 bool Layer::OpacityCanAnimateOnImplThread() const { |
498 return false; | 498 return false; |
499 } | 499 } |
500 | 500 |
501 void Layer::SetBlendMode(SkXfermode::Mode blend_mode) { | 501 void Layer::SetBlendMode(SkXfermode::Mode blend_mode) { |
502 DCHECK(IsPropertyChangeAllowed()); | 502 DCHECK(IsPropertyChangeAllowed()); |
503 if (blend_mode_ == blend_mode) | 503 if (blend_mode_ == blend_mode) |
504 return; | 504 return; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return; | 594 return; |
595 transform_origin_ = transform_origin; | 595 transform_origin_ = transform_origin; |
596 SetNeedsCommit(); | 596 SetNeedsCommit(); |
597 } | 597 } |
598 | 598 |
599 bool Layer::AnimationsPreserveAxisAlignment() const { | 599 bool Layer::AnimationsPreserveAxisAlignment() const { |
600 return layer_animation_controller_->AnimationsPreserveAxisAlignment(); | 600 return layer_animation_controller_->AnimationsPreserveAxisAlignment(); |
601 } | 601 } |
602 | 602 |
603 bool Layer::TransformIsAnimating() const { | 603 bool Layer::TransformIsAnimating() const { |
604 return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM); | 604 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
605 } | 605 } |
606 | 606 |
607 void Layer::SetScrollParent(Layer* parent) { | 607 void Layer::SetScrollParent(Layer* parent) { |
608 DCHECK(IsPropertyChangeAllowed()); | 608 DCHECK(IsPropertyChangeAllowed()); |
609 if (scroll_parent_ == parent) | 609 if (scroll_parent_ == parent) |
610 return; | 610 return; |
611 | 611 |
612 if (scroll_parent_) | 612 if (scroll_parent_) |
613 scroll_parent_->RemoveScrollChild(this); | 613 scroll_parent_->RemoveScrollChild(this); |
614 | 614 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 "devtools.timeline.layers"), | 902 "devtools.timeline.layers"), |
903 &is_tracing); | 903 &is_tracing); |
904 if (is_tracing) | 904 if (is_tracing) |
905 layer->SetDebugInfo(TakeDebugInfo()); | 905 layer->SetDebugInfo(TakeDebugInfo()); |
906 | 906 |
907 layer->SetDoubleSided(double_sided_); | 907 layer->SetDoubleSided(double_sided_); |
908 layer->SetDrawCheckerboardForMissingTiles( | 908 layer->SetDrawCheckerboardForMissingTiles( |
909 draw_checkerboard_for_missing_tiles_); | 909 draw_checkerboard_for_missing_tiles_); |
910 layer->SetDrawsContent(DrawsContent()); | 910 layer->SetDrawsContent(DrawsContent()); |
911 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 911 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
912 layer->SetHasRenderSurface(has_render_surface_ || layer->HasCopyRequest()); | 912 layer->SetHasRenderSurface(has_render_surface_); |
913 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 913 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
914 layer->SetFilters(filters_); | 914 layer->SetFilters(filters_); |
915 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); | 915 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); |
916 layer->SetBackgroundFilters(background_filters()); | 916 layer->SetBackgroundFilters(background_filters()); |
917 layer->SetMasksToBounds(masks_to_bounds_); | 917 layer->SetMasksToBounds(masks_to_bounds_); |
918 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 918 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
919 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 919 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
920 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); | 920 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); |
921 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 921 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
922 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 922 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 } | 1174 } |
1175 | 1175 |
1176 bool Layer::IsActive() const { | 1176 bool Layer::IsActive() const { |
1177 return true; | 1177 return true; |
1178 } | 1178 } |
1179 | 1179 |
1180 bool Layer::AddAnimation(scoped_ptr <Animation> animation) { | 1180 bool Layer::AddAnimation(scoped_ptr <Animation> animation) { |
1181 if (!layer_animation_controller_->animation_registrar()) | 1181 if (!layer_animation_controller_->animation_registrar()) |
1182 return false; | 1182 return false; |
1183 | 1183 |
1184 if (animation->target_property() == Animation::SCROLL_OFFSET && | 1184 if (animation->target_property() == Animation::ScrollOffset && |
1185 !layer_animation_controller_->animation_registrar() | 1185 !layer_animation_controller_->animation_registrar() |
1186 ->supports_scroll_animations()) | 1186 ->supports_scroll_animations()) |
1187 return false; | 1187 return false; |
1188 | 1188 |
1189 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer", | 1189 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer", |
1190 !layer_tree_host_); | 1190 !layer_tree_host_); |
1191 layer_animation_controller_->AddAnimation(animation.Pass()); | 1191 layer_animation_controller_->AddAnimation(animation.Pass()); |
1192 SetNeedsCommit(); | 1192 SetNeedsCommit(); |
1193 return true; | 1193 return true; |
1194 } | 1194 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 } | 1233 } |
1234 | 1234 |
1235 ScrollbarLayerInterface* Layer::ToScrollbarLayer() { | 1235 ScrollbarLayerInterface* Layer::ToScrollbarLayer() { |
1236 return nullptr; | 1236 return nullptr; |
1237 } | 1237 } |
1238 | 1238 |
1239 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 1239 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
1240 return layer_tree_host_->rendering_stats_instrumentation(); | 1240 return layer_tree_host_->rendering_stats_instrumentation(); |
1241 } | 1241 } |
1242 | 1242 |
| 1243 bool Layer::SupportsLCDText() const { |
| 1244 return false; |
| 1245 } |
| 1246 |
1243 void Layer::RemoveFromScrollTree() { | 1247 void Layer::RemoveFromScrollTree() { |
1244 if (scroll_children_.get()) { | 1248 if (scroll_children_.get()) { |
1245 std::set<Layer*> copy = *scroll_children_; | 1249 std::set<Layer*> copy = *scroll_children_; |
1246 for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it) | 1250 for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it) |
1247 (*it)->SetScrollParent(nullptr); | 1251 (*it)->SetScrollParent(nullptr); |
1248 } | 1252 } |
1249 | 1253 |
1250 DCHECK(!scroll_children_); | 1254 DCHECK(!scroll_children_); |
1251 SetScrollParent(nullptr); | 1255 SetScrollParent(nullptr); |
1252 } | 1256 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 } | 1323 } |
1320 | 1324 |
1321 void Layer::SetFrameTimingRequests( | 1325 void Layer::SetFrameTimingRequests( |
1322 const std::vector<FrameTimingRequest>& requests) { | 1326 const std::vector<FrameTimingRequest>& requests) { |
1323 frame_timing_requests_ = requests; | 1327 frame_timing_requests_ = requests; |
1324 frame_timing_requests_dirty_ = true; | 1328 frame_timing_requests_dirty_ = true; |
1325 SetNeedsCommit(); | 1329 SetNeedsCommit(); |
1326 } | 1330 } |
1327 | 1331 |
1328 } // namespace cc | 1332 } // namespace cc |
OLD | NEW |