Replace WTF::move with WTFMove
[WebKit-https.git] / Source / WebCore / platform / win / CursorWin.cpp
index a51d8bf..38811fc 100644 (file)
@@ -32,9 +32,6 @@
 #include "Image.h"
 #include "IntPoint.h"
 #include "SystemInfo.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/win/GDIObject.h>
 
 #include <windows.h>
@@ -54,8 +51,9 @@ static PassRefPtr<SharedCursor> createSharedCursor(Image* img, const IntPoint& h
     HWndDC dc(0);
     auto workingDC = adoptGDIObject(::CreateCompatibleDC(dc));
     if (doAlpha) {
-        auto hCursor = adoptGDIObject(::CreateDIBSection(dc, (BITMAPINFO *)&cursorImage, DIB_RGB_COLORS, 0, 0, 0));
-        ASSERT(hCursor);
+        auto hCursor = adoptGDIObject(::CreateDIBSection(dc, &cursorImage, DIB_RGB_COLORS, nullptr, 0, 0));
+        if (!hCursor)
+            return nullptr;
 
         img->getHBITMAP(hCursor.get()); 
         HBITMAP hOldBitmap = (HBITMAP)SelectObject(workingDC.get(), hCursor.get());
@@ -79,8 +77,10 @@ static PassRefPtr<SharedCursor> createSharedCursor(Image* img, const IntPoint& h
         // to create the mask manually
         auto andMaskDC = adoptGDIObject(::CreateCompatibleDC(dc));
         auto xorMaskDC = adoptGDIObject(::CreateCompatibleDC(dc));
-        auto hCursor = adoptGDIObject(::CreateDIBSection(dc, &cursorImage, DIB_RGB_COLORS, 0, 0, 0));
-        ASSERT(hCursor);
+        auto hCursor = adoptGDIObject(::CreateDIBSection(dc, &cursorImage, DIB_RGB_COLORS, nullptr, 0, 0));
+        if (!hCursor)
+            return nullptr;
+
         img->getHBITMAP(hCursor.get()); 
         BITMAP cursor;
         GetObject(hCursor.get(), sizeof(BITMAP), &cursor);
@@ -251,6 +251,8 @@ void Cursor::ensurePlatformCursor() const
         break;
     case Cursor::Custom:
         m_platformCursor = createSharedCursor(m_image.get(), m_hotSpot);
+        if (!m_platformCursor)
+            m_platformCursor = loadSharedCursor(0, IDC_ARROW);
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -268,6 +270,9 @@ Cursor::Cursor(const Cursor& other)
     : m_type(other.m_type)
     , m_image(other.m_image)
     , m_hotSpot(other.m_hotSpot)
+#if ENABLE(MOUSE_CURSOR_SCALE)
+    , m_imageScaleFactor(other.m_imageScaleFactor)
+#endif
     , m_platformCursor(other.m_platformCursor)
 {
 }
@@ -277,6 +282,9 @@ Cursor& Cursor::operator=(const Cursor& other)
     m_type = other.m_type;
     m_image = other.m_image;
     m_hotSpot = other.m_hotSpot;
+#if ENABLE(MOUSE_CURSOR_SCALE)
+    m_imageScaleFactor = other.m_imageScaleFactor;
+#endif
     m_platformCursor = other.m_platformCursor;
     return *this;
 }