This source file includes following definitions.
- actionMaskForDrag
- startDrag
#include "config.h"
#include "DragClientImpl.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "core/clipboard/Clipboard.h"
#include "core/clipboard/DataObject.h"
#include "core/frame/LocalFrame.h"
#include "platform/DragImage.h"
#include "platform/geometry/IntSize.h"
#include "platform/graphics/skia/NativeImageSkia.h"
#include "public/platform/WebCommon.h"
#include "public/platform/WebDragData.h"
#include "public/platform/WebImage.h"
#include "public/platform/WebPoint.h"
#include "public/web/WebDragOperation.h"
#include "wtf/Assertions.h"
#include "wtf/RefPtr.h"
using namespace WebCore;
namespace blink {
DragDestinationAction DragClientImpl::actionMaskForDrag(DragData*)
{
if (m_webView->client() && m_webView->client()->acceptsLoadDrops())
return DragDestinationActionAny;
return static_cast<DragDestinationAction>(
DragDestinationActionDHTML | DragDestinationActionEdit);
}
void DragClientImpl::startDrag(DragImage* dragImage,
const IntPoint& dragImageOrigin,
const IntPoint& eventPos,
Clipboard* clipboard,
LocalFrame* frame,
bool isLinkDrag)
{
RefPtr<LocalFrame> frameProtector = frame;
WebDragData dragData(clipboard->dataObject());
WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask>(clipboard->sourceOperation());
WebImage image;
IntSize offsetSize(eventPos - dragImageOrigin);
WebPoint offsetPoint(offsetSize.width(), offsetSize.height());
if (dragImage) {
float resolutionScale = dragImage->resolutionScale();
if (m_webView->deviceScaleFactor() != resolutionScale) {
ASSERT(resolutionScale > 0);
float scale = m_webView->deviceScaleFactor() / resolutionScale;
dragImage->scale(scale, scale);
}
image = dragImage->bitmap();
}
m_webView->startDragging(frame, dragData, dragOperationMask, image, offsetPoint);
}
}