Commit b73b711c authored by enrica@apple.com's avatar enrica@apple.com

REGRESSION: Drag & Drop Gmail Attachments doesn't work.

https://bugs.webkit.org/show_bug.cgi?id=57909
<rdar://problem/9103220>

Reviewed by Darin Adler.

Source/WebCore: 

In WebKit2 we cannot rely on the value returned by platformData() that
on Mac returns an NSDraggingInfo object. This is available only in the UI
process. Therefore we should use m_pasteboard instead.
We cannot change what platformData() returns on Mac, since there are
delegate methods that receive a NSDraggingInfo object (only in WebKit).
        
* platform/DragData.h:
(WebCore::DragData::pasteboard): Added.
* platform/mac/ClipboardMac.mm:
(WebCore::Clipboard::create): Changed to use pasteboard() instead of platformData().
* platform/mac/DragDataMac.mm:
(WebCore::DragData::asColor): Replaced references to m_platformData with m_pasteboard.
(WebCore::DragData::asURL): Same as above.

Source/WebKit2: 

Added _hitTest method to support drag and drop when the drag types cannot be matched.
This is the case for elements that do not place content
in the drag pasteboard automatically when the drag start (i.e. dragging a DIV element).
               
* UIProcess/API/mac/WKView.mm:
(-[WKView _hitTest:dragTypes:]): Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@83070 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 602477f7
2011-04-05 Enrica Casucci <enrica@apple.com>
Reviewed by Darin Adler.
REGRESSION: Drag & Drop Gmail Attachments doesn't work.
https://bugs.webkit.org/show_bug.cgi?id=57909
<rdar://problem/9103220>
In WebKit2 we cannot rely on the value returned by platformData() that
on Mac returns an NSDraggingInfo object. This is available only in the UI
process. Therefore we should use m_pasteboard instead.
We cannot change what platformData() returns on Mac, since there are
delegate methods that receive a NSDraggingInfo object (only in WebKit).
* platform/DragData.h:
(WebCore::DragData::pasteboard): Added.
* platform/mac/ClipboardMac.mm:
(WebCore::Clipboard::create): Changed to use pasteboard() instead of platformData().
* platform/mac/DragDataMac.mm:
(WebCore::DragData::asColor): Replaced references to m_platformData with m_pasteboard.
(WebCore::DragData::asURL): Same as above.
2011-04-06 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Darin Adler.
......@@ -117,6 +117,9 @@ public:
bool canSmartReplace() const;
bool containsColor() const;
bool containsFiles() const;
#if PLATFORM(MAC)
NSPasteboard *pasteboard() { return m_pasteboard.get(); }
#endif
private:
IntPoint m_clientPosition;
IntPoint m_globalPosition;
......
......@@ -49,7 +49,7 @@ namespace WebCore {
PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame)
{
return ClipboardMac::create(DragAndDrop, [dragData->platformData() draggingPasteboard], policy, frame);
return ClipboardMac::create(DragAndDrop, dragData->pasteboard(), policy, frame);
}
ClipboardMac::ClipboardMac(ClipboardType clipboardType, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame *frame)
......
......@@ -104,7 +104,7 @@ String DragData::asPlainText(Frame *frame) const
Color DragData::asColor() const
{
NSColor *color = [NSColor colorFromPasteboard:[m_platformDragData draggingPasteboard]];
NSColor *color = [NSColor colorFromPasteboard:m_pasteboard.get()];
return makeRGBA((int)([color redComponent] * 255.0 + 0.5), (int)([color greenComponent] * 255.0 + 0.5),
(int)([color blueComponent] * 255.0 + 0.5), (int)([color alphaComponent] * 255.0 + 0.5));
}
......@@ -141,7 +141,7 @@ String DragData::asURL(Frame* frame, FilenameConversionPolicy filenamePolicy, St
(void)filenamePolicy;
if (title) {
if (NSString *URLTitleString = [[m_platformDragData draggingPasteboard] stringForType:WebURLNamePboardType])
if (NSString *URLTitleString = [m_pasteboard.get() stringForType:WebURLNamePboardType])
*title = URLTitleString;
}
Pasteboard pasteboard(m_pasteboard.get());
......
2011-04-05 Enrica Casucci <enrica@apple.com>
Reviewed by Darin Adler.
REGRESSION: Drag & Drop Gmail Attachments doesn't work.
https://bugs.webkit.org/show_bug.cgi?id=57909
<rdar://problem/9103220>
Added _hitTest method to support drag and drop when the drag types cannot be matched.
This is the case for elements that do not place content
in the drag pasteboard automatically when the drag start (i.e. dragging a DIV element).
* UIProcess/API/mac/WKView.mm:
(-[WKView _hitTest:dragTypes:]): Added.
2011-04-06 Csaba Osztrogonác <ossy@webkit.org>
Reviewed by Darin Adler.
......
......@@ -1473,6 +1473,16 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
return YES;
}
// This code is needed to support drag and drop when the drag types cannot be matched.
// This is the case for elements that do not place content
// in the drag pasteboard automatically when the drag start (i.e. dragging a DIV element).
- (NSView *)_hitTest:(NSPoint *)point dragTypes:(NSSet *)types
{
if ([[self superview] mouse:*point inRect:[self frame]])
return self;
return nil;
}
- (void)_updateWindowVisibility
{
_data->_page->updateWindowIsVisible(![[self window] isMiniaturized]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment