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

Side by Side Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2352773003: Fix the scale of Drag and Drop shadow image. (Closed)
Patch Set: Created 4 years, 3 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/web_contents/web_contents_view_android.h" 5 #include "content/browser/web_contents/web_contents_view_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/android/content_view_core_impl.h" 10 #include "content/browser/android/content_view_core_impl.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (!native_view) { 242 if (!native_view) {
243 // Need to clear drag and drop state in blink. 243 // Need to clear drag and drop state in blink.
244 OnDragEnded(); 244 OnDragEnded();
245 return; 245 return;
246 } 246 }
247 247
248 JNIEnv* env = AttachCurrentThread(); 248 JNIEnv* env = AttachCurrentThread();
249 ScopedJavaLocalRef<jstring> jtext = 249 ScopedJavaLocalRef<jstring> jtext =
250 ConvertUTF16ToJavaString(env, drop_data.text.string()); 250 ConvertUTF16ToJavaString(env, drop_data.text.string());
251 251
252 float page_scale = content_view_core_->page_scale();
253 // No way to scale image.bitmap() itself. So we need to pass the page scale
254 // here and let the embedder do the scaling.
252 if (!native_view->StartDragAndDrop( 255 if (!native_view->StartDragAndDrop(
253 jtext, gfx::ConvertToJavaBitmap(image.bitmap()))) { 256 jtext, gfx::ConvertToJavaBitmap(image.bitmap()), page_scale)) {
Ted C 2016/09/20 20:05:24 who generates the bitmap? In this case, were we g
hush (inactive) 2016/09/20 21:32:33 Blink generates it here. https://cs.chromium.org/c
254 // Need to clear drag and drop state in blink. 257 // Need to clear drag and drop state in blink.
255 OnDragEnded(); 258 OnDragEnded();
256 return; 259 return;
257 } 260 }
258 261
259 if (content_view_core_) 262 if (content_view_core_)
260 content_view_core_->HidePopupsAndPreserveSelection(); 263 content_view_core_->HidePopupsAndPreserveSelection();
261 } 264 }
262 265
263 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) { 266 void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // This is called when we the renderer asks us to take focus back (i.e., it has 311 // This is called when we the renderer asks us to take focus back (i.e., it has
309 // iterated past the last focusable element on the page). 312 // iterated past the last focusable element on the page).
310 void WebContentsViewAndroid::TakeFocus(bool reverse) { 313 void WebContentsViewAndroid::TakeFocus(bool reverse) {
311 if (web_contents_->GetDelegate() && 314 if (web_contents_->GetDelegate() &&
312 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) 315 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse))
313 return; 316 return;
314 web_contents_->GetRenderWidgetHostView()->Focus(); 317 web_contents_->GetRenderWidgetHostView()->Focus();
315 } 318 }
316 319
317 } // namespace content 320 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698