mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Replace content::CursorInfo with ui::Cursor
https://chromium-review.googlesource.com/c/chromium/src/+/1999201
This commit is contained in:
@@ -2337,17 +2337,18 @@ bool WebContents::IsBeingCaptured() {
|
||||
return web_contents()->IsBeingCaptured();
|
||||
}
|
||||
|
||||
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
||||
const content::CursorInfo& info = cursor.info();
|
||||
void WebContents::OnCursorChange(const content::WebCursor& webcursor) {
|
||||
const ui::Cursor& cursor = webcursor.cursor();
|
||||
|
||||
if (info.type == ui::mojom::CursorType::kCustom) {
|
||||
Emit("cursor-changed", CursorTypeToString(info),
|
||||
gfx::Image::CreateFrom1xBitmap(info.custom_image),
|
||||
info.image_scale_factor,
|
||||
gfx::Size(info.custom_image.width(), info.custom_image.height()),
|
||||
info.hotspot);
|
||||
if (cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
Emit("cursor-changed", CursorTypeToString(cursor),
|
||||
gfx::Image::CreateFrom1xBitmap(cursor.custom_bitmap()),
|
||||
cursor.image_scale_factor(),
|
||||
gfx::Size(cursor.custom_bitmap().width(),
|
||||
cursor.custom_bitmap().height()),
|
||||
cursor.custom_hotspot());
|
||||
} else {
|
||||
Emit("cursor-changed", CursorTypeToString(info));
|
||||
Emit("cursor-changed", CursorTypeToString(cursor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ using Cursor = ui::mojom::CursorType;
|
||||
|
||||
namespace electron {
|
||||
|
||||
std::string CursorTypeToString(const content::CursorInfo& info) {
|
||||
switch (info.type) {
|
||||
std::string CursorTypeToString(const ui::Cursor& cursor) {
|
||||
switch (cursor.type()) {
|
||||
case Cursor::kPointer:
|
||||
return "default";
|
||||
case Cursor::kCross:
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace electron {
|
||||
|
||||
// Returns the cursor's type as a string.
|
||||
std::string CursorTypeToString(const content::CursorInfo& info);
|
||||
std::string CursorTypeToString(const ui::Cursor& cursor);
|
||||
|
||||
} // namespace electron
|
||||
|
||||
|
||||
Reference in New Issue
Block a user