summaryrefslogtreecommitdiff
path: root/chromium/ui/android/view_android.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/ui/android/view_android.cc
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/android/view_android.cc')
-rw-r--r--chromium/ui/android/view_android.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/chromium/ui/android/view_android.cc b/chromium/ui/android/view_android.cc
index 7d2e6ded2f0..9de5d840506 100644
--- a/chromium/ui/android/view_android.cc
+++ b/chromium/ui/android/view_android.cc
@@ -14,9 +14,11 @@
#include "base/stl_util.h"
#include "cc/layers/layer.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/android/event_forwarder.h"
#include "ui/android/ui_android_jni_headers/ViewAndroidDelegate_jni.h"
#include "ui/android/window_android.h"
+#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/base/layout.h"
#include "ui/events/android/drag_event_android.h"
@@ -25,6 +27,7 @@
#include "ui/events/android/key_event_android.h"
#include "ui/events/android/motion_event_android.h"
#include "ui/gfx/android/java_bitmap.h"
+#include "ui/gfx/geometry/point.h"
#include "url/gurl.h"
namespace ui {
@@ -389,25 +392,25 @@ bool ViewAndroid::StartDragAndDrop(const JavaRef<jstring>& jtext,
jimage);
}
-void ViewAndroid::OnCursorChanged(int type,
- const SkBitmap& custom_image,
- const gfx::Point& hotspot) {
+void ViewAndroid::OnCursorChanged(const Cursor& cursor) {
ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate());
if (delegate.is_null())
return;
JNIEnv* env = base::android::AttachCurrentThread();
- if (type == static_cast<int>(ui::mojom::CursorType::kCustom)) {
- if (custom_image.drawsNothing()) {
+ if (cursor.type() == mojom::CursorType::kCustom) {
+ const SkBitmap& bitmap = cursor.custom_bitmap();
+ const gfx::Point& hotspot = cursor.custom_hotspot();
+ if (bitmap.drawsNothing()) {
Java_ViewAndroidDelegate_onCursorChanged(
- env, delegate, static_cast<int>(ui::mojom::CursorType::kPointer));
+ env, delegate, static_cast<int>(mojom::CursorType::kPointer));
return;
}
- ScopedJavaLocalRef<jobject> java_bitmap =
- gfx::ConvertToJavaBitmap(&custom_image);
+ ScopedJavaLocalRef<jobject> java_bitmap = gfx::ConvertToJavaBitmap(&bitmap);
Java_ViewAndroidDelegate_onCursorChangedToCustom(env, delegate, java_bitmap,
hotspot.x(), hotspot.y());
} else {
- Java_ViewAndroidDelegate_onCursorChanged(env, delegate, type);
+ Java_ViewAndroidDelegate_onCursorChanged(env, delegate,
+ static_cast<int>(cursor.type()));
}
}
@@ -461,6 +464,16 @@ void ViewAndroid::OnBrowserControlsHeightChanged() {
}
}
+void ViewAndroid::OnVerticalScrollDirectionChanged(bool direction_up,
+ float current_scroll_ratio) {
+ ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate());
+ if (delegate.is_null())
+ return;
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_ViewAndroidDelegate_onVerticalScrollDirectionChanged(
+ env, delegate, direction_up, current_scroll_ratio);
+}
+
void ViewAndroid::OnSizeChanged(int width, int height) {
// Match-parent view must not receive size events.
DCHECK(!match_parent());