| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_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 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. | 407 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. |
| 408 if (active_tree_->LayerListIsEmpty()) { | 408 if (active_tree_->LayerListIsEmpty()) { |
| 409 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", | 409 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", |
| 410 TRACE_EVENT_SCOPE_THREAD); | 410 TRACE_EVENT_SCOPE_THREAD); |
| 411 return false; | 411 return false; |
| 412 } | 412 } |
| 413 | 413 |
| 414 if (resourceless_software_draw_) | 414 if (resourceless_software_draw_) |
| 415 return true; | 415 return true; |
| 416 | 416 |
| 417 if (DrawViewportSize().IsEmpty()) { | 417 if (DeviceViewport().IsEmpty()) { |
| 418 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", | 418 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", |
| 419 TRACE_EVENT_SCOPE_THREAD); | 419 TRACE_EVENT_SCOPE_THREAD); |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 if (active_tree_->ViewportSizeInvalid()) { | 422 if (active_tree_->ViewportSizeInvalid()) { |
| 423 TRACE_EVENT_INSTANT0( | 423 TRACE_EVENT_INSTANT0( |
| 424 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed", | 424 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed", |
| 425 TRACE_EVENT_SCOPE_THREAD); | 425 TRACE_EVENT_SCOPE_THREAD); |
| 426 return false; | 426 return false; |
| 427 } | 427 } |
| (...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 active_tree_->SetViewportSizeInvalid(); | 2489 active_tree_->SetViewportSizeInvalid(); |
| 2490 | 2490 |
| 2491 device_viewport_size_ = device_viewport_size; | 2491 device_viewport_size_ = device_viewport_size; |
| 2492 | 2492 |
| 2493 UpdateViewportContainerSizes(); | 2493 UpdateViewportContainerSizes(); |
| 2494 client_->OnCanDrawStateChanged(CanDraw()); | 2494 client_->OnCanDrawStateChanged(CanDraw()); |
| 2495 SetFullViewportDamage(); | 2495 SetFullViewportDamage(); |
| 2496 active_tree_->set_needs_update_draw_properties(); | 2496 active_tree_->set_needs_update_draw_properties(); |
| 2497 } | 2497 } |
| 2498 | 2498 |
| 2499 const gfx::Rect LayerTreeHostImpl::ViewportRectForTilePriority() const { | |
| 2500 if (viewport_rect_for_tile_priority_.IsEmpty()) | |
| 2501 return DeviceViewport(); | |
| 2502 | |
| 2503 return viewport_rect_for_tile_priority_; | |
| 2504 } | |
| 2505 | |
| 2506 gfx::Size LayerTreeHostImpl::DrawViewportSize() const { | |
| 2507 return DeviceViewport().size(); | |
| 2508 } | |
| 2509 | |
| 2510 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { | 2499 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { |
| 2511 if (external_viewport_.IsEmpty()) | 2500 if (external_viewport_.IsEmpty()) |
| 2512 return gfx::Rect(device_viewport_size_); | 2501 return gfx::Rect(device_viewport_size_); |
| 2513 | 2502 |
| 2514 return external_viewport_; | 2503 return external_viewport_; |
| 2515 } | 2504 } |
| 2516 | 2505 |
| 2506 const gfx::Rect LayerTreeHostImpl::ViewportRectForTilePriority() const { |
| 2507 if (viewport_rect_for_tile_priority_.IsEmpty()) |
| 2508 return DeviceViewport(); |
| 2509 |
| 2510 return viewport_rect_for_tile_priority_; |
| 2511 } |
| 2512 |
| 2517 const gfx::Transform& LayerTreeHostImpl::DrawTransform() const { | 2513 const gfx::Transform& LayerTreeHostImpl::DrawTransform() const { |
| 2518 return external_transform_; | 2514 return external_transform_; |
| 2519 } | 2515 } |
| 2520 | 2516 |
| 2521 void LayerTreeHostImpl::DidChangeBrowserControlsPosition() { | 2517 void LayerTreeHostImpl::DidChangeBrowserControlsPosition() { |
| 2522 UpdateViewportContainerSizes(); | 2518 UpdateViewportContainerSizes(); |
| 2523 SetNeedsRedraw(); | 2519 SetNeedsRedraw(); |
| 2524 SetNeedsOneBeginImplFrame(); | 2520 SetNeedsOneBeginImplFrame(); |
| 2525 active_tree_->set_needs_update_draw_properties(); | 2521 active_tree_->set_needs_update_draw_properties(); |
| 2526 SetFullViewportDamage(); | 2522 SetFullViewportDamage(); |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3570 | 3566 |
| 3571 // Record and reset scroll source flags. | 3567 // Record and reset scroll source flags. |
| 3572 scroll_info->has_scrolled_by_wheel = has_scrolled_by_wheel_; | 3568 scroll_info->has_scrolled_by_wheel = has_scrolled_by_wheel_; |
| 3573 scroll_info->has_scrolled_by_touch = has_scrolled_by_touch_; | 3569 scroll_info->has_scrolled_by_touch = has_scrolled_by_touch_; |
| 3574 has_scrolled_by_wheel_ = has_scrolled_by_touch_ = false; | 3570 has_scrolled_by_wheel_ = has_scrolled_by_touch_ = false; |
| 3575 | 3571 |
| 3576 return scroll_info; | 3572 return scroll_info; |
| 3577 } | 3573 } |
| 3578 | 3574 |
| 3579 void LayerTreeHostImpl::SetFullViewportDamage() { | 3575 void LayerTreeHostImpl::SetFullViewportDamage() { |
| 3580 SetViewportDamage(gfx::Rect(DrawViewportSize())); | 3576 SetViewportDamage(gfx::Rect(DeviceViewport().size())); |
| 3581 } | 3577 } |
| 3582 | 3578 |
| 3583 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { | 3579 bool LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) { |
| 3584 if (!page_scale_animation_) | 3580 if (!page_scale_animation_) |
| 3585 return false; | 3581 return false; |
| 3586 | 3582 |
| 3587 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); | 3583 gfx::ScrollOffset scroll_total = active_tree_->TotalScrollOffset(); |
| 3588 | 3584 |
| 3589 if (!page_scale_animation_->IsAnimationStarted()) | 3585 if (!page_scale_animation_->IsAnimationStarted()) |
| 3590 page_scale_animation_->StartAnimation(monotonic_time); | 3586 page_scale_animation_->StartAnimation(monotonic_time); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4301 | 4297 |
| 4302 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4298 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4303 if (!element_id) | 4299 if (!element_id) |
| 4304 return; | 4300 return; |
| 4305 if (ScrollbarAnimationController* animation_controller = | 4301 if (ScrollbarAnimationController* animation_controller = |
| 4306 ScrollbarAnimationControllerForElementId(element_id)) | 4302 ScrollbarAnimationControllerForElementId(element_id)) |
| 4307 animation_controller->DidScrollUpdate(); | 4303 animation_controller->DidScrollUpdate(); |
| 4308 } | 4304 } |
| 4309 | 4305 |
| 4310 } // namespace cc | 4306 } // namespace cc |
| OLD | NEW |