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

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

Issue 2855353002: Make Paste Popup use selection rect for positioning (Closed)
Patch Set: fix typo 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_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 962
963 return true; 963 return true;
964 } 964 }
965 965
966 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( 966 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent(
967 const ui::MotionEvent& event) { 967 const ui::MotionEvent& event) {
968 return touch_selection_controller_ && 968 return touch_selection_controller_ &&
969 touch_selection_controller_->WillHandleTouchEvent(event); 969 touch_selection_controller_->WillHandleTouchEvent(event);
970 } 970 }
971 971
972 int RenderWidgetHostViewAndroid::GetTouchHandleHeight() {
973 if (!touch_selection_controller_)
974 return 0;
975 return static_cast<int>(
976 touch_selection_controller_->GetStartHandleRect().height());
977 }
978
972 void RenderWidgetHostViewAndroid::ResetGestureDetection() { 979 void RenderWidgetHostViewAndroid::ResetGestureDetection() {
973 const ui::MotionEvent* current_down_event = 980 const ui::MotionEvent* current_down_event =
974 gesture_provider_.GetCurrentDownEvent(); 981 gesture_provider_.GetCurrentDownEvent();
975 if (!current_down_event) { 982 if (!current_down_event) {
976 // A hard reset ensures prevention of any timer-based events that might fire 983 // A hard reset ensures prevention of any timer-based events that might fire
977 // after a touch sequence has ended. 984 // after a touch sequence has ended.
978 gesture_provider_.ResetDetection(); 985 gesture_provider_.ResetDetection();
979 return; 986 return;
980 } 987 }
981 988
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 DCHECK(selection_popup_controller_); 1305 DCHECK(selection_popup_controller_);
1299 DCHECK(touch_selection_controller_); 1306 DCHECK(touch_selection_controller_);
1300 // If a selection drag has started, it has taken over the active touch 1307 // If a selection drag has started, it has taken over the active touch
1301 // sequence. Immediately cancel gesture detection and any downstream touch 1308 // sequence. Immediately cancel gesture detection and any downstream touch
1302 // listeners (e.g., web content) to communicate this transfer. 1309 // listeners (e.g., web content) to communicate this transfer.
1303 if (event == ui::SELECTION_HANDLES_SHOWN && 1310 if (event == ui::SELECTION_HANDLES_SHOWN &&
1304 gesture_provider_.GetCurrentDownEvent()) { 1311 gesture_provider_.GetCurrentDownEvent()) {
1305 ResetGestureDetection(); 1312 ResetGestureDetection();
1306 } 1313 }
1307 selection_popup_controller_->OnSelectionEvent( 1314 selection_popup_controller_->OnSelectionEvent(
1308 event, touch_selection_controller_->GetStartPosition(), 1315 event, GetSelectionRect(*touch_selection_controller_));
1309 GetSelectionRect(*touch_selection_controller_));
1310 } 1316 }
1311 1317
1312 std::unique_ptr<ui::TouchHandleDrawable> 1318 std::unique_ptr<ui::TouchHandleDrawable>
1313 RenderWidgetHostViewAndroid::CreateDrawable() { 1319 RenderWidgetHostViewAndroid::CreateDrawable() {
1314 DCHECK(content_view_core_); 1320 DCHECK(content_view_core_);
1315 if (!using_browser_compositor_) { 1321 if (!using_browser_compositor_) {
1316 if (!sync_compositor_) 1322 if (!sync_compositor_)
1317 return nullptr; 1323 return nullptr;
1318 return std::unique_ptr<ui::TouchHandleDrawable>( 1324 return std::unique_ptr<ui::TouchHandleDrawable>(
1319 sync_compositor_->client()->CreateDrawable()); 1325 sync_compositor_->client()->CreateDrawable());
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 2197
2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 2198 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
2193 if (!compositor) 2199 if (!compositor)
2194 return; 2200 return;
2195 2201
2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2202 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); 2203 overscroll_refresh_handler, compositor, view_.GetDipScale());
2198 } 2204 }
2199 2205
2200 } // namespace content 2206 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698