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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 657803002: Update touch selection to only modify one selection point at a time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DCHECK Created 6 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 root_layer_->SetIsDrawable(false); 770 root_layer_->SetIsDrawable(false);
771 } 771 }
772 772
773 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) { 773 void ContentViewCoreImpl::RemoveLayer(scoped_refptr<cc::Layer> layer) {
774 layer->RemoveFromParent(); 774 layer->RemoveFromParent();
775 775
776 if (!root_layer_->children().size()) 776 if (!root_layer_->children().size())
777 root_layer_->SetIsDrawable(true); 777 root_layer_->SetIsDrawable(true);
778 } 778 }
779 779
780 void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& start, 780 void ContentViewCoreImpl::MoveRangeSelectionExtent(
781 const gfx::PointF& end) { 781 const gfx::PointF& position) {
jdduke (slow) 2014/10/21 16:57:36 Nit: Let's call this |extent| instead of |position
782 if (!web_contents_) 782 if (!web_contents_)
783 return; 783 return;
784 784
785 gfx::Point start_point = gfx::Point(start.x(), start.y()); 785 web_contents_->MoveRangeSelectionExtent(
786 gfx::Point end_point = gfx::Point(end.x(), end.y()); 786 gfx::Point(position.x(), position.y()));
787 if (start_point == end_point) 787 }
788
789 void ContentViewCoreImpl::SelectBetweenCoordinates(const gfx::PointF& base,
790 const gfx::PointF& extent) {
791 if (!web_contents_)
788 return; 792 return;
789 793
790 web_contents_->SelectRange(start_point, end_point); 794 gfx::Point base_point = gfx::Point(base.x(), base.y());
795 gfx::Point extent_point = gfx::Point(extent.x(), extent.y());
796 if (base_point == extent_point)
797 return;
798
799 web_contents_->SelectRange(base_point, extent_point);
791 } 800 }
792 801
793 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const { 802 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const {
794 return view_android_; 803 return view_android_;
795 } 804 }
796 805
797 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const { 806 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const {
798 return window_android_; 807 return window_android_;
799 } 808 }
800 809
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 reinterpret_cast<ui::WindowAndroid*>(window_android), 1347 reinterpret_cast<ui::WindowAndroid*>(window_android),
1339 retained_objects_set); 1348 retained_objects_set);
1340 return reinterpret_cast<intptr_t>(view); 1349 return reinterpret_cast<intptr_t>(view);
1341 } 1350 }
1342 1351
1343 bool RegisterContentViewCore(JNIEnv* env) { 1352 bool RegisterContentViewCore(JNIEnv* env) {
1344 return RegisterNativesImpl(env); 1353 return RegisterNativesImpl(env);
1345 } 1354 }
1346 1355
1347 } // namespace content 1356 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698