Title: [95275] trunk
Revision
95275
Author
leo.y...@torchmobile.com.cn
Date
2011-09-16 00:15:57 -0700 (Fri, 16 Sep 2011)

Log Message

[Qt] Crash when dragging google maps.
https://bugs.webkit.org/show_bug.cgi?id=68223

Source/WebCore: 

The custom image for a cursor might not be ready when WebKit trying
to use it to construct the cursor in Qt porting. This patch is using
arrow image to substitute the unready custom image.

Reviewed by Adam Barth.

Test: fast/css/crash-on-custom-cursor-when-loading.html

* platform/qt/CursorQt.cpp:
(WebCore::createCustomCursor):
(WebCore::Cursor::ensurePlatformCursor):

LayoutTests: 

Test case to use an unready custom cursor.

Reviewed by Adam Barth.

* fast/css/crash-on-custom-cursor-when-loading-expected.txt: Added.
* fast/css/crash-on-custom-cursor-when-loading.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95274 => 95275)


--- trunk/LayoutTests/ChangeLog	2011-09-16 06:52:00 UTC (rev 95274)
+++ trunk/LayoutTests/ChangeLog	2011-09-16 07:15:57 UTC (rev 95275)
@@ -1,3 +1,15 @@
+2011-09-16  Leo Yang  <leo.y...@torchmobile.com.cn>
+
+        [Qt] Crash when dragging google maps.
+        https://bugs.webkit.org/show_bug.cgi?id=68223
+
+        Test case to use an unready custom cursor.
+
+        Reviewed by Adam Barth.
+
+        * fast/css/crash-on-custom-cursor-when-loading-expected.txt: Added.
+        * fast/css/crash-on-custom-cursor-when-loading.html: Added.
+
 2011-09-15  Keishi Hattori  <kei...@webkit.org>
 
         [chromium] Add slow to calculate-percentage.html

Added: trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading-expected.txt (0 => 95275)


--- trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading-expected.txt	2011-09-16 07:15:57 UTC (rev 95275)
@@ -0,0 +1 @@
+PASS without crash.

Added: trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading.html (0 => 95275)


--- trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/crash-on-custom-cursor-when-loading.html	2011-09-16 07:15:57 UTC (rev 95275)
@@ -0,0 +1,25 @@
+<html>
+<head>
+<style>
+    div {
+        cursor: url(resources/purple-srgb.png);
+        width: 200;
+        height: 200;
+        background: green;
+    }
+</style>
+</head>
+<body>
+    <div></div>
+    <script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    if (window.eventSender) {
+        eventSender.dragMode = false;
+        eventSender.mouseMoveTo(50, 50)
+    }
+    </script>
+    <p>PASS without crash.</p>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (95274 => 95275)


--- trunk/Source/WebCore/ChangeLog	2011-09-16 06:52:00 UTC (rev 95274)
+++ trunk/Source/WebCore/ChangeLog	2011-09-16 07:15:57 UTC (rev 95275)
@@ -1,3 +1,20 @@
+2011-09-16  Leo Yang  <leo.y...@torchmobile.com.cn>
+
+        [Qt] Crash when dragging google maps.
+        https://bugs.webkit.org/show_bug.cgi?id=68223
+
+        The custom image for a cursor might not be ready when WebKit trying
+        to use it to construct the cursor in Qt porting. This patch is using
+        arrow image to substitute the unready custom image.
+
+        Reviewed by Adam Barth.
+
+        Test: fast/css/crash-on-custom-cursor-when-loading.html
+
+        * platform/qt/CursorQt.cpp:
+        (WebCore::createCustomCursor):
+        (WebCore::Cursor::ensurePlatformCursor):
+
 2011-09-15  Adam Barth  <aba...@webkit.org>
 
         Rename ENABLE(DATABASE) to ENABLE(SQL_DATABASE)

Modified: trunk/Source/WebCore/platform/qt/CursorQt.cpp (95274 => 95275)


--- trunk/Source/WebCore/platform/qt/CursorQt.cpp	2011-09-16 06:52:00 UTC (rev 95274)
+++ trunk/Source/WebCore/platform/qt/CursorQt.cpp	2011-09-16 07:15:57 UTC (rev 95275)
@@ -75,6 +75,8 @@
 #ifndef QT_NO_CURSOR
 static QCursor* createCustomCursor(Image* image, const IntPoint& hotSpot)
 {
+    if (!image->nativeImageForCurrentFrame())
+        return 0;
     IntPoint effectiveHotSpot = determineHotSpot(image, hotSpot);
     return new QCursor(*(image->nativeImageForCurrentFrame()), effectiveHotSpot.x(), effectiveHotSpot.y());
 }
@@ -197,6 +199,8 @@
         break;
     case Custom:
         m_platformCursor = createCustomCursor(m_image.get(), m_hotSpot);
+        if (!m_platformCursor)
+            m_platformCursor = new QCursor(Qt::ArrowCursor);
         break;
     default:
         ASSERT_NOT_REACHED();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to