| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 DCHECK(!layer_tree_host_->IsVisible()); | 583 DCHECK(!layer_tree_host_->IsVisible()); |
| 584 never_visible_ = true; | 584 never_visible_ = true; |
| 585 } | 585 } |
| 586 | 586 |
| 587 const base::WeakPtr<cc::InputHandler>& | 587 const base::WeakPtr<cc::InputHandler>& |
| 588 RenderWidgetCompositor::GetInputHandler() { | 588 RenderWidgetCompositor::GetInputHandler() { |
| 589 return layer_tree_host_->GetInputHandler(); | 589 return layer_tree_host_->GetInputHandler(); |
| 590 } | 590 } |
| 591 | 591 |
| 592 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { | 592 void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { |
| 593 layer_tree_host_->GetLayerTree()->SetNeedsDisplayOnAllLayers(); | 593 layer_tree_host_->SetNeedsDisplayOnAllLayers(); |
| 594 } | 594 } |
| 595 | 595 |
| 596 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { | 596 void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { |
| 597 cc::LayerTreeDebugState current = layer_tree_host_->GetDebugState(); | 597 cc::LayerTreeDebugState current = layer_tree_host_->GetDebugState(); |
| 598 current.rasterize_only_visible_content = true; | 598 current.rasterize_only_visible_content = true; |
| 599 layer_tree_host_->SetDebugState(current); | 599 layer_tree_host_->SetDebugState(current); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 602 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 603 layer_tree_host_->SetNeedsRedrawRect(damage_rect); | 603 layer_tree_host_->SetNeedsRedrawRect(damage_rect); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 630 | 630 |
| 631 void RenderWidgetCompositor::SetNeedsCommit() { | 631 void RenderWidgetCompositor::SetNeedsCommit() { |
| 632 layer_tree_host_->SetNeedsCommit(); | 632 layer_tree_host_->SetNeedsCommit(); |
| 633 } | 633 } |
| 634 | 634 |
| 635 void RenderWidgetCompositor::NotifyInputThrottledUntilCommit() { | 635 void RenderWidgetCompositor::NotifyInputThrottledUntilCommit() { |
| 636 layer_tree_host_->NotifyInputThrottledUntilCommit(); | 636 layer_tree_host_->NotifyInputThrottledUntilCommit(); |
| 637 } | 637 } |
| 638 | 638 |
| 639 const cc::Layer* RenderWidgetCompositor::GetRootLayer() const { | 639 const cc::Layer* RenderWidgetCompositor::GetRootLayer() const { |
| 640 return layer_tree_host_->GetLayerTree()->root_layer(); | 640 return layer_tree_host_->root_layer(); |
| 641 } | 641 } |
| 642 | 642 |
| 643 int RenderWidgetCompositor::ScheduleMicroBenchmark( | 643 int RenderWidgetCompositor::ScheduleMicroBenchmark( |
| 644 const std::string& name, | 644 const std::string& name, |
| 645 std::unique_ptr<base::Value> value, | 645 std::unique_ptr<base::Value> value, |
| 646 const base::Callback<void(std::unique_ptr<base::Value>)>& callback) { | 646 const base::Callback<void(std::unique_ptr<base::Value>)>& callback) { |
| 647 return layer_tree_host_->ScheduleMicroBenchmark(name, std::move(value), | 647 return layer_tree_host_->ScheduleMicroBenchmark(name, std::move(value), |
| 648 callback); | 648 callback); |
| 649 } | 649 } |
| 650 | 650 |
| 651 bool RenderWidgetCompositor::SendMessageToMicroBenchmark( | 651 bool RenderWidgetCompositor::SendMessageToMicroBenchmark( |
| 652 int id, | 652 int id, |
| 653 std::unique_ptr<base::Value> value) { | 653 std::unique_ptr<base::Value> value) { |
| 654 return layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(value)); | 654 return layer_tree_host_->SendMessageToMicroBenchmark(id, std::move(value)); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 657 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
| 658 layer_tree_host_->GetLayerTree()->SetRootLayer( | 658 layer_tree_host_->SetRootLayer( |
| 659 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); | 659 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void RenderWidgetCompositor::clearRootLayer() { | 662 void RenderWidgetCompositor::clearRootLayer() { |
| 663 layer_tree_host_->GetLayerTree()->SetRootLayer(scoped_refptr<cc::Layer>()); | 663 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
| 664 } | 664 } |
| 665 | 665 |
| 666 cc::AnimationHost* RenderWidgetCompositor::compositorAnimationHost() { | 666 cc::AnimationHost* RenderWidgetCompositor::compositorAnimationHost() { |
| 667 return animation_host_.get(); | 667 return animation_host_.get(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void RenderWidgetCompositor::setViewportSize( | 670 void RenderWidgetCompositor::setViewportSize( |
| 671 const WebSize& device_viewport_size) { | 671 const WebSize& device_viewport_size) { |
| 672 layer_tree_host_->GetLayerTree()->SetViewportSize(device_viewport_size); | 672 layer_tree_host_->SetViewportSize(device_viewport_size); |
| 673 } | 673 } |
| 674 | 674 |
| 675 WebSize RenderWidgetCompositor::getViewportSize() const { | 675 WebSize RenderWidgetCompositor::getViewportSize() const { |
| 676 return layer_tree_host_->GetLayerTree()->device_viewport_size(); | 676 return layer_tree_host_->device_viewport_size(); |
| 677 } | 677 } |
| 678 | 678 |
| 679 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( | 679 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( |
| 680 const WebFloatPoint& point) const { | 680 const WebFloatPoint& point) const { |
| 681 return point; | 681 return point; |
| 682 } | 682 } |
| 683 | 683 |
| 684 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { | 684 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { |
| 685 layer_tree_host_->GetLayerTree()->SetDeviceScaleFactor(device_scale); | 685 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
| 686 } | 686 } |
| 687 | 687 |
| 688 void RenderWidgetCompositor::setBackgroundColor(blink::WebColor color) { | 688 void RenderWidgetCompositor::setBackgroundColor(blink::WebColor color) { |
| 689 layer_tree_host_->GetLayerTree()->set_background_color(color); | 689 layer_tree_host_->set_background_color(color); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { | 692 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { |
| 693 layer_tree_host_->GetLayerTree()->set_has_transparent_background(transparent); | 693 layer_tree_host_->set_has_transparent_background(transparent); |
| 694 } | 694 } |
| 695 | 695 |
| 696 void RenderWidgetCompositor::setVisible(bool visible) { | 696 void RenderWidgetCompositor::setVisible(bool visible) { |
| 697 if (never_visible_) | 697 if (never_visible_) |
| 698 return; | 698 return; |
| 699 | 699 |
| 700 layer_tree_host_->SetVisible(visible); | 700 layer_tree_host_->SetVisible(visible); |
| 701 } | 701 } |
| 702 | 702 |
| 703 void RenderWidgetCompositor::setPageScaleFactorAndLimits( | 703 void RenderWidgetCompositor::setPageScaleFactorAndLimits( |
| 704 float page_scale_factor, float minimum, float maximum) { | 704 float page_scale_factor, float minimum, float maximum) { |
| 705 layer_tree_host_->GetLayerTree()->SetPageScaleFactorAndLimits( | 705 layer_tree_host_->SetPageScaleFactorAndLimits(page_scale_factor, minimum, |
| 706 page_scale_factor, minimum, maximum); | 706 maximum); |
| 707 } | 707 } |
| 708 | 708 |
| 709 void RenderWidgetCompositor::startPageScaleAnimation( | 709 void RenderWidgetCompositor::startPageScaleAnimation( |
| 710 const blink::WebPoint& destination, | 710 const blink::WebPoint& destination, |
| 711 bool use_anchor, | 711 bool use_anchor, |
| 712 float new_page_scale, | 712 float new_page_scale, |
| 713 double duration_sec) { | 713 double duration_sec) { |
| 714 base::TimeDelta duration = base::TimeDelta::FromMicroseconds( | 714 base::TimeDelta duration = base::TimeDelta::FromMicroseconds( |
| 715 duration_sec * base::Time::kMicrosecondsPerSecond); | 715 duration_sec * base::Time::kMicrosecondsPerSecond); |
| 716 layer_tree_host_->GetLayerTree()->StartPageScaleAnimation( | 716 layer_tree_host_->StartPageScaleAnimation( |
| 717 gfx::Vector2d(destination.x, destination.y), use_anchor, new_page_scale, | 717 gfx::Vector2d(destination.x, destination.y), use_anchor, new_page_scale, |
| 718 duration); | 718 duration); |
| 719 } | 719 } |
| 720 | 720 |
| 721 bool RenderWidgetCompositor::hasPendingPageScaleAnimation() const { | 721 bool RenderWidgetCompositor::hasPendingPageScaleAnimation() const { |
| 722 return layer_tree_host_->GetLayerTree()->HasPendingPageScaleAnimation(); | 722 return layer_tree_host_->HasPendingPageScaleAnimation(); |
| 723 } | 723 } |
| 724 | 724 |
| 725 void RenderWidgetCompositor::heuristicsForGpuRasterizationUpdated( | 725 void RenderWidgetCompositor::heuristicsForGpuRasterizationUpdated( |
| 726 bool matches_heuristics) { | 726 bool matches_heuristics) { |
| 727 layer_tree_host_->SetHasGpuRasterizationTrigger(matches_heuristics); | 727 layer_tree_host_->SetHasGpuRasterizationTrigger(matches_heuristics); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void RenderWidgetCompositor::setNeedsBeginFrame() { | 730 void RenderWidgetCompositor::setNeedsBeginFrame() { |
| 731 layer_tree_host_->SetNeedsAnimate(); | 731 layer_tree_host_->SetNeedsAnimate(); |
| 732 } | 732 } |
| 733 | 733 |
| 734 void RenderWidgetCompositor::setNeedsCompositorUpdate() { | 734 void RenderWidgetCompositor::setNeedsCompositorUpdate() { |
| 735 layer_tree_host_->SetNeedsUpdateLayers(); | 735 layer_tree_host_->SetNeedsUpdateLayers(); |
| 736 } | 736 } |
| 737 | 737 |
| 738 void RenderWidgetCompositor::didStopFlinging() { | 738 void RenderWidgetCompositor::didStopFlinging() { |
| 739 layer_tree_host_->DidStopFlinging(); | 739 layer_tree_host_->DidStopFlinging(); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void RenderWidgetCompositor::registerViewportLayers( | 742 void RenderWidgetCompositor::registerViewportLayers( |
| 743 const blink::WebLayer* overscrollElasticityLayer, | 743 const blink::WebLayer* overscrollElasticityLayer, |
| 744 const blink::WebLayer* pageScaleLayer, | 744 const blink::WebLayer* pageScaleLayer, |
| 745 const blink::WebLayer* innerViewportScrollLayer, | 745 const blink::WebLayer* innerViewportScrollLayer, |
| 746 const blink::WebLayer* outerViewportScrollLayer) { | 746 const blink::WebLayer* outerViewportScrollLayer) { |
| 747 layer_tree_host_->GetLayerTree()->RegisterViewportLayers( | 747 layer_tree_host_->RegisterViewportLayers( |
| 748 // TODO(bokan): This check can probably be removed now, but it looks | 748 // TODO(bokan): This check can probably be removed now, but it looks |
| 749 // like overscroll elasticity may still be NULL until VisualViewport | 749 // like overscroll elasticity may still be NULL until VisualViewport |
| 750 // registers its layers. | 750 // registers its layers. |
| 751 // The scroll elasticity layer will only exist when using pinch virtual | 751 // The scroll elasticity layer will only exist when using pinch virtual |
| 752 // viewports. | 752 // viewports. |
| 753 overscrollElasticityLayer | 753 overscrollElasticityLayer |
| 754 ? static_cast<const cc_blink::WebLayerImpl*>( | 754 ? static_cast<const cc_blink::WebLayerImpl*>( |
| 755 overscrollElasticityLayer) | 755 overscrollElasticityLayer) |
| 756 ->layer() | 756 ->layer() |
| 757 : NULL, | 757 : NULL, |
| 758 static_cast<const cc_blink::WebLayerImpl*>(pageScaleLayer)->layer(), | 758 static_cast<const cc_blink::WebLayerImpl*>(pageScaleLayer)->layer(), |
| 759 static_cast<const cc_blink::WebLayerImpl*>(innerViewportScrollLayer) | 759 static_cast<const cc_blink::WebLayerImpl*>(innerViewportScrollLayer) |
| 760 ->layer(), | 760 ->layer(), |
| 761 // TODO(bokan): This check can probably be removed now, but it looks | 761 // TODO(bokan): This check can probably be removed now, but it looks |
| 762 // like overscroll elasticity may still be NULL until VisualViewport | 762 // like overscroll elasticity may still be NULL until VisualViewport |
| 763 // registers its layers. | 763 // registers its layers. |
| 764 // The outer viewport layer will only exist when using pinch virtual | 764 // The outer viewport layer will only exist when using pinch virtual |
| 765 // viewports. | 765 // viewports. |
| 766 outerViewportScrollLayer | 766 outerViewportScrollLayer |
| 767 ? static_cast<const cc_blink::WebLayerImpl*>(outerViewportScrollLayer) | 767 ? static_cast<const cc_blink::WebLayerImpl*>(outerViewportScrollLayer) |
| 768 ->layer() | 768 ->layer() |
| 769 : NULL); | 769 : NULL); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void RenderWidgetCompositor::clearViewportLayers() { | 772 void RenderWidgetCompositor::clearViewportLayers() { |
| 773 layer_tree_host_->GetLayerTree()->RegisterViewportLayers( | 773 layer_tree_host_->RegisterViewportLayers( |
| 774 scoped_refptr<cc::Layer>(), scoped_refptr<cc::Layer>(), | 774 scoped_refptr<cc::Layer>(), scoped_refptr<cc::Layer>(), |
| 775 scoped_refptr<cc::Layer>(), scoped_refptr<cc::Layer>()); | 775 scoped_refptr<cc::Layer>(), scoped_refptr<cc::Layer>()); |
| 776 } | 776 } |
| 777 | 777 |
| 778 void RenderWidgetCompositor::registerSelection( | 778 void RenderWidgetCompositor::registerSelection( |
| 779 const blink::WebSelection& selection) { | 779 const blink::WebSelection& selection) { |
| 780 layer_tree_host_->GetLayerTree()->RegisterSelection( | 780 layer_tree_host_->RegisterSelection(ConvertWebSelection(selection)); |
| 781 ConvertWebSelection(selection)); | |
| 782 } | 781 } |
| 783 | 782 |
| 784 void RenderWidgetCompositor::clearSelection() { | 783 void RenderWidgetCompositor::clearSelection() { |
| 785 cc::LayerSelection empty_selection; | 784 cc::LayerSelection empty_selection; |
| 786 layer_tree_host_->GetLayerTree()->RegisterSelection(empty_selection); | 785 layer_tree_host_->RegisterSelection(empty_selection); |
| 787 } | 786 } |
| 788 | 787 |
| 789 void RenderWidgetCompositor::setMutatorClient( | 788 void RenderWidgetCompositor::setMutatorClient( |
| 790 std::unique_ptr<blink::WebCompositorMutatorClient> client) { | 789 std::unique_ptr<blink::WebCompositorMutatorClient> client) { |
| 791 TRACE_EVENT0("compositor-worker", "RenderWidgetCompositor::setMutatorClient"); | 790 TRACE_EVENT0("compositor-worker", "RenderWidgetCompositor::setMutatorClient"); |
| 792 layer_tree_host_->SetLayerTreeMutator(std::move(client)); | 791 layer_tree_host_->SetLayerTreeMutator(std::move(client)); |
| 793 } | 792 } |
| 794 | 793 |
| 795 void RenderWidgetCompositor::forceRecalculateRasterScales() { | 794 void RenderWidgetCompositor::forceRecalculateRasterScales() { |
| 796 layer_tree_host_->SetNeedsRecalculateRasterScales(); | 795 layer_tree_host_->SetNeedsRecalculateRasterScales(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 818 cc::EventListenerProperties::kBlocking, | 817 cc::EventListenerProperties::kBlocking, |
| 819 "EventListener and WebEventListener enums must match"); | 818 "EventListener and WebEventListener enums must match"); |
| 820 static_assert(static_cast<cc::EventListenerProperties>( | 819 static_assert(static_cast<cc::EventListenerProperties>( |
| 821 blink::WebEventListenerProperties::BlockingAndPassive) == | 820 blink::WebEventListenerProperties::BlockingAndPassive) == |
| 822 cc::EventListenerProperties::kBlockingAndPassive, | 821 cc::EventListenerProperties::kBlockingAndPassive, |
| 823 "EventListener and WebEventListener enums must match"); | 822 "EventListener and WebEventListener enums must match"); |
| 824 | 823 |
| 825 void RenderWidgetCompositor::setEventListenerProperties( | 824 void RenderWidgetCompositor::setEventListenerProperties( |
| 826 blink::WebEventListenerClass eventClass, | 825 blink::WebEventListenerClass eventClass, |
| 827 blink::WebEventListenerProperties properties) { | 826 blink::WebEventListenerProperties properties) { |
| 828 layer_tree_host_->GetLayerTree()->SetEventListenerProperties( | 827 layer_tree_host_->SetEventListenerProperties( |
| 829 static_cast<cc::EventListenerClass>(eventClass), | 828 static_cast<cc::EventListenerClass>(eventClass), |
| 830 static_cast<cc::EventListenerProperties>(properties)); | 829 static_cast<cc::EventListenerProperties>(properties)); |
| 831 } | 830 } |
| 832 | 831 |
| 833 void RenderWidgetCompositor::updateTouchRectsForSubframeIfNecessary() { | 832 void RenderWidgetCompositor::updateTouchRectsForSubframeIfNecessary() { |
| 834 if (!is_for_oopif_) | 833 if (!is_for_oopif_) |
| 835 return; | 834 return; |
| 836 | 835 |
| 837 // If this is an oopif sub-frame compositor, we won't be getting TouchRects | 836 // If this is an oopif sub-frame compositor, we won't be getting TouchRects |
| 838 // from ScrollingCoordinator, so to make sure touch events are handled | 837 // from ScrollingCoordinator, so to make sure touch events are handled |
| 839 // properly, mark the entire root layer as a TouchRect. | 838 // properly, mark the entire root layer as a TouchRect. |
| 840 // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame, | 839 // TODO(wjmaclean): remove this when ScrollingCoordinator is made per-frame, |
| 841 // as opposed to per-page. | 840 // as opposed to per-page. |
| 842 using blink::WebEventListenerProperties; | 841 using blink::WebEventListenerProperties; |
| 843 using blink::WebEventListenerClass; | 842 using blink::WebEventListenerClass; |
| 844 | 843 |
| 845 blink::WebEventListenerProperties touch_start_properties = | 844 blink::WebEventListenerProperties touch_start_properties = |
| 846 eventListenerProperties(WebEventListenerClass::TouchStartOrMove); | 845 eventListenerProperties(WebEventListenerClass::TouchStartOrMove); |
| 847 blink::WebEventListenerProperties touch_end_cancel_properties = | 846 blink::WebEventListenerProperties touch_end_cancel_properties = |
| 848 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel); | 847 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel); |
| 849 bool has_touch_handlers = | 848 bool has_touch_handlers = |
| 850 touch_start_properties == WebEventListenerProperties::Blocking || | 849 touch_start_properties == WebEventListenerProperties::Blocking || |
| 851 touch_start_properties == | 850 touch_start_properties == |
| 852 WebEventListenerProperties::BlockingAndPassive || | 851 WebEventListenerProperties::BlockingAndPassive || |
| 853 touch_end_cancel_properties == WebEventListenerProperties::Blocking || | 852 touch_end_cancel_properties == WebEventListenerProperties::Blocking || |
| 854 touch_end_cancel_properties == | 853 touch_end_cancel_properties == |
| 855 WebEventListenerProperties::BlockingAndPassive; | 854 WebEventListenerProperties::BlockingAndPassive; |
| 856 | 855 |
| 857 cc::Layer* root_layer = layer_tree_host_->GetLayerTree()->root_layer(); | 856 cc::Layer* root_layer = layer_tree_host_->root_layer(); |
| 858 cc::Region touch_handler_region; | 857 cc::Region touch_handler_region; |
| 859 if (has_touch_handlers) | 858 if (has_touch_handlers) |
| 860 touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds()); | 859 touch_handler_region = gfx::Rect(gfx::Point(), root_layer->bounds()); |
| 861 root_layer->SetTouchEventHandlerRegion(touch_handler_region); | 860 root_layer->SetTouchEventHandlerRegion(touch_handler_region); |
| 862 } | 861 } |
| 863 | 862 |
| 864 blink::WebEventListenerProperties | 863 blink::WebEventListenerProperties |
| 865 RenderWidgetCompositor::eventListenerProperties( | 864 RenderWidgetCompositor::eventListenerProperties( |
| 866 blink::WebEventListenerClass event_class) const { | 865 blink::WebEventListenerClass event_class) const { |
| 867 return static_cast<blink::WebEventListenerProperties>( | 866 return static_cast<blink::WebEventListenerProperties>( |
| 868 layer_tree_host_->GetLayerTree()->event_listener_properties( | 867 layer_tree_host_->event_listener_properties( |
| 869 static_cast<cc::EventListenerClass>(event_class))); | 868 static_cast<cc::EventListenerClass>(event_class))); |
| 870 } | 869 } |
| 871 | 870 |
| 872 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { | 871 void RenderWidgetCompositor::setHaveScrollEventHandlers(bool has_handlers) { |
| 873 layer_tree_host_->GetLayerTree()->SetHaveScrollEventHandlers(has_handlers); | 872 layer_tree_host_->SetHaveScrollEventHandlers(has_handlers); |
| 874 } | 873 } |
| 875 | 874 |
| 876 bool RenderWidgetCompositor::haveScrollEventHandlers() const { | 875 bool RenderWidgetCompositor::haveScrollEventHandlers() const { |
| 877 return layer_tree_host_->GetLayerTree()->have_scroll_event_handlers(); | 876 return layer_tree_host_->have_scroll_event_handlers(); |
| 878 } | 877 } |
| 879 | 878 |
| 880 void CompositeAndReadbackAsyncCallback( | 879 void CompositeAndReadbackAsyncCallback( |
| 881 blink::WebCompositeAndReadbackAsyncCallback* callback, | 880 blink::WebCompositeAndReadbackAsyncCallback* callback, |
| 882 std::unique_ptr<cc::CopyOutputResult> result) { | 881 std::unique_ptr<cc::CopyOutputResult> result) { |
| 883 if (result->HasBitmap()) { | 882 if (result->HasBitmap()) { |
| 884 std::unique_ptr<SkBitmap> result_bitmap = result->TakeBitmap(); | 883 std::unique_ptr<SkBitmap> result_bitmap = result->TakeBitmap(); |
| 885 callback->didCompositeAndReadback(*result_bitmap); | 884 callback->didCompositeAndReadback(*result_bitmap); |
| 886 } else { | 885 } else { |
| 887 callback->didCompositeAndReadback(SkBitmap()); | 886 callback->didCompositeAndReadback(SkBitmap()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 WebBrowserControlsState constraints, | 995 WebBrowserControlsState constraints, |
| 997 WebBrowserControlsState current, | 996 WebBrowserControlsState current, |
| 998 bool animate) { | 997 bool animate) { |
| 999 layer_tree_host_->UpdateBrowserControlsState( | 998 layer_tree_host_->UpdateBrowserControlsState( |
| 1000 ConvertBrowserControlsState(constraints), | 999 ConvertBrowserControlsState(constraints), |
| 1001 ConvertBrowserControlsState(current), animate); | 1000 ConvertBrowserControlsState(current), animate); |
| 1002 } | 1001 } |
| 1003 | 1002 |
| 1004 void RenderWidgetCompositor::setBrowserControlsHeight(float height, | 1003 void RenderWidgetCompositor::setBrowserControlsHeight(float height, |
| 1005 bool shrink) { | 1004 bool shrink) { |
| 1006 layer_tree_host_->GetLayerTree()->SetBrowserControlsHeight(height, shrink); | 1005 layer_tree_host_->SetBrowserControlsHeight(height, shrink); |
| 1007 } | 1006 } |
| 1008 | 1007 |
| 1009 void RenderWidgetCompositor::setBrowserControlsShownRatio(float ratio) { | 1008 void RenderWidgetCompositor::setBrowserControlsShownRatio(float ratio) { |
| 1010 layer_tree_host_->GetLayerTree()->SetBrowserControlsShownRatio(ratio); | 1009 layer_tree_host_->SetBrowserControlsShownRatio(ratio); |
| 1011 } | 1010 } |
| 1012 | 1011 |
| 1013 void RenderWidgetCompositor::setBottomControlsHeight(float height) { | 1012 void RenderWidgetCompositor::setBottomControlsHeight(float height) { |
| 1014 layer_tree_host_->GetLayerTree()->SetBottomControlsHeight(height); | 1013 layer_tree_host_->SetBottomControlsHeight(height); |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 void RenderWidgetCompositor::WillBeginMainFrame() { | 1016 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 1018 delegate_->WillBeginCompositorFrame(); | 1017 delegate_->WillBeginCompositorFrame(); |
| 1019 } | 1018 } |
| 1020 | 1019 |
| 1021 void RenderWidgetCompositor::DidBeginMainFrame() { | 1020 void RenderWidgetCompositor::DidBeginMainFrame() { |
| 1022 } | 1021 } |
| 1023 | 1022 |
| 1024 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { | 1023 void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 } | 1116 } |
| 1118 | 1117 |
| 1119 void RenderWidgetCompositor::SetFrameSinkId( | 1118 void RenderWidgetCompositor::SetFrameSinkId( |
| 1120 const cc::FrameSinkId& frame_sink_id) { | 1119 const cc::FrameSinkId& frame_sink_id) { |
| 1121 frame_sink_id_ = frame_sink_id; | 1120 frame_sink_id_ = frame_sink_id; |
| 1122 layer_tree_host_->SetFrameSinkId(frame_sink_id); | 1121 layer_tree_host_->SetFrameSinkId(frame_sink_id); |
| 1123 } | 1122 } |
| 1124 | 1123 |
| 1125 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1124 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
| 1126 float device_scale) { | 1125 float device_scale) { |
| 1127 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1126 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
| 1128 } | 1127 } |
| 1129 | 1128 |
| 1130 void RenderWidgetCompositor::SetDeviceColorSpace( | 1129 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1131 const gfx::ColorSpace& color_space) { | 1130 const gfx::ColorSpace& color_space) { |
| 1132 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1131 layer_tree_host_->SetDeviceColorSpace(color_space); |
| 1133 } | 1132 } |
| 1134 | 1133 |
| 1135 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { | 1134 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { |
| 1136 is_for_oopif_ = is_for_oopif; | 1135 is_for_oopif_ = is_for_oopif; |
| 1137 } | 1136 } |
| 1138 | 1137 |
| 1139 } // namespace content | 1138 } // namespace content |
| OLD | NEW |