Dragging a PDF image triggers assertion in DragController::startDrag()
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Mar 2010 01:05:58 +0000 (01:05 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Mar 2010 01:05:58 +0000 (01:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=36247

Reviewed by Dmitry Titov.

WebCore:

Test: fast/images/drag-pdf-as-image.html

* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::filenameExtension):
* platform/graphics/cg/PDFDocumentImage.h:

LayoutTests:

* fast/images/drag-pdf-as-image-expected.txt: Added.
* fast/images/drag-pdf-as-image.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@56205 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/images/drag-pdf-as-image-expected.txt [new file with mode: 0644]
LayoutTests/fast/images/drag-pdf-as-image.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/cg/PDFDocumentImage.cpp
WebCore/platform/graphics/cg/PDFDocumentImage.h

index 8571889..157988f 100644 (file)
@@ -1,3 +1,13 @@
+2010-03-18  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Dmitry Titov.
+
+        Dragging a PDF image triggers assertion in DragController::startDrag()
+        https://bugs.webkit.org/show_bug.cgi?id=36247
+
+        * fast/images/drag-pdf-as-image-expected.txt: Added.
+        * fast/images/drag-pdf-as-image.html: Added.
+
 2010-03-18  Dan Bernstein  <mitz@apple.com>
 
         Add missing file from r56186.
diff --git a/LayoutTests/fast/images/drag-pdf-as-image-expected.txt b/LayoutTests/fast/images/drag-pdf-as-image-expected.txt
new file mode 100644 (file)
index 0000000..5c768a8
--- /dev/null
@@ -0,0 +1,2 @@
+
+This test checks that dragging a pdf doesn't crash the browser.
diff --git a/LayoutTests/fast/images/drag-pdf-as-image.html b/LayoutTests/fast/images/drag-pdf-as-image.html
new file mode 100644 (file)
index 0000000..adc7973
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script type="text/javascript">
+function test() {
+
+    if (!window.layoutTestController || !window.eventSender)
+        return;
+
+    layoutTestController.dumpAsText();
+
+    var dragMe = document.getElementById("dragMe");
+    var startX = dragMe.offsetLeft + (dragMe.offsetWidth / 2);
+    var startY = dragMe.offsetTop + (dragMe.offsetTop / 2);
+    var endX = startX + 100;
+    var endY = startY + 100;
+
+    eventSender.mouseMoveTo(startX, startY);
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(endX, endY);
+    eventSender.mouseUp();
+}
+</script>
+</head>
+<body onload="test()">
+    <img id="dragMe" src='resources/pdf_test_landscape.pdf'>
+    <div>
+        This test checks that dragging a pdf doesn't crash the browser.
+    </div>
+</body>
+</html>
index 0733010..4a41bee 100644 (file)
@@ -1,3 +1,16 @@
+2010-03-18  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Dmitry Titov.
+
+        Dragging a PDF image triggers assertion in DragController::startDrag()
+        https://bugs.webkit.org/show_bug.cgi?id=36247
+
+        Test: fast/images/drag-pdf-as-image.html
+
+        * platform/graphics/cg/PDFDocumentImage.cpp:
+        (WebCore::PDFDocumentImage::filenameExtension):
+        * platform/graphics/cg/PDFDocumentImage.h:
+
 2010-03-18  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein.
index 45a20b9..8bf04f1 100644 (file)
@@ -56,6 +56,11 @@ PDFDocumentImage::~PDFDocumentImage()
     CGPDFDocumentRelease(m_document);
 }
 
+String PDFDocumentImage::filenameExtension() const
+{
+    return "pdf";
+}
+
 IntSize PDFDocumentImage::size() const
 {
     const float sina = sinf(-m_rotation);
index 12ab46c..790d620 100644 (file)
@@ -46,6 +46,8 @@ namespace WebCore {
     private:
         virtual ~PDFDocumentImage();
 
+        virtual String filenameExtension() const;
+
         virtual bool hasSingleSecurityOrigin() const { return true; }
 
         virtual bool dataChanged(bool allDataReceived);