| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 cc::CompositorFrame frame) { | 911 cc::CompositorFrame frame) { |
| 912 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 912 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
| 913 | 913 |
| 914 // Override the background color to the current compositor background. | 914 // Override the background color to the current compositor background. |
| 915 // This allows us to, when navigating to a new page, transfer this color to | 915 // This allows us to, when navigating to a new page, transfer this color to |
| 916 // that page. This allows us to pass this background color to new views on | 916 // that page. This allows us to pass this background color to new views on |
| 917 // navigation. | 917 // navigation. |
| 918 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); | 918 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); |
| 919 | 919 |
| 920 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 920 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
| 921 | |
| 922 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; | 921 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; |
| 923 if (IsUseZoomForDSFEnabled()) { | 922 if (IsUseZoomForDSFEnabled()) { |
| 924 float viewportToDIPScale = 1.0f / current_device_scale_factor_; | 923 float viewportToDIPScale = 1.0f / current_device_scale_factor_; |
| 925 gfx::PointF start_edge_top = selection.start.edge_top(); | 924 gfx::PointF start_edge_top = selection.start.edge_top(); |
| 926 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); | 925 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); |
| 927 gfx::PointF end_edge_top = selection.end.edge_top(); | 926 gfx::PointF end_edge_top = selection.end.edge_top(); |
| 928 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); | 927 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); |
| 929 | 928 |
| 930 start_edge_top.Scale(viewportToDIPScale); | 929 start_edge_top.Scale(viewportToDIPScale); |
| 931 start_edge_bottom.Scale(viewportToDIPScale); | 930 start_edge_bottom.Scale(viewportToDIPScale); |
| 932 end_edge_top.Scale(viewportToDIPScale); | 931 end_edge_top.Scale(viewportToDIPScale); |
| 933 end_edge_bottom.Scale(viewportToDIPScale); | 932 end_edge_bottom.Scale(viewportToDIPScale); |
| 934 | 933 |
| 935 selection.start.SetEdge(start_edge_top, start_edge_bottom); | 934 selection.start.SetEdge(start_edge_top, start_edge_bottom); |
| 936 selection.end.SetEdge(end_edge_top, end_edge_bottom); | 935 selection.end.SetEdge(end_edge_top, end_edge_bottom); |
| 937 } | 936 } |
| 938 | 937 |
| 939 if (delegated_frame_host_) { | 938 if (delegated_frame_host_) { |
| 940 delegated_frame_host_->SubmitCompositorFrame(local_surface_id, | 939 delegated_frame_host_->SubmitCompositorFrame(local_surface_id, |
| 941 std::move(frame)); | 940 std::move(frame)); |
| 942 } | 941 } |
| 943 selection_controller_->OnSelectionBoundsChanged(selection.start, | 942 if (selection.start != selection_start_ || selection.end != selection_end_) { |
| 944 selection.end); | 943 selection_start_ = selection.start; |
| 944 selection_end_ = selection.end; |
| 945 selection_controller_client_->UpdateClientSelectionBounds(selection_start_, |
| 946 selection_end_); |
| 947 } |
| 945 } | 948 } |
| 946 | 949 |
| 947 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( | 950 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( |
| 948 const cc::BeginFrameAck& ack) { | 951 const cc::BeginFrameAck& ack) { |
| 949 delegated_frame_host_->BeginFrameDidNotSwap(ack); | 952 delegated_frame_host_->BeginFrameDidNotSwap(ack); |
| 950 } | 953 } |
| 951 | 954 |
| 952 void RenderWidgetHostViewAura::ClearCompositorFrame() { | 955 void RenderWidgetHostViewAura::ClearCompositorFrame() { |
| 953 if (delegated_frame_host_) | 956 if (delegated_frame_host_) |
| 954 delegated_frame_host_->ClearDelegatedFrame(); | 957 delegated_frame_host_->ClearDelegatedFrame(); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 BrowserAccessibilityManager* manager = | 1783 BrowserAccessibilityManager* manager = |
| 1781 host_->GetRootBrowserAccessibilityManager(); | 1784 host_->GetRootBrowserAccessibilityManager(); |
| 1782 if (manager) | 1785 if (manager) |
| 1783 manager->OnWindowFocused(); | 1786 manager->OnWindowFocused(); |
| 1784 } else if (window_ == lost_focus) { | 1787 } else if (window_ == lost_focus) { |
| 1785 host_->SetActive(false); | 1788 host_->SetActive(false); |
| 1786 host_->Blur(); | 1789 host_->Blur(); |
| 1787 | 1790 |
| 1788 DetachFromInputMethod(); | 1791 DetachFromInputMethod(); |
| 1789 | 1792 |
| 1793 // TODO(wjmaclean): Do we need to let TouchSelectionControllerClientAura |
| 1794 // handle this, just in case it stomps on a new highlight in another view |
| 1795 // that has just become focused? So far it doesn't appear to be a problem, |
| 1796 // but we should keep an eye on it. |
| 1790 selection_controller_->HideAndDisallowShowingAutomatically(); | 1797 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1791 | 1798 |
| 1792 if (overscroll_controller_) | 1799 if (overscroll_controller_) |
| 1793 overscroll_controller_->Cancel(); | 1800 overscroll_controller_->Cancel(); |
| 1794 | 1801 |
| 1795 BrowserAccessibilityManager* manager = | 1802 BrowserAccessibilityManager* manager = |
| 1796 host_->GetRootBrowserAccessibilityManager(); | 1803 host_->GetRootBrowserAccessibilityManager(); |
| 1797 if (manager) | 1804 if (manager) |
| 1798 manager->OnWindowBlurred(); | 1805 manager->OnWindowBlurred(); |
| 1799 | 1806 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 return root_window->GetHost()->GetInputMethod(); | 2036 return root_window->GetHost()->GetInputMethod(); |
| 2030 } | 2037 } |
| 2031 | 2038 |
| 2032 void RenderWidgetHostViewAura::Shutdown() { | 2039 void RenderWidgetHostViewAura::Shutdown() { |
| 2033 if (!in_shutdown_) { | 2040 if (!in_shutdown_) { |
| 2034 in_shutdown_ = true; | 2041 in_shutdown_ = true; |
| 2035 host_->ShutdownAndDestroyWidget(true); | 2042 host_->ShutdownAndDestroyWidget(true); |
| 2036 } | 2043 } |
| 2037 } | 2044 } |
| 2038 | 2045 |
| 2046 TouchSelectionControllerClientManager* |
| 2047 RenderWidgetHostViewAura::touch_selection_controller_client_manager() { |
| 2048 return selection_controller_client_.get(); |
| 2049 } |
| 2050 |
| 2039 bool RenderWidgetHostViewAura::NeedsInputGrab() { | 2051 bool RenderWidgetHostViewAura::NeedsInputGrab() { |
| 2040 return popup_type_ == blink::kWebPopupTypePage; | 2052 return popup_type_ == blink::kWebPopupTypePage; |
| 2041 } | 2053 } |
| 2042 | 2054 |
| 2043 bool RenderWidgetHostViewAura::NeedsMouseCapture() { | 2055 bool RenderWidgetHostViewAura::NeedsMouseCapture() { |
| 2044 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 2056 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 2045 return NeedsInputGrab(); | 2057 return NeedsInputGrab(); |
| 2046 #endif | 2058 #endif |
| 2047 return false; | 2059 return false; |
| 2048 } | 2060 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 } | 2399 } |
| 2388 | 2400 |
| 2389 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2401 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
| 2390 if (!delegated_frame_host_) | 2402 if (!delegated_frame_host_) |
| 2391 return; | 2403 return; |
| 2392 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2404 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
| 2393 needs_flush_input_); | 2405 needs_flush_input_); |
| 2394 } | 2406 } |
| 2395 | 2407 |
| 2396 } // namespace content | 2408 } // namespace content |
| OLD | NEW |