diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 3301738801b0bf7c8241d13acd7131a8fd86b291..2e67b0e8970155037f9aa2327fdd5ce238f5e9ec 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -75,6 +75,7 @@ #include <QTextFormat> #include <QKeyEvent> #include <QMouseEvent> +#include <QPixmap> #include <QScreen> #include <QStyleHints> #include <QVariant> @@ -535,7 +536,12 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) shape = Qt::ClosedHandCursor; break; case blink::WebCursorInfo::TypeCustom: - // FIXME: Extract from the CursorInfo. + if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) { + QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32); + m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor))); + return; + } + // Use arrow cursor as fallback in case the Chromium implementation changes. shape = Qt::ArrowCursor; break; default: diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index 9e54618889d17beade8788fa21eca3529048365d..eb874a26d5c119ee074dce2871e9903a8246b278 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -40,6 +40,7 @@ #include <QColor> #include <QDateTime> #include <QDir> +#include <QImage> #include <QMatrix4x4> #include <QNetworkCookie> #include <QRect> @@ -49,8 +50,10 @@ #include "base/time/time.h" #include "content/public/common/file_chooser_file_info.h" #include "net/cookies/canonical_cookie.h" -#include "third_party/skia/include/utils/SkMatrix44.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkPixelRef.h" +#include "third_party/skia/include/utils/SkMatrix44.h" #include "ui/gfx/geometry/rect.h" #include "url/gurl.h" @@ -134,6 +137,12 @@ inline SkColor toSk(const QColor &c) return c.rgba(); } +inline QImage toQImage(const SkBitmap &bitmap, QImage::Format format) +{ + SkPixelRef *pixelRef = bitmap.pixelRef(); + return QImage((uchar *)pixelRef->pixels(), bitmap.width(), bitmap.height(), format); +} + inline QMatrix4x4 toQt(const SkMatrix44 &m) { QMatrix4x4 qtMatrix(