From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- widget/PuppetWidget.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'widget/PuppetWidget.cpp') diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 07b22d9a2b..7da6de3eaa 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -900,17 +900,14 @@ void PuppetWidget::SetCursor(const Cursor& aCursor) { return; } - bool hasCustomCursor = false; - Maybe customCursorData; - size_t length = 0; - IntSize customCursorSize; - int32_t stride = 0; - auto format = SurfaceFormat::B8G8R8A8; ImageResolution resolution = aCursor.mResolution; + Maybe customCursor; if (aCursor.IsCustom()) { - int32_t width = 0, height = 0; + int32_t width = 0; + int32_t height = 0; aCursor.mContainer->GetWidth(&width); aCursor.mContainer->GetHeight(&height); + const int32_t flags = imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_ASYNC_NOTIFY; RefPtr surface; @@ -928,22 +925,17 @@ void PuppetWidget::SetCursor(const Cursor& aCursor) { surface = aCursor.mContainer->GetFrame(imgIContainer::FRAME_CURRENT, flags); } + if (surface) { if (RefPtr dataSurface = surface->GetDataSurface()) { - hasCustomCursor = true; - customCursorData = - nsContentUtils::GetSurfaceData(*dataSurface, &length, &stride); - customCursorSize = dataSurface->GetSize(); - format = dataSurface->GetFormat(); + customCursor = nsContentUtils::SurfaceToIPCImage(*dataSurface); } } } if (!mBrowserChild->SendSetCursor( - aCursor.mDefaultCursor, hasCustomCursor, std::move(customCursorData), - customCursorSize.width, customCursorSize.height, resolution.mX, - resolution.mY, stride, format, aCursor.mHotspotX, aCursor.mHotspotY, - force)) { + aCursor.mDefaultCursor, std::move(customCursor), resolution.mX, + resolution.mY, aCursor.mHotspotX, aCursor.mHotspotY, force)) { return; } mCursor = aCursor; -- cgit v1.2.3