| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const { | 407 bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const { |
| 408 return (orientation == HORIZONTAL) ? user_scrollable_horizontal_ | 408 return (orientation == HORIZONTAL) ? user_scrollable_horizontal_ |
| 409 : user_scrollable_vertical_; | 409 : user_scrollable_vertical_; |
| 410 } | 410 } |
| 411 | 411 |
| 412 std::unique_ptr<LayerImpl> LayerImpl::CreateLayerImpl( | 412 std::unique_ptr<LayerImpl> LayerImpl::CreateLayerImpl( |
| 413 LayerTreeImpl* tree_impl) { | 413 LayerTreeImpl* tree_impl) { |
| 414 return LayerImpl::Create(tree_impl, layer_id_); | 414 return LayerImpl::Create(tree_impl, layer_id_); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void LayerImpl::set_main_thread_scrolling_reasons( | |
| 418 uint32_t main_thread_scrolling_reasons) { | |
| 419 if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) | |
| 420 return; | |
| 421 | |
| 422 if (main_thread_scrolling_reasons & | |
| 423 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects && | |
| 424 layer_tree_impl()) { | |
| 425 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) { | |
| 426 const bool needs_completion = true; | |
| 427 layer_tree_impl()->ScrollAnimationAbort(needs_completion); | |
| 428 } | |
| 429 } | |
| 430 | |
| 431 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; | |
| 432 } | |
| 433 | |
| 434 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { | 417 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 435 layer->SetBackgroundColor(background_color_); | 418 layer->SetBackgroundColor(background_color_); |
| 436 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); | 419 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); |
| 437 layer->SetBounds(bounds_); | 420 layer->SetBounds(bounds_); |
| 438 layer->SetDrawsContent(DrawsContent()); | 421 layer->SetDrawsContent(DrawsContent()); |
| 439 // If whether layer has render surface changes, we need to update draw | 422 // If whether layer has render surface changes, we need to update draw |
| 440 // properties. | 423 // properties. |
| 441 // TODO(weiliangc): Should be safely removed after impl side is able to | 424 // TODO(weiliangc): Should be safely removed after impl side is able to |
| 442 // update render surfaces without rebuilding property trees. | 425 // update render surfaces without rebuilding property trees. |
| 443 if (layer->has_render_surface() != has_render_surface()) | 426 if (layer->has_render_surface() != has_render_surface()) |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 .layer_transforms_should_scale_layer_contents) { | 1397 .layer_transforms_should_scale_layer_contents) { |
| 1415 return default_scale; | 1398 return default_scale; |
| 1416 } | 1399 } |
| 1417 | 1400 |
| 1418 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1401 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1419 DrawTransform(), default_scale); | 1402 DrawTransform(), default_scale); |
| 1420 return std::max(transform_scales.x(), transform_scales.y()); | 1403 return std::max(transform_scales.x(), transform_scales.y()); |
| 1421 } | 1404 } |
| 1422 | 1405 |
| 1423 } // namespace cc | 1406 } // namespace cc |
| OLD | NEW |