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

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

Issue 712723002: suppress link disambiguation popup when virtual keyboard requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix linux build Created 6 years, 1 month 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 1220
1221 } 1221 }
1222 1222
1223 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 1223 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
1224 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 1224 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
1225 } 1225 }
1226 1226
1227 void RenderWidgetHostViewAura::ShowDisambiguationPopup( 1227 void RenderWidgetHostViewAura::ShowDisambiguationPopup(
1228 const gfx::Rect& rect_pixels, 1228 const gfx::Rect& rect_pixels,
1229 const SkBitmap& zoomed_bitmap) { 1229 const SkBitmap& zoomed_bitmap) {
1230 RenderViewHostDelegate* delegate = NULL;
1231 if (host_->IsRenderView())
1232 delegate = RenderViewHost::From(host_)->GetDelegate();
1233 // Suppress the link disambiguation popup if the virtual keyboard is currently
1234 // requested, as it doesn't interact well with the keyboard.
1235 if (delegate && delegate->IsVirtualKeyboardRequested())
1236 return;
1237
1230 // |target_rect| is provided in pixels, not DIPs. So we convert it to DIPs 1238 // |target_rect| is provided in pixels, not DIPs. So we convert it to DIPs
1231 // by scaling it by the inverse of the device scale factor. 1239 // by scaling it by the inverse of the device scale factor.
1232 gfx::RectF screen_target_rect_f(rect_pixels); 1240 gfx::RectF screen_target_rect_f(rect_pixels);
1233 screen_target_rect_f.Scale(1.0f / current_device_scale_factor_); 1241 screen_target_rect_f.Scale(1.0f / current_device_scale_factor_);
1234 disambiguation_target_rect_ = gfx::ToEnclosingRect(screen_target_rect_f); 1242 disambiguation_target_rect_ = gfx::ToEnclosingRect(screen_target_rect_f);
1235 1243
1236 float scale = static_cast<float>(zoomed_bitmap.width()) / 1244 float scale = static_cast<float>(zoomed_bitmap.width()) /
1237 static_cast<float>(rect_pixels.width()); 1245 static_cast<float>(rect_pixels.width());
1238 gfx::Size zoomed_size(gfx::ToCeiledSize( 1246 gfx::Size zoomed_size(gfx::ToCeiledSize(
1239 gfx::ScaleSize(disambiguation_target_rect_.size(), scale))); 1247 gfx::ScaleSize(disambiguation_target_rect_.size(), scale)));
(...skipping 11 matching lines...) Expand all
1251 kN32_SkColorType); 1259 kN32_SkColorType);
1252 } 1260 }
1253 1261
1254 void RenderWidgetHostViewAura::DisambiguationPopupRendered( 1262 void RenderWidgetHostViewAura::DisambiguationPopupRendered(
1255 bool success, 1263 bool success,
1256 const SkBitmap& result) { 1264 const SkBitmap& result) {
1257 if (!success || disambiguation_scroll_offset_ != last_scroll_offset_) 1265 if (!success || disambiguation_scroll_offset_ != last_scroll_offset_)
1258 return; 1266 return;
1259 1267
1260 // Use RenderViewHostDelegate to get to the WebContentsViewAura, which will 1268 // Use RenderViewHostDelegate to get to the WebContentsViewAura, which will
1261 // actually show the delegate. 1269 // actually show the disambiguation popup.
1262 RenderViewHostDelegate* delegate = NULL; 1270 RenderViewHostDelegate* delegate = NULL;
1263 if (host_->IsRenderView()) 1271 if (host_->IsRenderView())
1264 delegate = RenderViewHost::From(host_)->GetDelegate(); 1272 delegate = RenderViewHost::From(host_)->GetDelegate();
1265 RenderViewHostDelegateView* delegate_view = NULL; 1273 RenderViewHostDelegateView* delegate_view = NULL;
1266 if (delegate) 1274 if (delegate) {
1267 delegate_view = delegate->GetDelegateView(); 1275 delegate_view = delegate->GetDelegateView();
1276 if (delegate->IsVirtualKeyboardRequested())
1277 return;
1278 }
1268 if (delegate_view) { 1279 if (delegate_view) {
1269 delegate_view->ShowDisambiguationPopup( 1280 delegate_view->ShowDisambiguationPopup(
1270 disambiguation_target_rect_, 1281 disambiguation_target_rect_,
1271 result, 1282 result,
1272 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationGesture, 1283 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationGesture,
1273 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr 1284 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
1274 <RenderWidgetHostViewAura>(this)), 1285 <RenderWidgetHostViewAura>(this)),
1275 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationMouse, 1286 base::Bind(&RenderWidgetHostViewAura::ProcessDisambiguationMouse,
1276 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr 1287 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
1277 <RenderWidgetHostViewAura>(this))); 1288 <RenderWidgetHostViewAura>(this)));
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 2551
2541 //////////////////////////////////////////////////////////////////////////////// 2552 ////////////////////////////////////////////////////////////////////////////////
2542 // RenderWidgetHostViewBase, public: 2553 // RenderWidgetHostViewBase, public:
2543 2554
2544 // static 2555 // static
2545 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2556 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2546 GetScreenInfoForWindow(results, NULL); 2557 GetScreenInfoForWindow(results, NULL);
2547 } 2558 }
2548 2559
2549 } // namespace content 2560 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698