[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:18:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cbb3253da31d3a5f12f88911bb8843fc6d5ba10c
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 21:20:36 2010 +0000

    2010-08-18  Balazs Kelemen  <kb at inf.u-szeged.hu>
    
            Reviewed by Antonio Gomes.
    
            [Qt] Use LAZY_NATIVE_CURSOR
            https://bugs.webkit.org/show_bug.cgi?id=44062
    
            No functional change so new tests.
    
            Change Cursor behaviour to match the LAZY_NATIVE_CURSOR policy.
    
            * platform/Cursor.h: Typedef PlatformCursor to be a QCursor* to be able create it dynamically.
            (WebCore::Cursor::Cursor): Remove the ifdef for Qt.
            * platform/qt/CursorQt.cpp: Remove the Cursors class since we have the static cursor instances
            for the common cursor types in Cursor.cpp. Move the logic that maps the cursor types to
            QCursor instances into ensurePlatformCursor.
            (WebCore::Cursor::Cursor):
            (WebCore::Cursor::~Cursor):
            (WebCore::Cursor::operator=):
            (WebCore::createCustomCursor):
            (WebCore::Cursor::ensurePlatformCursor):
            * platform/qt/WidgetQt.cpp:
            (WebCore::Widget::setCursor): Adjust to the PlatformCursor change.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65631 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e7dde79..c5c1b61 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-18  Balazs Kelemen  <kb at inf.u-szeged.hu>
+
+        Reviewed by Antonio Gomes.
+
+        [Qt] Use LAZY_NATIVE_CURSOR
+        https://bugs.webkit.org/show_bug.cgi?id=44062
+
+        No functional change so new tests.
+
+        Change Cursor behaviour to match the LAZY_NATIVE_CURSOR policy.
+
+        * platform/Cursor.h: Typedef PlatformCursor to be a QCursor* to be able create it dynamically.
+        (WebCore::Cursor::Cursor): Remove the ifdef for Qt.
+        * platform/qt/CursorQt.cpp: Remove the Cursors class since we have the static cursor instances
+        for the common cursor types in Cursor.cpp. Move the logic that maps the cursor types to
+        QCursor instances into ensurePlatformCursor.
+        (WebCore::Cursor::Cursor):
+        (WebCore::Cursor::~Cursor):
+        (WebCore::Cursor::operator=):
+        (WebCore::createCustomCursor):
+        (WebCore::Cursor::ensurePlatformCursor):
+        * platform/qt/WidgetQt.cpp:
+        (WebCore::Widget::setCursor): Adjust to the PlatformCursor change.
+
 2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h
index 5e547ef..9b77d1c 100644
--- a/WebCore/platform/Cursor.h
+++ b/WebCore/platform/Cursor.h
@@ -62,7 +62,7 @@ typedef struct HICON__ *HICON;
 typedef HICON HCURSOR;
 #endif
 
-#if PLATFORM(WIN) || PLATFORM(MAC) || PLATFORM(GTK)
+#if PLATFORM(WIN) || PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT)
 #define WTF_USE_LAZY_NATIVE_CURSOR 1
 #endif
 
@@ -88,7 +88,8 @@ namespace WebCore {
 #elif PLATFORM(EFL)
     typedef const char* PlatformCursor;
 #elif PLATFORM(QT) && !defined(QT_NO_CURSOR)
-    typedef QCursor PlatformCursor;
+    // Do not need to be shared but need to be created dynamically via ensurePlatformCursor.
+    typedef QCursor* PlatformCursor;
 #elif PLATFORM(WX)
     typedef wxCursor* PlatformCursor;
 #elif PLATFORM(CHROMIUM)
@@ -151,7 +152,7 @@ namespace WebCore {
         static const Cursor& fromType(Cursor::Type);
 
         Cursor()
-#if !PLATFORM(QT) && !PLATFORM(EFL)
+#if !PLATFORM(EFL)
             : m_platformCursor(0)
 #endif
         {
diff --git a/WebCore/platform/qt/CursorQt.cpp b/WebCore/platform/qt/CursorQt.cpp
index 6017daa..227b80c 100644
--- a/WebCore/platform/qt/CursorQt.cpp
+++ b/WebCore/platform/qt/CursorQt.cpp
@@ -3,6 +3,7 @@
  * Copyright (C) 2006 George Staikos <staikos at kde.org>
  * Copyright (C) 2006 Charles Samuels <charles at kde.org>
  * Copyright (C) 2008, 2009 Holger Hans Peter Freyther
+ * Copyright (C) 2010 University of Szeged
  *
  * All rights reserved.
  *
@@ -43,329 +44,166 @@
 
 namespace WebCore {
 
-Cursor::Cursor(PlatformCursor p)
-    : m_platformCursor(p)
-{
-}
-
 Cursor::Cursor(const Cursor& other)
-    : m_platformCursor(other.m_platformCursor)
+    : m_type(other.m_type)
+    , m_image(other.m_image)
+    , m_hotSpot(other.m_hotSpot)
+#ifndef QT_NO_CURSOR
+    , m_platformCursor(other.m_platformCursor ? new QCursor(*other.m_platformCursor)  : 0)
+#endif
 {
 }
 
 Cursor::~Cursor()
 {
-}
-
-Cursor::Cursor(Image* image, const IntPoint& hotSpot)
-{
 #ifndef QT_NO_CURSOR
-    IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
-    m_platformCursor = QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
+    delete m_platformCursor;
 #endif
 }
 
 Cursor& Cursor::operator=(const Cursor& other)
 {
-    m_platformCursor = other.m_platformCursor;
-    return *this;
-}
-
-namespace {
-
-// FIXME: static deleter
-class Cursors : public Noncopyable {
-protected:
-    Cursors()
+    m_type = other.m_type;
+    m_image = other.m_image;
+    m_hotSpot = other.m_hotSpot;
 #ifndef QT_NO_CURSOR
-        : CrossCursor(Qt::CrossCursor)
-        , MoveCursor(Qt::SizeAllCursor)
-        , PointerCursor(Qt::ArrowCursor)
-        , PointingHandCursor(Qt::PointingHandCursor)
-        , IBeamCursor(Qt::IBeamCursor)
-        , WaitCursor(Qt::WaitCursor)
-        , WhatsThisCursor(Qt::WhatsThisCursor)
-        , SizeHorCursor(Qt::SizeHorCursor)
-        , SizeVerCursor(Qt::SizeVerCursor)
-        , SizeFDiagCursor(Qt::SizeFDiagCursor)
-        , SizeBDiagCursor(Qt::SizeBDiagCursor)
-        , SplitHCursor(Qt::SplitHCursor)
-        , SplitVCursor(Qt::SplitVCursor)
-        , NoDropCursor(Qt::ForbiddenCursor)
-        , BlankCursor(Qt::BlankCursor)
-        , ZoomInCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomInCursor.png")), 7, 7))
-        , ZoomOutCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomOutCursor.png")), 7, 7))
-        , VerticalTextCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/verticalTextCursor.png")), 7, 7))
-        , CellCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/cellCursor.png")), 7, 7))
-        , ContextMenuCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/contextMenuCursor.png")), 3, 2))
-        , CopyCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/copyCursor.png")), 3, 2))
-        , ProgressCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/progressCursor.png")), 3, 2))
-        , AliasCursor(QCursor(QPixmap(QLatin1String(":/webkit/resources/aliasCursor.png")), 11, 3))
-
+    m_platformCursor = other.m_platformCursor ? new QCursor(*other.m_platformCursor)  : 0;
 #endif
-    {
-    }
-
-    ~Cursors()
-    {
-    }
-
-public:
-    static Cursors* self();
-    static Cursors* s_self;
-
-    Cursor CrossCursor;
-    Cursor MoveCursor;
-    Cursor PointerCursor;
-    Cursor PointingHandCursor;
-    Cursor IBeamCursor;
-    Cursor WaitCursor;
-    Cursor WhatsThisCursor;
-    Cursor SizeHorCursor;
-    Cursor SizeVerCursor;
-    Cursor SizeFDiagCursor;
-    Cursor SizeBDiagCursor;
-    Cursor SplitHCursor;
-    Cursor SplitVCursor;
-    Cursor NoDropCursor;
-    Cursor BlankCursor;
-    Cursor ZoomInCursor;
-    Cursor ZoomOutCursor;
-    Cursor VerticalTextCursor;
-    Cursor CellCursor;
-    Cursor ContextMenuCursor;
-    Cursor CopyCursor;
-    Cursor ProgressCursor;
-    Cursor AliasCursor;
-};
-
-Cursors* Cursors::s_self = 0;
-
-Cursors* Cursors::self()
-{
-    if (!s_self)
-        s_self = new Cursors();
-
-    return s_self;
-}
-
-}
-
-const Cursor& pointerCursor()
-{
-    return Cursors::self()->PointerCursor;
-}
-
-const Cursor& moveCursor()
-{
-    return Cursors::self()->MoveCursor;
-}
-
-const Cursor& crossCursor()
-{
-    return Cursors::self()->CrossCursor;
-}
-
-const Cursor& handCursor()
-{
-    return Cursors::self()->PointingHandCursor;
-}
-
-const Cursor& iBeamCursor()
-{
-    return Cursors::self()->IBeamCursor;
-}
-
-const Cursor& waitCursor()
-{
-    return Cursors::self()->WaitCursor;
-}
-
-const Cursor& helpCursor()
-{
-    return Cursors::self()->WhatsThisCursor;
-}
-
-const Cursor& eastResizeCursor()
-{
-    return Cursors::self()->SizeHorCursor;
-}
-
-const Cursor& northResizeCursor()
-{
-    return Cursors::self()->SizeVerCursor;
-}
-
-const Cursor& northEastResizeCursor()
-{
-    return Cursors::self()->SizeBDiagCursor;
-}
-
-const Cursor& northWestResizeCursor()
-{
-    return Cursors::self()->SizeFDiagCursor;
-}
-
-const Cursor& southResizeCursor()
-{
-    return Cursors::self()->SizeVerCursor;
-}
-
-const Cursor& southEastResizeCursor()
-{
-    return Cursors::self()->SizeFDiagCursor;
-}
-
-const Cursor& southWestResizeCursor()
-{
-    return Cursors::self()->SizeBDiagCursor;
-}
-
-const Cursor& westResizeCursor()
-{
-    return Cursors::self()->SizeHorCursor;
-}
-
-const Cursor& northSouthResizeCursor()
-{
-    return Cursors::self()->SizeVerCursor;
-}
-
-const Cursor& eastWestResizeCursor()
-{
-    return Cursors::self()->SizeHorCursor;
-}
-
-const Cursor& northEastSouthWestResizeCursor()
-{
-    return Cursors::self()->SizeBDiagCursor;
-}
-
-const Cursor& northWestSouthEastResizeCursor()
-{
-    return Cursors::self()->SizeFDiagCursor;
-}
-
-const Cursor& columnResizeCursor()
-{
-    return Cursors::self()->SplitHCursor;
-}
-
-const Cursor& rowResizeCursor()
-{
-    return Cursors::self()->SplitVCursor;
-}
-
-const Cursor& middlePanningCursor()
-{
-    return moveCursor();
-}
-
-const Cursor& eastPanningCursor()
-{
-    return eastResizeCursor();
-}
-
-const Cursor& northPanningCursor()
-{
-    return northResizeCursor();
-}
-
-const Cursor& northEastPanningCursor()
-{
-    return northEastResizeCursor();
-}
-
-const Cursor& northWestPanningCursor()
-{
-    return northWestResizeCursor();
-}
-
-const Cursor& southPanningCursor()
-{
-    return southResizeCursor();
-}
-
-const Cursor& southEastPanningCursor()
-{
-    return southEastResizeCursor();
-}
-
-const Cursor& southWestPanningCursor()
-{
-    return southWestResizeCursor();
-}
-
-const Cursor& westPanningCursor()
-{
-    return westResizeCursor();
-}
-
-const Cursor& verticalTextCursor()
-{
-    return Cursors::self()->VerticalTextCursor;
-}
-
-const Cursor& cellCursor()
-{
-    return Cursors::self()->CellCursor;
-}
-
-const Cursor& contextMenuCursor()
-{
-    return Cursors::self()->ContextMenuCursor;
-}
-
-const Cursor& noDropCursor()
-{
-    return Cursors::self()->NoDropCursor;
-}
-
-const Cursor& copyCursor()
-{
-    return Cursors::self()->CopyCursor;
-}
-
-const Cursor& progressCursor()
-{
-    return Cursors::self()->ProgressCursor;
-}
-
-const Cursor& aliasCursor()
-{
-    return Cursors::self()->AliasCursor;
-}
-
-const Cursor& noneCursor()
-{
-    return Cursors::self()->BlankCursor;
-}
-
-const Cursor& notAllowedCursor()
-{
-    return Cursors::self()->NoDropCursor;
-}
-
-const Cursor& zoomInCursor()
-{
-    return Cursors::self()->ZoomInCursor;
-}
-
-const Cursor& zoomOutCursor()
-{
-    return Cursors::self()->ZoomOutCursor;
+    return *this;
 }
 
-const Cursor& grabCursor()
+static QCursor* createCustomCursor(Image* image, const IntPoint& hotSpot)
 {
-    notImplemented();
-    return Cursors::self()->PointerCursor;
+#ifndef QT_NO_CURSOR
+    IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
+    return new QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
+#else
+    return 0;
+#endif
 }
 
-const Cursor& grabbingCursor()
+void Cursor::ensurePlatformCursor() const
 {
-    notImplemented();
-    return Cursors::self()->PointerCursor;
+#ifndef QT_NO_CURSOR
+    if (m_platformCursor)
+        return;
+
+    switch (m_type) {
+    case Pointer:
+        m_platformCursor = new QCursor(Qt::ArrowCursor);
+        break;
+    case Cross:
+        m_platformCursor = new QCursor(Qt::CrossCursor);
+        break;
+    case Hand:
+        m_platformCursor = new QCursor(Qt::PointingHandCursor);
+        break;
+    case IBeam:
+        m_platformCursor = new QCursor(Qt::IBeamCursor);
+        break;
+    case Wait:
+        m_platformCursor = new QCursor(Qt::WaitCursor);
+        break;
+    case Help:
+        m_platformCursor = new QCursor(Qt::WhatsThisCursor);
+        break;
+    case EastResize:
+    case EastPanning:
+        m_platformCursor = new QCursor(Qt::SizeHorCursor);
+        break;
+    case NorthResize:
+    case NorthPanning:
+        m_platformCursor = new QCursor(Qt::SizeVerCursor);
+        break;
+    case NorthEastResize:
+    case NorthEastPanning:
+        m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+        break;
+    case NorthWestResize:
+    case NorthWestPanning:
+        m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+        break;
+    case SouthResize:
+    case SouthPanning:
+        m_platformCursor = new QCursor(Qt::SizeVerCursor);
+        break;
+    case SouthEastResize:
+    case SouthEastPanning:
+        m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+        break;
+    case SouthWestResize:
+    case SouthWestPanning:
+        m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+        break;
+    case WestResize:
+    case WestPanning:
+        m_platformCursor = new QCursor(Qt::SizeHorCursor);
+        break;
+    case NorthSouthResize:
+        m_platformCursor = new QCursor(Qt::SizeVerCursor);
+        break;
+    case EastWestResize:
+        m_platformCursor = new QCursor(Qt::SizeHorCursor);
+        break;
+    case NorthEastSouthWestResize:
+        m_platformCursor = new QCursor(Qt::SizeBDiagCursor);
+        break;
+    case NorthWestSouthEastResize:
+        m_platformCursor = new QCursor(Qt::SizeFDiagCursor);
+        break;
+    case ColumnResize:
+        m_platformCursor = new QCursor(Qt::SplitHCursor);
+        break;
+    case RowResize:
+        m_platformCursor = new QCursor(Qt::SplitVCursor);
+        break;
+    case MiddlePanning:
+    case Move:
+        m_platformCursor = new QCursor(Qt::SizeAllCursor);
+        break;
+    case None:
+        m_platformCursor = new QCursor(Qt::BlankCursor);
+        break;
+    case NoDrop:
+    case NotAllowed:
+        m_platformCursor = new QCursor(Qt::ForbiddenCursor);
+        break;
+    case Grab:
+    case Grabbing:
+        notImplemented();
+        m_platformCursor = new QCursor(Qt::ArrowCursor);
+        break;
+    case VerticalText:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/verticalTextCursor.png")), 7, 7);
+        break;
+    case Cell:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/cellCursor.png")), 7, 7);
+        break;
+    case ContextMenu:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/contextMenuCursor.png")), 3, 2);
+        break;
+    case Alias:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/aliasCursor.png")), 11, 3);
+        break;
+    case Progress:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/progressCursor.png")), 3, 2);
+        break;
+    case Copy:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/copyCursor.png")), 3, 2);
+        break;
+    case ZoomIn:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomInCursor.png")), 7, 7);
+        break;
+    case ZoomOut:
+        m_platformCursor = new QCursor(QPixmap(QLatin1String(":/webkit/resources/zoomOutCursor.png")), 7, 7);
+        break;
+    case Custom:
+        m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+#endif
 }
 
 }
diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp
index 0903b6e..cda969f 100644
--- a/WebCore/platform/qt/WidgetQt.cpp
+++ b/WebCore/platform/qt/WidgetQt.cpp
@@ -81,7 +81,7 @@ void Widget::setCursor(const Cursor& cursor)
     QWebPageClient* pageClient = root()->hostWindow()->platformPageClient();
 
     if (pageClient)
-        pageClient->setCursor(cursor.impl());
+        pageClient->setCursor(*cursor.platformCursor());
 #endif
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list