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

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

Issue 342633003: [Android] Select text when stylus first button is pressed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed signed unsigned comparison error Created 6 years, 5 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 "base/android/sys_utils.h" 9 #include "base/android/sys_utils.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 is_showing_(!widget_host->is_hidden()), 180 is_showing_(!widget_host->is_hidden()),
181 content_view_core_(NULL), 181 content_view_core_(NULL),
182 ime_adapter_android_(this), 182 ime_adapter_android_(this),
183 cached_background_color_(SK_ColorWHITE), 183 cached_background_color_(SK_ColorWHITE),
184 last_output_surface_id_(kUndefinedOutputSurfaceId), 184 last_output_surface_id_(kUndefinedOutputSurfaceId),
185 weak_ptr_factory_(this), 185 weak_ptr_factory_(this),
186 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch( 186 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch(
187 switches::kDisableOverscrollEdgeEffect)), 187 switches::kDisableOverscrollEdgeEffect)),
188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), 188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)),
189 gesture_provider_(CreateGestureProviderConfig(), this), 189 gesture_provider_(CreateGestureProviderConfig(), this),
190 gesture_text_selector_(this),
190 flush_input_requested_(false), 191 flush_input_requested_(false),
191 accelerated_surface_route_id_(0), 192 accelerated_surface_route_id_(0),
192 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( 193 using_synchronous_compositor_(SynchronousCompositorImpl::FromID(
193 widget_host->GetProcess()->GetID(), 194 widget_host->GetProcess()->GetID(),
194 widget_host->GetRoutingID()) != NULL), 195 widget_host->GetRoutingID()) != NULL),
195 frame_evictor_(new DelegatedFrameEvictor(this)), 196 frame_evictor_(new DelegatedFrameEvictor(this)),
196 locks_on_frame_count_(0), 197 locks_on_frame_count_(0),
197 observing_root_window_(false) { 198 observing_root_window_(false) {
198 host_->SetView(this); 199 host_->SetView(this);
199 SetContentViewCore(content_view_core); 200 SetContentViewCore(content_view_core);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 552 }
552 553
553 bool RenderWidgetHostViewAndroid::OnTouchEvent( 554 bool RenderWidgetHostViewAndroid::OnTouchEvent(
554 const ui::MotionEvent& event) { 555 const ui::MotionEvent& event) {
555 if (!host_) 556 if (!host_)
556 return false; 557 return false;
557 558
558 if (!gesture_provider_.OnTouchEvent(event)) 559 if (!gesture_provider_.OnTouchEvent(event))
559 return false; 560 return false;
560 561
562 if (gesture_text_selector_.OnTouchEvent(event)) {
563 gesture_provider_.OnTouchEventAck(false);
564 return true;
565 }
566
561 // Short-circuit touch forwarding if no touch handlers exist. 567 // Short-circuit touch forwarding if no touch handlers exist.
562 if (!host_->ShouldForwardTouchEvent()) { 568 if (!host_->ShouldForwardTouchEvent()) {
563 const bool event_consumed = false; 569 const bool event_consumed = false;
564 gesture_provider_.OnTouchEventAck(event_consumed); 570 gesture_provider_.OnTouchEventAck(event_consumed);
565 return true; 571 return true;
566 } 572 }
567 573
568 SendTouchEvent(CreateWebTouchEventFromMotionEvent(event)); 574 SendTouchEvent(CreateWebTouchEventFromMotionEvent(event));
569 return true; 575 return true;
570 } 576 }
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 1286
1281 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1287 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1282 while (!ack_callbacks_.empty()) { 1288 while (!ack_callbacks_.empty()) {
1283 ack_callbacks_.front().Run(); 1289 ack_callbacks_.front().Run();
1284 ack_callbacks_.pop(); 1290 ack_callbacks_.pop();
1285 } 1291 }
1286 } 1292 }
1287 1293
1288 void RenderWidgetHostViewAndroid::OnGestureEvent( 1294 void RenderWidgetHostViewAndroid::OnGestureEvent(
1289 const ui::GestureEventData& gesture) { 1295 const ui::GestureEventData& gesture) {
1296 if (gesture_text_selector_.OnGestureEvent(gesture))
1297 return;
1298
1290 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); 1299 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture));
1291 } 1300 }
1292 1301
1293 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { 1302 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() {
1294 RunAckCallbacks(); 1303 RunAckCallbacks();
1295 } 1304 }
1296 1305
1297 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1306 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1298 DCHECK(content_view_core_); 1307 DCHECK(content_view_core_);
1299 DCHECK(!using_synchronous_compositor_); 1308 DCHECK(!using_synchronous_compositor_);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 // Define the criteria here. If say the 16 texture readback is 1436 // Define the criteria here. If say the 16 texture readback is
1428 // supported we should go with that (this degrades quality) 1437 // supported we should go with that (this degrades quality)
1429 // or stick back to the default format. 1438 // or stick back to the default format.
1430 if (base::android::SysUtils::IsLowEndDevice()) { 1439 if (base::android::SysUtils::IsLowEndDevice()) {
1431 if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config)) 1440 if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config))
1432 return SkBitmap::kRGB_565_Config; 1441 return SkBitmap::kRGB_565_Config;
1433 } 1442 }
1434 return SkBitmap::kARGB_8888_Config; 1443 return SkBitmap::kARGB_8888_Config;
1435 } 1444 }
1436 1445
1446 void RenderWidgetHostViewAndroid::ShowSelectionHandlesAutomatically() {
1447 if (content_view_core_)
1448 content_view_core_->ShowSelectionHandlesAutomatically();
1449 }
1450
1451 void RenderWidgetHostViewAndroid::SelectRange(
1452 float x1, float y1, float x2, float y2) {
1453 if (content_view_core_)
1454 static_cast<WebContentsImpl*>(content_view_core_->GetWebContents())->
1455 SelectRange(gfx::Point(x1, y1), gfx::Point(x2, y2));
1456 }
1457
1458 void RenderWidgetHostViewAndroid::Unselect() {
1459 if (content_view_core_)
1460 content_view_core_->GetWebContents()->Unselect();
1461 }
1462
1437 // static 1463 // static
1438 void RenderWidgetHostViewBase::GetDefaultScreenInfo( 1464 void RenderWidgetHostViewBase::GetDefaultScreenInfo(
1439 blink::WebScreenInfo* results) { 1465 blink::WebScreenInfo* results) {
1440 const gfx::Display& display = 1466 const gfx::Display& display =
1441 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 1467 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
1442 results->rect = display.bounds(); 1468 results->rect = display.bounds();
1443 // TODO(husky): Remove any system controls from availableRect. 1469 // TODO(husky): Remove any system controls from availableRect.
1444 results->availableRect = display.work_area(); 1470 results->availableRect = display.work_area();
1445 results->deviceScaleFactor = display.device_scale_factor(); 1471 results->deviceScaleFactor = display.device_scale_factor();
1446 results->orientationAngle = display.RotationAsDegree(); 1472 results->orientationAngle = display.RotationAsDegree();
1447 results->orientationType = 1473 results->orientationType =
1448 RenderWidgetHostViewBase::GetOrientationTypeFromDisplay(display); 1474 RenderWidgetHostViewBase::GetOrientationTypeFromDisplay(display);
1449 gfx::DeviceDisplayInfo info; 1475 gfx::DeviceDisplayInfo info;
1450 results->depth = info.GetBitsPerPixel(); 1476 results->depth = info.GetBitsPerPixel();
1451 results->depthPerComponent = info.GetBitsPerComponent(); 1477 results->depthPerComponent = info.GetBitsPerComponent();
1452 results->isMonochrome = (results->depthPerComponent == 0); 1478 results->isMonochrome = (results->depthPerComponent == 0);
1453 } 1479 }
1454 1480
1455 } // namespace content 1481 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698