Changeset 64852 in webkit


Ignore:
Timestamp:
Aug 6, 2010 8:59:55 AM (14 years ago)
Author:
Martin Robinson
Message:

2010-08-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Support for image drags
https://bugs.webkit.org/show_bug.cgi?id=40788

Unskip and add baselines for tests that are now passing with image drag support.

  • platform/gtk/Skipped:
  • platform/gtk/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.txt: Added.
  • platform/gtk/editing/pasteboard/drag-selected-image-to-contenteditable-expected.txt: Added.
  • platform/gtk/editing/selection/drag-to-contenteditable-iframe-expected.txt: Added.
  • platform/gtk/fast/events/standalone-image-drag-to-editable-expected.txt: Added.

2010-08-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Support for image drags
https://bugs.webkit.org/show_bug.cgi?id=40788

Add image drag-and-drop support for WebKit GTK+.

  • platform/gtk/ClipboardGtk.cpp: (WebCore::ClipboardGtk::setDragImage): Filled this stub. (WebCore::ClipboardGtk::setDragImageElement): Filled this stub. (WebCore::ClipboardGtk::createDragImage): Filled this stub. (WebCore::ClipboardGtk::declareAndWriteDragImage): Write the image URL, markup, and image itself to the data object member.
  • platform/gtk/ClipboardGtk.h: Brought method declarations into line with the parent class.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64850 r64852  
     12010-08-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Support for image drags
     6        https://bugs.webkit.org/show_bug.cgi?id=40788
     7
     8        Unskip and add baselines for tests that are now passing with image drag support.
     9
     10        * platform/gtk/Skipped:
     11        * platform/gtk/editing/pasteboard/drag-image-to-contenteditable-in-iframe-expected.txt: Added.
     12        * platform/gtk/editing/pasteboard/drag-selected-image-to-contenteditable-expected.txt: Added.
     13        * platform/gtk/editing/selection/drag-to-contenteditable-iframe-expected.txt: Added.
     14        * platform/gtk/fast/events/standalone-image-drag-to-editable-expected.txt: Added.
     15
    1162010-08-06  Nikolas Zimmermann  <nzimmermann@rim.com>
    217
  • trunk/LayoutTests/platform/gtk/Skipped

    r64845 r64852  
    58285828http/tests/security/clipboard/clipboard-file-access.html
    58295829
    5830 # Tests that fail because image dragging does not yet work
    5831 editing/pasteboard/drag-image-in-about-blank-frame.html
    5832 editing/pasteboard/drag-image-to-contenteditable-in-iframe.html
    5833 editing/pasteboard/drag-selected-image-to-contenteditable.html
    5834 editing/selection/drag-to-contenteditable-iframe.html
    5835 fast/events/standalone-image-drag-to-editable.html
    5836 editing/pasteboard/drag-drop-iframe-refresh-crash.html
     5830# Still failing, looks like a bug in the EventSender drag-and-drop
    58375831fast/css/user-drag-none.html
    58385832
  • trunk/WebCore/ChangeLog

    r64846 r64852  
     12010-08-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Support for image drags
     6        https://bugs.webkit.org/show_bug.cgi?id=40788
     7
     8        Add image drag-and-drop support for WebKit GTK+.
     9
     10        * platform/gtk/ClipboardGtk.cpp:
     11        (WebCore::ClipboardGtk::setDragImage): Filled this stub.
     12        (WebCore::ClipboardGtk::setDragImageElement): Filled this stub.
     13        (WebCore::ClipboardGtk::createDragImage): Filled this stub.
     14        (WebCore::ClipboardGtk::declareAndWriteDragImage): Write the image URL, markup, and image itself to the data object member.
     15        * platform/gtk/ClipboardGtk.h: Brought method declarations into line with the parent class.
     16
    1172010-08-06  Yury Semikhatsky  <yurys@chromium.org>
    218
  • trunk/WebCore/platform/gtk/ClipboardGtk.cpp

    r64152 r64852  
    2424#include "FileList.h"
    2525#include "Frame.h"
     26#include "HTMLNames.h"
    2627#include "Image.h"
    2728#include "NotImplemented.h"
     
    272273}
    273274
    274 IntPoint ClipboardGtk::dragLocation() const
    275 {
    276     notImplemented();
    277     return IntPoint(0, 0);
    278 }
    279 
    280 CachedImage* ClipboardGtk::dragImage() const
    281 {
    282     notImplemented();
    283     return 0;
    284 }
    285 
    286 void ClipboardGtk::setDragImage(CachedImage*, const IntPoint&)
    287 {
    288     notImplemented();
    289 }
    290 
    291 Node* ClipboardGtk::dragImageElement()
    292 {
    293     notImplemented();
    294     return 0;
    295 }
    296 
    297 void ClipboardGtk::setDragImageElement(Node*, const IntPoint&)
    298 {
    299     notImplemented();
    300 }
    301 
    302 DragImageRef ClipboardGtk::createDragImage(IntPoint&) const
    303 {
    304     notImplemented();
    305     return 0;
     275void ClipboardGtk::setDragImage(CachedImage* image, const IntPoint& location)
     276{
     277    setDragImage(image, 0, location);
     278}
     279
     280void ClipboardGtk::setDragImageElement(Node* element, const IntPoint& location)
     281{
     282    setDragImage(0, element, location);
     283}
     284
     285void ClipboardGtk::setDragImage(CachedImage* image, Node* element, const IntPoint& location)
     286{
     287    if (policy() != ClipboardImageWritable && policy() != ClipboardWritable)
     288        return;
     289
     290    if (m_dragImage)
     291        m_dragImage->removeClient(this);
     292    m_dragImage = image;
     293    if (m_dragImage)
     294        m_dragImage->addClient(this);
     295
     296    m_dragLoc = location;
     297    m_dragImageElement = element;
     298}
     299
     300DragImageRef ClipboardGtk::createDragImage(IntPoint& location) const
     301{
     302    location = m_dragLoc;
     303    if (!m_dragImage)
     304        return 0;
     305
     306    return createDragImageFromImage(m_dragImage->image());
    306307}
    307308
     
    321322}
    322323
    323 void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*)
    324 {
    325     CachedImage* cachedImage = getCachedImage(element);
    326     if (!cachedImage || !cachedImage->isLoaded())
    327         return;
    328 
    329     GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf();
     324void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame* frame)
     325{
     326    m_dataObject->setURL(url, label);
     327    m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, AbsoluteURLs));
     328
     329    CachedImage* image = getCachedImage(element);
     330    if (!image || !image->isLoaded())
     331        return;
     332
     333    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->image()->getGdkPixbuf());
    330334    if (!pixbuf)
    331335        return;
    332336
    333     GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage"));
    334     gtk_clipboard_clear(imageClipboard);
    335 
    336     gtk_clipboard_set_image(imageClipboard, pixbuf);
    337     g_object_unref(pixbuf);
    338 
    339     writeURL(url, label, 0);
     337    m_dataObject->setImage(pixbuf.get());
    340338}
    341339
  • trunk/WebCore/platform/gtk/ClipboardGtk.h

    r64152 r64852  
    2828#define ClipboardGtk_h
    2929
     30#include "CachedResourceClient.h"
    3031#include "Clipboard.h"
    3132#include "DataObjectGtk.h"
     
    4041    // State available during IE's events for drag and drop and copy/paste
    4142    // Created from the EventHandlerGtk to be used by the dom
    42     class ClipboardGtk : public Clipboard {
     43    class ClipboardGtk : public Clipboard, public CachedResourceClient {
    4344    public:
    4445        static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, bool isForDragging, Frame* frame)
     
    6162        virtual PassRefPtr<FileList> files() const;
    6263
    63         IntPoint dragLocation() const;
    64         CachedImage* dragImage() const;
    6564        void setDragImage(CachedImage*, const IntPoint&);
    66         Node* dragImageElement();
    6765        void setDragImageElement(Node*, const IntPoint&);
     66        void setDragImage(CachedImage*, Node*, const IntPoint&);
    6867
    6968        virtual DragImageRef createDragImage(IntPoint&) const;
     69#if ENABLE(DRAG_SUPPORT)
    7070        virtual void declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*);
     71#endif
    7172        virtual void writeURL(const KURL&, const String&, Frame*);
    7273        virtual void writeRange(Range*, Frame*);
Note: See TracChangeset for help on using the changeset viewer.