Ejemplo n.º 1
0
void DataTransfer::setDragImage(Element* image, int x, int y) {
  ASSERT(image);

  if (!isForDragAndDrop())
    return;

  IntPoint location(x, y);
  if (isHTMLImageElement(*image) && !image->isConnected())
    setDragImageResource(toHTMLImageElement(*image).cachedImage(), location);
  else
    setDragImageElement(image, location);
}
Ejemplo n.º 2
0
void Clipboard::setDropEffect(const String &effect)
{
    if (!isForDragAndDrop())
        return;

    // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move. 
    if (effect != "none" && effect != "copy"  && effect != "link" && effect != "move")
        return;

    if (m_policy == ClipboardReadable || m_policy == ClipboardTypesReadable)
        m_dropEffect = effect;
}
Ejemplo n.º 3
0
void DataTransfer::setDropEffect(const String &effect)
{
    if (!isForDragAndDrop())
        return;

    // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move.
    if (effect != "none" && effect != "copy"  && effect != "link" && effect != "move")
        return;

    // FIXME: The spec actually allows this in all circumstances, even though there's no point in
    // setting the drop effect when this condition is not true.
    if (canReadTypes())
        m_dropEffect = effect;
}
Ejemplo n.º 4
0
void DataTransfer::setDragImage(Element* image, int x, int y, ExceptionState& exceptionState)
{
    if (!isForDragAndDrop())
        return;

    if (!image) {
        exceptionState.throwTypeError("setDragImage: Invalid first argument");
        return;
    }
    IntPoint location(x, y);
    if (isHTMLImageElement(*image) && !image->inDocument())
        setDragImageResource(toHTMLImageElement(*image).cachedImage(), location);
    else
        setDragImageElement(image, location);
}
void ClipboardQt::clearData(const String& type)
{
    if (policy() != ClipboardWritable)
        return;

    if (m_writableData) {
        m_writableData->removeFormat(type);
        if (m_writableData->formats().isEmpty()) {
            if (isForDragAndDrop())
                delete m_writableData;
            m_writableData = 0;
        }
    }
#ifndef QT_NO_CLIPBOARD
    if (isForCopyAndPaste())
        QApplication::clipboard()->setMimeData(m_writableData);
#endif
}
Ejemplo n.º 6
0
void DataTransfer::setEffectAllowed(const String& effect) {
  if (!isForDragAndDrop())
    return;

  if (convertEffectAllowedToDragOperation(effect) == DragOperationPrivate) {
    // This means that there was no conversion, and the effectAllowed that
    // we are passed isn't a valid effectAllowed, so we should ignore it,
    // and not set m_effectAllowed.

    // The attribute must ignore any attempts to set it to a value other than
    // none, copy, copyLink, copyMove, link, linkMove, move, all, and
    // uninitialized.
    return;
  }

  if (canWriteData())
    m_effectAllowed = effect;
}
Ejemplo n.º 7
0
void Clipboard::setEffectAllowed(const String &effect)
{
    if (!isForDragAndDrop())
        return;

    if (dragOpFromIEOp(effect) == DragOperationPrivate) {
        // This means that there was no conversion, and the effectAllowed that
        // we are passed isn't a valid effectAllowed, so we should ignore it,
        // and not set m_effectAllowed.

        // The attribute must ignore any attempts to set it to a value other than 
        // none, copy, copyLink, copyMove, link, linkMove, move, all, and uninitialized.
        return;
    }


    if (m_policy == ClipboardWritable)
        m_effectAllowed = effect;
}
Ejemplo n.º 8
0
bool Clipboard::hasData()
{
    ASSERT(isForDragAndDrop());

    return m_dataObject->length() > 0;
}