Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2883653002: Implement TouchSelectionEditing controls for OOPIF. (Closed)
Patch Set: ChildFrame client uses root view's animation defaults. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 BrowserAccessibilityManager* manager = 1784 BrowserAccessibilityManager* manager =
1782 host_->GetRootBrowserAccessibilityManager(); 1785 host_->GetRootBrowserAccessibilityManager();
1783 if (manager) 1786 if (manager)
1784 manager->OnWindowFocused(); 1787 manager->OnWindowFocused();
1785 } else if (window_ == lost_focus) { 1788 } else if (window_ == lost_focus) {
1786 host_->SetActive(false); 1789 host_->SetActive(false);
1787 host_->Blur(); 1790 host_->Blur();
1788 1791
1789 DetachFromInputMethod(); 1792 DetachFromInputMethod();
1790 1793
1794 // TODO(wjmaclean): Do we need to let TouchSelectionControllerClientAura
1795 // handle this, just in case it stomps on a new highlight in another view
1796 // that has just become focused? So far it doesn't appear to be a problem,
1797 // but we should keep an eye on it.
1791 selection_controller_->HideAndDisallowShowingAutomatically(); 1798 selection_controller_->HideAndDisallowShowingAutomatically();
1792 1799
1793 if (overscroll_controller_) 1800 if (overscroll_controller_)
1794 overscroll_controller_->Cancel(); 1801 overscroll_controller_->Cancel();
1795 1802
1796 BrowserAccessibilityManager* manager = 1803 BrowserAccessibilityManager* manager =
1797 host_->GetRootBrowserAccessibilityManager(); 1804 host_->GetRootBrowserAccessibilityManager();
1798 if (manager) 1805 if (manager)
1799 manager->OnWindowBlurred(); 1806 manager->OnWindowBlurred();
1800 1807
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 return root_window->GetHost()->GetInputMethod(); 2037 return root_window->GetHost()->GetInputMethod();
2031 } 2038 }
2032 2039
2033 void RenderWidgetHostViewAura::Shutdown() { 2040 void RenderWidgetHostViewAura::Shutdown() {
2034 if (!in_shutdown_) { 2041 if (!in_shutdown_) {
2035 in_shutdown_ = true; 2042 in_shutdown_ = true;
2036 host_->ShutdownAndDestroyWidget(true); 2043 host_->ShutdownAndDestroyWidget(true);
2037 } 2044 }
2038 } 2045 }
2039 2046
2047 TouchSelectionControllerClientManager*
2048 RenderWidgetHostViewAura::touch_selection_controller_client_manager() {
2049 return selection_controller_client_.get();
2050 }
2051
2040 bool RenderWidgetHostViewAura::NeedsInputGrab() { 2052 bool RenderWidgetHostViewAura::NeedsInputGrab() {
2041 return popup_type_ == blink::kWebPopupTypePage; 2053 return popup_type_ == blink::kWebPopupTypePage;
2042 } 2054 }
2043 2055
2044 bool RenderWidgetHostViewAura::NeedsMouseCapture() { 2056 bool RenderWidgetHostViewAura::NeedsMouseCapture() {
2045 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 2057 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
2046 return NeedsInputGrab(); 2058 return NeedsInputGrab();
2047 #endif 2059 #endif
2048 return false; 2060 return false;
2049 } 2061 }
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 } 2418 }
2407 2419
2408 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { 2420 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
2409 if (!delegated_frame_host_) 2421 if (!delegated_frame_host_)
2410 return; 2422 return;
2411 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || 2423 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
2412 needs_flush_input_); 2424 needs_flush_input_);
2413 } 2425 }
2414 2426
2415 } // namespace content 2427 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698