Exemple #1
0
// extensions beyond IE's API
Vector<String> DataTransfer::types() const {
  Vector<String> types;
  if (!canReadTypes())
    return types;

  return m_dataObject->types();
}
bool DataTransfer::hasStringOfType(const String& type) const
{
    if (!canReadTypes())
        return false;

    return types().contains(type);
}
Exemple #3
0
bool Clipboard::hasStringOfType(const String& type) const
{
    if (!canReadTypes())
        return false;

    return types().contains(type);
}
Vector<String> DataTransfer::types() const
{
    // FIXME: Per HTML5, types should be a live array, and the DOM attribute should always return the same object.

    if (!canReadTypes())
        return Vector<String>();

    return m_pasteboard->types();
}
// extensions beyond IE's API
Vector<String> DataTransfer::types() const
{
    Vector<String> types;
    if (!canReadTypes())
        return types;

    ListHashSet<String> typesSet = m_dataObject->types();
    types.appendRange(typesSet.begin(), typesSet.end());
    return types;
}
bool DataTransfer::hasFileOfType(const String& type)
{
    ASSERT_WITH_SECURITY_IMPLICATION(canReadTypes());

    for (const String& path : m_pasteboard->readFilenames()) {
        if (equalIgnoringASCIICase(File::contentTypeForFile(path), type))
            return true;
    }

    return false;
}
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;
}
Exemple #8
0
bool DataTransfer::hasFileOfType(const String& type) const {
  if (!canReadTypes())
    return false;

  FileList* fileList = files();
  if (fileList->isEmpty())
    return false;

  for (unsigned f = 0; f < fileList->length(); f++) {
    if (equalIgnoringCase(fileList->item(f)->type(), type))
      return true;
  }
  return false;
}
void DataTransfer::setDropEffect(const String& effect)
{
    if (!m_forDrag)
        return;

    if (effect != "none" && effect != "copy" && effect != "link" && effect != "move")
        return;

    // FIXME: The spec allows this in all circumstances. There is probably no value
    // in ignoring attempts to change it.
    if (!canReadTypes())
        return;

    m_dropEffect = effect;
}
Exemple #10
0
bool Clipboard::hasFileOfType(const String& type) const
{
    if (!canReadTypes())
        return false;

    RefPtrWillBeRawPtr<FileList> fileList = files();
    if (fileList->isEmpty())
        return false;

    for (unsigned f = 0; f < fileList->length(); f++) {
        if (equalIgnoringCase(fileList->item(f)->type(), type))
            return true;
    }
    return false;
}
bool DataTransfer::hasStringOfType(const String& type)
{
    ASSERT_WITH_SECURITY_IMPLICATION(canReadTypes());

    return !type.isNull() && types().contains(type);
}