#include "third_party/blink/renderer/core/clipboard/data_transfer.h"
#include <memory>
#include <optional>
#include "build/build_config.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h"
#include "third_party/blink/renderer/core/clipboard/data_object.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_access_policy.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_item.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_item_list.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/fileapi/file_list.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/layout/layout_image.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource_content.h"
#include "third_party/blink/renderer/core/page/drag_image.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/cull_rect_updater.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_painter.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-blink.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace blink {
namespace {
class DraggedNodeImageBuilder { … };
std::optional<DragOperationsMask> ConvertEffectAllowedToDragOperationsMask(
const AtomicString& op) { … }
AtomicString ConvertDragOperationsMaskToEffectAllowed(DragOperationsMask op) { … }
String NormalizeType(const String& type, bool* convert_to_url = nullptr) { … }
}
DataTransfer* DataTransfer::Create() { … }
DataTransfer* DataTransfer::Create(DataTransferType type,
DataTransferAccessPolicy policy,
DataObject* data_object) { … }
DataTransfer::~DataTransfer() = default;
void DataTransfer::setDropEffect(const AtomicString& effect) { … }
void DataTransfer::setEffectAllowed(const AtomicString& effect) { … }
void DataTransfer::clearData(const String& type) { … }
String DataTransfer::getData(const String& type) const { … }
void DataTransfer::setData(const String& type, const String& data) { … }
bool DataTransfer::hasDataStoreItemListChanged() const { … }
void DataTransfer::OnItemListChanged() { … }
Vector<String> DataTransfer::types() { … }
FileList* DataTransfer::files() const { … }
void DataTransfer::setDragImage(Element* image, int x, int y) { … }
void DataTransfer::ClearDragImage() { … }
void DataTransfer::SetDragImageResource(ImageResourceContent* img,
const gfx::Point& loc) { … }
void DataTransfer::SetDragImageElement(Node* node, const gfx::Point& loc) { … }
gfx::RectF DataTransfer::ClipByVisualViewport(const gfx::RectF& absolute_rect,
const LocalFrame& frame) { … }
std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame(
LocalFrame& frame,
float opacity,
const gfx::SizeF& layout_size,
const gfx::Vector2dF& paint_offset,
PaintRecordBuilder& builder,
const PropertyTreeState& property_tree_state) { … }
std::unique_ptr<DragImage> DataTransfer::NodeImage(LocalFrame& frame,
Node& node) { … }
std::unique_ptr<DragImage> DataTransfer::CreateDragImage(
gfx::Point& loc,
float device_scale_factor,
LocalFrame* frame) const { … }
static ImageResourceContent* GetImageResourceContent(Element* element) { … }
static void WriteImageToDataObject(DataObject* data_object,
Element* element,
const KURL& image_url) { … }
void DataTransfer::DeclareAndWriteDragImage(Element* element,
const KURL& link_url,
const KURL& image_url,
const String& title) { … }
void DataTransfer::WriteURL(Node* node, const KURL& url, const String& title) { … }
void DataTransfer::WriteSelection(const FrameSelection& selection) { … }
void DataTransfer::SetAccessPolicy(DataTransferAccessPolicy policy) { … }
bool DataTransfer::CanReadTypes() const { … }
bool DataTransfer::CanReadData() const { … }
bool DataTransfer::CanWriteData() const { … }
bool DataTransfer::CanSetDragImage() const { … }
DragOperationsMask DataTransfer::SourceOperation() const { … }
ui::mojom::blink::DragOperation DataTransfer::DestinationOperation() const { … }
void DataTransfer::SetSourceOperation(DragOperationsMask op) { … }
void DataTransfer::SetDestinationOperation(ui::mojom::blink::DragOperation op) { … }
DataTransferItemList* DataTransfer::items() { … }
DataObject* DataTransfer::GetDataObject() const { … }
DataTransfer::DataTransfer(DataTransferType type,
DataTransferAccessPolicy policy,
DataObject* data_object)
: … { … }
void DataTransfer::setDragImage(ImageResourceContent* image,
Node* node,
const gfx::Point& loc) { … }
bool DataTransfer::HasFileOfType(const String& type) const { … }
bool DataTransfer::HasStringOfType(const String& type) const { … }
void DataTransfer::Trace(Visitor* visitor) const { … }
}